diff --git a/pmapi/.idea/.gitignore b/hz-pm-api/.idea/.gitignore similarity index 100% rename from pmapi/.idea/.gitignore rename to hz-pm-api/.idea/.gitignore diff --git a/pmapi/.idea/checkstyle-idea.xml b/hz-pm-api/.idea/checkstyle-idea.xml similarity index 100% rename from pmapi/.idea/checkstyle-idea.xml rename to hz-pm-api/.idea/checkstyle-idea.xml diff --git a/pmapi/.idea/compiler.xml b/hz-pm-api/.idea/compiler.xml similarity index 100% rename from pmapi/.idea/compiler.xml rename to hz-pm-api/.idea/compiler.xml diff --git a/pmapi/.idea/eclipseCodeFormatter.xml b/hz-pm-api/.idea/eclipseCodeFormatter.xml similarity index 100% rename from pmapi/.idea/eclipseCodeFormatter.xml rename to hz-pm-api/.idea/eclipseCodeFormatter.xml diff --git a/pmapi/.idea/encodings.xml b/hz-pm-api/.idea/encodings.xml similarity index 100% rename from pmapi/.idea/encodings.xml rename to hz-pm-api/.idea/encodings.xml diff --git a/pmapi/.idea/inspectionProfiles/Project_Default.xml b/hz-pm-api/.idea/inspectionProfiles/Project_Default.xml similarity index 100% rename from pmapi/.idea/inspectionProfiles/Project_Default.xml rename to hz-pm-api/.idea/inspectionProfiles/Project_Default.xml diff --git a/pmapi/.idea/jarRepositories.xml b/hz-pm-api/.idea/jarRepositories.xml similarity index 100% rename from pmapi/.idea/jarRepositories.xml rename to hz-pm-api/.idea/jarRepositories.xml diff --git a/pmapi/.idea/misc.xml b/hz-pm-api/.idea/misc.xml similarity index 100% rename from pmapi/.idea/misc.xml rename to hz-pm-api/.idea/misc.xml diff --git a/pmapi/.idea/sonarlint/issuestore/0/0/002597a7f172f343a6cffcd273be74aa895d74b3 b/hz-pm-api/.idea/sonarlint/issuestore/0/0/002597a7f172f343a6cffcd273be74aa895d74b3 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/0/0/002597a7f172f343a6cffcd273be74aa895d74b3 rename to hz-pm-api/.idea/sonarlint/issuestore/0/0/002597a7f172f343a6cffcd273be74aa895d74b3 diff --git a/pmapi/.idea/sonarlint/issuestore/0/2/02999ca52b20720a6dba73a2ea57a018dba90084 b/hz-pm-api/.idea/sonarlint/issuestore/0/2/02999ca52b20720a6dba73a2ea57a018dba90084 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/0/2/02999ca52b20720a6dba73a2ea57a018dba90084 rename to hz-pm-api/.idea/sonarlint/issuestore/0/2/02999ca52b20720a6dba73a2ea57a018dba90084 diff --git a/pmapi/.idea/sonarlint/issuestore/0/3/032c44040c9d507864de35d7170661addf623095 b/hz-pm-api/.idea/sonarlint/issuestore/0/3/032c44040c9d507864de35d7170661addf623095 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/0/3/032c44040c9d507864de35d7170661addf623095 rename to hz-pm-api/.idea/sonarlint/issuestore/0/3/032c44040c9d507864de35d7170661addf623095 diff --git a/pmapi/.idea/sonarlint/issuestore/3/a/3a29a241dcf97a75f4de88a48dacd988a7193f67 b/hz-pm-api/.idea/sonarlint/issuestore/3/a/3a29a241dcf97a75f4de88a48dacd988a7193f67 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/3/a/3a29a241dcf97a75f4de88a48dacd988a7193f67 rename to hz-pm-api/.idea/sonarlint/issuestore/3/a/3a29a241dcf97a75f4de88a48dacd988a7193f67 diff --git a/pmapi/.idea/sonarlint/issuestore/4/d/4d181ee0ef35161a71fa355047c13e9ab5aa4793 b/hz-pm-api/.idea/sonarlint/issuestore/4/d/4d181ee0ef35161a71fa355047c13e9ab5aa4793 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/4/d/4d181ee0ef35161a71fa355047c13e9ab5aa4793 rename to hz-pm-api/.idea/sonarlint/issuestore/4/d/4d181ee0ef35161a71fa355047c13e9ab5aa4793 diff --git a/pmapi/.idea/sonarlint/issuestore/7/a/7a4df0ff8172ed96c29e54029f6ecac024700aa5 b/hz-pm-api/.idea/sonarlint/issuestore/7/a/7a4df0ff8172ed96c29e54029f6ecac024700aa5 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/7/a/7a4df0ff8172ed96c29e54029f6ecac024700aa5 rename to hz-pm-api/.idea/sonarlint/issuestore/7/a/7a4df0ff8172ed96c29e54029f6ecac024700aa5 diff --git a/pmapi/.idea/sonarlint/issuestore/8/c/8c928fdb02a7d0f06b9a34c0b545a00ddf44aab7 b/hz-pm-api/.idea/sonarlint/issuestore/8/c/8c928fdb02a7d0f06b9a34c0b545a00ddf44aab7 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/8/c/8c928fdb02a7d0f06b9a34c0b545a00ddf44aab7 rename to hz-pm-api/.idea/sonarlint/issuestore/8/c/8c928fdb02a7d0f06b9a34c0b545a00ddf44aab7 diff --git a/pmapi/.idea/sonarlint/issuestore/9/2/92bb80058f98a2589a95655e976c4c3b31905e3f b/hz-pm-api/.idea/sonarlint/issuestore/9/2/92bb80058f98a2589a95655e976c4c3b31905e3f similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/9/2/92bb80058f98a2589a95655e976c4c3b31905e3f rename to hz-pm-api/.idea/sonarlint/issuestore/9/2/92bb80058f98a2589a95655e976c4c3b31905e3f diff --git a/pmapi/.idea/sonarlint/issuestore/a/9/a90097c62f2d5eef81300bceaa14afa9559ec829 b/hz-pm-api/.idea/sonarlint/issuestore/a/9/a90097c62f2d5eef81300bceaa14afa9559ec829 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/a/9/a90097c62f2d5eef81300bceaa14afa9559ec829 rename to hz-pm-api/.idea/sonarlint/issuestore/a/9/a90097c62f2d5eef81300bceaa14afa9559ec829 diff --git a/pmapi/.idea/sonarlint/issuestore/b/7/b7eec6c95fd743ceb0853f62f1870e78ac47fa1d b/hz-pm-api/.idea/sonarlint/issuestore/b/7/b7eec6c95fd743ceb0853f62f1870e78ac47fa1d similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/b/7/b7eec6c95fd743ceb0853f62f1870e78ac47fa1d rename to hz-pm-api/.idea/sonarlint/issuestore/b/7/b7eec6c95fd743ceb0853f62f1870e78ac47fa1d diff --git a/pmapi/.idea/sonarlint/issuestore/d/3/d39b8ec842398247637f12ea4caf897c9a0a8463 b/hz-pm-api/.idea/sonarlint/issuestore/d/3/d39b8ec842398247637f12ea4caf897c9a0a8463 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/d/3/d39b8ec842398247637f12ea4caf897c9a0a8463 rename to hz-pm-api/.idea/sonarlint/issuestore/d/3/d39b8ec842398247637f12ea4caf897c9a0a8463 diff --git a/pmapi/.idea/sonarlint/issuestore/d/7/d7146276b7a0a780dc7631a29b70c58f9c37fac3 b/hz-pm-api/.idea/sonarlint/issuestore/d/7/d7146276b7a0a780dc7631a29b70c58f9c37fac3 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/d/7/d7146276b7a0a780dc7631a29b70c58f9c37fac3 rename to hz-pm-api/.idea/sonarlint/issuestore/d/7/d7146276b7a0a780dc7631a29b70c58f9c37fac3 diff --git a/pmapi/.idea/sonarlint/issuestore/e/4/e427e2fbf9cff46a15e651e8759e4487828aaa90 b/hz-pm-api/.idea/sonarlint/issuestore/e/4/e427e2fbf9cff46a15e651e8759e4487828aaa90 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/e/4/e427e2fbf9cff46a15e651e8759e4487828aaa90 rename to hz-pm-api/.idea/sonarlint/issuestore/e/4/e427e2fbf9cff46a15e651e8759e4487828aaa90 diff --git a/pmapi/.idea/sonarlint/issuestore/e/c/ecd8157d3ccb289d327361f90fcef4d14eddb335 b/hz-pm-api/.idea/sonarlint/issuestore/e/c/ecd8157d3ccb289d327361f90fcef4d14eddb335 similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/e/c/ecd8157d3ccb289d327361f90fcef4d14eddb335 rename to hz-pm-api/.idea/sonarlint/issuestore/e/c/ecd8157d3ccb289d327361f90fcef4d14eddb335 diff --git a/pmapi/.idea/sonarlint/issuestore/f/1/f1ece2c596126c2753f07e9c33ac1dee153eca7c b/hz-pm-api/.idea/sonarlint/issuestore/f/1/f1ece2c596126c2753f07e9c33ac1dee153eca7c similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/f/1/f1ece2c596126c2753f07e9c33ac1dee153eca7c rename to hz-pm-api/.idea/sonarlint/issuestore/f/1/f1ece2c596126c2753f07e9c33ac1dee153eca7c diff --git a/pmapi/.idea/sonarlint/issuestore/index.pb b/hz-pm-api/.idea/sonarlint/issuestore/index.pb similarity index 100% rename from pmapi/.idea/sonarlint/issuestore/index.pb rename to hz-pm-api/.idea/sonarlint/issuestore/index.pb diff --git a/pmapi/.idea/vcs.xml b/hz-pm-api/.idea/vcs.xml similarity index 100% rename from pmapi/.idea/vcs.xml rename to hz-pm-api/.idea/vcs.xml diff --git a/pmapi/lib/agent-boot-1.3.22.0215.jar b/hz-pm-api/lib/agent-boot-1.3.22.0215.jar similarity index 100% rename from pmapi/lib/agent-boot-1.3.22.0215.jar rename to hz-pm-api/lib/agent-boot-1.3.22.0215.jar diff --git a/pmapi/lib/commons-compress-1.19.jar b/hz-pm-api/lib/commons-compress-1.19.jar similarity index 100% rename from pmapi/lib/commons-compress-1.19.jar rename to hz-pm-api/lib/commons-compress-1.19.jar diff --git a/pmapi/lib/commons-io-2.5.jar b/hz-pm-api/lib/commons-io-2.5.jar similarity index 100% rename from pmapi/lib/commons-io-2.5.jar rename to hz-pm-api/lib/commons-io-2.5.jar diff --git a/pmapi/lib/commons-lang-2.6.jar b/hz-pm-api/lib/commons-lang-2.6.jar similarity index 100% rename from pmapi/lib/commons-lang-2.6.jar rename to hz-pm-api/lib/commons-lang-2.6.jar diff --git a/pmapi/lib/commons-lang3-3.8.1.jar b/hz-pm-api/lib/commons-lang3-3.8.1.jar similarity index 100% rename from pmapi/lib/commons-lang3-3.8.1.jar rename to hz-pm-api/lib/commons-lang3-3.8.1.jar diff --git a/pmapi/lib/commons-logging-1.1.1.jar b/hz-pm-api/lib/commons-logging-1.1.1.jar similarity index 100% rename from pmapi/lib/commons-logging-1.1.1.jar rename to hz-pm-api/lib/commons-logging-1.1.1.jar diff --git a/pmapi/lib/dom4j-2.0.2.jar b/hz-pm-api/lib/dom4j-2.0.2.jar similarity index 100% rename from pmapi/lib/dom4j-2.0.2.jar rename to hz-pm-api/lib/dom4j-2.0.2.jar diff --git a/pmapi/lib/gson-2.8.0.jar b/hz-pm-api/lib/gson-2.8.0.jar similarity index 100% rename from pmapi/lib/gson-2.8.0.jar rename to hz-pm-api/lib/gson-2.8.0.jar diff --git a/pmapi/lib/httpclient-4.5.13.jar b/hz-pm-api/lib/httpclient-4.5.13.jar similarity index 100% rename from pmapi/lib/httpclient-4.5.13.jar rename to hz-pm-api/lib/httpclient-4.5.13.jar diff --git a/pmapi/lib/httpcore-4.4.13.jar b/hz-pm-api/lib/httpcore-4.4.13.jar similarity index 100% rename from pmapi/lib/httpcore-4.4.13.jar rename to hz-pm-api/lib/httpcore-4.4.13.jar diff --git a/pmapi/lib/httpmime-4.5.13.jar b/hz-pm-api/lib/httpmime-4.5.13.jar similarity index 100% rename from pmapi/lib/httpmime-4.5.13.jar rename to hz-pm-api/lib/httpmime-4.5.13.jar diff --git a/pmapi/lib/jbArchivesTools-1.0-SNAPSHOT.jar b/hz-pm-api/lib/jbArchivesTools-1.0-SNAPSHOT.jar similarity index 100% rename from pmapi/lib/jbArchivesTools-1.0-SNAPSHOT.jar rename to hz-pm-api/lib/jbArchivesTools-1.0-SNAPSHOT.jar diff --git a/pmapi/lib/ofd-simple-tool-1.0.23.0324.jar b/hz-pm-api/lib/ofd-simple-tool-1.0.23.0324.jar similarity index 100% rename from pmapi/lib/ofd-simple-tool-1.0.23.0324.jar rename to hz-pm-api/lib/ofd-simple-tool-1.0.23.0324.jar diff --git a/pmapi/lib/slf4j-api-1.7.29.jar b/hz-pm-api/lib/slf4j-api-1.7.29.jar similarity index 100% rename from pmapi/lib/slf4j-api-1.7.29.jar rename to hz-pm-api/lib/slf4j-api-1.7.29.jar diff --git a/pmapi/lib/slf4j-simple-1.7.26.jar b/hz-pm-api/lib/slf4j-simple-1.7.26.jar similarity index 100% rename from pmapi/lib/slf4j-simple-1.7.26.jar rename to hz-pm-api/lib/slf4j-simple-1.7.26.jar diff --git a/pmapi/lib/suwell-agent-http-1.7.220630.jar b/hz-pm-api/lib/suwell-agent-http-1.7.220630.jar similarity index 100% rename from pmapi/lib/suwell-agent-http-1.7.220630.jar rename to hz-pm-api/lib/suwell-agent-http-1.7.220630.jar diff --git a/pmapi/lib/suwell-agent-wrapper-1.6.221208.jar b/hz-pm-api/lib/suwell-agent-wrapper-1.6.221208.jar similarity index 100% rename from pmapi/lib/suwell-agent-wrapper-1.6.221208.jar rename to hz-pm-api/lib/suwell-agent-wrapper-1.6.221208.jar diff --git a/pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar b/hz-pm-api/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar similarity index 100% rename from pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar rename to hz-pm-api/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar diff --git a/pmapi/lib/suwell-convert-base-1.5.19.0408.jar b/hz-pm-api/lib/suwell-convert-base-1.5.19.0408.jar similarity index 100% rename from pmapi/lib/suwell-convert-base-1.5.19.0408.jar rename to hz-pm-api/lib/suwell-convert-base-1.5.19.0408.jar diff --git a/pmapi/lib/suwell-core-base-1.7.220623-lite.jar b/hz-pm-api/lib/suwell-core-base-1.7.220623-lite.jar similarity index 100% rename from pmapi/lib/suwell-core-base-1.7.220623-lite.jar rename to hz-pm-api/lib/suwell-core-base-1.7.220623-lite.jar diff --git a/pmapi/lib/suwell-extend-1.0.22.0804.jar b/hz-pm-api/lib/suwell-extend-1.0.22.0804.jar similarity index 100% rename from pmapi/lib/suwell-extend-1.0.22.0804.jar rename to hz-pm-api/lib/suwell-extend-1.0.22.0804.jar diff --git a/pmapi/lib/suwell-packet-wrapper-1.21.230306.jar b/hz-pm-api/lib/suwell-packet-wrapper-1.21.230306.jar similarity index 100% rename from pmapi/lib/suwell-packet-wrapper-1.21.230306.jar rename to hz-pm-api/lib/suwell-packet-wrapper-1.21.230306.jar diff --git a/pmapi/lib/suwell-rpc-manager-client-2.7.211125.jar b/hz-pm-api/lib/suwell-rpc-manager-client-2.7.211125.jar similarity index 100% rename from pmapi/lib/suwell-rpc-manager-client-2.7.211125.jar rename to hz-pm-api/lib/suwell-rpc-manager-client-2.7.211125.jar diff --git a/hz-pm-api/pom.xml b/hz-pm-api/pom.xml new file mode 100644 index 0000000..b62a2db --- /dev/null +++ b/hz-pm-api/pom.xml @@ -0,0 +1,463 @@ + + + 4.0.0 + + com.hz.pm + hz-project-management + 1.0.0 + + hz-pm-api + 1.0.0 + + 0.11.5 + + + + + com.google.guava + guava + + + cn.hutool + hutool-all + 5.8.5 + + + + org.projectlombok + lombok + + + + com.baomidou + mybatis-plus-boot-starter + + + + org.springframework.boot + spring-boot-starter-data-redis + + + com.baomidou + mybatis-plus-extension + + + org.springframework.session + spring-session-data-redis + + + org.springframework.boot + spring-boot-starter-freemarker + + + + org.apache.commons + commons-pool2 + ${commons-pool2.version} + + + org.apache.commons + commons-lang3 + + + com.alibaba + fastjson + + + org.apache.tomcat.embed + tomcat-embed-core + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.springframework.boot + spring-boot-devtools + true + true + + + org.springframework.boot + spring-boot-starter-aop + + + + com.github.ben-manes.caffeine + caffeine + + + org.apache.httpcomponents + httpclient + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + + com.aliyun.oss + aliyun-sdk-oss + 3.15.0 + + + junit + junit + test + + + org.aspectj + aspectjweaver + + + + org.springframework.boot + spring-boot-starter-test + + + + com.auth0 + java-jwt + 3.10.3 + + + org.springframework.boot + spring-boot-configuration-processor + + + com.ningdatech + nd-log-starter + 1.0.0 + + + com.ningdatech + nd-basic + + + org.slf4j + slf4j-log4j12 + + + + + com.ningdatech + nd-swagger2-starter + + + org.slf4j + slf4j-log4j12 + + + + + + com.ningdatech + nd-zwdd-starter + + + org.slf4j + slf4j-log4j12 + + + 1.0.0 + + + + + com.kingbase8 + kingbase8-8.2.0 + 8.2.0 + system + ${project.basedir}/src/lib/kingbase8-8.2.0.jar + + + com.ningdatech + nd-cache-starter + + + com.ningdatech + nd-irs-starter + + + com.ningdatech + nd-yxt-starter + 1.0.0 + + + com.alibaba + easyexcel-core + + + com.ningdatech + nd-file-starter + + + com.ningdatech + nd-flowable-starter + + + com.baomidou + mybatis-plus-boot-starter + + + com.alibaba + druid-spring-boot-starter + + + + + + com.alibaba.xxpt + zwdd + 1.2.0 + system + ${basedir}/src/lib/zwdd-sdk-java-1.2.0.jar + + + joda-time + joda-time + + + + org.springframework.statemachine + spring-statemachine-core + + + + + com.itextpdf + itextpdf + + + com.itextpdf + itext-asian + + + com.itextpdf.tool + xmlworker + + + org.xhtmlrenderer + flying-saucer-pdf-itext5 + + + + com.itextpdf + html2pdf + + + + 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 + + + + + + + dev + + + dev + + + + test + + test + + + + pre + + pre + + + + prod + + prod + + + + + + + + src/main/resources + + **/* + + + + src/main/java + + **/*.xml + + + + src/main/lib + BOOT-INF/lib/ + + **/*.jar + + + + src/main/resources + BOOT-INF/classes/ + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.8 + + true + + + + + repackage + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + diff --git a/ningda-generator/lib/kingbase8-8.2.0.jar b/hz-pm-api/src/lib/kingbase8-8.2.0.jar similarity index 100% rename from ningda-generator/lib/kingbase8-8.2.0.jar rename to hz-pm-api/src/lib/kingbase8-8.2.0.jar diff --git a/pmapi/src/lib/kingbase8-8.6.0.jar b/hz-pm-api/src/lib/kingbase8-8.6.0.jar similarity index 100% rename from pmapi/src/lib/kingbase8-8.6.0.jar rename to hz-pm-api/src/lib/kingbase8-8.6.0.jar diff --git a/pmapi/src/lib/zwdd-sdk-java-1.2.0.jar b/hz-pm-api/src/lib/zwdd-sdk-java-1.2.0.jar similarity index 100% rename from pmapi/src/lib/zwdd-sdk-java-1.2.0.jar rename to hz-pm-api/src/lib/zwdd-sdk-java-1.2.0.jar diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/App.java b/hz-pm-api/src/main/java/com/hz/pm/api/App.java new file mode 100644 index 0000000..9de6501 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/App.java @@ -0,0 +1,41 @@ +package com.hz.pm.api; + +import com.ningdatech.basic.util.SpringUtils; +import com.hz.pm.api.common.util.SpringContextHolder; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * @author liuxinxin + */ +@SpringBootApplication +@EnableAsync +@MapperScan(App.MAPPER_PACKAGES) +@EnableScheduling +@EnableTransactionManagement +@EnableAspectJAutoProxy(exposeProxy = true) +@ComponentScan(basePackages = {"com.hz.pm", "com.ningdatech.irs"}) +public class App { + + protected static final String MAPPER_PACKAGES = "com.hz.pm.api.**.mapper"; + + public static void main(String[] args) { + ApplicationContext context = SpringApplication.run(App.class, args); + // 设置applicationContext + SpringUtils.setApplicationContext(context); + } + + @Bean + public SpringContextHolder springContextHolder() { + return new SpringContextHolder(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/Compare.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/Compare.java new file mode 100644 index 0000000..175ebef --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/Compare.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.common.compare; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 字段标记注解 + * + * @author zpf + * @since 2023/07/21 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Compare { + + /** + * 字段名称 + */ + String value(); +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareNode.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareNode.java new file mode 100644 index 0000000..b44d04a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareNode.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.common.compare; + +/** + * @author zpf + * @since 2023/07/21 + */ +public class CompareNode { + + /** + * 字段 + */ + private String fieldKey; + + /** + * 字段值 + */ + private Object fieldValue; + + /** + * 字段名称 + */ + private String fieldName; + + public String getFieldKey() { + return fieldKey; + } + + public void setFieldKey(String fieldKey) { + this.fieldKey = fieldKey; + } + + public Object getFieldValue() { + return fieldValue; + } + + public void setFieldValue(Object fieldValue) { + this.fieldValue = fieldValue; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareUtils.java new file mode 100644 index 0000000..8c3e518 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/compare/CompareUtils.java @@ -0,0 +1,182 @@ +package com.hz.pm.api.common.compare; + +import com.alibaba.fastjson.JSONObject; + +import java.lang.reflect.Field; +import java.util.*; + +/** + * 使用须知:
+ * (1)该工具类主要用于两个同类对象的属性值比较;
+ * (2)使用本工具类前,请将对应的类属性上打上 @Compare("xxx") 注解,其中xxx为字段的表达名称;
+ * (3)为了比较灵活,只有打了该注解才会进行比较,不打的字段则不会进行比较
+ * (4)比较后,只会返回有变化的字段,无变化的字符则不返回
+ * + * @author zpf + * @since 2023/07/21 + */ +public class CompareUtils { + + private static final String COMMA = ","; + + /** + * 属性比较 + * + * @param source 源数据对象 + * @param target 目标数据对象 + * @return 对应属性值的比较变化 + */ + public String compare(T source, T target) { + return compare(source, target, null); + } + + + /** + * 属性比较 + * + * @param source 源数据对象 + * @param target 目标数据对象 + * @param ignoreCompareFields 忽略比较的字段 + * @return 对应属性值的比较变化 + */ + public String compare(T source, T target, List ignoreCompareFields) { + if (Objects.isNull(source) && Objects.isNull(target)) { + return ""; + } + Map sourceMap = this.getFiledValueMap(source); + Map targetMap = this.getFiledValueMap(target); + if (sourceMap.isEmpty() && targetMap.isEmpty()) { + return ""; + } + // 如果源数据为空,则只显示目标数据,不显示属性变化情况 + if (sourceMap.isEmpty()) { + return doEmpty(targetMap, ignoreCompareFields); + } + // 如果源数据为空,则显示属性变化情况 + String s = doCompare(sourceMap, targetMap, ignoreCompareFields); + if (!s.endsWith(COMMA)) { + return s; + } + return s.substring(0, s.length() - 1); + } + + public JSONObject compareToJson(T source, T target, List ignoreCompareFields) { + JSONObject res = new JSONObject(); + if (Objects.isNull(source) && Objects.isNull(target)) { + return res; + } + Map sourceMap = this.getFiledValueMap(source); + Map targetMap = this.getFiledValueMap(target); + if (sourceMap.isEmpty() && targetMap.isEmpty()) { + return res; + } + // 如果源数据为空,则只显示目标数据,不显示属性变化情况 + if (sourceMap.isEmpty()) { + return res; + } + + return doCompareJson(sourceMap, targetMap, ignoreCompareFields); + } + + private String doEmpty(Map targetMap, List ignoreCompareFields) { + StringBuilder sb = new StringBuilder(); + Collection values = targetMap.values(); + int size = values.size(); + int current = 0; + for (CompareNode node : values) { + current++; + Object o = Optional.ofNullable(node.getFieldValue()).orElse(""); + if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(node.getFieldKey())) { + continue; + } + if (o.toString().length() > 0) { + sb.append("[" + node.getFieldName() + ":" + o + "]"); + if (current < size) { + sb.append(COMMA); + } + } + } + return sb.toString(); + } + + private String doCompare(Map sourceMap, Map targetMap, List ignoreCompareFields) { + StringBuilder sb = new StringBuilder(); + Set keys = sourceMap.keySet(); + int size = keys.size(); + int current = 0; + for (String key : keys) { + current++; + CompareNode sn = sourceMap.get(key); + CompareNode tn = targetMap.get(key); + if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(sn.getFieldKey())) { + continue; + } + String sv = Optional.ofNullable(sn.getFieldValue()).orElse("").toString(); + String tv = Optional.ofNullable(tn.getFieldValue()).orElse("").toString(); + // 只有两者属性值不一致时, 才显示变化情况 + if (!sv.equals(tv)) { + sb.append(String.format("[%s:%s -> %s]", sn.getFieldName(), sv, tv)); + if (current < size) { + sb.append(COMMA); + } + } + } + return sb.toString(); + } + + private JSONObject doCompareJson(Map sourceMap, Map targetMap, List ignoreCompareFields) { + JSONObject res = new JSONObject(); + Set keys = sourceMap.keySet(); + int size = keys.size(); + int current = 0; + for (String key : keys) { + current++; + CompareNode sn = sourceMap.get(key); + CompareNode tn = targetMap.get(key); + if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(sn.getFieldKey())) { + continue; + } + String sv = Optional.ofNullable(sn.getFieldValue()).orElse("").toString(); + String tv = Optional.ofNullable(tn.getFieldValue()).orElse("").toString(); + // 只有两者属性值不一致时, 才显示变化情况 + if (!sv.equals(tv)) { + JSONObject valueChange = new JSONObject(); + valueChange.put("fieldKey",sn.getFieldKey()); + valueChange.put("old",tv); + valueChange.put("new",sv); + res.put(sn.getFieldName(),valueChange); + } + } + return res; + } + + private Map getFiledValueMap(T t) { + if (Objects.isNull(t)) { + return Collections.emptyMap(); + } + Field[] fields = t.getClass().getDeclaredFields(); + if (Objects.isNull(fields) || fields.length == 0) { + return Collections.emptyMap(); + } + Map map = new LinkedHashMap(); + for (Field field : fields) { + Compare compareAnnotation = field.getAnnotation(Compare.class); + if (Objects.isNull(compareAnnotation)) { + continue; + } + field.setAccessible(true); + try { + String fieldKey = field.getName(); + CompareNode node = new CompareNode(); + node.setFieldKey(fieldKey); + node.setFieldValue(field.get(t)); + node.setFieldName(compareAnnotation.value()); + map.put(field.getName(), node); + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return map; + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/BeanConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/BeanConfig.java new file mode 100644 index 0000000..5b3ed37 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/BeanConfig.java @@ -0,0 +1,111 @@ +package com.hz.pm.api.common.config; + +import lombok.extern.slf4j.Slf4j; +import org.apache.http.Header; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicHeader; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @Classname BeanConfig + * @Description + * @Date 2023/3/2 9:42 + * @Created by PoffyZhang + */ +@Configuration +@Slf4j +public class BeanConfig { + + + @Bean + public RestTemplate restTemplate() { + // 添加内容转换器,使用默认的内容转换器 + RestTemplate restTemplate = new RestTemplate(httpRequestFactory()); + // 设置编码格式为UTF-8,解决中文乱码问题 + List> converterList = restTemplate.getMessageConverters(); + HttpMessageConverter converterTarget = null; + for (HttpMessageConverter item : converterList) { + if (item.getClass() == StringHttpMessageConverter.class) { + converterTarget = item; + break; + } + } + if (converterTarget != null) { + converterList.remove(converterTarget); + } + HttpMessageConverter converter = new StringHttpMessageConverter(StandardCharsets.UTF_8); + converterList.add(1,converter); + + MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); + mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList( + MediaType.TEXT_HTML, + MediaType.TEXT_PLAIN)); + restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter); + + log.info("-----restTemplate-----初始化完成"); + return restTemplate; + } + + @Bean + public ClientHttpRequestFactory httpRequestFactory() { + return new HttpComponentsClientHttpRequestFactory(httpClient()); + } + + @Bean + public HttpClient httpClient() { + // 长连接保持30秒 + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(30, TimeUnit.SECONDS); + //设置整个连接池最大连接数 根据自己的场景决定 + connectionManager.setMaxTotal(500); + //同路由的并发数,路由是对maxTotal的细分 + connectionManager.setDefaultMaxPerRoute(500); + + //requestConfig + RequestConfig requestConfig = RequestConfig.custom() + //服务器返回数据(response)的时间,超过该时间抛出read timeout + .setSocketTimeout(10000) + //连接上服务器(握手成功)的时间,超出该时间抛出connect timeout + .setConnectTimeout(5000) + //从连接池中获取连接的超时时间,超过该时间未拿到可用连接,会抛出org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool + .setConnectionRequestTimeout(500) + .build(); + //headers + List
headers = new ArrayList<>(); + headers.add(new BasicHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36")); + headers.add(new BasicHeader("Accept-Encoding", "gzip,deflate")); + headers.add(new BasicHeader("Accept-Language", "zh-CN")); + headers.add(new BasicHeader("Connection", "Keep-Alive")); + headers.add(new BasicHeader("Content-type", "application/json;charset=UTF-8")); + + return HttpClientBuilder.create() + .setDefaultRequestConfig(requestConfig) + .setConnectionManager(connectionManager) + .setDefaultHeaders(headers) + // 保持长连接配置,需要在头添加Keep-Alive + .setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy()) + //重试次数,默认是3次,没有开启 + .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) + .build(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ConfigurerAdapter.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ConfigurerAdapter.java new file mode 100644 index 0000000..8746812 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ConfigurerAdapter.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.common.config; + +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import com.hz.pm.api.common.interceptor.LogInterceptor; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.lang.NonNull; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * @author qinxianyun + */ +@EnableWebMvc +@Configuration +public class ConfigurerAdapter implements WebMvcConfigurer { + + @Override + public void configureMessageConverters(List> converters) { + // 使用 fastjson 序列化,会导致 @JsonIgnore 失效,可以使用 @JSONField(serialize = false) 替换 + FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); + List supportMediaTypeList = new ArrayList<>(); + supportMediaTypeList.add(MediaType.APPLICATION_JSON); + FastJsonConfig config = new FastJsonConfig(); + config.setDateFormat("yyyy-MM-dd HH:mm:ss"); + config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); + converter.setFastJsonConfig(config); + converter.setSupportedMediaTypes(supportMediaTypeList); + converter.setDefaultCharset(StandardCharsets.UTF_8); + converters.add(converter); + } + + @Override + public void addInterceptors(@NonNull InterceptorRegistry registry) { + registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**").order(-100); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/DingOrganizationProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/DingOrganizationProperties.java new file mode 100644 index 0000000..aab6597 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/DingOrganizationProperties.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.common.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/9/9 下午5:37 + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "organization") +public class DingOrganizationProperties { + private List deptVisibleScopes = new ArrayList<>(); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ProvincialProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ProvincialProperties.java new file mode 100644 index 0000000..34065ef --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/ProvincialProperties.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.common.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author zpf + * @date 2023/3/2 下午5:37 + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "provincial") +public class ProvincialProperties { + private String host; + + private String pushUrl; + + private String detailUrl; + + private String domainUrl; + + private String key; + + private String secret; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BaseFieldConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BaseFieldConst.java new file mode 100644 index 0000000..25e99ed --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BaseFieldConst.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.common.constant; + +/** + *

+ * 创建人修改人基础字段 + *

+ * + * @author WendyYang + * @since 17:17 2023/01/29 + */ +public interface BaseFieldConst { + + String CREATE_BY = "createBy"; + String UPDATE_BY = "updateBy"; + String CREATE_ON = "createOn"; + String UPDATE_ON = "updateOn"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BizConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BizConst.java new file mode 100644 index 0000000..eb72be1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BizConst.java @@ -0,0 +1,108 @@ +package com.hz.pm.api.common.constant; + +import com.ningdatech.basic.model.ApiResponse; + +import java.math.BigDecimal; + +/** + *

+ * 业务常量 + *

+ * + * @author WendyYang + * @since 13:42 2022/12/1 + */ +public interface BizConst { + + /** + * SQL查询一条 + */ + String LIMIT_1 = "limit 1"; + + String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; + + /** + * 一小时秒数 + **/ + BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); + + /** + * 十分钟的毫秒数 + */ + long MILLS_10_MIN = 1000L * 60 * 10; + + /** + * 中国行政区划编码 + */ + long ROOT_REGION_CODE = 100000L; + + /** + * 一级行政区划数量 + */ + int NUM_PROVINCE = 34; + + /** + * 默认的父id + */ + long PARENT_ID = 0L; + + /** + * 默认树层级 + */ + int TREE_GRADE = 0; + + /** + * 默认的排序 + */ + int SORT_VALUE = 0; + + /** + * 浙江省的region_id + */ + long ZJ_REGION_CODE = 330000L; + String NINE_AREA_CODE_LAST = "000"; + + /** + * 省/直辖市 level + */ + int GOV_L1 = 1; + + /** + * 市 level + */ + int GOV_L2 = 2; + + /** + * 区/县 level + */ + int GOV_L3 = 3; + + /** + * 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 + */ + String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; + + ApiResponse UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); + + int MAX_EXPORT_COUNT = 5000; + + String RESPONSE_KEY_DATA = "data"; + String RESPONSE_KEY_ID = "id"; + String RESPONSE_KEY_DING_CODE = "dingCode"; + String RESPONSE_KEY_MATTER_NAME = "matterName"; + String RESPONSE_KEY_ORG_NAME = "orgName"; + String RESPONSE_KEY_USER_STATE = "userState"; + + String RESPONSE_KEY_AREA_NAME = "areaName"; + String ORG_NAME = "organizationName"; + String ORG_CODE = "organizationCode"; + + String DEV = "dev"; + String PRE = "pre"; + String PROD = "prod"; + + String SAVE_SUCCESS = "保存成功"; + String OP_SUCCESS = "操作成功"; + String OP_FAIL = "操作失败"; + String SAVE_FAIL = "保存失败"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java new file mode 100644 index 0000000..d81257d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java @@ -0,0 +1,69 @@ +package com.hz.pm.api.common.constant; + +/** + * @description: 常量 + * @author: LiuXinXin + * @date: 2022/5/5 17:31 + */ +public interface CommonConst { + + String COOKIE_KEY = "ND_JSESSION"; + + Integer EXPORT_PAGE_NUMBER = 1; + Integer EXPORT_PAGE_SIZE = 100000; + String CALL_STATUS = "status"; + String CALL_STATUS_OK_VALUE = "ok"; + + Integer COMMENT_MAX_SIZE = 163; + Integer SUB_COMMENT_SIZE_MIN = 0; + Integer SUB_COMMENT_SIZE_MAX = 160; + + String PROJECT_DECLARE = "项目申报"; + String UNIT_INNER_AUDIT = "单位内部审核"; + String PRELIMINARY_PREVIEW = "项目预审"; + + String DEPT_UNITED_REVIEW = "部门联审"; + String PROVINCE_UNITED_REVIEW = "省级部门联审"; + String ANNUAL_PLAN = "年度计划"; + String CONSTRUCTION_PLAN_REVIEW = "建设方案评审"; + String PROJECT_APPROVAL = "立项批复"; + String TENDER_PURCHASE = "招标采购"; + String PROJECT_PRELIMINARY_INSPECTION = "项目初验"; + String PROJECT_FINAL_INSPECTION = "项目终验"; + + String ARCHIVED = "归档"; + + String FILE_NAME = "name"; + String BASIS_FILE_NAME = "fileName"; + + String NULL = "null"; + + String TITLE = "title"; + + String FILE_NAME_STR = "fileName"; + String FILE_ID_STR = "fileId"; + String ID_STR = "id"; + String FILE_LIST = "fileList"; + String ITEM_BASED = "依据项:"; + String ITEM_BASED_FILE_NAME = "依据文件名:"; + String APPENDIX = "文件:"; + String NEW_CONSTRUCTION = "新建"; + String CONTINUED_CONSTRUCTION = "续建"; + String MONTH = "月"; + String ZHI = "至"; + String YEAR = "年"; + + Integer VERSION_ONE = 1; + Integer VERSION_SIZE = 2; + Integer VERSION_JUDGE = -1; + + String COPY = "副本"; + String PROJECT_REPEAT = " 项目已在其他评价计划中,请勿重复添加!"; + String APP_REPEAT = " 应用已在其他评价计划中,请勿重复添加!"; + Integer REAPPRAISAL_TYPE = 1; + Integer VERIFY_TYPE = 2; + String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!"; + + String NORMAL_TIME_PATTERN = "yyyy-MM-dd"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DefValConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DefValConst.java new file mode 100644 index 0000000..2a6b6a5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DefValConst.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.common.constant; + + +import com.ningdatech.basic.util.StrPool; + +/** + * 默认值 + * + * @author PoffyZhang + */ +public interface DefValConst { + + /** + * 默认的根节点path + */ + String ROOT_PATH = StrPool.COMMA; + /** + * 默认树层级 + */ + Integer TREE_GRADE = 0; + /** + * 默认的父id + */ + Long PARENT_ID = 0L; + /** + * 默认的排序 + */ + Integer SORT_VALUE = 0; + /** + * 字典占位符 + */ + String DICT_PLACEHOLDER = "###"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DingConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DingConst.java new file mode 100644 index 0000000..33b0959 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/DingConst.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.common.constant; + +/** + * 浙政钉常量 + * + * @author CMM + * @since 2023/02/01 14:49 + */ +public interface DingConst { + /** + * 工作通知 + */ + String WORKING_NOTICE = "/message/workNotification"; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/ProjectDeclareConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/ProjectDeclareConst.java new file mode 100644 index 0000000..031d68e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/ProjectDeclareConst.java @@ -0,0 +1,172 @@ +package com.hz.pm.api.common.constant; + +import java.math.BigDecimal; + +/** + * 项目申报表单数据常量key + * @return + * @author CMM + * @since 2023/01/19 10:31 + */ +public interface ProjectDeclareConst { + + /** + * 基本信息 + */ + class BasicInformation { + // 项目名称 + public static final String PROJECT_NAME = "projectName"; + // 是否一地创新全省共享项目 + public static final String INNOVATION_SHARING_PROJECT = "innovationSharingProject"; + // 是否临时增补 + public static final String TEMPORARY_SUPPLEMENT = "temporarySupplement"; + // 项目负责人 + public static final String PROJECT_LEADER = "projectLeader"; + // 项目负责人手机号 + public static final String PROJECT_LEADER_PHONE_NUMBER = "projectLeaderPhoneNumber"; + // 项目联系人 + public static final String PROJECT_CONTACT = "projectContact"; + // 项目联系人手机号 + public static final String PROJECT_CONTACT_PHONE_NUMBER = "projectContactPhoneNumber"; + // 建设单位 + public static final String CONSTRUCTION_UNIT = "constructionUnit"; + // 建设单位统一信用代码 + public static final String CONSTRUCTION_UNIT_UNIFIED_CREDIT_CODE = "constructionUnitUnifiedCreditCode"; + // 项目类型 + public static final String PROJECT_TYPE = "projectType"; + // 是否首次新建 + public static final String FIRST_NEW_CONSTRUCTION = "firstNewConstruction"; + // 预算年度 + public static final String BUDGET_YEAR = "projectYear"; + // 建设开始时间 + public static final String CONSTRUCTION_START_TIME = "constructionStartTime"; + // 建设结束时间 + public static final String CONSTRUCTION_END_TIME = "constructionEndTime"; + // 四大体系 + public static final String FOUR_SYSTEM = "fourSystem"; + // 是否数字化改革项目 + public static final String DIGITAL_REFORM_PROJECT = "digitalReformProject"; + // 建设层级 + public static final String CONSTRUCTION_HIERARCHY = "constructionHierarchy"; + // 立项依据材料 + public static final String PROJECT_BASIS_MATERIAL = "projectBasisMaterial"; + // 发改编码 + public static final String CHANGE_CODE = "changeCode"; + // 财政编码 + public static final String FISCAL_CODE = "fiscalCode"; + // 是否上云 + public static final String ON_CLOUD = "onCloud"; + // 项目简介 + public static final String PROJECT_INTRODUCTION = "projectIntroduction"; + } + + /** + * 资金申报情况 + */ + class FundDeclareInfo { + // 申报金额 + public static final String DECLARE_AMOUNT = "declareAmount"; + // 自有资金 + public static final String OWN_FUND = "ownFund"; + // 政府投资-本级财政资金 + public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; + // 政府投资-上级补助资金 + public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; + // 银行贷款 + public static final String BANK_LOAN = "bankLoan"; + // 其他资金 + public static final String OTHER_FUND = "otherFund"; + } + + /** + * 总投资分配情况 + */ + class TotalInvestmentAllocations { + // 软件开发 + public static final String SOFTWARE_DEVELOPMENT = "softwareDevelopment"; + // 云资源、硬件配置 + public static final String CLOUD_RESOURCE_HARDWARE_CONFIGURATION = "cloudResourceHardwareConfiguration"; + // 第三方服务 + public static final String THIRD_PARTY_SERVICE = "thirdPartyService"; + } + /** + * 年度支付计划 + */ + class AnnualPaymentPlan { + // 年度支付金额 + public static final String ANNUAL_PAYMENT_AMOUNT = "annualPaymentAmount"; + // 自有资金 + public static final String OWN_FUND = "ownFund"; + // 政府投资-本级财政资金 + public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; + // 政府投资-上级补助资金 + public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; + // 银行贷款 + public static final String BANK_LOAN = "bankLoan"; + // 其他 + public static final String OTHER = "other"; + } + /** + * 核心业务 + */ + class CoreBusiness { + + } + /** + * 安全投入 + */ + class SafetyInput { + // 投入项 + public static final String INPUT_ITEM = "inputItem"; + // 内容描述 + public static final String CONTENT_DESCRIPTION = "contentDescription"; + // 金额 + public static final String AMOUNT = "amount"; + } + /** + * 工程形象进度 + */ + class ProjectImageProgress { + // 第一季度 + public static final String FIRST_QUARTER = "firstQuarter"; + // 第二季度 + public static final String SECOND_QUARTER = "secondQuarter"; + // 第三季度 + public static final String THIRD_QUARTER = "thirdQuarter"; + // 第四季度 + public static final String FOURTH_QUARTER = "fourthQuarter"; + } + /** + * 附件 + */ + class Appendix { + + } + /** + * 备注 + */ + class Remark { + + } + /** + * 应用信息 + */ + class ApplicationInformation { + + } + + class Number { + public static final BigDecimal DECLARE_AMOUNT_JUDGEMENT = BigDecimal.valueOf(1000); + + //区县是500万 + public static final BigDecimal DECLARE_COUNTY_AMOUNT_JUDGEMENT = BigDecimal.valueOf(500); + + public static final Integer COUNTRY_BUILD_LEVEL = 1; + public static final Integer PROVINCE_BUILD_LEVEL = 2; + public static final Integer PROVINCE_SELF_BUILD_LEVEL = 3; + public static final Integer CITY_BUILD_LEVEL = 4; + public static final Integer CITY_SELF_BUILD_LEVEL = 5; + public static final Integer DISTRICTS_COUNTRIES_BUILD_LEVEL = 6; + public static final Integer VILLAGES_TOWNS_BUILD_LEVEL = 7; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/RegionConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/RegionConst.java new file mode 100644 index 0000000..0e44d21 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/RegionConst.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.common.constant; + +import com.google.common.collect.Lists; + +import java.util.List; + +/** + *

+ * RegionConst + *

+ * + * @author WendyYang + * @since 13:57 2023/3/1 + */ +public interface RegionConst { + + //---------------------------------------地区层级(缩写RL)------------------------------------------------------------- + + int RL_PROVINCE = 1; + + int RL_CITY = 2; + + int RL_COUNTY = 3; + + //---------------------------------------地区编码(缩写RC)------------------------------------------------------------- + + /** + * 丽水行政区划编码 + */ + String RC_LS = "331100"; + //丽水开发区 + String LS_KF = "331118"; + String LS_KF_IRS = "331151"; + String RC_LS_SBJ_IRS = "331101"; + //遂昌县 + String RC_SC = "331123"; + String LS_KF_NAME = "开发区"; + + /** + * 中国行政区划编码 + */ + String RC_CHINA = "100000"; + + + /** + * 浙江行政区划编码 + */ + String RC_ZJ = "330000"; + + String NINE_CODE_LAST = "000"; + //莲都 + String LD = "331102"; + //青田 + String QT = "331121"; + //缙云 + String JY = "331122"; + //遂昌 + String SC = "331123"; + //松阳 + String SY = "331124"; + //云和 + String YH = "331125"; + //庆元 + String QY = "331126"; + String QN = "331127"; + String LQ = "331181"; + + List LS_ARR = Lists.newArrayList(RC_LS,LS_KF,LD,QT,JY,SC,SY,YH,QY,QN,LQ); + + //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- + + long PID_CHINA = 0; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/StateMachineConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/StateMachineConst.java new file mode 100644 index 0000000..f7acc26 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/StateMachineConst.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.common.constant; + +/** + * @author CMM + * @since 2023/02/07 16:24 + */ + +public class StateMachineConst { + + public static final String PROJECT_DECLARE = "projectDeclare"; + public static final String APPLICATION_DECLARE = "applicationDeclare"; + public static final String LI_SHUI_CITY_AREA_CODE = "331100"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/BoolDisplayEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/BoolDisplayEnum.java new file mode 100644 index 0000000..f0b1211 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/BoolDisplayEnum.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum BoolDisplayEnum { + + /** + * true + */ + Y, + + /** + * false + */ + N; + + public static boolean judgeBoolean(String key) { + return Y.name().equals(key); + } + + public static BoolDisplayEnum judgeBoolean(boolean key) { + return key ? Y : N; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/CommonEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/CommonEnum.java new file mode 100644 index 0000000..da577aa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/CommonEnum.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author zpf + * @date 2023/3/12 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum CommonEnum { + /** + * 公共的一些枚举 + */ + YES(1,"是",1), + NO(0,"否",1), + + LS_SBJ(331100,"市本级",2), + LS_LD(331102,"莲都区",2), + LS_QT(331121,"青田县",2), + LS_JY(331122,"缙云县",2), + LS_SC(331123,"遂昌县",2), + LS_SY(331124,"松阳县",2), + LS_YH(331125,"云和县",2), + LS_QY(331126,"庆元县",2), + LS_JN(331127,"景宁畲族自治县",2), + LS_LQ(331181,"龙泉市",2), + LS_KFQ(331199,"开发区",2), + ZWDD(0,"浙政钉",3), + MOBILE(1,"短信",3); + + private Integer code; + private String desc; + private Integer groupId; + + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ExportOptionEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ExportOptionEnum.java new file mode 100644 index 0000000..f51711d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ExportOptionEnum.java @@ -0,0 +1,157 @@ +package com.hz.pm.api.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +/** + * 导出选项枚举 + * + * @author CMM + * @since 2023/02/10 16:38 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ExportOptionEnum { + /** + * 导出选项 + */ + id(1, "项目ID"), + + projectName(2, "项目名称"), + + areaCode(3, "行政区划编码"), + + area(4, "行政区划名称"), + + responsibleMan(5, "项目负责人"), + + responsibleManMobile(6, "项目负责人手机号"), + + contactName(7, "项目联系人"), + + contactPhone(8, "项目联系人手机号"), + + higherSuperOrg(9, "上级业务主管单位"), + + higherSuperOrgCode(10, "上级主管单位浙政钉ID"), + + superOrg(11, "本级主管部门"), + + superOrgCode(12, "本级主管部门浙政钉ID"), + + buildOrgName(13, "建设单位名称"), + + buildOrgZheJiangGovDingId(14, "建设单位浙政钉ID"), + + orgCreditCode(15, "建设单位统一信用代码"), + + projectType(16, "项目类型"), + + isFirst(17, "是否首次新建"), + + relatedExistsApplication(18, "关联应用"), + + relatedExistsApplicationCode(19, "关联应用IRS编码"), + + declareAmount(20, "申报金额"), + + approvedTotalInvestmentIncrease(21, "批复金额"), + + /** + * 表里没有 + */ + budgetSource(22, "预算来源"), + + projectYear(23, "预算年度"), + + projectIntroduction(24, "项目简介"), + + buildBasis(25, "立项依据"), + + buildLevel(26, "建设层级"), + + developCode(27, "发改编码"), + + financialCode(28, "财政编码"), + + /** + * 表里没有 + */ + informationValidity(29, "信息是否有效"), + + + isDigitalReform(30, "是否数字化改革项目"), + + bizDomain(31, "综合应用领域"), + + isCloud(32, "是否上云"), + + cloudType(33, "云类型"), + + fourSystems(34, "四大体系"), + isTemporaryAugment(35, "是否临时增补"), + + protectionLevel(36, "等保级别"), + + isSecretComments(37, "是否密评"), + + businessNumber(38, "业务编号"), + + businessName(39, "业务名称"), + + orgName(40, "单位名称"), + + softwareDevelopmentAmount(41, "软件开发"), + + cloudHardwarePurchaseAmount(42, "云资源、硬件购置"), + + thirdPartyAmount(43, "第三方服务"), + + safetyInputTitle(44, "投入项"), + + safetyInputDescribe(45, "内容描述"), + + safetyInputAmount(46, "金额"), + + annualPlanAmount(47, "年度支付金额"), + + annualPlanHaveAmount(48, "自有资金"), + + declareGovOwnFinanceAmount(49, "政府投资-本级财政资金"), + + declareGovSuperiorFinanceAmount(50, "政府投资-上级补助资金"), + + declareBankLendingAmount(51, "银行贷款"), + + declareOtherAmount(52, "其它资金"), + + engineeringSpeedOne(53, "第一季度"), + + engineeringSpeedTwo(54, "第二季度"), + + engineeringSpeedThree(55, "第三季度"), + + engineeringSpeedFour(56, "第四季度"), + + preliminaryPlanFile(57, "初步方案"), + + supportingMaterialsFile(58, "附件-佐证材料"), + + projectRemarks(59, "备注"), + processStatusName(60, "流程状态名称"), + processLaunchTime(61,"流程发起时间"), + processHandleTime(62,"流程处理时间"), + + projectStatusName(63,"项目状态名称"), + + createOn(64,"创建时间"), + + updateOn(65,"更新时间"); + + + private Integer code; + private String desc; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java new file mode 100644 index 0000000..2512b83 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectProcessStageEnum { + /** + * 项目流程配置 阶段枚举 + */ + ORG_INTERNAL_APPROVAL_PROCESS(1,"单位内部审批流程"), + PROJECT_PREQUALIFICATION_APPROVAL_PROCESS(2,"项目预审审批流程"), + DEPARTMENT_JOINT_APPROVAL_PROCESS(3,"部门联合审批流程"), + CONSTRUCTION_PROJECT_APPROVAL_PROCESS(4,"建设方案审批流程"), + ACCEPTANCE_DECLARATION_APPROVAL_PROCESS(5,"验收申报审批流程"), + APPLY_DELAY(6,"申请延期审批流程"), + APPLY_BORROW(7,"申请借阅审批流程"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectProcessStageEnum t : ProjectProcessStageEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/errorcode/AppErrorCode.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/errorcode/AppErrorCode.java new file mode 100644 index 0000000..9d554ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/errorcode/AppErrorCode.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.common.errorcode; + +import lombok.Getter; + +/** + * @author LiuXinXin + */ +@Getter +public enum AppErrorCode { + USER(100), + + AUTH(101); + + private final Integer code; + + AppErrorCode(Integer code) { + this.code = code; + } + + public Integer getCode() { + return code; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/BaseFieldFillHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/BaseFieldFillHandler.java new file mode 100644 index 0000000..e550ddd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/BaseFieldFillHandler.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.common.handler; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +import static com.hz.pm.api.common.constant.BaseFieldConst.*; + +/** + *

+ * 字段自动填充处理 + *

+ * + * @author WendyYang + * @since 17:20 2022/11/24 + */ +@Slf4j +@Component +public class BaseFieldFillHandler implements MetaObjectHandler { + + private Long getUserId() { + if (LoginUserUtil.isLogin()) { + return LoginUserUtil.getUserId(); + } + return 0L; + } + + @Override + public void insertFill(MetaObject metaObject) { + long userId = getUserId(); + LocalDateTime now = LocalDateTime.now(); + this.fillStrategy(metaObject, CREATE_BY, userId); + this.fillStrategy(metaObject, CREATE_ON, now); + this.fillStrategy(metaObject, UPDATE_BY, userId); + this.fillStrategy(metaObject, UPDATE_ON, now); + } + + @Override + public void updateFill(MetaObject metaObject) { + this.fillStrategy(metaObject, UPDATE_BY, getUserId()); + this.fillStrategy(metaObject, UPDATE_ON, LocalDateTime.now()); + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalExceptionHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..a40eedd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalExceptionHandler.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.common.handler; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.support.DefaultMessageSourceResolvable; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.servlet.NoHandlerFoundException; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.stream.Collectors; + +/** + * @description: 统一错误处理 + * @author: liuxinxin + * @date: 2023/01/03 11:39 + */ +@Slf4j +@ControllerAdvice +@ResponseStatus(HttpStatus.BAD_REQUEST) +public class GlobalExceptionHandler { + + @ResponseBody + @ExceptionHandler(value = NoHandlerFoundException.class) + public ApiResponse noHandlerFoundException(NoHandlerFoundException e) { + log.error("【全局异常拦截】NoHandlerFoundException: 请求方法 {}, 请求路径 {}", e.getRequestURL(), e.getHttpMethod()); + return ApiResponse.ofStatus(Status.REQUEST_NOT_FOUND); + } + + @ResponseBody + @ExceptionHandler(value = {MethodArgumentNotValidException.class, BindException.class}) + public ApiResponse bindException(BindException e) { + String msg = e.getAllErrors().stream() + .map(DefaultMessageSourceResolvable::getDefaultMessage) + .collect(Collectors.joining(",")); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); + } + + @ResponseBody + @ExceptionHandler(value = ConstraintViolationException.class) + public ApiResponse constraintViolationException(ConstraintViolationException e) { + String msg = e.getConstraintViolations().stream() + .map(ConstraintViolation::getMessage) + .collect(Collectors.joining(",")); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); + } + + @ResponseBody + @ExceptionHandler(value = Exception.class) + public ApiResponse handlerException(Exception e) { + log.error("【全局异常拦截】: 异常信息 {}: {} ", e.getClass().getSimpleName(), e); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), e.getMessage(), null); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java new file mode 100644 index 0000000..79f7d13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.common.handler; + +import com.ningdatech.basic.model.ApiResponse; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +/** + * @Author liuxinxin + * @Date 2021/7/21 11:26 + * @Version 1.0 + **/ +@RestControllerAdvice(basePackages = { + "com.hz.pm.api.fiscal.controller", + "com.hz.pm.api.organization.controller", + "com.hz.pm.api.projectdeclared.controller", + "com.hz.pm.api.projectlib.controller", + "com.hz.pm.api.sys.controller", + "com.hz.pm.api.todocenter.controller", + "com.hz.pm.api.user.controller", + "com.hz.pm.api.meeting.controller", + "com.hz.pm.api.expert.controller", + "com.hz.pm.api.sms.controller", + "com.hz.pm.api.workbench.controller", + "com.hz.pm.api.ding.controller", + "com.hz.pm.api.filemanage.controller", + "com.hz.pm.api.performance.controller", + "com.hz.pm.api.irs.controller", + "com.hz.pm.api.safety.controller", + "com.hz.pm.api.portrait.controller", + "com.hz.pm.api.irs.controller", + "com.hz.pm.api.gov.controller", + "com.hz.pm.api.dashboard.controller", + "com.hz.pm.api.wps.controller", + "com.hz.pm.api.gov.controller" +}) +public class GlobalResponseHandler implements ResponseBodyAdvice { + + private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; + + @Override + public boolean supports(MethodParameter methodParameter, Class> aClass) { + return filter(methodParameter); + } + + @Override + public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, + Class> aClass, ServerHttpRequest serverHttpRequest, + ServerHttpResponse serverHttpResponse) { + ApiResponse apiResponse = ApiResponse.ofSuccess(o); + // 处理字符串时,遇到了类型转换的问题,debug一步一步跟踪,原来是对于字符串的ContentType是“text-plain”, + // ConverterType是StringHttpMessageConverter这个类型转换, + // 由于将结果封装成了自定义的ApiResponse类型,所以有ApiResponse转换成String报错 + // 所以需要对String类型的返回值单独进行处理 +// if (o instanceof String) { +// return JSONUtil.toJsonStr(apiResponse); +// } + return ApiResponse.ofSuccess(o); +// return o; + } + + private Boolean filter(MethodParameter methodParameter) { + Class declaringClass = methodParameter.getDeclaringClass(); + // swagger中的所有返回不进行统一封装 + if (declaringClass.getName().contains(SWAGGER_CLASS_PREFIX)) { + return false; + } + if (methodParameter.hasMethodAnnotation(ExceptionHandler.class)) { + return false; + } + // 如果本身就是使用ApiResponse返回,则不需要进行格式化 + return !methodParameter.getParameterType().equals(ApiResponse.class); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionCacheHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionCacheHelper.java new file mode 100644 index 0000000..511aa43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionCacheHelper.java @@ -0,0 +1,120 @@ +package com.hz.pm.api.common.helper; + + +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.vo.RegionTreeVO; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * RegionCacheHelper - + *

+ * + * @author WendyYang + * @since 13:50 2023/3/1 + */ +public interface RegionCacheHelper { + + + /** + * 获取完整的区域树状结构 + * + * @return / + */ + List all(); + + /** + * 根据区域code 区域层级获取 区域类 + * + * @param code 区域编码 + * @param level 区域层级 + * @return {@link RegionDTO} + */ + RegionDTO getByCodeAndLevel(String code, Integer level); + + /** + * 获取区域名称 + * + * @param code 区域编码 + * @param level 区域层级 + * @return 名称 + */ + String getRegionName(String code, int level); + + /** + * 根据传入的地区code与level获取所有上层地区集合 + * 按照level升序排列 + * + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + List listParents(String code, int level); + + /** + * 根据传入的地区code与level获取所有子区域集合 + * + * @param code 地域编码 + * @param level 地域层级 + * @return 所有子区域(包含自己) + * @author WendyYang + **/ + List listChildren(String code, int level); + + /** + * 获取当前区域所有的子区域(包括自己) + * + * @param code 区域编码 + * @param level 级别 + * @return / + */ + Collection listChildRegionCodeList(String code, int level); + + /** + * 获取当前节点开始的区域树 + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return 区域树 + */ + RegionTreeVO getRegionTree(String regionCode, Integer regionLevel); + + /** + * 获取展示名称(浙江省/杭州市/滨江区) + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return java.lang.String + **/ + String getFullDisplayName(String regionCode, Integer regionLevel); + + /** + * 获取展示名称(杭州市/滨江区) + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return java.lang.String + **/ + String getDisplayName(String regionCode, Integer regionLevel); + + + /** + * 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用 + * + * @param code 区域编码 + * @param level 区域层级 + * @return \ + */ + String getUnionPath(String code, Integer level); + + /** + * 根据区域名称获取区域信息(参数格式:浙江省-杭州市-滨江区) + * + * @param regionName 地区名称 + * @return \ + **/ + RegionDTO getByRegionName(String regionName); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java new file mode 100644 index 0000000..bb5a8c0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.common.helper; + +import com.hz.pm.api.meta.model.bo.RegionContainsBO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/12/21 下午5:37 + * 区域限制帮助类 + */ + +public interface RegionLimitHelper { + /** + * 校验层级包含关系 + * + * @param regionContainsBOList / + * @param regionCode / + * @param regionLevel / + * @return / + */ + Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel); + + /** + * 查询操作 包含区域包含列表装配 + * + * @param queryRegionContainBo 查询区域范围列表 + * @param expertAdminContainsRegionList 专家管理员可管理的区域范围列表 + * @return / + */ + List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList); + + /** + * 根据 区域层级-区域编码 获取区域包含列表 + * + * @param regionLevel 区域层级 + * @param regionCode 区域编码 + * @return / + */ + RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); + + + + /** + * 根据专家管理员用户id 获取专家管理员管辖区域列表 + * + * @param expertAdminUserId 专家管理员用户id + * @return + */ + List getExpertAdminContainsRegion(Long expertAdminUserId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java new file mode 100644 index 0000000..4f16803 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.common.helper; + +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; + +import java.util.Collection; +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:38 + * @Description: 用户信息管理工具类 helper + */ + +public interface UserInfoHelper { + + /** + * 根据用户id 获取 用户所属组织code organizationCode + * + * @param userId + * @return + */ + String getOrganizationCode(Long userId); + + UserFullInfoDTO getUserFullInfo(Long userId); + + UserFullInfoDTO getUserFullInfo(UserInfo userInfo); + + List getUserFullInfos(List userInfos); + + String getUserName(Long userId); + + /** + * 判断该用户是否是区管或者超管 + * + * @return + */ + boolean isSuperOrRegionAdmin(Long userId); + + UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); + + List getUserFullInfoByEmployeeCodes(Collection employeeCodes); + + /** + * 获取用户任职所在单位code + * + * @return + */ + String getUserEmpPosUnitCode(Long userId); + + String getMainOrgCode(String empPosUnitCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java new file mode 100644 index 0000000..701401b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.common.helper.basic; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.model.RegionMapKey; +import com.hz.pm.api.sys.convert.RegionConverter; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.service.IRegionService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +/** + *

+ * AbstractRegionCache + *

+ * + * @author WendyYang + * @since 14:41 2023/3/1 + */ +@Slf4j +public abstract class AbstractRegionCacheHelper implements InitializingBean { + + private static final String PARENT_CODE_ROOT = "-1"; + + @Autowired + private IRegionService regionService; + + protected LoadingCache regionsCache; + + private void initRegionCache() { + List allRegions = regionService.all(); + if (allRegions.isEmpty()) { + log.warn("区域元数据未初始化"); + return; + } + allRegions.forEach(w -> { + RegionMapKey key = RegionMapKey.of(w.getRegionCode(), w.getRegionLevel()); + regionsCache.put(key, w); + }); + } + + protected RegionDTO get(RegionMapKey key) { + return regionsCache.get(key); + } + + protected List all() { + return Lists.newArrayList(regionsCache.asMap().values()); + } + + @Override + public void afterPropertiesSet() { + regionsCache = Caffeine.newBuilder() + .refreshAfterWrite(7, TimeUnit.DAYS) + .maximumSize(512) + .build(key -> { + Region region = regionService.getOne(key.getRegionCode(), key.getRegionLevel()); + if (Objects.isNull(region)) { + //查不到直接返回null + return null; + } + return RegionConverter.toRegionDTO(region); + }); + // 初始化所有区域数据到缓存 + initRegionCache(); + } + + public String getParentCodeRoot() { + return PARENT_CODE_ROOT; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionLimitHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionLimitHelper.java new file mode 100644 index 0000000..56903b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionLimitHelper.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.common.helper.basic; + +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.RegionLimitHelper; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.sys.service.IRegionService; +import com.hz.pm.api.user.service.IUserInfoService; +import lombok.AllArgsConstructor; + +import java.util.Objects; + +/** + *

+ * AbstractRegionLimitHelper + *

+ * + * @author WendyYang + * @since 14:35 2023/3/1 + */ +@AllArgsConstructor +public abstract class AbstractRegionLimitHelper implements RegionLimitHelper { + + protected final RegionCacheHelper regionCache; + protected final IExpertUserFullInfoService expertUserFullInfoService; + protected final IUserInfoService iUserInfoService; + protected final IRegionService regionService; + + + /** + * 根据 专家用户id 获取专家层级 + * + * @param expertUserId / + * @return / + */ + protected ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { + ExpertUserFullInfo userFullInfo = expertUserFullInfoService.getByUserId(expertUserId); + if (Objects.isNull(userFullInfo)) { + return new ExpertRegionInfo(); + } + ExpertRegionInfo regionInfo = new ExpertRegionInfo(); + regionInfo.setRegionCode(userFullInfo.getRegionCode()); + regionInfo.setRegionLevel(userFullInfo.getRegionLevel()); + return regionInfo; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java new file mode 100644 index 0000000..ea3d9a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java @@ -0,0 +1,127 @@ +package com.hz.pm.api.common.helper.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.basic.AbstractRegionLimitHelper; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.bo.RegionContainsBO; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.service.IRegionService; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/8/1 下午2:27 + */ +@Component +public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { + + private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); + + public RegionLimitHelperImpl(RegionCacheHelper regionCache, IExpertUserFullInfoService expertUserFullInfoService + , IUserInfoService iUserInfoService, IRegionService regionService) { + super(regionCache, expertUserFullInfoService, iUserInfoService, regionService); + } + + public static Boolean contains(Integer adminRegionLevel, List adminAllContainsRegionCodes + , Integer expertRegionLevel, String expertRegionCode) { + for (String adminAllContainsRegionCode : adminAllContainsRegionCodes) { + if (adminAllContainsRegionCode.equals(expertRegionCode) && adminRegionLevel >= expertRegionLevel) { + return true; + } + } + return false; + } + + @Override + public Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel) { + for (RegionContainsBO regionContainsBO : regionContainsBOList) { + Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); + List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); + for (String containsRegionCode : containsRegionCodeList) { + if (containsRegionCode.equals(regionCode) && parentRegionTreeLevel <= regionLevel) { + return true; + } + } + } + return false; + } + + + @Override + public List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList) { + List resultBoList = new ArrayList<>(); + if (Objects.nonNull(queryRegionContainBo)) { + List containsRegionCodeList = queryRegionContainBo.getContainsRegionCodeList(); + // 查询取并级 + if (CollectionUtils.isNotEmpty(expertAdminContainsRegionList)) { + for (RegionContainsBO regionContainsBO : expertAdminContainsRegionList) { + List regionCodeList = regionContainsBO.getContainsRegionCodeList(); + regionCodeList.retainAll(containsRegionCodeList); + if (CollectionUtils.isNotEmpty(regionCodeList)) { + regionContainsBO.setContainsRegionCodeList(regionCodeList); + resultBoList.add(regionContainsBO); + } + } + } + return resultBoList; + } else { + return expertAdminContainsRegionList; + } + } + + @Override + public RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode) { + Collection regionCodes = regionCache.listChildRegionCodeList(regionCode, regionLevel); + RegionContainsBO regionContains = new RegionContainsBO(); + regionContains.setContainsRegionCodeList(new ArrayList<>(regionCodes)); + regionContains.setParentRegionTreeLevel(regionLevel); + return regionContains; + } + + + @Override + public List getExpertAdminContainsRegion(Long expertAdminUserId) { + if (Objects.isNull(expertAdminUserId)) { + logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); + return new ArrayList<>(); + } + + UserInfo userInfo = iUserInfoService.getById(expertAdminUserId); + + if (Objects.isNull(userInfo) || StringUtils.isBlank(userInfo.getRegionCode())) { + logger.error("getExpertAdminContainsRegion userInfo is null Or regionCode is null"); + return new ArrayList<>(); + } + + String regionCode = userInfo.getRegionCode(); + List regionList = regionService.list(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, regionCode) + .orderByDesc(Region::getRegionLevel)); + + Region region = regionList.get(0); + Collection regionCodes = regionCache + .listChildRegionCodeList(region.getRegionCode(), region.getRegionLevel()); + RegionContainsBO regionContainsBO = new RegionContainsBO(); + regionContainsBO.setContainsRegionCodeList(new ArrayList<>(regionCodes)); + regionContainsBO.setParentRegionTreeLevel(region.getRegionLevel()); + + ArrayList regionContainsBOS = CollectionUtil.toList(regionContainsBO); + + return regionContainsBOS; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java new file mode 100644 index 0000000..20a1c0b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java @@ -0,0 +1,244 @@ +package com.hz.pm.api.common.helper.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.text.StrPool; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.basic.AbstractRegionCacheHelper; +import com.hz.pm.api.common.model.RegionMapKey; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.sys.convert.RegionConverter; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.dto.RegionTreeDTO; +import com.hz.pm.api.sys.model.vo.RegionTreeVO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 上午8:58 + * 构建地区码 地区树 + */ +@Slf4j +@Component +public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements RegionCacheHelper { + + @Override + public RegionDTO getByCodeAndLevel(String code, Integer level) { + if (StringUtils.isBlank(code) || Objects.isNull(level)) { + return null; + } + return super.get(RegionMapKey.of(code, level)); + } + + @Override + public String getRegionName(String code, int level) { + RegionDTO dto = getByCodeAndLevel(code, level); + if (Objects.nonNull(dto)) { + return dto.getRegionName(); + } + return StringUtils.EMPTY; + } + + @Override + public List all() { + return super.all(); + } + + @Override + public Collection listChildRegionCodeList(String regionCode, int regionLevel) { + RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); + if (Objects.isNull(currRegion)) { + return Collections.emptyList(); + } + if (currRegion.getParentCode().equals(regionCode)) { + return Collections.singletonList(regionCode); + } + List allRegions = all(); + return allRegions.stream().filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) + .map(RegionDTO::getRegionCode).collect(Collectors.toSet()); + } + + @Override + public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { + Map> regions; + Long parentId; + if (regionCode == null || regionCode.equals(RegionConst.RC_CHINA)) { + regions = CollUtils.group(all(), RegionDTO::getParentId); + parentId = RegionConst.PID_CHINA; + } else { + RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); + if (currRegion.getParentCode().equals(regionCode)) { + return RegionConverter.toRegionTreeVO(currRegion); + } + regions = all().stream() + .filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) + .collect(Collectors.groupingBy(RegionDTO::getParentId)); + parentId = currRegion.getParentId(); + } + regions.values().forEach(w -> w.sort(Comparator.comparing(x -> Long.parseLong(x.getRegionCode())))); + return RegionConverter.toRegionTree(parentId, regions, false).get(0); + } + + @Override + public String getFullDisplayName(String regionCode, Integer regionLevel) { + RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); + return getDisplayName(regionCurr, RegionConst.RL_PROVINCE); + } + + @Override + public String getDisplayName(String regionCode, Integer regionLevel) { + RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); + return getDisplayName(regionCurr, RegionConst.RL_CITY); + } + + //------------------------------------------------------------------------------------------------------------------ + + /** + * 获取指定层级的展示名称 + * + * @param region 当前区域 + * @param sLevel 开始层级 + * @return 展示名称 + */ + private String getDisplayName(RegionDTO region, int sLevel) { + if (Objects.isNull(region)) { + return StringUtils.EMPTY; + } + Integer level = region.getRegionLevel(); + if (RegionConst.RL_PROVINCE > sLevel || sLevel > level) { + throw BizException.wrap("区域层级无效"); + } + if (sLevel == level) { + return region.getRegionName(); + } + StringBuilder builder = new StringBuilder(); + List regionCodes = StrUtils.split(region.getRegionCodePath()); + for (int i = regionCodes.size() - 2; i > 0; i--) { + if (level <= sLevel) { + break; + } + RegionDTO tmp = getByCodeAndLevel(regionCodes.get(i), --level); + builder.insert(0, StrPool.SLASH); + builder.insert(0, tmp.getRegionName()); + } + builder.append(region.getRegionName()); + return builder.toString(); + } + + protected List getCopyListByLevel(int level) { + List regions = all().stream() + .filter(w -> w.getRegionLevel() <= level) + .collect(Collectors.toList()); + return RegionConverter.toRegionTreeDTOList(regions); + } + + /** + * 获取某一个地区开始的层级树 + * + * @param list 地区集合 + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + private RegionTreeDTO getTreeByRegionAndCode(List list, String code, int level) { + if (CollectionUtils.isEmpty(list)) { + list = getCopyListByLevel(3); + if (CollectionUtils.isEmpty(list)) { + return null; + } + } + Optional first = list.stream() + .filter(w -> w.getRegionCode().equals(code) && w.getLevel() == level) + .findFirst(); + if (first.isPresent()) { + return first.get(); + } + for (RegionTreeDTO dto : list) { + if (CollectionUtils.isEmpty(dto.getChildren())) { + continue; + } + RegionTreeDTO temp = getTreeByRegionAndCode(dto.getChildren(), code, level); + if (temp != null) { + return temp; + } + } + return null; + } + + @Override + public List listParents(String code, int level) { + List result = new ArrayList<>(); + RegionDTO dto = getByCodeAndLevel(code, level); + result.add(0, dto); + if (RegionConst.RC_CHINA.equals(dto.getParentCode())) { + return result; + } + result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1)); + return result; + } + + @Override + public List listChildren(String code, int level) { + RegionDTO curr = getByCodeAndLevel(code, level); + if (curr.getParentCode().equals(curr.getRegionCode())) { + return Collections.singletonList(curr); + } + return all().stream() + .filter(w -> StrUtils.split(w.getRegionCodePath()).contains(code)) + .collect(Collectors.toList()); + } + + + @Override + public String getUnionPath(String code, Integer level) { + if (StrUtils.isBlank(code) || Objects.isNull(level)) { + return StrUtils.EMPTY; + } + List unionPathStrList = new ArrayList<>(); + buildUnionPathStrList(code, level, unionPathStrList); + Collections.reverse(unionPathStrList); + if (CollUtil.isEmpty(unionPathStrList)) { + return StrUtils.EMPTY; + } + return String.join("@@", unionPathStrList); + } + + @Override + public RegionDTO getByRegionName(String regionName) { + if (StrUtils.isBlank(regionName)) { + return null; + } + String[] regionArray = regionName.split("-"); + int length = regionArray.length; + return all().stream() + .filter(w -> { + boolean lastEq = w.getRegionLevel().equals(length) + && w.getRegionName().equals(regionArray[length - 1]); + if (lastEq && length > 1) { + RegionDTO parent = getByCodeAndLevel(w.getParentCode(), w.getRegionLevel() - 1); + return parent.getRegionName().equals(regionArray[length - 2]); + } + return false; + }).findFirst().orElse(null); + } + + protected void buildUnionPathStrList(String code, Integer level, List unionPathStrList) { + if (level <= 0 || super.getParentCodeRoot().equals(code)) { + return; + } + RegionDTO regionDTO = getByCodeAndLevel(code, level); + unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel()); + if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) { + buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java new file mode 100644 index 0000000..c550d84 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java @@ -0,0 +1,247 @@ +package com.hz.pm.api.common.helper.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sys.mapper.RoleMapper; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.service.IUserRoleService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.service.IUserInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:40 + */ +@Component +@RequiredArgsConstructor +public class UserInfoHelperImpl implements UserInfoHelper { + + + private final IUserInfoService userInfoService; + private final IDingEmployeeInfoService iDingEmployeeInfoService; + private final IDingOrganizationService iDingOrganizationService; + private final IUserRoleService iUserRoleService; + private final RoleMapper roleMapper; + + @Override + public String getOrganizationCode(Long userId) { + UserFullInfoDTO userFullInfo = getUserFullInfo(userId); + return userFullInfo.getOrganizationCode(); + } + + @Override + public UserFullInfoDTO getUserFullInfo(Long userId) { + UserInfo userInfo = userInfoService.getById(userId); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + return getUserFullInfo(userInfo); + } + + @Override + public UserFullInfoDTO getUserFullInfo(UserInfo userInfo) { + UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); + // 获取浙政钉雇员信息 组织信息 + String employeeCode = userInfo.getEmployeeCode(); + if (StringUtils.isNotBlank(employeeCode)) { + List dingEmployeeInfoList = iDingEmployeeInfoService + .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .eq(DingEmployeeInfo::getMainJob, "true")); + DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); + + + // 装配用户任职所在单位 + String empPosUnitCode = dingEmployeeInfo.getEmpPosUnitCode(); + if (StringUtils.isNotBlank(empPosUnitCode)) { + DingOrganization dingOrganization = iDingOrganizationService.getByOrgCode(empPosUnitCode); + if (Objects.nonNull(dingOrganization)) { + userFullInfo.setEmpPosUnitCode(empPosUnitCode); + userFullInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userFullInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + } + + // 装配用户所在orgCode + String organizationCode = dingEmployeeInfo.getOrganizationCode(); + List dingOrganizationList = iDingOrganizationService.list(Wrappers + .lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, organizationCode)); + if (CollectionUtil.isNotEmpty(dingOrganizationList)) { + DingOrganization dingOrganization = dingOrganizationList.get(0); + userFullInfo.setOrganizationCode(dingOrganization.getOrganizationCode()); + userFullInfo.setOrganizationName(dingOrganization.getOrganizationName()); + // 测试使用 + userFullInfo.setRegionLevel(3); + } + } + + List roleList = new ArrayList<>(); + // 获取用户角色列表信息 + List userRoleList = iUserRoleService + .list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userInfo.getId())); + if (CollectionUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream() + .map(UserRole::getRoleId).distinct() + .collect(Collectors.toList()); + roleList = roleMapper.selectBatchIds(roleIdList); + } + userFullInfo.setUserRoleList(roleList); + + // 装配用户任职所在单位 + + // 装配返回 + userFullInfo.setUserId(userInfo.getId()); + userFullInfo.setIdentifier(userInfo.getRealName()); + userFullInfo.setRealName(userInfo.getRealName()); + userFullInfo.setEmployeeCode(employeeCode); + userFullInfo.setUsername(userInfo.getRealName()); + userFullInfo.setMobile(userInfo.getMobile()); + userFullInfo.setAccountId(userInfo.getAccountId()); + + String available = userInfo.getAvailable(); + if (StringUtils.isNotBlank(available)) { + userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); + } + return userFullInfo; + } + + /** + * 批量查询 这里 会没有角色 + * + * @param userInfos \ + * @return \ + */ + @Override + public List getUserFullInfos(List userInfos) { + if (CollUtil.isEmpty(userInfos)) { + return Collections.emptyList(); + } + Map userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, e -> e)); + // 获取浙政钉雇员信息 组织信息 + List employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); + List dingEmployeeInfoList = iDingEmployeeInfoService + .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .in(DingEmployeeInfo::getEmployeeCode, employeeCodes) + .eq(DingEmployeeInfo::getMainJob, "true")); + + if (CollUtil.isEmpty(dingEmployeeInfoList)) { + return Collections.emptyList(); + } + + // 装配用户任职所在单位 + List empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); + List orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); + List allOrgCodes = Stream.concat(empPosUnitCodes.stream(), orgCodes.stream()).collect(Collectors.toList()); + if (CollUtil.isEmpty(allOrgCodes)) { + return Collections.emptyList(); + } + List dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); + if (CollUtil.isEmpty(dingOrganizations)) { + return Collections.emptyList(); + } + Map orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, d -> d)); + + return dingEmployeeInfoList.stream().map(e -> { + UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); + if (orgMap.containsKey(e.getEmpPosUnitCode())) { + DingOrganization organization = orgMap.get(e.getEmpPosUnitCode()); + userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode()); + userFullInfo.setEmpPosUnitName(organization.getOrganizationName()); + userFullInfo.setRegionCode(organization.getDivisionCode()); + } + if (orgMap.containsKey(e.getOrganizationCode())) { + DingOrganization organization = orgMap.get(e.getOrganizationCode()); + userFullInfo.setOrganizationCode(organization.getOrganizationCode()); + userFullInfo.setOrganizationName(organization.getOrganizationName()); + // 测试使用 + userFullInfo.setRegionLevel(3); + } + if (userMap.containsKey(e.getEmployeeCode())) { + UserInfo userInfo = userMap.get(e.getEmployeeCode()); + // 装配返回 + userFullInfo.setUserId(userInfo.getId()); + userFullInfo.setIdentifier(userInfo.getRealName()); + userFullInfo.setRealName(userInfo.getRealName()); + userFullInfo.setEmployeeCode(e.getEmployeeCode()); + userFullInfo.setUsername(userInfo.getRealName()); + userFullInfo.setMobile(userInfo.getMobile()); + userFullInfo.setAccountId(userInfo.getAccountId()); + String available = userInfo.getAvailable(); + if (StringUtils.isNotBlank(available)) { + userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); + } + } + return userFullInfo; + }).collect(Collectors.toList()); + } + + @Override + public String getUserName(Long userId) { + UserFullInfoDTO userFullInfo = getUserFullInfo(userId); + return userFullInfo.getRealName(); + } + + @Override + public boolean isSuperOrRegionAdmin(Long userId) { + UserFullInfoDTO userFullInfo = getUserFullInfo(userId); + if (CollUtil.isNotEmpty(userFullInfo.getUserRoleList())) { + for (Role role : userFullInfo.getUserRoleList()) { + if (RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) || + RoleEnum.REGION_MANAGER.name().equals(role.getCode())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } + + @Override + public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { + UserInfo userInfo = userInfoService.getUserInfoByEmployeeCode(employeeCode); + return getUserFullInfo(userInfo); + } + + @Override + public List getUserFullInfoByEmployeeCodes(Collection employeeCodes) { + List userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); + return getUserFullInfos(userInfos); + } + + @Override + public String getUserEmpPosUnitCode(Long userId) { + UserFullInfoDTO userFullInfo = getUserFullInfo(userId); + return userFullInfo.getEmpPosUnitCode(); + } + + @Override + public String getMainOrgCode(String empPosUnitCode) { + DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, empPosUnitCode) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(org)){ + return null; + } + return org.getParentCode(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/interceptor/LogInterceptor.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/interceptor/LogInterceptor.java new file mode 100644 index 0000000..e25eda5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/interceptor/LogInterceptor.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.common.interceptor; + +import cn.hutool.core.lang.UUID; +import com.hz.pm.api.common.util.MDCUtil; +import org.springframework.lang.NonNull; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + *

+ * LogInterceptor + *

+ * + * @author WendyYang + * @since 2023/10/26 + **/ +public class LogInterceptor implements HandlerInterceptor { + + @Override + public boolean preHandle(@NonNull HttpServletRequest request, + @NonNull HttpServletResponse response, + @NonNull Object handler) { + String traceId = UUID.randomUUID().toString(true); + response.addHeader(MDCUtil.TRACE_ID_HEADER, traceId); + MDCUtil.setTraceId(traceId); + return true; + } + + @Override + public void afterCompletion(@NonNull HttpServletRequest request, + @NonNull HttpServletResponse response, + @NonNull Object handler, Exception ex) { + MDCUtil.removeTraceId(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPage.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPage.java new file mode 100644 index 0000000..3550c3d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPage.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.common.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:34 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CommonPage implements Serializable { + private static final long serialVersionUID = 1L; + private int currentPageNumber; + private Long itemsTotal; + private List items; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPageReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPageReq.java new file mode 100644 index 0000000..a39e388 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/CommonPageReq.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.common.model; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:19 + */ +@Data +public class CommonPageReq { + private static final long serialVersionUID = 1L; + private int pageSize; + private int pageNumber; + + public int getOffset() { + return (this.getPageNumber() - 1) * this.getPageSize(); + } + + public int getLimit() { + return this.getPageSize(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ExpertRegionModifyDiffBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ExpertRegionModifyDiffBO.java new file mode 100644 index 0000000..7007876 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ExpertRegionModifyDiffBO.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.common.model; + +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午4:34 + */ +@Data +public class ExpertRegionModifyDiffBO { + + private List addList; + + private List removeList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FileBasicInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FileBasicInfo.java new file mode 100644 index 0000000..a5073c9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FileBasicInfo.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.common.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:55 + * 用于包装使用 + */ +@Data +@ApiModel("文件信息基类") +public class FileBasicInfo { + + @ApiModelProperty("文件id") + private Long fileId; + + @ApiModelProperty("文件url") + private String url; + + @ApiModelProperty("文件名") + private String fileName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FreemarkerBatchExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FreemarkerBatchExportDTO.java new file mode 100644 index 0000000..990f173 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/FreemarkerBatchExportDTO.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.common.model; + +import lombok.Data; + +/** + *

+ * FreemarkerBatchExportDTO + *

+ * + * @author WendyYang + * @since 2023/8/1 + **/ +@Data +public class FreemarkerBatchExportDTO { + + private String fileName; + + private String template; + + private Object data; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/RegionMapKey.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/RegionMapKey.java new file mode 100644 index 0000000..4a979fb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/RegionMapKey.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.common.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.util.Objects; + +/** + *

+ * RegionMapKey + *

+ * + * @author WendyYang + * @since 13:54 2023/3/1 + */ +@Data +@AllArgsConstructor +public class RegionMapKey { + + public static RegionMapKey of(String regionCode, int regionLevel) { + return new RegionMapKey(regionCode, regionLevel); + } + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区级别 + */ + private Integer regionLevel; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RegionMapKey regionMapKey = (RegionMapKey) o; + return regionCode.equals(regionMapKey.getRegionCode()) + && regionLevel.equals(regionMapKey.getRegionLevel()); + } + + @Override + public int hashCode() { + return Objects.hash(regionCode, regionLevel); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ReqRegionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ReqRegionDTO.java new file mode 100644 index 0000000..974ceac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ReqRegionDTO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.common.model; + +import lombok.Data; + +/** + *

+ * ReqRegionDTO + *

+ * + * @author WendyYang + * @since 2023/8/4 + **/ +@Data +public class ReqRegionDTO { + + private String regionCode; + + private Integer regionLevel; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ZwddTokenUser.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ZwddTokenUser.java new file mode 100644 index 0000000..2df8600 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/ZwddTokenUser.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.common.model; + +import lombok.Data; + +@Data +public class ZwddTokenUser { + private Long accountId; + + private String employeeCode; + + private String employeeName; + + private String mobile; + + private Long tenantId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/CountGroupByDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/CountGroupByDTO.java new file mode 100644 index 0000000..cff00c5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/CountGroupByDTO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.common.model.entity; + +import lombok.Data; + +/** + *

+ * CountGroupByDto + *

+ * + * @author WendyYang + * @since 15:44 2022/8/28 + */ +@Data +public class CountGroupByDTO { + + private Integer total; + + private T groupKey; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java new file mode 100644 index 0000000..ced9cbc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.common.model.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.math.BigDecimal; + +/** + *

+ * DataDTO + *

+ * + * @author ZPF + * @since 16:40 2023/12/05 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DataDTO { + + public static DataDTO of(String name,Integer num){ + DataDTO dataDTO = new DataDTO(); + dataDTO.setName(name); + dataDTO.setNum(num); + return dataDTO; + } + + public static DataDTO of(String name,String code,Integer num){ + DataDTO dataDTO = new DataDTO(); + dataDTO.setName(name); + dataDTO.setCode(code); + dataDTO.setNum(num); + return dataDTO; + } + + public static DataDTO of(String name,BigDecimal amount){ + DataDTO dataDTO = new DataDTO(); + dataDTO.setName(name); + dataDTO.setAmount(amount); + return dataDTO; + } + + public static DataDTO of(String name,String code,BigDecimal amount){ + DataDTO dataDTO = new DataDTO(); + dataDTO.setName(name); + dataDTO.setCode(code); + dataDTO.setAmount(amount); + return dataDTO; + } + + public static DataDTO ofRate(String name,BigDecimal rate){ + DataDTO dataDTO = new DataDTO(); + dataDTO.setName(name); + dataDTO.setRate(rate); + return dataDTO; + } + + @ApiModelProperty("编号") + private String code; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("数量") + private Integer num = 0; + + @ApiModelProperty("金额") + private BigDecimal amount = BigDecimal.ZERO; + + @ApiModelProperty("比例") + private BigDecimal rate = BigDecimal.ZERO; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportDTO.java new file mode 100644 index 0000000..1bf8c1f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportDTO.java @@ -0,0 +1,200 @@ +package com.hz.pm.api.common.model.entity; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 待办中心待我处理项目列表导出实体 + * + * @author CMM + * @since 2023/01/19 16:42 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor + +public class ExcelExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("项目ID") + private Long id; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("行政区划编码") + private String areaCode; + + @ExcelProperty("行政区划名称") + private String area; + + @ExcelProperty("项目负责人") + private String responsibleMan; + + @ExcelProperty("项目负责人手机号") + private String responsibleManMobile; + + @ExcelProperty("项目联系人") + private String contactName; + + @ExcelProperty("项目联系人手机号") + private String contactPhone; + + @ExcelProperty("上级业务主管单位") + private String higherSuperOrg; + + @ExcelProperty("上级主管单位浙政钉ID") + private String higherSuperOrgCode; + + @ExcelProperty("本级主管部门") + private String superOrg; + + @ExcelProperty("本级主管部门浙政钉ID") + private String superOrgCode; + + @ExcelProperty("建设单位名称") + private String buildOrgName; + + @ExcelProperty("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ExcelProperty("建设单位统一信用代码") + private String buildOrgCode; + + @ExcelProperty("项目类型") + private Integer projectType; + + @ExcelProperty("是否首次新建") + private Integer isFirst; + + @ExcelProperty("关联应用") + private String relatedExistsApplication; + + @ExcelProperty("关联应用IRS编码") + private String relatedExistsApplicationCode; + + @ExcelProperty("申报金额(万元)") + private BigDecimal declareAmount; + + @ExcelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ExcelProperty("预算来源") + private String budgetSource; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("项目简介") + private String projectIntroduction; + + @ExcelProperty("立项依据") + private String buildBasis; + + @ExcelProperty("建设层级") + private String buildLevel; + + @ExcelProperty("发改编码") + private String developCode; + + @ExcelProperty("财政编码") + private String financialCode; + + @ExcelProperty("信息是否有效") + private Boolean informationValidity; + + @ExcelProperty("是否数字化改革项目") + private Integer isDigitalReform; + + @ExcelProperty("综合应用领域") + private String bizDomain; + + @ExcelProperty("是否上云") + private Integer isCloud; + + @ExcelProperty("云类型") + private String cloudType; + + @ExcelProperty("四大体系") + private Integer fourSystems; + + @ExcelProperty("是否临时增补") + private Integer isTemporaryAugment; + + @ExcelProperty("等保级别") + private Integer protectionLevel; + + @ExcelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ExcelProperty("业务编号") + private String businessNumber; + + @ExcelProperty("业务名称") + private String businessName; + + @ExcelProperty("单位名称") + private String orgName; + + @ExcelProperty("软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ExcelProperty("云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ExcelProperty("第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ExcelProperty("投入项") + private String safetyInputTitle; + + @ExcelProperty("内容描述") + private String safetyInputDescribe; + + @ExcelProperty("金额(万元)") + private BigDecimal safetyInputAmount; + + @ExcelProperty("年度支付金额(万元)") + private BigDecimal annualPlanAmount; + + @ExcelProperty("自有资金(万元)") + private BigDecimal annualPlanHaveAmount; + + @ExcelProperty("政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ExcelProperty("政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ExcelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ExcelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ExcelProperty("第一季度") + private String engineeringSpeedOne; + + @ExcelProperty("第二季度") + private String engineeringSpeedTwo; + + @ExcelProperty("第三季度") + private String engineeringSpeedThree; + + @ExcelProperty("第四季度") + private String engineeringSpeedFour; + + @ExcelProperty("初步方案") + private String preliminaryPlanFile; + + @ExcelProperty("附件-佐证材料") + private String supportingMaterialsFile; + + @ExcelProperty("备注") + private String projectRemarks; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportWriter.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportWriter.java new file mode 100644 index 0000000..aeeb3f5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ExcelExportWriter.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.common.model.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.List; + + +/** + * 文件模板导出对象 + * @author CMM + * @since 2023/02/11 11:26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ExcelExportWriter { + /** + * 文件名称 + */ + private String fileName; + + /** + * sheet 名称数组 + */ + private List sheets; + + /** + * 是否启用 头部Excel属性。 + * 如果使用,则会读取 class对象注解 ExcelProperty 属性值。 + * 不启用:则会根据heads 动态对列名称去便利 + */ + private Boolean headPropertyFlag; + + /** + * 头部属性class + */ + private Class headPropertyClass; + + /** + * 动态列名称 + * 描述: + * 第一个List 代表:sheet 列表集合 + * 第二个List 代表:表体行数据(集合) + * 第三个list 代表:表体列数据(集合) + */ + private List>> heads; + + + /** + * 数据对象 + * 1、对象写:根据对象固定字段写(分为三层) + * 第二个List 代表:表体行数据(集合) + * 第三个对象(class) 对象 + * List + * + * 2、无对象写(动态表体数据) 分为三层 + * 第一个List 代表:表体行数据(集合) + * 第二个list 代表:表体列数据(集合) + * List> + */ + private Collection datas; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/KeyValDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/KeyValDTO.java new file mode 100644 index 0000000..f332138 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/KeyValDTO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.common.model.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * KeyValueDTO + *

+ * + * @author WendyYang + * @since 16:40 2022/8/31 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KeyValDTO { + + private K key; + + private V value; + + public static KeyValDTO of(K k, V v) { + return new KeyValDTO<>(k, v); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java new file mode 100644 index 0000000..2209dab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java @@ -0,0 +1,125 @@ +package com.hz.pm.api.common.model.entity; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * 包括id、create_time、created_by、updated_by、update_time、label、parent_id、sort_value 字段的表继承的树形实体 + * + * @author PoffyZhang + * @since 2022/09/30 + */ +@Getter +@Setter +@Accessors(chain = true) +@ToString(callSuper = true) +public class MenuTreeEntity { + + @TableId(value = "id", type = IdType.AUTO) + protected Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + @TableField(value = "name", condition = LIKE) + protected String name; + + /** + * 菜单标题 + */ + @ApiModelProperty(value = "菜单标题") + @NotEmpty(message = "菜单标题不能为空") + @Size(max = 255, message = "菜单标题长度不能超过255") + @TableField(value = "title", condition = LIKE) + protected String title; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父ID") + @TableField(value = "pid") + protected Long pid; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序号") + @TableField(value = "sort") + protected Integer sort; + + /** + * 顶层菜单 + */ + @ApiModelProperty(value = "顶层菜单") + @TableField(exist = false) + protected String topMenu; + + /** + * 路径 + */ + @ApiModelProperty(value = "路径") + @Size(max = 255, message = "路径长度不能超过255") + @TableField(value = "path", condition = LIKE) + protected String path; + + + @ApiModelProperty(value = "子节点", hidden = true) + @TableField(exist = false) + protected List children; + + + /** + * 层级 + */ + @ApiModelProperty(value = "层级") + @TableField(exist = false) + protected Integer level = 1; + + + /** + * 初始化子类 + */ + @JsonIgnore + public void initChildren() { + if (getChildren() == null) { + this.setChildren(new ArrayList<>()); + } + } + + @JsonIgnore + public void addChildren(E child) { + initChildren(); + children.add(child); + } + + public Integer getSize() { + if (CollUtil.isNotEmpty(getChildren())) { + return getChildren().size(); + } + return 0; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ViewRegionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ViewRegionDTO.java new file mode 100644 index 0000000..ddcdc18 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/ViewRegionDTO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.common.model.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.Collection; + +/** + *

+ * ViewRegionDTO + *

+ * + * @author WendyYang + * @since 2023/4/27 + **/ +@Data +@AllArgsConstructor +public class ViewRegionDTO { + + private Collection regions; + + private Integer regionLevel; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java new file mode 100644 index 0000000..4504921 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java @@ -0,0 +1,277 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.StateContext; +import org.springframework.statemachine.action.Action; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_SBJ_CODE) +public class ProjectDeclareAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java new file mode 100644 index 0000000..e552782 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.common.statemachine.action; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import lombok.extern.slf4j.Slf4j; +import org.springframework.statemachine.StateContext; +import org.springframework.statemachine.action.Action; + +import java.util.List; + +import static com.hz.pm.api.common.constant.StateMachineConst.APPLICATION_DECLARE; + +/** + * 项目申报状态机选择分支action类 + * + * @author CMM + * @since 2023/02/07 22:31 + */ +@Slf4j +public class ProjectDeclareChoiceAction implements Action { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @Override + public void execute(StateContext stateContext) { + log.info(String.valueOf(stateContext.getTarget().getId())); + ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId(); + switch (projectStatusEnum){ + case PENDING_PREQUALIFICATION_CHOICE: + preDeclareChoice(stateContext); + break; + case PREQUALIFICATION_WITHDRAW_CHOICE: + preWithDrawChoice(stateContext); + break; + case APPROVED_AFTER_CHOICE: + approvedAfterChoice(stateContext); + break; + default: + throw new IllegalStateException("Unexpected value: " + projectStatusEnum); + } + } + + private void approvedAfterChoice(StateContext stateContext) { + List projectApplications = stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + log.info("立项批复之后,项目的状态为:{}" + project.getStatus()); + // 判断 是否有初次创建的应用 + if (CollUtil.isEmpty(projectApplications)){ + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + final Boolean[] isFirstApp = {Boolean.FALSE}; + projectApplications.stream().forEach(app -> { + Integer isFirst = app.getIsFirst(); + if(isFirst.equals(CommonEnum.YES.getCode())){ + isFirstApp[0] = Boolean.TRUE; + } + }); + if(isFirstApp[0]){ + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()); + }else{ + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + } + + private void preDeclareChoice(StateContext stateContext) { + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); + }else { + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + } + + private void preWithDrawChoice(StateContext stateContext) { + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + }else { + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java new file mode 100644 index 0000000..51a8dac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java @@ -0,0 +1,280 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 景宁畲族自治县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_JN_CODE) +public class ProjectDeclareJNAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java new file mode 100644 index 0000000..80ceaa4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 缙云县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_JY_CODE) +public class ProjectDeclareJYAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java new file mode 100644 index 0000000..700c654 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 开发区 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_KFQ_CODE) +public class ProjectDeclareKFBAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java new file mode 100644 index 0000000..893144a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 莲都区 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_LD_CODE) +public class ProjectDeclareLDAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java new file mode 100644 index 0000000..653f6c6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * ;龙泉市 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_LQ_CODE) +public class ProjectDeclareLQAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "TO_BE_APPROVED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java new file mode 100644 index 0000000..ea404f1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 青田县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_QT_CODE) +public class ProjectDeclareQTAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java new file mode 100644 index 0000000..9041fd1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 庆元县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_QY_CODE) +public class ProjectDeclareQYAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java new file mode 100644 index 0000000..46265ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 市本级 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_SBJ_CODE) +public class ProjectDeclareSBJAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "TO_BE_FINALLY_INSPECTED") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java new file mode 100644 index 0000000..2d8c554 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java @@ -0,0 +1,287 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 遂昌县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_SC_CODE) +public class ProjectDeclareSCAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "APPROVED_AFTER_CHOICE") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); + } + + @OnTransition(source = "TO_BE_APP_REGISTER", target = "TO_BE_PURCHASED") + public void REGISTER_APP(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java new file mode 100644 index 0000000..70572f2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 松阳县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_SY_CODE) +public class ProjectDeclareSYAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java new file mode 100644 index 0000000..9bf7f07 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java @@ -0,0 +1,280 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 云和县 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = RegionContant.LS_YH_CODE) +public class ProjectDeclareYHAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + + @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()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java new file mode 100644 index 0000000..4f1e268 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.persist.StateMachinePersister; + +/** + * 项目申报状态机 + * + * @author CMM + * @since 2023/02/07 15:56 + */ +public interface ProjectDeclareStateMachineBuilder { + StateMachine build() throws Exception; + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + StateMachine build(BeanFactory beanFactory) throws Exception; + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + StateMachinePersister getProjectPersister(); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java new file mode 100644 index 0000000..1abb32b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java @@ -0,0 +1,284 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 景宁畲族自治县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineJNBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateMachineBuilder{ + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + private Logger logger = LoggerFactory.getLogger(getClass()); + + private StateMachinePersister stateMachinePersister; + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_JN_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineJNPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_JN_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java new file mode 100644 index 0000000..b1e0b2b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 缙云县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineJYBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + private Logger logger = LoggerFactory.getLogger(getClass()); + + private StateMachinePersister stateMachinePersister; + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_JY_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineJYPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_JY_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java new file mode 100644 index 0000000..94fa453 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 开发区 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineKFQBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + private Logger logger = LoggerFactory.getLogger(getClass()); + + private StateMachinePersister stateMachinePersister; + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_KFQ_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineKFQPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_KFQ_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java new file mode 100644 index 0000000..a4fe433 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 莲都区 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineLDBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_LD_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineLDPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_LD_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java new file mode 100644 index 0000000..c8604df --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java @@ -0,0 +1,286 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 龙泉市 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineLQBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_LQ_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + + // 年度计划中开启方案申报,从年度计划中到立项批复 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineLQPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_LQ_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java new file mode 100644 index 0000000..bbd5fb5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 青田县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineQTBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_QT_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineQTPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_QT_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java new file mode 100644 index 0000000..932f5bc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 庆元县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineQYBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_QY_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineQYPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_QY_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java new file mode 100644 index 0000000..949b596 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 市本级 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineSBJBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_SBJ_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineSBJPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_SBJ_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java new file mode 100644 index 0000000..ff29abb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java @@ -0,0 +1,295 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 遂昌县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineSCBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateMachineBuilder{ + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_SC_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .choice(ProjectStatusEnum.APPROVED_AFTER_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.APPROVED_AFTER_CHOICE) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + .withChoice() + .source(ProjectStatusEnum.APPROVED_AFTER_CHOICE) + .first(ProjectStatusEnum.TO_BE_APP_REGISTER,projectDeclareGuardFactory.new ApprovedAfterChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.TO_BE_PURCHASED,new ProjectDeclareChoiceAction()).and() + //待所有应用都注册 并且 绑定了关系后 再进入下一状态 待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APP_REGISTER) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.REGISTER_APP).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineSCPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_SC_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java new file mode 100644 index 0000000..474e47b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 松阳县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineSYBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_SY_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineSYPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_SY_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java new file mode 100644 index 0000000..6170a0a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java @@ -0,0 +1,285 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 云和县 + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@EnableStateMachine(name= ProjectDeclareStateMachineYHBuilder.MACHINEID_TO) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateMachineBuilder { + private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + private StateMachinePersister stateMachinePersister; + private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * TO状态机 + */ + public final static String MACHINEID_TO = RegionContant.LS_YH_CODE; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + logger.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + /** + * 构建状态机 + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINEID_TO) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() + ,new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .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) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStateMachineYHPersister") + @Override + public StateMachinePersister getProjectPersister() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + } + + @Override + public StateMachineContext read(Project contextObj) { + StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null, RegionContant.LS_YH_CODE); + return result; + } + }); + stateMachinePersister = sp; + return sp; + } + + public StateMachinePersister getStateMachinePersister(){ + return stateMachinePersister; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contants/RegionContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contants/RegionContant.java new file mode 100644 index 0000000..6614aa5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contants/RegionContant.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.common.statemachine.contants; + +/** + * @Classname RegionContant + * @Description + * @Date 2023/6/13 13:57 + * @Author PoffyZhang + */ +public class RegionContant { + //市本级 + public static final String LS_SBJ_CODE = "331100"; + //莲都区 + public static final String LS_LD_CODE = "331102"; + //青田县 + public static final String LS_QT_CODE = "331121"; + //缙云县 + public static final String LS_JY_CODE = "331122"; + //遂昌县 + public static final String LS_SC_CODE = "331123"; + //松阳县 + public static final String LS_SY_CODE = "331124"; + //云和县 + public static final String LS_YH_CODE = "331125"; + //庆元县 + public static final String LS_QY_CODE = "331126"; + //景宁畲族自治县 + public static final String LS_JN_CODE = "331127"; + //龙泉市 + public static final String LS_LQ_CODE = "331181"; + //开发区 + public static final String LS_KFQ_CODE = "331199"; + + public static final String MORE_CODE = "000"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStatusChangeEvent.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStatusChangeEvent.java new file mode 100644 index 0000000..45db507 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStatusChangeEvent.java @@ -0,0 +1,211 @@ +package com.hz.pm.api.common.statemachine.event; + +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Objects; + +/** + * 项目状态改变事件 + * + * @author CMM + * @return + * @since 2023/02/07 9:22 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectStatusChangeEvent { + + /** + * 项目申报暂存(项目状态进入:待申报) + */ + PROJECT_APPLICATION_HOLD(null, null, null), + /** + * 项目申报提交(项目状态进入:单位内部审核中) + */ + PROJECT_APPLICATION_SUBMIT( ProjectStatusEnum.TO_BE_DECLARED.getCode(), null, null), + /** + * 单位内部审核驳回(项目状态进入:单位内部审核不通过) + */ + UNDER_INTERNAL_REJECT(null, ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode(), null), + /** + * 单位内部审核通过(项目状态进入:待预审) + */ + UNDER_INTERNAL_PASS(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode(), null, null), + /** + * 单位内部审核不通过重新提交(项目状态进入:单位内部审核中) + */ + UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),null,null), + + /** + * 预审申报(项目状态进入:待预审选择,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审中;否则项目状态变为:预审中) + */ + PRELIMINARY_REVIEW_DECLARE(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), null, null), + /** + * 省级部门联审不通过(项目状态变为:省级部门联审不通过) + */ + PROVINCIAL_DEPARTMENT_REVIEW_REJECT(null, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null), + /** + * 省级部门联审通过(项目状态变为:省级联审成功) + */ + PROVINCIAL_DEPARTMENT_REVIEW_PASS(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null, null), + + /** + * 去到预审(项目状态变为:预审中) + */ + PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode(), null, null), + /** + * 预审驳回(项目状态变为:预审不通过) + */ + PRELIMINARY_REVIEW_REJECT(null, ProjectStatusEnum.PRE_APPLYING.getCode(), null), + /** + * 预审不通过重新提交(项目状态变为:待预审选择) + */ + PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),null,null), + /** + * 预审通过(项目状态变为:部门联审中) + */ + PRELIMINARY_REVIEW_PASS(ProjectStatusEnum.PRE_APPLYING.getCode(), null, null), + /** + * 部门联审驳回(项目状态变为:部门联审不通过) + */ + DEPARTMENT_UNITED_REVIEW_REJECT(null, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), null), + /** + * 部门联审通过(项目状态变为:年度计划中) + */ + DEPARTMENT_UNITED_REVIEW_PASS(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), null, null), + /** + * 年度计划暂缓(项目状态变为:被暂缓) + */ + ANNUAL_PLAN_SUSPEND(null, ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode(), null), + /** + * 年度计划项目开启方案申报(项目状态变为:方案待申报) + */ + ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode(), null, null), + /** + * 申报方案(项目状态变为:方案评审中) + */ + DECLARE_PLAN( ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(), null, null), + /** + * 方案评审驳回(项目状态变为:方案评审不通过) + */ + PLAN_REVIEW_REJECT(null, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null), + /** + * 方案评审不通过重新提交(项目状态变为:方案评审中) + */ + PLAN_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(),null,null), + /** + * 方案评审通过(项目状态变为:待立项批复) + */ + PLAN_REVIEW_PASS(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null, null), + /** + * 立项批复(项目状态变为:已立项-待采购) + */ + PROJECT_APPROVAL(ProjectStatusEnum.TO_BE_APPROVED.getCode(), null, null), + + /** + * 注册应用 + */ + REGISTER_APP(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode(), null, null), + /** + * 采购备案(项目状态变为:待开工) + */ + PURCHASE_PUT_ON_RECORD(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), null, null), + + /** + * 开工 到建设中 + */ + START_TO_WORK(ProjectStatusEnum.OPERATION.getCode(), null,null), + /** + * 初验备案(项目状态变为:待终验) + */ + PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(), null, null), + /** + * 终验申请(项目状态变为:终验审核中) + */ + FINAL_ACCEPTANCE_APPLICATION(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(), null, null), + /** + * 终验审核不通过(项目状态变为:终验审核不通过) + */ + FINAL_ACCEPTANCE_REJECT(null, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode(), null), + /** + * 终验审核通过(项目状态变为:已归档) + */ + FINAL_ACCEPTANCE_PASS(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode(), null, null), + + // 下个节点还未提交审核意见时,流程发起人和前一个审核人可以点击撤回 + + /** + * 单位内部审核中时被撤回(项目状态进入:待申报) + */ + UNDER_INTERNAL_WITHDRAW(null, null, ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()), + /** + * 省级部门联审中时被撤回(项目状态进入:待预审) + */ + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(null, null, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()), + /** + * 预审中时被撤回(项目状态进入:待预审选择,,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审通过;否则项目状态变为:待预审) + */ + PRE_APPLYING_WITHDRAW(null, null, ProjectStatusEnum.PRE_APPLYING.getCode()), + /** + * 部门联审中时被撤回(项目状态进入:预审中) + */ + DEPARTMENT_JOINT_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()), + /** + * 方案评审中时被撤回(项目状态进入:方案待申报) + */ + SCHEME_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()), + /** + * 终验审核中时被撤回(项目状态进入:待终验) + */ + FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()), + + /** + * 重新提交 终验 + */ + FINAL_RE_ACCEPTANCE_APPLICATION(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), null, null); + + + private Integer passProjectStatusCode; + private Integer rejectProjectStatusCode; + private Integer withdrawProjectStatusCode; + + public static ProjectStatusChangeEvent getPassValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { + if (code.equals(t.getPassProjectStatusCode())) { + return t; + } + } + return null; + } + + public static ProjectStatusChangeEvent getRejectValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { + if (code.equals(t.getRejectProjectStatusCode())) { + return t; + } + } + return null; + } + + public static ProjectStatusChangeEvent getWithdrawValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { + if (code.equals(t.getWithdrawProjectStatusCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java new file mode 100644 index 0000000..7a8521b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.common.statemachine.factory; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import org.springframework.statemachine.StateContext; +import org.springframework.statemachine.guard.Guard; + +import java.util.List; + +import static com.hz.pm.api.common.constant.StateMachineConst.APPLICATION_DECLARE; + +/** + * 项目申报状态机guard集合类 + * + * @author CMM + * @since 2023/02/07 16:18 + */ + +public class ProjectDeclareGuardFactory { + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + public class PendingPreQualificationChoiceGuard implements Guard { + @Override + public boolean evaluate(StateContext context) { + Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + return true; + } + return false; + } + } + + public class ApprovedAfterChoiceGuard implements Guard { + @Override + public boolean evaluate(StateContext context) { + List projectApplications = context.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); + final Boolean[] res = {Boolean.FALSE}; + // 判断 是否有初次创建的应用 + if (CollUtil.isEmpty(projectApplications)){ + return res[0]; + } + projectApplications.stream().forEach(app -> { + Integer isFirst = app.getIsFirst(); + if(isFirst.equals(CommonEnum.YES.getCode())){ + res[0] = Boolean.TRUE; + } + }); + return res[0]; + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java new file mode 100644 index 0000000..1f07d16 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.common.statemachine.util; + +import com.google.common.collect.Maps; +import com.hz.pm.api.common.statemachine.builder.*; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.Map; + +/** + * 项目申报状态机 + * + * @author CMM + * @since 2023/02/07 15:56 + */ +@Component +@Slf4j +public class MachineBuilderFounder { + + public final static Map machineBuilderMap = + Maps.newConcurrentMap(); + + @Autowired + private ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; + + @Autowired + private ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; + + @Autowired + private ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; + + @Autowired + private ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; + + @Autowired + private ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; + + @Autowired + private ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; + + @Autowired + private ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; + + @Autowired + private ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; + + @Autowired + private ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; + + @Autowired + private ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; + + @Autowired + private ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; + + @PostConstruct + public void MachineBuilderFounder(){ + machineBuilderMap.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); + machineBuilderMap.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); + machineBuilderMap.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); + machineBuilderMap.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); + machineBuilderMap.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); + machineBuilderMap.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); + machineBuilderMap.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); + machineBuilderMap.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); + machineBuilderMap.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); + machineBuilderMap.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); + machineBuilderMap.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java new file mode 100644 index 0000000..06dffc2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java @@ -0,0 +1,164 @@ +package com.hz.pm.api.common.statemachine.util; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 状态机工具类 + * + * @author CMM + * @since 2023/02/07 22:49 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class StateMachineUtils { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; + + private final INdProjectStatusChangeService projectStatusChangeService; + + private final IProjectApplicationService projectApplicationService; + + //通过审核 + public void pass(Project project) { + try{ + execute(project,getProjectStatusPassEvent(project.getStatus())); + }catch (Exception e){ + log.info("状态机 通过失败 :{}",e.getMessage()); + throw new BusinessException("状态机 通过失败: " + e); + } + } + + //拒绝 + public void reject(Project project) { + try{ + execute(project,getProjectStatusRejectEvent(project.getStatus())); + }catch (Exception e){ + log.info("状态机 拒绝失败 :{}",e.getMessage()); + throw new BusinessException("状态机 拒绝失败: " + e); + } + } + + //撤回 + public void withDraw(Project project) { + try{ + execute(project,getProjectStatusWithdrawEvent(project.getStatus())); + }catch (Exception e){ + log.info("状态机 撤回失败 :{}",e.getMessage()); + throw new BusinessException("状态机 撤回失败: " + e); + } + } + + public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { + log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); + // 将状态变更记录保存到项目状态变更表中 + ProjectStatusChange projectStatusChange = new ProjectStatusChange(); + projectStatusChange.setBeforeStatus(project.getStatus()); + + ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.machineBuilderMap.get(project.getAreaCode()); + + VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); + //获取TO状态机 + StateMachine stateMachine = builder.build(); + Message message = MessageBuilder.withPayload(event) + .setHeader(PROJECT_DECLARE, project) + .setHeader(APPLICATION_DECLARE,projectApplicationService.getApplicationsByProject(project)) + .build(); + //初始化状态机 + StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); + projectDeclareStateMachinePersister.restore(stateMachine, project); + stateMachine.sendEvent(message); + projectStatusChange.setProjectId(project.getId()); + projectStatusChange.setAfterStatus(project.getStatus()); + projectStatusChange.setEvent(event.name()); + projectStatusChange.setCreateOn(LocalDateTime.now()); + projectStatusChange.setProjectCode(project.getProjectCode()); + // 插入项目状态变更表中 + projectStatusChangeService.save(projectStatusChange); + log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); + } + + /** + * 判断项目申报金额是否大于1000万元 + * + * @param project + * @return boolean + * @author CMM + * @since 2023/02/07 17:13 + */ + public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { + int flag = project.getDeclareAmount().compareTo(targetAmount); + if (flag > 0 || flag == 0) { + return true; + } + return false; + } + + /** + * 判断申报项目是否为市级项目 + * + * @param project + * @return boolean + * @author CMM + * @since 2023/02/07 17:05 + */ + public static boolean isCityProject(Project project) { + String areaCode = project.getAreaCode(); + if (areaCode.equals(RegionConst.RC_LS)) { + return true; + } + return false; + } + + public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的通过操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的驳回操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的撤回操作!"); + } + return event; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java new file mode 100644 index 0000000..78e014c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java @@ -0,0 +1,176 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.file.entity.vo.result.FileResultVO; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.NumberUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static java.util.stream.Collectors.toList; + +/** + *

+ * BizUtils + *

+ * + * @author WendyYang + * @since 17:32 2023/1/29 + */ +public class BizUtils { + + private BizUtils() { + + } + + public static > void notEmpty(T objs, Consumer consumer) { + if (objs != null && !objs.isEmpty()) { + consumer.accept(objs); + } + } + + public static List splitToNum(String str, Class aClass) { + if (StrUtil.isEmpty(str)) { + return Collections.emptyList(); + } + return Arrays.stream(str.split(StrPool.COMMA)) + .map(w -> NumberUtils.parseNumber(w, aClass)) + .collect(Collectors.toList()); + } + + public static List splitToLong(String str) { + return splitToNum(str, Long.class); + } + + + public static void notNull(T obj, Consumer consumer) { + if (obj != null) { + consumer.accept(obj); + } + } + + public static void notBlank(String str, Consumer consumer) { + if (StrUtil.isNotBlank(str)) { + consumer.accept(str); + } + } + + public static boolean getJSONType(String str) { + boolean result = false; + if (StringUtils.isNotBlank(str)) { + str = str.trim(); + if (str.startsWith("{") && str.endsWith("}")) { + result = true; + } else if (str.startsWith("[") && str.endsWith("]")) { + result = true; + } + } + return result; + } + + public static String uuid32() { + return UUID.randomUUID().toString().replace("-", ""); + } + + /** + * 对象分组取第一条 + * + * @param objs 对象集合 + * @param group 分组函数 + * @param comparator 比较器 + * @return java.util.Collection + * @author WendyYang + **/ + public static Collection groupFirst(Collection objs, Function group, Comparator comparator) { + return groupFirstMap(objs, group, comparator).values(); + } + + /** + * 对象分组取第一条 + * + * @param objs 对象集合 + * @param group 分组函数 + * @param comparator 比较器 + * @return java.util.Collection + * @author WendyYang + **/ + public static Map groupFirstMap(Collection objs, Function group, Comparator comparator) { + return objs.stream().collect(Collectors.groupingBy(group, + Collectors.collectingAndThen(toList(), w -> { + w.sort(comparator); + return w.get(0); + }))); + } + + public static String inSqlJoin(List strings) { + return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); + } + + public static String getProjectTypeName(String projectType) { + if (Objects.nonNull(projectType)) { + return ProjectTypeNewEnum.getDesc(projectType); + } + return StringUtils.EMPTY; + } + + public static LocalDateTime convertDate(Date date) { + if (Objects.nonNull(date)) { + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + } + return null; + } + + public static String computeRise(Integer numa, Integer numb) { + if((Objects.isNull(numb)|| numb.equals(0)) && + (Objects.isNull(numa)|| numa.equals(0))){ + return "0"; + } + if(Objects.isNull(numa) || numa.equals(0)){ + return "-100"; + } + if(Objects.isNull(numb)|| numb.equals(0)){ + return "100"; + } + return BigDecimal.valueOf((numa - numb) * 100.0).divide(BigDecimal.valueOf(numb),2, RoundingMode.CEILING) + .stripTrailingZeros().toPlainString(); + } + + public static String buildFileJson(FileResultVO resultVo) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(resultVo); + return JSON.toJSONString(jsonArray); + } + + public static LocalDateTime convertLocalDateTime(String time) { + if(StringUtils.isBlank(time)){ + return null; + } + String[] timeSplit = time.split(StrPool.DASH); + String year = timeSplit[0]; + String month = "01"; + String dayOfMonth = "01"; + if(timeSplit.length > 1){ + month = timeSplit[1]; + } + if(timeSplit.length > 2){ + dayOfMonth = timeSplit[2]; + } + return LocalDateTime.of(Integer.parseInt(year), + Integer.parseInt(month), + Integer.parseInt(dayOfMonth) + ,0,0,0); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CallBack.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CallBack.java new file mode 100644 index 0000000..dfc6837 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CallBack.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.common.util; + +/** + * @author qinxianyun + * @see {@link SpringContextHolder} + * 针对某些初始化方法,在SpringContextHolder 初始化前时,
+ * 可提交一个 提交回调任务。
+ * 在SpringContextHolder 初始化后,进行回调使用 + */ + +public interface CallBack { + /** + * 回调执行方法 + */ + void executor(); + + /** + * 本回调任务名称 + * @return / + */ + default String getCallBackName() { + return Thread.currentThread().getId() + ":" + this.getClass().getName(); + } +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CodeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CodeUtil.java new file mode 100644 index 0000000..f254bff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CodeUtil.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.common.util; + +import com.ningdatech.basic.util.StrPool; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.stream.Collectors; + +/** + * @Classname CodeUtil + * @Description + * @Date 2023/6/20 16:06 + * @Author PoffyZhang + */ +@Slf4j +public class CodeUtil { + + public static Collection convertStrToList(String str) { + if(StringUtils.isBlank(str)){ + return Collections.emptyList(); + } + return Arrays.stream(str.split(StrPool.COMMA)).collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CommonInputStreamResource.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CommonInputStreamResource.java new file mode 100644 index 0000000..30e9361 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CommonInputStreamResource.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.common.util; + +import org.springframework.core.io.InputStreamResource; + +import java.io.InputStream; + +public class CommonInputStreamResource extends InputStreamResource { + /*** + * 文件長度 + */ + private int length; + /*** + * 文件名稱 + */ + private String fileName; + public CommonInputStreamResource(InputStream inputStream) { + super(inputStream); + } + public CommonInputStreamResource(InputStream inputStream, int length,String fileName) { + super(inputStream); + this.length = length; + this.fileName = fileName; + } + /** + * 覆写父类方法 + * 如果不重写这个方法,并且文件有一定大小,那么服务端会出现异常 + * {@code The multi-part request contained parameter data (excluding uploaded files) that exceeded} + * + * @return + */ + @Override + public String getFilename() { + return this.fileName; + } + /** + * 覆写父类 contentLength 方法 + * 因为 {@link org.springframework.core.io.AbstractResource#contentLength()}方法会重新读取一遍文件, + * 而上传文件时,restTemplate 会通过这个方法获取大小。然后当真正需要读取内容的时候,发现已经读完,会报如下错误。 + * + * java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times + * at org.springframework.core.io.InputStreamResource.getInputStream(InputStreamResource.java:96) + * + *

+ * ref:com.amazonaws.services.s3.model.S3ObjectInputStream#available() + * + * @return + */ + @Override + public long contentLength() { + int estimate = length; + return estimate == 0 ? 1 : estimate; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CryptUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CryptUtils.java new file mode 100644 index 0000000..5691b70 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/CryptUtils.java @@ -0,0 +1,85 @@ +package com.hz.pm.api.common.util; + +import org.apache.commons.codec.binary.Hex; + +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * 加密工具 + * @author hank + */ +public class CryptUtils { + + /** + * 默认的算法 + */ + private static final String DE_KEY_MAC = "HmacMD5"; + + /** + * 默认的字符集 + */ + private static final Charset DE_CHARSET = StandardCharsets.UTF_8; + + + /** + * 使用默认的算法(HmacMD5) 得到hmac 16进制字符串 + * @param inputStr 需要加密的串 + * @param key key + * @return 16进制字符串 + * @throws Exception + */ + public static String encryptHMAC(String inputStr, String key) throws Exception { + return encryptHMAC(inputStr, key, DE_KEY_MAC); + } + /** + * 使用指定的算法得到hmac 16进制字符串 + * @param inputStr 需要加密的串 + * @param key key + * @param keyMac hmac算法 + * @return 16进制字符串 + * @throws Exception + */ + public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception { + return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac)); + } + + public static String MD5Encode(String origin) throws NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET))); + } + + private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception { + + SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac); + Mac mac = Mac.getInstance(secretKey.getAlgorithm()); + mac.init(secretKey); + return mac.doFinal(data); + } + + /** + * 生成HMAC-MD5值 + * @param data 消息数据 + * @param key 密钥 + * @return HMAC-MD5值 + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + */ + public static byte[] hmacMd5(byte[] data, byte[] key) + throws NoSuchAlgorithmException, InvalidKeyException { + SecretKeySpec signingKey = new SecretKeySpec(key, "HmacMD5"); + Mac mac = Mac.getInstance("HmacMD5"); + mac.init(signingKey); + return mac.doFinal(data); + } + + public static void main(String[] args) throws Exception{ + System.out.println("HMACStr:\n" + encryptHMAC("a", "hank")); + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DictUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DictUtils.java new file mode 100644 index 0000000..4bc4d3f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DictUtils.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; + +import java.util.Comparator; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午2:14 + */ + +public class DictUtils { + + public static Boolean isValueEquals(List list1, List list2) { + if (CollUtil.isEmpty(list1) && CollUtil.isEmpty(list2)) { + return true; + } + boolean collectionStatusNotEquals = (CollUtil.isEmpty(list1) && CollUtil.isNotEmpty(list2)) + || (CollUtil.isEmpty(list2) && CollUtil.isNotEmpty(list1)); + if (collectionStatusNotEquals) { + return false; + } + if (list1.size() != list2.size()) { + return false; + } + list1.sort(Comparator.comparing(DictionaryFieldInfo::getDictionaryFieldName).thenComparing(DictionaryFieldInfo::getDictionaryCode)); + list2.sort(Comparator.comparing(DictionaryFieldInfo::getDictionaryFieldName).thenComparing(DictionaryFieldInfo::getDictionaryCode)); + + for (int i = 0; i < list1.size(); i++) { + if (!StrUtils.trimEquals(list1.get(i).getDictionaryFieldName(), list2.get(i).getDictionaryFieldName()) + || !StrUtils.trimEquals(list1.get(i).getDictionaryCode(), list2.get(i).getDictionaryCode())) { + return false; + } + } + return true; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelDownUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelDownUtil.java new file mode 100644 index 0000000..c7eb28d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelDownUtil.java @@ -0,0 +1,247 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.enumeration.ExportOptionEnum; +import com.hz.pm.api.common.model.entity.ExcelExportWriter; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.wflow.workflow.bean.vo.ProcessInstanceVo; +import com.wflow.workflow.bean.vo.ProcessTaskVo; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.http.HttpStatus; + +import javax.servlet.http.HttpServletResponse; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.*; +import java.util.function.BiConsumer; + +/** + *

+ * ExcelDownUtil + *

+ * + * @author WendyYang + * @since 00:48 2022/11/5 + */ +@Slf4j +public class ExcelDownUtil { + + public static Map convertMap = Maps.newHashMap(); + + static { + convertMap.put("buildBasis","baseBasisEstablish"); + } + + public static String encodeName(String name) { + String fileName; + try { + fileName = URLEncoder.encode(name, "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error("文件名编码异常:", e); + fileName = UUID.randomUUID().toString().replace("-", ""); + } + return fileName; + } + + @SneakyThrows + private static void down(HttpServletResponse response, T param, BiConsumer consumer) { + response.setCharacterEncoding("utf-8"); + try { + consumer.accept(response, param); + } catch (Exception e) { + log.error("文件导出失败:", e); + response.reset(); + response.setContentType(StrPool.CONTENT_TYPE); + ApiResponse res = ApiResponse.of(HttpStatus.SC_BAD_REQUEST, "导出失败", null); + response.setStatus(HttpStatus.SC_BAD_REQUEST); + response.getWriter().println(JSON.toJSONString(res)); + } + } + + public static void downXls(HttpServletResponse response, T param, BiConsumer consumer) { + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + down(response, param, consumer); + } + + public static void downXlsx(HttpServletResponse response, T param, BiConsumer consumer) { + response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE); + down(response, param, consumer); + } + + public static void setFileName(String fileName, HttpServletResponse response) { + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); + } + + public static void excelExportFile(HttpServletResponse response, ExcelExportWriter excelExport) { + try { + if (Objects.isNull(excelExport)) { + throw new BizException("导出失败!"); + } + setExportResponseHeader(excelExport.getFileName(), response); + + ExcelWriter writer; + //是否启用头部属性、头部属性类不能为空 + if (Objects.nonNull(excelExport.getHeadPropertyFlag()) && excelExport.getHeadPropertyFlag() && Objects.nonNull(excelExport.getHeadPropertyClass())) { + writer = EasyExcel.write(response.getOutputStream(), excelExport.getHeadPropertyClass()).build(); + } else { + writer = EasyExcel.write(response.getOutputStream()).build(); + } + int sheetNum = 0; + if (CollectionUtils.isNotEmpty(excelExport.getSheets())) { + sheetNum = excelExport.getSheets().size(); + } else if (CollectionUtils.isNotEmpty(excelExport.getHeads())) { + sheetNum = excelExport.getHeads().size(); + } else if (CollectionUtils.isNotEmpty(excelExport.getDatas())) { + sheetNum = excelExport.getDatas().size(); + } + + if (sheetNum == 0) { + sheetNum = 1; + } + + for (int i = 0; i < sheetNum; i++) { + WriteSheet sheet = EasyExcel.writerSheet(i).automaticMergeHead(false).build(); + if (CollectionUtils.isNotEmpty(excelExport.getSheets())) { + sheet.setSheetName(excelExport.getSheets().get(i)); + } + if (CollectionUtils.isNotEmpty(excelExport.getHeads())) { + sheet.setHead(excelExport.getHeads().get(i)); + } + + if (CollectionUtils.isNotEmpty(excelExport.getDatas())) { + writer.write((Collection) ((List) excelExport.getDatas()).get(i), sheet); + } else { + writer.write((Collection) null, sheet); + } + } + // 最后 finish + writer.finish(); + writer.close(); + } catch (Exception e) { + log.error("export file error!", e); + throw new BizException("导出失败!"); + } + } + + public static void setExportResponseHeader(String fileName, HttpServletResponse response) throws UnsupportedEncodingException { + // 设置响应头和保存文件名 + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); + } + + public static List> getTaskExportDatas(List columnList, List taskVoList, Map projectInfoMap) { + + // 表体行数据集合 + List> rowList = Lists.newArrayList(); + for (ExportOptionEnum column : columnList) { + List columnValues = Lists.newArrayList(); + columnValues.add(column.getDesc()); + taskVoList.forEach(taskVo -> { + Project project = projectInfoMap.get(taskVo.getInstanceId()); + String s = JSON.toJSONString(project); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue; + if (column.name().equals(ExportOptionEnum.processStatusName.name())) { + columnValue = taskVo.getStatus(); + } else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())) { + columnValue = NdDateUtils.format(taskVo.getCreateTime(), "yyyy-MM-dd HH:mm"); + } else if (column.name().equals(ExportOptionEnum.processHandleTime.name())) { + columnValue = NdDateUtils.format(taskVo.getTaskEndTime(), "yyyy-MM-dd HH:mm"); + } else { + columnValue = String.valueOf(jsonObject.get(column.toString())); + } + columnValues.add(columnValue); + }); + rowList.add(columnValues); + } + return rowList; + } + + + public static List> getInstExportDatas(List columnList, List instanceVoList, Map projectInfoMap) { + + // 表体行数据集合 + List> rowList = Lists.newArrayList(); + for (ExportOptionEnum column : columnList) { + List columnValues = Lists.newArrayList(); + columnValues.add(column.getDesc()); + instanceVoList.forEach(instanceVo -> { + Project project = projectInfoMap.get(instanceVo.getInstanceId()); + String s = JSON.toJSONString(project); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue; + if (column.name().equals(ExportOptionEnum.processStatusName.name())) { + columnValue = instanceVo.getStatus(); + } else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())) { + columnValue = NdDateUtils.format(instanceVo.getStartTime(), "yyyy-MM-dd HH:mm"); + } else { + columnValue = String.valueOf(jsonObject.get(column.toString())); + } + columnValues.add(columnValue); + }); + rowList.add(columnValues); + } + return rowList; + } + + + public static List> getProjectExportDatas(List columnList, List projects) { + + // 表体行数据集合 + List> rowList = Lists.newArrayList(); + for (ExportOptionEnum column : columnList) { + List columnValues = Lists.newArrayList(); + if(Objects.isNull(column)){ + continue; + } + String desc = column.getDesc(); + if (Objects.nonNull(desc)) { + columnValues.add(desc); + } + projects.forEach(project -> { + String s = JSON.toJSONString(project); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue; + if (ExportOptionEnum.preliminaryPlanFile.equals(column) + || ExportOptionEnum.supportingMaterialsFile.equals(column)) { + String fileStr = jsonObject.getString(column.toString()); + if (Objects.isNull(fileStr) || CommonConst.NULL.equals(fileStr)) { + return; + } + List fileArray = JSON.parseArray(fileStr, JSONObject.class); + List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.FILE_NAME)); + columnValue = String.join(StrPool.COMMA, nameList); + } else { + //强转列 + if(convertMap.containsKey(column.toString())){ + columnValue = jsonObject.getString(convertMap.get(column.toString())); + }else{ + columnValue = jsonObject.getString(column.toString()); + } + } + if (Objects.isNull(columnValue) || CommonConst.NULL.equals(columnValue)) { + columnValue = ""; + } + columnValues.add(columnValue); + }); + rowList.add(columnValues); + } + return rowList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelExportStyle.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelExportStyle.java new file mode 100644 index 0000000..3b4b089 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExcelExportStyle.java @@ -0,0 +1,80 @@ +package com.hz.pm.api.common.util; + +import org.apache.poi.ss.usermodel.*; + +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.metadata.style.WriteFont; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; + +/** + *

+ * ExcelExportStyle + *

+ * + * @author WendyYang + * @since 01:39 2022/11/5 + */ +public class ExcelExportStyle { + + public static HorizontalCellStyleStrategy formalStyle() { + // 表头样式策略 + WriteCellStyle headStyle = new WriteCellStyle(); + // 是否换行 + headStyle.setWrapped(false); + // 水平对齐方式 + headStyle.setHorizontalAlignment(HorizontalAlignment.LEFT); + // 垂直对齐方式 + headStyle.setVerticalAlignment(VerticalAlignment.CENTER); + // 前景色 + headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + // 背景色 + headStyle.setFillBackgroundColor(IndexedColors.AUTOMATIC.getIndex()); + + // 设置为1时,单元格将被前景色填充 + headStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); + // 控制单元格是否应自动调整大小以适应文本过长时的大小 + headStyle.setShrinkToFit(false); + // 单元格边框类型 + headStyle.setBorderBottom(BorderStyle.NONE); + headStyle.setBorderLeft(BorderStyle.NONE); + headStyle.setBorderRight(BorderStyle.NONE); + headStyle.setBorderTop(BorderStyle.NONE); + // 单元格边框颜色 + headStyle.setLeftBorderColor(IndexedColors.BLACK.index); + headStyle.setRightBorderColor(IndexedColors.BLACK.index); + headStyle.setTopBorderColor(IndexedColors.BLACK.index); + headStyle.setBottomBorderColor(IndexedColors.BLACK.index); + // 字体策略 + WriteFont writeFont = new WriteFont(); + // 是否加粗/黑体 + writeFont.setBold(false); + // 字体颜色 + writeFont.setColor(Font.COLOR_NORMAL); + // 字体名称 + writeFont.setFontName("宋体"); + // 字体大小 + writeFont.setFontHeightInPoints((short) 11); + // 是否使用斜体 + writeFont.setItalic(false); + // 是否在文本中使用横线删除 + writeFont.setStrikeout(false); + // 设置要使用的文本下划线的类型 + writeFont.setUnderline(Font.U_NONE); + // 设置要使用的字符集 + writeFont.setCharset((int) Font.DEFAULT_CHARSET); + headStyle.setWriteFont(writeFont); + + // 内容样式策略策略 + WriteCellStyle contentStyle = new WriteCellStyle(); + contentStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); + contentStyle.setHorizontalAlignment(HorizontalAlignment.GENERAL); + contentStyle.setBorderBottom(BorderStyle.NONE); + contentStyle.setBorderLeft(BorderStyle.NONE); + contentStyle.setBorderRight(BorderStyle.NONE); + contentStyle.setBorderTop(BorderStyle.NONE); + contentStyle.setFillPatternType(FillPatternType.NO_FILL); + contentStyle.setWrapped(false); + return new HorizontalCellStyleStrategy(headStyle, contentStyle); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtils.java new file mode 100644 index 0000000..97923ec --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtils.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.common.util; + +import com.hz.pm.api.common.model.ExpertRegionModifyDiffBO; +import com.hz.pm.api.expert.model.RegionDtoMapKey; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/28 下午4:33 + */ + +public class ExpertRegionInfoUtils { + + public static ExpertRegionModifyDiffBO modifyDiff(List beforeList, List afterList) { + ExpertRegionModifyDiffBO expertRegionModifyDiffBO = new ExpertRegionModifyDiffBO(); + List addList = new ArrayList<>(); + List removeList = new ArrayList<>(); + if (CollectionUtils.isEmpty(beforeList) && CollectionUtils.isEmpty(afterList)) { + expertRegionModifyDiffBO.setAddList(addList); + expertRegionModifyDiffBO.setRemoveList(removeList); + return expertRegionModifyDiffBO; + } else if (CollectionUtils.isEmpty(beforeList)) { + expertRegionModifyDiffBO.setAddList(afterList); + expertRegionModifyDiffBO.setRemoveList(removeList); + return expertRegionModifyDiffBO; + } else if (CollectionUtils.isEmpty(afterList)) { + expertRegionModifyDiffBO.setAddList(addList); + expertRegionModifyDiffBO.setRemoveList(beforeList); + return expertRegionModifyDiffBO; + } + + List beforeRegionDtoMapKeyList = beforeList.stream().map(r -> { + RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); + regionDtoMapKey.setRegionLevel(r.getRegionLevel()); + regionDtoMapKey.setRegionCode(r.getRegionCode()); + return regionDtoMapKey; + }).collect(Collectors.toList()); + + List afterRegionDtoMapKeyList = afterList.stream().map(r -> { + RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); + regionDtoMapKey.setRegionLevel(r.getRegionLevel()); + regionDtoMapKey.setRegionCode(r.getRegionCode()); + return regionDtoMapKey; + }).collect(Collectors.toList()); + + for (RegionDtoMapKey key : beforeRegionDtoMapKeyList) { + if (!afterRegionDtoMapKeyList.contains(key)) { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(key.getRegionCode()); + expertRegionInfo.setRegionLevel(key.getRegionLevel()); + removeList.add(expertRegionInfo); + } + } + + for (RegionDtoMapKey key : afterRegionDtoMapKeyList) { + if (!beforeRegionDtoMapKeyList.contains(key)) { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(key.getRegionCode()); + expertRegionInfo.setRegionLevel(key.getRegionLevel()); + addList.add(expertRegionInfo); + } + } + + expertRegionModifyDiffBO.setAddList(addList); + expertRegionModifyDiffBO.setRemoveList(removeList); + return expertRegionModifyDiffBO; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java new file mode 100644 index 0000000..7295715 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java @@ -0,0 +1,269 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.json.JSONUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.expert.controller.ExpertController; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; +import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sys.model.dto.RegionDTO; + +import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + *

+ * ExpertRegisterUtil + *

+ * + * @author WendyYang + * @since 10:03 2023/11/21 + */ +public class ExpertRegisterUtil { + + private ExpertRegisterUtil() { + } + + private static final String SEPARATOR = ",|,|\\n"; + + public static RegionCacheHelper regionCacheHelper; + public static DictionaryCache dictionaryCache; + public static IDingOrganizationService organizationService; + public static TagCache tagCache; + public static ExpertController expertController; + + public static void registerExpertBatch(String path) { + ExcelReader reader = ExcelUtil.getReader(new File(path)); + List> experts = reader.readAll(); + experts.forEach(w -> { + ExpertRegistrationRequest request = new ExpertRegistrationRequest(); + ExpertBasicInfo basic = new ExpertBasicInfo(); + basic.setBank(MapUtil.getStr(w, "开户行")); + basic.setBankNo(MapUtil.getStr(w, "银行卡号")); + basic.setName(MapUtil.getStr(w, "*姓名")); + basic.setPhoneNo(MapUtil.getStr(w, "*手机")); + basic.setGender("男".equals(MapUtil.getStr(w, "性别")) ? "1" : "0"); + // 政治面貌 + basic.setPolitical(new ArrayList<>()); + String political = MapUtil.getStr(w, "政治面貌"); + List politicalDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.POLITICAL.getKey()); + if (!politicalDicts.isEmpty()) { + politicalDicts.stream() + .filter(dict -> dict.getName().equals(political)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + basic.getPolitical().add(dict); + }); + } + ExpertEduInfo eduInfo = new ExpertEduInfo(); + eduInfo.setSchool("暂无"); + eduInfo.setAcademicTitle("暂无"); + eduInfo.setGraduatedAt(LocalDateTime.now()); + eduInfo.setEdu(new ArrayList<>()); + eduInfo.setDegree(new ArrayList<>()); + // 学历 + String eduStr = MapUtil.getStr(w, "学历"); + List eduDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.EDU.getKey()); + if (!eduDicts.isEmpty()) { + eduDicts.stream() + .filter(dict -> dict.getName().equals(eduStr)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + eduInfo.getEdu().add(dict); + }); + } + // 学位 + String degreeStr = MapUtil.getStr(w, "学位"); + List degreeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.DEGREE.getKey()); + if (!degreeDicts.isEmpty()) { + degreeDicts.stream() + .filter(dict -> dict.getName().equals(degreeStr)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + eduInfo.getDegree().add(dict); + }); + } + request.setEduInfo(eduInfo); + // 专家层级 + String expertRegionStr = MapUtil.getStr(w, "*专家层级").replace("景宁县", "景宁畲族自治县"); + RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr); + if (expertRegion != null) { + basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class)); + } + // 履职意向 + String intentionRegions = MapUtil.getStr(w, "*履职意向").replace("景宁县", "景宁畲族自治县"); + basic.setExpertIntentionWorkRegions(new ArrayList<>()); + for (String intentionRegionStr : intentionRegions.split("")) { + RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr); + if (currRegion != null) { + basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class)); + } + } + request.setBasicInfo(basic); + // 职业信息 + ExpertJobInfo jobInfo = new ExpertJobInfo(); + jobInfo.setAddress("暂无"); + jobInfo.setExperience("暂无"); + jobInfo.setJobStatus(new ArrayList<>()); + jobInfo.setCompany(MapUtil.getStr(w, "*工作单位")); + List organizations = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationName, jobInfo.getCompany())); + if (organizations.size() == 1) { + jobInfo.setCompanyUniqCode(organizations.get(0).getOrganizationCode()); + } + jobInfo.setAdministrativeDuties(MapUtil.getStr(w, "行政职务")); + jobInfo.setAdministrativeRank(new ArrayList<>()); + String administrativeRankStr = MapUtil.getStr(w, "行政职级"); + List administrativeRankDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.ADMINISTRATIVE_RANK.getKey()); + if (!administrativeRankDicts.isEmpty()) { + administrativeRankDicts.stream() + .filter(dict -> dict.getName().equals(administrativeRankStr)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + jobInfo.getAdministrativeRank().add(dict); + }); + } + jobInfo.setCompanyAttribute(new ArrayList<>()); + String companyTypeStr = MapUtil.getStr(w, "*单位类型"); + List companyTypeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.COMPANY_ATTRIBUTE.getKey()); + if (!companyTypeDicts.isEmpty()) { + companyTypeDicts.stream() + .filter(dict -> dict.getName().equals(companyTypeStr)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + jobInfo.getCompanyAttribute().add(dict); + }); + } + request.setJobInfo(jobInfo); + ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); + professionalInfo.setAwards("暂无"); + professionalInfo.setIndustrySector(new ArrayList<>()); + professionalInfo.setOther(new ArrayList<>()); + Map tagMap = tagCache.getNameTagDtoMap(); + String otherTagStr = MapUtil.getStr(w, "其他标签"); + if (StrUtils.isNotBlank(otherTagStr)) { + for (String othTag : otherTagStr.split(SEPARATOR)) { + tagMap.entrySet().stream() + .filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.OTHER.getKey()) + && tag.getValue().getTagName().equals(othTag)) + .forEach(tag -> { + TagFieldInfo expertTag = new TagFieldInfo(); + expertTag.setTagCode(tag.getValue().getTagCode()); + expertTag.setTagFieldName(tag.getValue().getParentCode()); + expertTag.setTagName(tag.getValue().getTagName()); + professionalInfo.getOther().add(expertTag); + }); + } + } + + String avoidCompanyStr = MapUtil.getStr(w, "*回避单位"); + professionalInfo.setAvoidCompanyList(new ArrayList<>()); + List avoidOrges = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getOrganizationName, avoidCompanyStr.split(SEPARATOR))); + if (!avoidOrges.isEmpty()) { + avoidOrges.forEach(org -> { + ExpertAvoidCompanyInfo companyInfo = new ExpertAvoidCompanyInfo(); + companyInfo.setCompanyName(org.getOrganizationName()); + companyInfo.setCompanyUniqCode(org.getOrganizationCode()); + professionalInfo.getAvoidCompanyList().add(companyInfo); + }); + } + + professionalInfo.setGoodAt(new ArrayList<>()); + String goodAtStr = MapUtil.getStr(w, "*擅长方向"); + for (String othTag : goodAtStr.split(SEPARATOR)) { + tagMap.entrySet().stream() + .filter(tag -> tag.getValue().getTagName().equals(othTag)) + .forEach(tag -> { + TagFieldInfo expertTag = new TagFieldInfo(); + expertTag.setTagCode(tag.getValue().getTagCode()); + expertTag.setTagFieldName(ExpertTagEnum.GOOD_AT.getKey()); + expertTag.setTagName(tag.getValue().getTagName()); + professionalInfo.getGoodAt().add(expertTag); + }); + } + String industrySectorStr = MapUtil.getStr(w, "行业领域"); + for (String othTag : industrySectorStr.split(SEPARATOR)) { + tagMap.entrySet().stream() + .filter(tag -> tag.getValue().getTagName().equals(othTag)) + .forEach(tag -> { + TagFieldInfo expertTag = new TagFieldInfo(); + expertTag.setTagCode(tag.getValue().getTagCode()); + expertTag.setTagFieldName(ExpertTagEnum.INDUSTRY_SECTOR.getKey()); + expertTag.setTagName(tag.getValue().getTagName()); + professionalInfo.getIndustrySector().add(expertTag); + }); + } + professionalInfo.setTechnicalExpertise(new ArrayList<>()); + String techStr = MapUtil.getStr(w, "技术专长"); + for (String othTag : techStr.split(SEPARATOR)) { + tagMap.entrySet().stream() + .filter(tag -> tag.getValue().getTagName().equals(othTag)) + .forEach(tag -> { + TagFieldInfo expertTag = new TagFieldInfo(); + expertTag.setTagCode(tag.getValue().getTagCode()); + expertTag.setTagFieldName(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey()); + expertTag.setTagName(tag.getValue().getTagName()); + professionalInfo.getTechnicalExpertise().add(expertTag); + }); + } + professionalInfo.setTitleLevel(new ArrayList<>()); + String titleLevel = MapUtil.getStr(w, "*职称级别"); + List titleLevelDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.TITLE_LEVEL.getKey()); + if (!titleLevelDicts.isEmpty()) { + titleLevelDicts.stream() + .filter(dict -> dict.getName().equals(titleLevel)) + .findFirst().ifPresent(dictionary -> { + DictionaryFieldInfo dict = new DictionaryFieldInfo(); + dict.setDictionaryName(dictionary.getName()); + dict.setDictionaryCode(dictionary.getDictionaryCode()); + dict.setDictionaryFieldName(dictionary.getDictionaryType()); + professionalInfo.getTitleLevel().add(dict); + }); + } + professionalInfo.setTechnicalTitles(MapUtil.getStr(w, "技术职称")); + request.setProfessionalInfo(professionalInfo); + ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); + recommendInfo.setRecommendedWay(new ArrayList<>()); + recommendInfo.setRecommendationProofFile(new ArrayList<>()); + request.setRecommendInfo(recommendInfo); + try { + expertController.expertBasicInfoSubmit(request); + } catch (Exception e) { + System.out.println(JSONUtil.toJsonStr(request)); + } + }); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java new file mode 100644 index 0000000..a117069 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java @@ -0,0 +1,152 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.io.IoUtil; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.common.model.FreemarkerBatchExportDTO; +import com.hz.pm.api.meeting.entity.dto.ExpertFeeExportDTO; +import com.hz.pm.api.meeting.entity.dto.ExpertInfoDTO; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.entity.ContentType; +import org.springframework.core.io.ByteArrayResource; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + *

+ * FreemarkerWordUtil + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Slf4j +public class FreemarkerWordUtil { + + private static void setDownFileName(HttpServletResponse response, String fileName) { + String fileNameEncoded; + try { + fileNameEncoded = URLEncoder.encode(fileName, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("文件名编码异常"); + } + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileNameEncoded); + } + + private static final Configuration CONFIGURATION = new Configuration(Configuration.VERSION_2_3_31); + + static { + CONFIGURATION.setDefaultEncoding("UTF-8"); + CONFIGURATION.setClassForTemplateLoading(FreemarkerWordUtil.class, "/template"); + } + + /** + * 生成word文件 + * + * @param dataMap word中需要展示的动态数据,用map集合来保存 + * @param templateName word模板名称,例如:test.ftl + * @param filePath 文件生成的目标路径,例如:D:/wordFile/ + * @param fileName 生成的文件名称,例如:test.doc + */ + public static void create(Object dataMap, String templateName, String filePath, String fileName) { + try { + Template template = CONFIGURATION.getTemplate(templateName); + //输出文件 + File outFile = new File(filePath + File.separator + fileName); + //如果输出目标文件夹不存在,则创建 + if (!outFile.getParentFile().exists()) { + boolean ignore = outFile.getParentFile().mkdirs(); + } + //将模板和数据模型合并生成文件 + Writer out = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outFile.toPath()), StandardCharsets.UTF_8)); + //生成文件 + template.process(dataMap, out); + IoUtil.flush(out); + IoUtil.close(out); + } catch (Exception e) { + log.error("根据模版生成Word文件失败:", e); + throw BizException.wrap("根据模版生成Word文件失败"); + } + } + + public static void export(String fileName, Object data, HttpServletResponse response, String templateName) throws TemplateException, IOException { + Template template = CONFIGURATION.getTemplate(templateName); + response.setCharacterEncoding(StandardCharsets.UTF_8.displayName()); + response.setContentType(ContentType.APPLICATION_JSON.getMimeType()); + setDownFileName(response, fileName); + try (StringWriter out = new StringWriter(); + Writer writer = new BufferedWriter(out, 4096)) { + template.process(data, writer); + try (InputStream is = new ByteArrayResource(out.toString().getBytes(StandardCharsets.UTF_8)).getInputStream(); + ServletOutputStream outputStream = response.getOutputStream()) { + // 缓冲区 + byte[] buffer = new byte[1024]; + int bytesToRead; + // 通过循环将读入的Word文件的内容输出到浏览器中 + while ((bytesToRead = is.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesToRead); + } + } + } + + + } + + public static void exportBatch(HttpServletResponse response, List fbeList, String fileName) throws IOException, TemplateException { + response.setCharacterEncoding(StandardCharsets.UTF_8.displayName()); + response.setContentType("application/zip"); + setDownFileName(response, fileName); + try (ServletOutputStream os = response.getOutputStream(); + ZipOutputStream zos = new ZipOutputStream(os)) { + for (FreemarkerBatchExportDTO param : fbeList) { + Template template = CONFIGURATION.getTemplate(param.getTemplate()); + StringWriter out = new StringWriter(); + try (Writer writer = new BufferedWriter(out, 4096)) { + template.process(param.getData(), writer); + } + ZipEntry zipEntry = new ZipEntry(param.getFileName()); + zos.putNextEntry(zipEntry); + zos.write(out.toString().getBytes(StandardCharsets.UTF_8)); + zos.closeEntry(); + } + } finally { + response.flushBuffer(); + } + } + + public static void main(String[] args) { + ExpertFeeExportDTO dto = new ExpertFeeExportDTO(); + dto.setMeetingAddress("杭州市滨江区海创还能到我当时防守打法十大发放"); + dto.setMeetingTime("2023-01-01 12:20"); + dto.setProjectName("阿萨法舒服舒服舒服舒服送达方"); + dto.setExperts(new ArrayList<>()); + for (int i = 0; i < 10; i++) { + ExpertInfoDTO expert = new ExpertInfoDTO(); + expert.setNo(i); + expert.setBank("中国建设银行"); + expert.setMobile("17819392616"); + expert.setBankNo("6111111172121324354"); + expert.setCompany("宁达科技有限公司"); + expert.setFee(BigDecimal.valueOf(500)); + expert.setName("张三丰"); + expert.setSex("男"); + expert.setIdcard("1212121211212121"); + dto.getExperts().add(expert); + } + create(dto, "meeting/专家费.ftl", "/Users/wendy/Desktop/", "专家费.doc"); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java new file mode 100644 index 0000000..1a3cf74 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.common.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + *

+ * 压缩为Gzip + *

+ * + * @author WendyYang + */ +public class GzipUtils { + /** + * 使用gzip进行压缩 + */ + public static String compress(String primStr) { + if (primStr == null || primStr.length() == 0) { + return primStr; + } + ByteArrayOutputStream out = new ByteArrayOutputStream(); + GZIPOutputStream gzip = null; + try { + gzip = new GZIPOutputStream(out); + gzip.write(primStr.getBytes()); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + if (gzip != null) { + try { + gzip.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + return new sun.misc.BASE64Encoder().encode(out.toByteArray()); + } + + /** + * 使用gzip进行解压缩 + */ + public static String uncompress(String compressedStr) { + if (compressedStr == null) { + return null; + } + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ByteArrayInputStream in = null; + GZIPInputStream ginzip = null; + byte[] compressed = null; + String decompressed = null; + try { + compressed = new sun.misc.BASE64Decoder().decodeBuffer(compressedStr); + in = new ByteArrayInputStream(compressed); + ginzip = new GZIPInputStream(in); + + byte[] buffer = new byte[1024]; + int offset = -1; + while ((offset = ginzip.read(buffer)) != -1) { + out.write(buffer, 0, offset); + } + decompressed = out.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (ginzip != null) { + try { + ginzip.close(); + } catch (IOException e) { + } + } + if (in != null) { + try { + in.close(); + } catch (IOException e) { + } + } + try { + out.close(); + } catch (IOException e) { + } + } + return decompressed; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java new file mode 100644 index 0000000..4ee84e0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java @@ -0,0 +1,82 @@ +package com.hz.pm.api.common.util; + +import org.apache.commons.math3.util.Pair; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +public class HmacAuthUtil { + /** + * 构造http请求 header + * + * @param url 请求url,全路径格式,比如:https://bcdsg.zj.gov.cn/api/p/v1/user.get + * @param requestMethod 请求方法,大写格式,如:GET, POST + * @param accessKey 应用的 AK + * @param secretKey 应用的 SK + * @return + */ + public static Map generateHeader(String url, String requestMethod, String accessKey, String secretKey) { + Map header = new HashMap<>(); + try { + DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + String date = dateFormat.format(new Date()); + URI uri = URI.create(url); + String canonicalQueryString = getCanonicalQueryString(uri.getQuery()); + String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + accessKey + "\n" + date + "\n"; + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(secretKey.getBytes(), "HmacSHA256")); + byte[] hash = mac.doFinal(message.getBytes()); + // to lowercase hexits + DatatypeConverter.printHexBinary(hash); + // to base64 + String sign = DatatypeConverter.printBase64Binary(hash); + header.put("X-BG-HMAC-SIGNATURE", sign); + header.put("X-BG-HMAC-ALGORITHM", "hmac-sha256"); + header.put("X-BG-HMAC-ACCESS-KEY", accessKey); + header.put("X-BG-DATE-TIME", date); + System.out.println(date); + } catch (Exception e) { + throw new RuntimeException("generate jc brain header error", e); + } + return header; + } + + private static String getCanonicalQueryString(String query) { + if (query == null || query.trim().length() == 0) { + return ""; + } + List> queryParamList = new ArrayList<>(); + String[] params = query.split("&"); + for (String param : params) { + String[] keyValue = param.split("="); + Pair pair = new Pair(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); + queryParamList.add(pair); + } + List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); + List> encodeParamList = new ArrayList<>(); + sortedParamList.stream().forEach(param -> { + try { + String key = URLEncoder.encode(param.getKey(), "utf-8"); + String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8"); + encodeParamList.add(new Pair<>(key, value)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("encoding error"); + } + }); + StringBuilder queryParamString = new StringBuilder(64); + for (Pair encodeParam : encodeParamList) { + queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); + queryParamString.append("&"); + } + return queryParamString.substring(0, queryParamString.length() - 1); + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HttpUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HttpUtil.java new file mode 100644 index 0000000..15c464c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HttpUtil.java @@ -0,0 +1,246 @@ +package com.hz.pm.api.common.util; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.DefaultHostnameVerifier; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.conn.util.PublicSuffixMatcher; +import org.apache.http.conn.util.PublicSuffixMatcherLoader; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +public class HttpUtil { + private Logger logger = LoggerFactory.getLogger(getClass()); + private RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(15000) + .setConnectTimeout(15000) + .setConnectionRequestTimeout(15000) + .build(); + private static HttpUtil instance = null; + private HttpUtil(){} + + public static HttpUtil getInstance(){ + if (instance == null) { + instance = new HttpUtil(); + } + return instance; + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + */ + public String sendHttpPost(String httpUrl) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + return sendHttpPost(httpPost); + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + * @param params 参数(格式:key1=value1&key2=value2) + */ + public String sendHttpPost(String httpUrl, String params) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + try { + //设置参数 + StringEntity stringEntity = new StringEntity(params, "UTF-8"); + stringEntity.setContentType("application/x-www-form-urlencoded"); + httpPost.setEntity(stringEntity); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } + return sendHttpPost(httpPost); + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + * @param maps 参数 + */ + public String sendHttpPost(String httpUrl, Map maps) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + // 创建参数队列 + List nameValuePairs = new ArrayList(); + for (String key : maps.keySet()) { + nameValuePairs.add(new BasicNameValuePair(key, maps.get(key))); + } + try { + httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } + return sendHttpPost(httpPost); + } + + /** + * 发送 Post请求 + * @param httpPost + *@return + */ + private String sendHttpPost(HttpPost httpPost) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + httpClient = HttpClients.createDefault(); + httpPost.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpPost); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } + + /** + * 发送 get 请求 + * @param httpUrl + */ + public String sendHttpGet(String httpUrl) { + HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 + return sendHttpGet(httpGet); + } + + /** + * 发送 get请求 Https + * @param httpUrl + */ + public String sendHttpsGet(String httpUrl) { + HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 + return sendHttpsGet(httpGet); + } + + /** + * 发送 Get请求 + * @param httpGet + *@return + */ + private String sendHttpGet(HttpGet httpGet) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + httpClient = HttpClients.createDefault(); + httpGet.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpGet); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } + + /** + * 发送 Get请求 Https + *@return + */ + private String sendHttpsGet(HttpGet httpGet) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new + URL(httpGet.getURI().toString())); + DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher); + httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build(); + httpGet.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpGet); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } + + /** + * 通过该工厂类创建的RestTemplate发送请求时,可忽略https证书认证 + * @return 工厂 + */ + public static HttpComponentsClientHttpRequestFactory generateHttpRequestFactory(){ + try{ + TrustStrategy acceptingTrustStrategy = ((x509Certificates, authType) -> true); + SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); + SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); + + HttpClientBuilder httpClientBuilder = HttpClients.custom(); + httpClientBuilder.setSSLSocketFactory(connectionSocketFactory); + CloseableHttpClient httpClient = httpClientBuilder.build(); + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); + factory.setHttpClient(httpClient); + return factory; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java new file mode 100644 index 0000000..8aca60d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java @@ -0,0 +1,91 @@ +package com.hz.pm.api.common.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.hz.pm.api.common.model.ZwddTokenUser; +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2023/5/4 下午2:34 + */ + +public class JwtTokenUtil { + + private static final String SECRET_KEY = "dbe1cc89019c4c7abd5085bf47a25fb0"; + + private static final String CLAIM_KEY = "content"; + + private static final Integer DEFAULT_EXPIRE_TIME = Integer.valueOf(86400); + + public static String createToken(ZwddTokenUser dingTokenUser) { + return createToken(dingTokenUser, DEFAULT_EXPIRE_TIME); + } + + public static String createToken(ZwddTokenUser dingTokenUser, Integer expireTime) { + if (dingTokenUser == null) { + throw new IllegalArgumentException(""); + } + if (dingTokenUser.getTenantId() == null) { + throw new IllegalArgumentException(""); + } + if (StringUtils.isEmpty(dingTokenUser.getEmployeeCode())) { + throw new IllegalArgumentException(""); + } + if (dingTokenUser.getTenantId() == null) { + throw new IllegalArgumentException(""); + } + return createToken(JSON.toJSONString(dingTokenUser), expireTime); + } + + private static String createToken(String content, Integer expireTime) { + if (StringUtils.isEmpty(content)) { + throw new IllegalArgumentException(""); + } + Map header = new HashMap<>(4); + header.put("alg", "HS256"); + header.put("typ", "JWT"); + Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); + return JWT.create() + .withHeader(header) + .withClaim("content", content) + .withIssuedAt(new Date()) + .withExpiresAt(new Date(System.currentTimeMillis() + (expireTime.intValue() * 1000))) + .sign(algorithm); + } + + public static boolean verifyToken(String token) { + if (StringUtils.isEmpty(token)) { + throw new IllegalArgumentException("token"); + } + Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); + JWTVerifier verifier = JWT.require(algorithm).build(); + verifier.verify(token); + return true; + } + + private static String parseJwtString(String token) { + if (StringUtils.isEmpty(token)) { + throw new IllegalArgumentException("token"); + } + Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); + JWTVerifier verifier = JWT.require(algorithm).build(); + return verifier.verify(token).getClaim("content").asString(); + } + + public static ZwddTokenUser parseJwt(String token) { + String dingUserJson = parseJwtString(token); + if (StringUtils.isEmpty(dingUserJson)) { + return null; + } + ZwddTokenUser dingTokenUser = (ZwddTokenUser) JSONObject.parseObject(dingUserJson, ZwddTokenUser.class); + return dingTokenUser; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java new file mode 100644 index 0000000..fa5eef7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.common.util; + +import org.slf4j.MDC; + +/** + *

+ * MDCUtil + *

+ * + * @author WendyYang + * @since 2023/10/26 + **/ +public class MDCUtil { + + public static final String TRACE_ID = "traceId"; + public static final String TRACE_ID_HEADER = "Trace-Id"; + + public static void setTraceId(String traceId) { + MDC.put(TRACE_ID, traceId); + } + + public static void removeTraceId() { + MDC.remove(TRACE_ID); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Utils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Utils.java new file mode 100644 index 0000000..a6a4bc0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Utils.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.common.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; + +public class Md5Utils { + private static final Logger LOGGER = LoggerFactory.getLogger(Md5Utils.class); + + public static byte[] md5(String s) { + MessageDigest algorithm; + try { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes(StandardCharsets.UTF_8)); + return algorithm.digest(); + } catch (Exception e) { + LOGGER.error("MD5 Error...", e); + } + return null; + } + + private static String toHex(byte[] hash) { + if (hash == null) { + return null; + } + StringBuilder buf = new StringBuilder(hash.length * 2); + int i; + for (i = 0; i < hash.length; i++) { + if ((hash[i] & 0xff) < 0x10) { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) { + try { + String hex = toHex(md5(s)); + if (hex == null) { + return s; + } + return new String(hex.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); + } catch (Exception e) { + LOGGER.error("not supported charset:", e); + return s; + } + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RefreshKeyUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RefreshKeyUtil.java new file mode 100644 index 0000000..39d5dbb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RefreshKeyUtil.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.common.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname RefreshKeyUtil + * @Description + * @Date 2023/6/27 10:03 + * @Author PoffyZhang + */ +@Slf4j +public class RefreshKeyUtil { + public static String getRequestSecret(String appKey, String appSecret,Long requestTime) { + // 刷新秘钥 + HttpUtil httpUtil = HttpUtil.getInstance(); + log.info("请求密钥" + appSecret); + String sign = Md5Utils.hash (appKey + appSecret + requestTime); + String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm"; + log.info(refreshUrl); + Map map = new HashMap<>(); + map.put("appKey",appKey); + map.put("sign",sign); + map.put("requestTime",requestTime + ""); + String result = httpUtil.sendHttpPost(refreshUrl,map); + log.info(result); + JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); + if(Objects.nonNull(dataJson)){ + return dataJson.getString("requestSecret"); + } + return result; + } + + public static String refreshSecret(String appKey, String refreshSecret,Long requestTime) { + // 刷新秘钥 + HttpUtil httpUtil = HttpUtil.getInstance(); + log.info("刷新密钥" + refreshSecret); + String refreshSign = Md5Utils.hash (appKey + refreshSecret + requestTime); + String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm"; + log.info(refreshUrl); + Map map = new HashMap<>(); + map.put("appKey",appKey); + map.put("sign",refreshSign); + map.put("requestTime",requestTime + ""); + String result = httpUtil.sendHttpPost(refreshUrl,map); + log.info(result); + JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); + if(Objects.nonNull(dataJson)){ + return dataJson.getString("requestSecret"); + } + return result; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RegionUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RegionUtils.java new file mode 100644 index 0000000..4397c6a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/RegionUtils.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.common.util; + +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Comparator; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午2:27 + */ + +public class RegionUtils { + + public static Boolean isValueEquals(ExpertRegionInfo regionInfo1, ExpertRegionInfo regionInfo2) { + if (null == regionInfo1.getRegionCode() && null == regionInfo1.getRegionLevel()) { + return false; + } + return regionInfo1.getRegionCode().equals(regionInfo2.getRegionCode()) + && regionInfo1.getRegionLevel().equals(regionInfo2.getRegionLevel()); + } + + public static Boolean isValueEquals(List list1, List list2) { + if (CollectionUtils.isEmpty(list1) && CollectionUtils.isEmpty(list2)) { + return true; + } + boolean collectionStatusNotEquals = (CollectionUtils.isEmpty(list1) && CollectionUtils.isNotEmpty(list2)) + || (CollectionUtils.isEmpty(list2) && CollectionUtils.isNotEmpty(list1)); + if (collectionStatusNotEquals) { + return false; + } + if (list1.size() != list2.size()) { + return false; + } + list1.sort(Comparator.comparing(ExpertRegionInfo::getRegionCode).thenComparing(ExpertRegionInfo::getRegionLevel)); + list2.sort(Comparator.comparing(ExpertRegionInfo::getRegionCode).thenComparing(ExpertRegionInfo::getRegionLevel)); + + for (int i = 0; i < list1.size(); i++) { + if (!StrUtils.trimEquals(list1.get(i).getRegionCode(), list2.get(i).getRegionCode()) + || !list1.get(i).getRegionLevel().equals(list2.get(i).getRegionLevel())) { + return false; + } + } + return true; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java new file mode 100644 index 0000000..00c71a5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.common.util; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.zwdd.client.ZwddClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.concurrent.*; + +/** + * 异步发送工作通知工具类 + * + * @author CMM + * @since 2023/02/23 13:50 + */ +@Slf4j +@RequiredArgsConstructor +@Component +public class SendWorkNoticeUtil { + + private final ZwddClient zwddClient; + + /** + * 初始化线程池 + */ + public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, + 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); + + public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ + + // 将发送工作通知交给异步任务Future + String msg = workNoticeInfo.getMsg(); + CompletableFuture future = CompletableFuture.supplyAsync(() -> { + // 调用浙政钉的接口发送工作通知 + long startTime = System.currentTimeMillis(); + GenericResult result = + zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); + String resultMsg = result.getMsg(); + if ("success".equals(resultMsg)) { + log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); + long endTime = System.currentTimeMillis(); + log.info("方法执行完成返回,耗时:" + (endTime - startTime)); + }else { + return "发送工作通知失败!"; + } + return "发送工作通知成功!"; + }, threadPool); + String s; + try { + s = future.get(); + } catch (Exception e) { + throw new BizException("获取异步线程处理结果失败!"); + } + threadPool.shutdown(); + while (!threadPool.isTerminated()) { + log.info(s); + return Boolean.FALSE; + } + log.info(s); + return Boolean.TRUE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SpringContextHolder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SpringContextHolder.java new file mode 100644 index 0000000..6ed7f48 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SpringContextHolder.java @@ -0,0 +1,150 @@ +package com.hz.pm.api.common.util; + +import java.util.ArrayList; +import java.util.List; + + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.core.env.Environment; +import org.springframework.lang.NonNull; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author qinxianyun + */ +@Slf4j +public class SpringContextHolder implements ApplicationContextAware, DisposableBean { + + private static ApplicationContext applicationContext = null; + private static final List CALL_BACKS = new ArrayList<>(); + private static boolean addCallback = true; + + /** + * 针对 某些初始化方法,在SpringContextHolder 未初始化时 提交回调方法。 + * 在SpringContextHolder 初始化后,进行回调使用 + * + * @param callBack 回调函数 + */ + public synchronized static void addCallBacks(CallBack callBack) { + if (addCallback) { + SpringContextHolder.CALL_BACKS.add(callBack); + } else { + log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName()); + callBack.executor(); + } + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) { + assertContextInjected(); + return (T) applicationContext.getBean(name); + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + public static T getBean(Class requiredType) { + assertContextInjected(); + return applicationContext.getBean(requiredType); + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @param defaultValue 默认值 + * @param requiredType 返回类型 + * @return / + */ + public static T getProperties(String property, T defaultValue, Class requiredType) { + T result = defaultValue; + try { + result = getBean(Environment.class).getProperty(property, requiredType); + } catch (Exception ignored) { + } + return result; + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @return / + */ + public static String getProperties(String property) { + return getProperties(property, null, String.class); + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @param requiredType 返回类型 + * @return / + */ + public static T getProperties(String property, Class requiredType) { + return getProperties(property, null, requiredType); + } + + /** + * 检查ApplicationContext不为空. + */ + private static void assertContextInjected() { + if (applicationContext == null) { + throw new IllegalStateException("applicationContext属性未注入, 请在applicationContext" + + ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); + } + } + + /** + * 清除SpringContextHolder中的ApplicationContext为Null. + */ + private static void clearHolder() { + log.debug("清除SpringContextHolder中的ApplicationContext:" + + applicationContext); + applicationContext = null; + } + + @Override + public void destroy() { + SpringContextHolder.clearHolder(); + } + + @Override + public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException { + if (SpringContextHolder.applicationContext != null) { + log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); + } + SpringContextHolder.applicationContext = applicationContext; + if (addCallback) { + for (CallBack callBack : SpringContextHolder.CALL_BACKS) { + callBack.executor(); + } + CALL_BACKS.clear(); + } + SpringContextHolder.addCallback = false; + } + + /** + * 获取当前启用的配置文件 + *
    + *
  • 生产环境:prod
  • + *
  • 开发环境:dev
  • + *
+ * + * @return java.lang.String + * @author WendyYang + **/ + public static String getActiveProfile() { + String[] strings = applicationContext.getEnvironment().getActiveProfiles(); + return strings[0]; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/StrUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/StrUtils.java new file mode 100644 index 0000000..9d10207 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/StrUtils.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.text.StrPool; +import cn.hutool.core.util.StrUtil; + +import java.util.Collections; +import java.util.List; + +/** + *

+ * StrUtils + *

+ * + * @author WendyYang + * @since 21:23 2023/2/23 + */ +public class StrUtils extends StrUtil { + + private StrUtils() { + } + + public static List split(String str) { + if (isBlank(str)) { + return Collections.emptyList(); + } + return split(str, StrPool.COMMA); + } + + public static boolean trimEquals(String str1, String str2) { + if (isNotBlank(str1)) { + str1 = str1.trim(); + } + if (isNotBlank(str2)) { + str2 = str2.trim(); + } + return equals(str1, str2); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtils.java new file mode 100644 index 0000000..f64aa72 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtils.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.common.util; + +import com.hz.pm.api.expert.model.TagFieldInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Comparator; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午2:14 + */ +public class TagUtils { + + private TagUtils() { + } + + public static Boolean isValueEquals(List list1, List list2) { + if (CollectionUtils.isEmpty(list1) && CollectionUtils.isEmpty(list2)) { + return true; + } + + boolean collectionStatusNotEquals = (CollectionUtils.isEmpty(list1) && CollectionUtils.isNotEmpty(list2)) + || (CollectionUtils.isEmpty(list2) && CollectionUtils.isNotEmpty(list1)); + if (collectionStatusNotEquals) { + return false; + } + if (list1.size() != list2.size()) { + return false; + } + list1.sort(Comparator.comparing(TagFieldInfo::getTagFieldName).thenComparing(TagFieldInfo::getTagCode)); + list2.sort(Comparator.comparing(TagFieldInfo::getTagFieldName).thenComparing(TagFieldInfo::getTagCode)); + + for (int i = 0; i < list1.size(); i++) { + if (!StrUtils.trimEquals(list1.get(i).getTagFieldName(), list2.get(i).getTagFieldName()) + || !StrUtils.trimEquals(list1.get(i).getTagCode(), list2.get(i).getTagCode())) { + return false; + } + } + return true; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java new file mode 100644 index 0000000..19b51dd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java @@ -0,0 +1,164 @@ +package com.hz.pm.api.common.util; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.google.common.collect.Maps; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.model.entity.MenuTreeEntity; +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import com.hz.pm.api.sys.model.vo.MenuRoleVO; + +import java.io.Serializable; +import java.util.*; +import java.util.stream.Collectors; + +/** + * list列表 转换成tree列表 + * + * @author PoffyZhang + */ +public final class TreeUtil { + private TreeUtil() { + } + + private static Map nodeMap = Maps.newConcurrentMap(); + + /** + * 判断id是否为根节点 + * + * @param id + * @return + */ + public static boolean isRoot(Long id) { + return id == null || StrPool.DEF_PARENT_ID.equals(id); + } + + + public static String getTreePath(String parentTreePath, Long parentId) { + return StrPool.COMMA + parentId + parentTreePath; + } + + /** + * 构建Tree结构 + * + * @param treeList 待转换的集合 + * @return 树结构 + */ + public static > List buildTree(List treeList) { + if (CollUtil.isEmpty(treeList)) { + return treeList; + } + //记录自己是自己的父节点的id集合 + List selfIdEqSelfParent = new ArrayList<>(); + + // 遍历两次 + foreachNodes(treeList, selfIdEqSelfParent); + foreachNodesWithTopMenu(treeList); + + // 找出根节点集合 + List trees = new ArrayList<>(); + + List allIds = treeList.stream().map(node -> node.getId()).collect(Collectors.toList()); + for (E baseNode : treeList) { + if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { + baseNode.setPid(null); + baseNode.setTopMenu(baseNode.getName()); + trees.add(baseNode); + } + } + return trees; + } + + private static > + void foreachNodes(List treeList, List selfIdEqSelfParent) { + nodeMap = Maps.newConcurrentMap(); + for (E parent : treeList) { + Serializable id = parent.getId(); + nodeMap.put(parent.getId(), parent); + for (E children : treeList) { + if (parent != children) { + //parent != children 这个来判断自己的孩子不允许是自己,因为有时候,根节点的parent会被设置成为自己 + if (id.equals(children.getPid())) { + parent.initChildren(); + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + parent.getChildren().add(children); + } + } else if (id.equals(parent.getPid())) { + selfIdEqSelfParent.add(id); + } + } + } + } + + private static > void foreachNodesWithTopMenu(List treeList) { + for (E parent : treeList) { + Serializable id = parent.getId(); + for (E children : treeList) { + if (parent != children) { + if (id.equals(children.getPid())) { + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + } + } + } + } + } + + public static List buildUserTree(List treeList) { + if (CollUtil.isEmpty(treeList)) { + return Collections.emptyList(); + } + Map> menuGroup = CollUtils.group(treeList, MenuTreeEntity::getPid); + Map menuMap = CollUtils.listToMap(treeList, MenuTreeEntity::getId); + return buildUserMenuTree(menuGroup, menuMap, StrPool.DEF_PARENT_ID, null); + } + + private static List buildUserMenuTree(Map> menuGroup, + Map menuMap, + Long parentId, + ListIterator parentIter) { + MenuRoleVO parentMenu = menuMap.get(parentId); + List currMenus = menuGroup.get(parentId); + if (currMenus == null) { + return Collections.emptyList(); + } + List menus; + if (!parentId.equals(StrPool.DEF_PARENT_ID)) { + Map> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType); + for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) { + vo.setTopMenu(parentMenu.getTopMenu()); + parentIter.add(vo); + } + menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList()); + } else { + menus = new ArrayList<>(currMenus); + } + menus.sort(Comparator.comparing(w -> ObjectUtil.defaultIfNull(w.getSort(), 99))); + ListIterator currIter = menus.listIterator(); + while (currIter.hasNext()) { + MenuRoleVO curr = currIter.next(); + if (curr.getPid().equals(StrPool.DEF_PARENT_ID)) { + curr.setPid(null); + curr.setTopMenu(curr.getName()); + } else { + curr.setTopMenu(parentMenu.getTopMenu()); + } + curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter)); + } + return menus; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java new file mode 100644 index 0000000..ec980d2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.dashboard.constant; + +/** + * @author liuxinxin + * @date 2023/8/2 下午2:46 + */ + +public class AnalysisBasicConstant { + + + /** + * 丽水市区域编码 + */ + public static final String LS_REGION_CODE = "331100"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/ChartTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/ChartTypeEnum.java new file mode 100644 index 0000000..8554ae4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/ChartTypeEnum.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/DashboardConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/DashboardConstant.java new file mode 100644 index 0000000..0bfe2e2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/DashboardConstant.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.dashboard.constant; + +import java.math.BigDecimal; + +/** + * @author liuxinxin + * @date 2023/8/2 下午2:46 + */ + +public class DashboardConstant { + + public static class Protrait{ + public static final String NONE = "暂无"; + public static final String PLAN = "计划"; + public static final String DECLARED = "申报"; + public static final String APPROVE = "审批"; + public static final String CONSTRUCTION = "建设"; + public static final String ACCEPT = "验收"; + + public static final String OPERATION = "运维"; + public static final String PERFORMANCE = "绩效"; + public static final String LOG_OFF = "注销"; + + public static final String PROJECT_SIGNS = "项目体征"; + public static final String FEILD_SAFETYMONEY = "safetyInputAmount"; + + public static final String ZREO_PERCEN = "0"; + } + + + public static class CockpitStats{ + //总数 + public static final String TOTAL = "TOTAL"; + public static final int NONE_YEAR = 0; + } + + public static class Expert { + public static final String ACCOUNT_STATUS_OK = "available"; + + public static final String DISTRIBUTION_SHENG = "省维度"; + + public static final String DISTRIBUTION_SHI = "市维度"; + + public static final String NETWORK_CODE = "1030000"; + public static final String XINCHUANG_CODE = "2040000"; + public static final String FANGAN_CODE = "2030000"; + public static final String JISHU_CODE = "2010000"; + public static final String DANGZHENG_CODE = "1020000"; + public static final String RUANYING_CODE = "2020000"; + public static final String CAIWU_CODE = "5600000"; + + public static final String XINCHUANG_OTTHER_CODE = "5500000"; + + public static final String XINXIHUA_CODE = "5400000"; + public static final String EXPERT_TYPE = "expert_type"; + + public static final String EXPERT_TYPE_INNER = "300000"; + + public static final String EXPERT_TYPE_OUT = "300001"; + + public static final String EXPERT_LEVEL_ZHENGGAO = "900000"; + + public static final String EXPERT_LEVEL_FUGAO = "900001"; + + public static final String EXPERT_LEVEL_MID = "900002"; + + public static final String EXPERT_LEVEL_CHUJI = "900003"; + + public static final String EXPERT_LEVEL_NULL = "900004"; + + public static final BigDecimal REVIEW_AOUMT_EXPERT = BigDecimal.valueOf(0.05); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/DashboardController.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/DashboardController.java new file mode 100644 index 0000000..fd14d84 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/DashboardController.java @@ -0,0 +1,93 @@ +package com.hz.pm.api.dashboard.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.dashboard.manage.CockpitStatsManage; +import com.hz.pm.api.dashboard.manage.DashboardExpertManage; +import com.hz.pm.api.dashboard.manage.DashboardProjectManage; +import com.hz.pm.api.dashboard.model.dto.CockpitStatsSaveDTO; +import com.hz.pm.api.dashboard.model.po.QueryYearPO; +import com.hz.pm.api.dashboard.model.vo.*; +import com.hz.pm.api.scheduler.task.CockpitStatsStatisticsTask; +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.*; +import javax.validation.Valid; +import java.net.UnknownHostException; +import java.util.List; + +/** + * @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; + + private final CockpitStatsManage cockpitStatsManage; + + private final CockpitStatsStatisticsTask cockpitStatsStatisticsTask; + + @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); + } + + @GetMapping("/project-portrait/{projectCode}") + @ApiOperation("驾驶舱-项目画像接口") + public DashboardProjectProtraitVO getProjectPortrait(@PathVariable String projectCode) { + return dashboardProjectManage.getProjectPortrait(projectCode); + } + + @GetMapping("cockpit-stats") + @ApiOperation("驾驶舱-统计数据接口") + public CockpitStatsVO getData(@RequestParam(required = false) String regionCode, + @RequestParam(required = false) Integer year) { + return cockpitStatsManage.getData(regionCode,year); + } + + @GetMapping("cockpit-stats-start") + @ApiOperation("驾驶舱-统计数据接口 强制运行任务") + public String statsStart() throws UnknownHostException { + cockpitStatsStatisticsTask.doTask(); + return "运行成功"; + } + + @PostMapping("cockpit-stats-save") + @ApiOperation("驾驶舱-统计数据接口 假数据保存") + public String statsSave(@RequestBody List saves) { + cockpitStatsManage.save(saves); + return "保存成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java new file mode 100644 index 0000000..c9fe1a5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.dashboard.controller; + +import com.hz.pm.api.dashboard.manage.*; +import com.hz.pm.api.dashboard.model.vo.*; +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.*; + +/** + * @author ZPF + * @date 2023/11/25 上午10:36 + */ +@RestController +@RequestMapping("/api/v1/statistics") +@Validated +@RequiredArgsConstructor +@Api(value = "StatisticsController", tags = "统计") +public class StatisticsController { + + private final FundStatisticsManage fundStatisticsManage; + + private final ExpertStatisticsManage expertStatisticsManage; + + private final MeetingStatisticsManage meetingStatisticsManage; + + private final ProjectCostStatisticsManage costStatisticsManage; + + private final EarlyWarningStatisticsManage earlyWarningStatisticsManage; + + private final PerformanceStatisticsManage performanceStatisticsManage; + + @GetMapping("/fund") + @ApiOperation("项目资金统计") + public FundStatisticsVO fund(@RequestParam(required = false) Integer year) { + return fundStatisticsManage.statistics(year); + } + + @GetMapping("/expert") + @ApiOperation("专家统计") + public ExpertStatisticsVO expert(@RequestParam(required = false) Integer year) { + return expertStatisticsManage.statistics(year); + } + + @GetMapping("/meeting") + @ApiOperation("评审会议统计") + public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) { + return meetingStatisticsManage.statistics(year); + } + + @GetMapping("/project-cost") + @ApiOperation("项目成本统计") + public CostStatisticsVO projectCost() { + return costStatisticsManage.statistics(); + } + + @GetMapping("/early-warning") + @ApiOperation("预警统计") + public EarlyWarningStatisticsVO earlyWarning(@RequestParam(required = false) Integer year) { + return earlyWarningStatisticsManage.statistics(year); + } + + @GetMapping("/performance") + @ApiOperation("绩效统计") + public PerformanceStatisticsVO performance(@RequestParam(required = false) Integer year) { + return performanceStatisticsManage.statistics(year); + } + + @GetMapping("/project") + @ApiOperation("项目统计") + public EarlyWarningStatisticsVO project(@RequestParam(required = false) Integer year) { + return earlyWarningStatisticsManage.statistics(year); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/enums/CockpitAppcationTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/enums/CockpitAppcationTypeEnum.java new file mode 100644 index 0000000..b526836 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/enums/CockpitAppcationTypeEnum.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.dashboard.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Objects; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum CockpitAppcationTypeEnum { + /** + * 驾驶舱 应用类型 + */ + OPTIMAL(1,"最佳应用"), + MAJOR(2,"重大应用"); + + private Integer code; + private String desc; + + public static CockpitAppcationTypeEnum match(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (CockpitAppcationTypeEnum t : CockpitAppcationTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ApplicationHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ApplicationHandler.java new file mode 100644 index 0000000..a26406b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ApplicationHandler.java @@ -0,0 +1,82 @@ +package com.hz.pm.api.dashboard.handle; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname ApplicationHandler + * @Description + * @Date 2023/10/9 14:11 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ApplicationHandler { + private final IProjectApplicationService applicationService; + + private final IProjectService projectService; + /** + * 生成项目产出 + * @param projectCode + * @return + */ + public Map generateOutput(String projectCode) { + Map res = Maps.newHashMap(); + //1.初始化 项目体征 + res.put(DashboardConstant.Protrait.PROJECT_SIGNS, + generateOutputEntity(DashboardConstant.Protrait.PROJECT_SIGNS)); + //2.查询应用 + Project project = projectService.getProjectByCode(projectCode); + if(Objects.nonNull(project)){ + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectVersion, project.getVersion()) + .eq(ProjectApplication::getProjectCode, projectCode)); + for(ProjectApplication app : apps){ + String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication(); + res.put(appName,generateOutputEntity(appName)); + } + } + return res; + } + + public List generateIrsApp(String projectCode) { + List res = Lists.newArrayList(); + //.查询应用 + Project project = projectService.getProjectByCode(projectCode); + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectVersion, project.getVersion()) + .eq(ProjectApplication::getProjectCode, projectCode)); + for(ProjectApplication app : apps){ + String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication(); + res.add(generateOutputEntity(appName)); + } + return res; + } + + private ProtraitProjectOutputVO generateOutputEntity(String name){ + return ProtraitProjectOutputVO.builder() + .name(DashboardConstant.Protrait.PROJECT_SIGNS) + .generateData(new ProtraitProjectOutputVO.GenerateData()) + .componentUsage(new ProtraitProjectOutputVO.ComponentUsage()) + .cloudResourceUsage(new ProtraitProjectOutputVO.CloudResourceUsage()) + .dataUsage(new ProtraitProjectOutputVO.DataUsage()) + .operationReport(new ProtraitProjectOutputVO.OperationReport()) + .build(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java new file mode 100644 index 0000000..7af6d90 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java @@ -0,0 +1,254 @@ +package com.hz.pm.api.dashboard.handle; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.enums.CockpitAppcationTypeEnum; +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; +import com.hz.pm.api.dashboard.service.ICockpitStatsService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname CockpitStatsHandler + * @Description + * @Date 2023/10/9 14:11 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class CockpitStatsHandler { + + private final RegionCacheHelper regionCacheHelper; + + private final ICockpitStatsService cockpitStatsService; + + private static final List years = Lists.newArrayList(2021,2022,2023,2024,2025); + + public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats, String regionCode, Integer year + , List appDatas) { + CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); + + if(Objects.isNull(cockpitStats)){ + return res; + } + //监测数据 + res.setMonitorData(convertMonitor(cockpitStats,regionCode)); + //专家数据 + res.setExpertData(convertExpertData(cockpitStats)); + //顶部数据 + res.setTopData(convertTopData(cockpitStats)); + //地图数据 + res.setMapProjectData(convertMapProjectsData(cockpitStats,year)); + //项目项目数据 + res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); + //项目效益 优秀项目 + res.setExcellentData(convertExcellentData(cockpitStats)); + //核减信息 + res.setReduceData(convertReduceData(cockpitStats)); + //产出信息 + res.setProduceData(convertProduceData(cockpitStats)); + //绩效 + res.setPerformanceData(convertPerformanceData(cockpitStats)); + //最佳/重大应用 + res.setAppDatas(convertCockpitApps(appDatas)); + //数据质量分数 + res.setQualityDatas(convertQualityDatas(year)); + return res; + } + + private List convertQualityDatas(Integer year) { + List datas = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) + .eq(Objects.nonNull(year), CockpitStats::getYear, year) + .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) + .ne(CockpitStats::getRegionCode,DashboardConstant.CockpitStats.TOTAL) + .orderByAsc(CockpitStats::getRegionCode)); + + if(CollUtil.isEmpty(datas)){ + return Collections.emptyList(); + } + + return datas.stream().map(d -> { + CockpitStatsVO.QualityData data = new CockpitStatsVO.QualityData(); + data.setRegionCode(d.getRegionCode()); + data.setRegionName(d.getRegionName()); + data.setQuality(d.getDataQuality()); + return data; + }).collect(Collectors.toList()); + } + + private Map> convertCockpitApps(List appDatas) { + Map> res = Maps.newHashMap(); + res.put(CockpitAppcationTypeEnum.OPTIMAL.getDesc(), CollUtil.isEmpty(appDatas) ? Collections.emptyList() : + appDatas.stream().filter(a -> Objects.nonNull(a) && Objects.nonNull(a.getType()) && + CockpitAppcationTypeEnum.OPTIMAL.getCode().equals(a.getType())).collect(Collectors.toList())); + res.put(CockpitAppcationTypeEnum.MAJOR.getDesc(), CollUtil.isEmpty(appDatas) ? Collections.emptyList() : + appDatas.stream().filter(a -> Objects.nonNull(a) && Objects.nonNull(a.getType()) && + CockpitAppcationTypeEnum.MAJOR.getCode().equals(a.getType())).collect(Collectors.toList())); + return res; + } + + private CockpitStatsVO.PerformanceData convertPerformanceData(CockpitStats cockpitStats) { + CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.PerformanceData.class); + data.setPerformanceTops(convertTops(cockpitStats)); + return data; + } + + private List convertTops(CockpitStats cockpitStats) { + List tops = Lists.newArrayList(); + tops.add(new CockpitStatsVO.PerformanceTop("一星",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); + tops.add(new CockpitStatsVO.PerformanceTop("二星",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); + tops.add(new CockpitStatsVO.PerformanceTop("三星",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); + tops.add(new CockpitStatsVO.PerformanceTop("四星",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); + tops.add(new CockpitStatsVO.PerformanceTop("五星",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); + return tops; + } + + private CockpitStatsVO.ProduceData convertProduceData(CockpitStats cockpitStats) { + return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ProduceData.class); + } + + private CockpitStatsVO.ReduceData convertReduceData(CockpitStats cockpitStats) { + CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ReduceData.class); + data.setAmountComparisonCharts(convertAmountComparisonChart(cockpitStats)); + return data; + } + + private List convertAmountComparisonChart(CockpitStats cockpitStats) { + List res = Lists.newArrayList(); + res.add(new CockpitStatsVO.AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(),cockpitStats.getApprovalAmountApprove(),cockpitStats.getDifferenceApprove())); + res.add(new CockpitStatsVO.AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(),cockpitStats.getApprovalAmountApproval(),cockpitStats.getDifferenceApproval())); + res.add(new CockpitStatsVO.AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(),cockpitStats.getApprovalAmountContract(),cockpitStats.getDifferenceContract())); + return res; + } + + private CockpitStatsVO.ExcellentData convertExcellentData(CockpitStats cockpitStats) { + CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ExcellentData.class); + data.setExcellentProjects(Lists.newArrayList()); + return data; + } + + private CockpitStatsVO.StatusProjectsData convertStatusProjectsData(CockpitStats cockpitStats) { + return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.StatusProjectsData.class); + } + + private List convertMapProjectsData(CockpitStats cockpitStats,Integer year) { + List mapProjectsDatas = Lists.newArrayList(); + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); + + List cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) + .eq(Objects.nonNull(year), CockpitStats::getYear, year) + .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR)); + Map totalMap = cockpitStatsAll.stream().filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) + .collect(Collectors.toMap(c -> c.getRegionCode(), c -> c.getProjectsTotal())); + + for(RegionDTO region : regions){ + CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); + mapProjectsData.setRegionCode(region.getRegionCode()); + mapProjectsData.setRegionName(region.getRegionName()); + if(totalMap.containsKey(mapProjectsData.getRegionCode())){ + mapProjectsData.setProjectsNum(totalMap.get(mapProjectsData.getRegionCode())); + }else{ + mapProjectsData.setProjectsNum(0); + } + mapProjectsDatas.add(mapProjectsData); + } + return mapProjectsDatas; + } + + private CockpitStatsVO.TopData convertTopData(CockpitStats cockpitStats) { + return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.TopData.class); + } + + private CockpitStatsVO.Expert convertExpertData(CockpitStats cockpitStats) { + CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Expert.class); + expert.setExpertRegionData(buidExpertRegionData(cockpitStats)); + return expert; + } + + private List buidExpertRegionData(CockpitStats cockpitStats) { + List regionData = Lists.newArrayList(); + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); + + List cs = cockpitStatsService.list(); + Map csMap = cs.stream().collect(Collectors.toMap(c -> c.getRegionCode() + c.getYear(), CockpitStats::getExpertTotalNum)); + for(RegionDTO region : regions){ + CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); + expertRegion.setRegionCode(region.getRegionCode()); + expertRegion.setRegionName(region.getRegionName()); + if(csMap.containsKey(region.getRegionCode() + 0)){ + expertRegion.setExpertNum(csMap.get(region.getRegionCode() + 0)); + }else{ + expertRegion.setExpertNum(0); + } + regionData.add(expertRegion); + } + return regionData; + } + + private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats,String regionCode) { + CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Monitor.class); + monitor.setPasswordGradeCharts(buidPasswordGradeCharts(cockpitStats)); + monitor.setSecrecyGradeCharts(buidSecrecyGradeCharts(cockpitStats)); + monitor.setMonitorSafetyInputRate(computeSafetyRate(regionCode)); + return monitor; + } + + /** + * 安全投入 比 图 + * @param regionCode + * @return + */ + private List computeSafetyRate(String regionCode) { + List cocks = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) + .eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) + .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) + .in(CockpitStats::getYear, years) + .orderByAsc(CockpitStats::getYear)); + return cocks.stream().map(c -> { + CockpitStatsVO.SafetyInput safetyInput = new CockpitStatsVO.SafetyInput(); + safetyInput.setYear(c.getYear()); + safetyInput.setRate(Objects.nonNull(c.getMonitorDeclaredAmount()) && c.getMonitorDeclaredAmount().compareTo(BigDecimal.ZERO) > 0 ? + c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(),2, RoundingMode.CEILING): BigDecimal.ZERO); + return safetyInput; + }).collect(Collectors.toList()); + } + + private List buidSecrecyGradeCharts(CockpitStats cockpitStats) { + List chars = Lists.newArrayList(); + chars.add(new CockpitStatsVO.SecrecyGradeChart(1,cockpitStats.getMonitorSecrecyGrade1Num())); + chars.add(new CockpitStatsVO.SecrecyGradeChart(2,cockpitStats.getMonitorSecrecyGrade2Num())); + chars.add(new CockpitStatsVO.SecrecyGradeChart(3,cockpitStats.getMonitorSecrecyGrade3Num())); + chars.add(new CockpitStatsVO.SecrecyGradeChart(4,cockpitStats.getMonitorSecrecyGrade4Num())); + chars.add(new CockpitStatsVO.SecrecyGradeChart(5,cockpitStats.getMonitorSecrecyGrade5Num())); + return chars; + } + + private List buidPasswordGradeCharts(CockpitStats cockpitStats) { + List chars = Lists.newArrayList(); + chars.add(new CockpitStatsVO.PasswordGradeChart(1,cockpitStats.getMonitorPasswordGrade1Num())); + chars.add(new CockpitStatsVO.PasswordGradeChart(2,cockpitStats.getMonitorPasswordGrade2Num())); + chars.add(new CockpitStatsVO.PasswordGradeChart(3,cockpitStats.getMonitorPasswordGrade3Num())); + chars.add(new CockpitStatsVO.PasswordGradeChart(4,cockpitStats.getMonitorPasswordGrade4Num())); + chars.add(new CockpitStatsVO.PasswordGradeChart(5,cockpitStats.getMonitorPasswordGrade5Num())); + return chars; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java new file mode 100644 index 0000000..62ab917 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java @@ -0,0 +1,140 @@ +package com.hz.pm.api.dashboard.handle; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.core.util.CommonUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.model.vo.ProtraitProjectStatusSituationVO; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.HistoryService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectStatusHandler + * @Description + * @Date 2023/10/9 14:11 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProjectStatusHandler { + + private final IProjectService projectService; + private final IProjectInstService projectInstService; + + private final INdProjectStatusChangeService statusChangeService; + + private final HistoryService historyService; + + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + + /** + * 不同的项目状态 去求不同的审批完成时间 审批类型的 + * @param project + * @return + */ + public ProtraitProjectStatusSituationVO generateApproveStatus(Project project,String statusName,Integer instType) { + ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); + if(Objects.isNull(project)){ + return vo; + } + vo.setStatusName(statusName); + //查询 单位内部审核完成的时间 + String projectCode = project.getProjectCode(); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + List ids = projects.stream().map(Project::getId).collect(Collectors.toList()); + //查询 项目与实例关联表 + ProjectInst unitInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, ids) + .eq(ProjectInst::getInstType, instType) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(unitInst)){ + return vo; + } + //查询 这个实例 的完成时间 + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .finished() + .processInstanceId(unitInst.getInstCode()) + .singleResult(); + if(Objects.isNull(instance)){ + return vo; + } + Date endTime = instance.getEndTime(); + vo.setStatusTime(BizUtils.convertDate(endTime)); + return vo; + } + + /** + * 不同的项目状态 去求不同的审批完成时间 非审批类型的 + * @param project + * @return + */ + public ProtraitProjectStatusSituationVO generateStatus(Project project,String statusName, + Integer beforeStatusCode,Integer afterStatusCode) { + ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); + if(Objects.isNull(project)){ + return vo; + } + vo.setStatusName(statusName); + //查询 单位内部审核完成的时间 + String projectCode = project.getProjectCode(); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + List ids = projects.stream().map(Project::getId).collect(Collectors.toList()); + //查询 状态机流转的时间点 + ProjectStatusChange statusChange = statusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getBeforeStatus, beforeStatusCode) + .eq(ProjectStatusChange::getProjectCode, projectCode) + .eq(ProjectStatusChange::getAfterStatus, afterStatusCode) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(statusChange)){ + return vo; + } + vo.setStatusTime(statusChange.getCreateOn()); + return vo; + } + + /** + * 绩效 + * @param project + * @return + */ + public ProtraitProjectStatusSituationVO generatePerformanceStatus(Project project) { + ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); + vo.setStatusName(DashboardConstant.Protrait.PERFORMANCE); + if(Objects.isNull(project)){ + return vo; + } + //查询 绩效完成 核查时间 + String projectCode = project.getProjectCode(); + PerformanceAppraisalProject performance = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getProjectCode,projectCode) + .isNotNull(PerformanceAppraisalProject::getVerifyTotalScore) + .isNotNull(PerformanceAppraisalProject::getVerifyScoreTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(performance)){ + vo.setStatusTime(performance.getVerifyScoreTime()); + } + return vo; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java new file mode 100644 index 0000000..4b5ca6f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java @@ -0,0 +1,123 @@ +package com.hz.pm.api.dashboard.helper; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.dashboard.constant.ChartTypeEnum; +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.dashboard.model.basic.AnalysisData; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.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 static AnalysisChart buildAnalysisChartString(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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java new file mode 100644 index 0000000..1fb3396 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.dashboard.helper; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.dashboard.constant.AnalysisBasicConstant; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.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.Objects; +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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/CockpitStatsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/CockpitStatsManage.java new file mode 100644 index 0000000..1957034 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/CockpitStatsManage.java @@ -0,0 +1,93 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.handle.CockpitStatsHandler; +import com.hz.pm.api.dashboard.model.dto.CockpitApplicationDTO; +import com.hz.pm.api.dashboard.model.dto.CockpitStatsSaveDTO; +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; +import com.hz.pm.api.dashboard.service.ICockpitApplicationService; +import com.hz.pm.api.dashboard.service.ICockpitStatsService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname CockpitStatsManage + * @Description + * @Date 2023/10/11 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class CockpitStatsManage { + + private final ICockpitStatsService cockpitStatsService; + + private final CockpitStatsHandler convertCockpitStats; + + private final ICockpitApplicationService cockpitApplicationService; + + /** + * 驾驶舱 统计数据 + * @param regionCode + * @param year + * @return + */ + public CockpitStatsVO getData(String regionCode, Integer year) { + CockpitStats cockpitStats = cockpitStatsService.getOne(Wrappers.lambdaQuery(CockpitStats.class) + .eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) + .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) + .eq(Objects.nonNull(year), CockpitStats::getYear, year) + .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(cockpitStats)){ + return new CockpitStatsVO(); + } + + List aps = cockpitApplicationService + .list(Wrappers.lambdaQuery(CockpitApplication.class) + .orderByAsc(CockpitApplication::getCreateOn)); + + return convertCockpitStats.convertCockpitStats(cockpitStats,regionCode,year,aps); + } + + public void save(List saves) { + for(CockpitStatsSaveDTO save : saves){ + List cockpitStatsList = cockpitStatsService.list(Wrappers.lambdaUpdate(CockpitStats.class) + .eq(Objects.nonNull(save.getRegionCode()), CockpitStats::getRegionCode, save.getRegionCode()) + .eq(Objects.nonNull(save.getYear()), CockpitStats::getYear, save.getYear())); + if(CollUtil.isNotEmpty(cockpitStatsList)){ + for(CockpitStats cockpitStats : cockpitStatsList){ + BeanUtil.copyProperties(save,cockpitStats, CopyOptions.create().ignoreNullValue()); + cockpitStatsService.updateById(cockpitStats); + } + } + + if(Objects.nonNull(save.getCockpitApplications())){ + cockpitApplicationService.remove(Wrappers.lambdaQuery(CockpitApplication.class)); + + List cockpitApplications = save.getCockpitApplications(); + if(CollUtil.isNotEmpty(cockpitApplications)){ + List applications = cockpitApplications.stream() + .map(a -> BeanUtil.copyProperties(a,CockpitApplication.class)) + .collect(Collectors.toList()); + cockpitApplicationService.saveBatch(applications); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java new file mode 100644 index 0000000..be17e2d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java @@ -0,0 +1,168 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.dashboard.constant.ChartTypeEnum; +import com.hz.pm.api.dashboard.helper.DashboardChartAssembler; +import com.hz.pm.api.dashboard.helper.DashboardHelper; +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.dashboard.model.basic.AnalysisData; +import com.hz.pm.api.dashboard.model.basic.StarExpertBO; +import com.hz.pm.api.dashboard.model.po.QueryYearPO; +import com.hz.pm.api.dashboard.model.vo.ExpertDashboardSummaryVO; +import com.hz.pm.api.expert.constant.ExpertUserInfoStepEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java new file mode 100644 index 0000000..98ab64a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java @@ -0,0 +1,566 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.dashboard.constant.ChartTypeEnum; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.handle.ApplicationHandler; +import com.hz.pm.api.dashboard.handle.ProjectStatusHandler; +import com.hz.pm.api.dashboard.helper.DashboardChartAssembler; +import com.hz.pm.api.dashboard.helper.DashboardHelper; +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.dashboard.model.basic.CompanyProjectCntBO; +import com.hz.pm.api.dashboard.model.basic.ProjectATIISBO; +import com.hz.pm.api.dashboard.model.po.QueryYearPO; +import com.hz.pm.api.dashboard.model.vo.*; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovBizProjectApplyService; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.req.NoticeListReq; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedReq; +import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO; +import com.hz.pm.api.workbench.converter.WorkbenchConverter; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/8/2 上午10:39 + */ + +@Component +@RequiredArgsConstructor +public class DashboardProjectManage { + + private final IProjectService iProjectService; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovBizProjectApplyService applyService; + + + private final IGovOperationProjectBaseinfoService operationBaseService; + private final INdProjectDelayApplyService iProjectDelayApplyService; + private final DashboardHelper dashboardHelper; + private final IPurchaseService iPurchaseService; + + private final ProjectStatusHandler statusHandler; + + private final IProjectTagService projectTagService; + + private final ApplicationHandler applicationHandler; + + 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.buildAnalysisChartString(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; + } + + /** + * 驾驶舱-项目画像 + * @param projectCode + * @return + */ + public DashboardProjectProtraitVO getProjectPortrait(String projectCode) { + DashboardProjectProtraitVO res = new DashboardProjectProtraitVO(); + //1.先查询项目 + Project project = iProjectService.getProjectByCode(projectCode); + + GovBizProjectBaseinfo baseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + GovOperationProjectBaseinfo operationBase = operationBaseService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)){ + return res; + } + + //2.转换项目信息 + if(Objects.nonNull(project)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); + projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(project)); + res.setProjectInfo(projectInfo); + }else if(Objects.nonNull(baseInfo)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate("0"); + if(Objects.nonNull(apply)){ + try{ + projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); + }catch (Exception e){ + } + projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); + projectInfo.setBuildCycle(apply.getBaseProjDuration()); + projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); + } + projectInfo.setProjectCode(projectCode); + projectInfo.setProjectName(baseInfo.getBaseProjName()); + projectInfo.setBuildOrgName(baseInfo.getBaseBuildDeprt()); + projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); + projectInfo.setStatus(baseInfo.getBaseProjSetProg()); + res.setProjectInfo(projectInfo); + }else if(Objects.nonNull(operationBase)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate("0"); + if(Objects.nonNull(apply)){ + try{ + projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); + }catch (Exception e){ + } + projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); + projectInfo.setBuildCycle(apply.getBaseProjDuration()); + projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); + } + projectInfo.setProjectCode(projectCode); + projectInfo.setProjectName(operationBase.getBaseProjName()); + projectInfo.setBuildOrgName(operationBase.getBaseBuildDeprt()); + projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(operationBase)); + projectInfo.setStatus(operationBase.getBaseProjSetProg()); + res.setProjectInfo(projectInfo); + } + + + //4.查询项目特征 + res.setProjectFeatures(projectTagService.getProjectTas(projectCode)); + + //5.查询项目产出 + res.setProjectOutput(applicationHandler.generateOutput(projectCode)); + + return res; + } + + /** + * 计算安全投入 + * @param project + * @return + */ + public static String convertSafetyInputRate(Project project) { + String safetyInputDescribe = project.getSafetyInputDescribe(); + if(org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)){ + try{ + JSONArray array = JSON.parseArray(safetyInputDescribe); + final Double[] total = {0.0}; + array.forEach(j -> { + JSONObject json = JSON.parseObject(JSON.toJSONString(j)); + Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); + if(Objects.nonNull(safetyInputAmount)){ + total[0] += safetyInputAmount; + } + }); + Double totalAmount = total[0]; + //申报金额 + BigDecimal declareAmount = project.getDeclareAmount(); + if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ + return DashboardConstant.Protrait.ZREO_PERCEN; + } + BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) + .divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) + .stripTrailingZeros(); + return rate.toPlainString(); + }catch (Exception e){} + } + return DashboardConstant.Protrait.ZREO_PERCEN; + } + + /** + * 生成项目 状态流转信息 + * @param project + * @return + */ + private List generateProjectStatus(Project project) { + final List res = Lists.newArrayList(); + //1.计划(单位内部审核) + res.add(new ProtraitProjectStatusSituationVO()); + //2.申报(项目预审) + res.add(new ProtraitProjectStatusSituationVO()); + //3.审批(建设方案审批) + res.add(new ProtraitProjectStatusSituationVO()); + //4.建设(立项后的建设中) + res.add(new ProtraitProjectStatusSituationVO()); + //5.验收(终验) + res.add(new ProtraitProjectStatusSituationVO()); + //6.运维(todo: 运维时间还没有) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + //7.绩效 + res.add(new ProtraitProjectStatusSituationVO()); + //8.注销(todo: 还没有注销功能) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + + CompletableFuture.allOf( + CompletableFuture.runAsync(() -> { + res.set(0,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + res.set(1,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + res.set(2,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + res.set(3,statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, + ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + res.set(4,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + res.set(6, statusHandler.generatePerformanceStatus(project)); + }, ForkJoinPool.commonPool()) + ).join(); + return res; + } + + private List generateProjectStatus(GovBizProjectBaseinfo baseinfo) { + final List res = Lists.newArrayList(); + //1.计划(单位内部审核) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + //2.申报(项目预审) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + //3.审批(建设方案审批) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + //4.建设(立项后的建设中) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + //5.验收(终验) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); + //6.运维(todo: 运维时间还没有) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + //7.绩效 + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + //8.注销(todo: 还没有注销功能) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + return res; + } + + private List generateProjectStatus(GovOperationProjectBaseinfo baseinfo) { + final List res = Lists.newArrayList(); + //1.计划(单位内部审核) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + //2.申报(项目预审) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + //3.审批(建设方案审批) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + //4.建设(立项后的建设中) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + //5.验收(终验) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); + //6.运维(todo: 运维时间还没有) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + //7.绩效 + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + //8.注销(todo: 还没有注销功能) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java new file mode 100644 index 0000000..5aa8f0d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java @@ -0,0 +1,303 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.model.entity.DataDTO; +import com.hz.pm.api.dashboard.model.vo.EarlyWarningStatisticsVO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.WarningFlowTypeEnum; +import com.hz.pm.api.projectlib.enumeration.WarningOperationTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; +import com.hz.pm.api.sys.utils.EarlyWarningUtil; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.enums.WarningNoticeTypeEnum; +import com.wflow.enums.WarningRuleTypeEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.task.api.Task; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @Classname EarlyWarningStatisticsManage + * @Description + * @Date 2023/12/05 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class EarlyWarningStatisticsManage { + + private final IEarlyWarningRecordsService earlyWarningRecordsService; + + private final HistoryService historyService; + + private final IProjectInstService projectInstService; + + private final IProjectService projectService; + + private final TaskService taskService; + + private static final List threeYears = Lists.newArrayList(LocalDateTime.now().getYear() - 2, + LocalDateTime.now().getYear() - 1,LocalDateTime.now().getYear()); + + public EarlyWarningStatisticsVO statistics(Integer year) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + //项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE)); + + EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class); + EarlyWarningUtil.buildPermissonWrapper(wrapper,user); + List records = earlyWarningRecordsService.list(wrapper); + //累积总告警数 + res.setAccumulatedAlarmsTotal(records.size()); + res.setAccumulatedAlarmsFlow(records.stream().filter(a -> { + if (Objects.nonNull(a.getRuleType()) && + a.getRuleType().equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size()); + res.setAccumulatedAlarmsFilling(records.stream().filter(a -> { + if (Objects.nonNull(a.getRuleType()) && + a.getRuleType().equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size()); + + //近三年 + List threeYearsAlarms = Lists.newArrayList(); + for(Integer thisYear : threeYears){ + DataDTO yearData = new DataDTO(); + yearData.setName(thisYear.toString()); + yearData.setNum(records.stream().filter(r -> { + if(Objects.nonNull(r.getWarningTime()) && + thisYear.equals(r.getWarningTime().getYear())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size()); + threeYearsAlarms.add(yearData); + } + res.setThreeYearsAlarms(threeYearsAlarms); + + //当前各流程报警数 + List alarmsFlowsNow = Lists.newArrayList(); + for(ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()){ + String processName = stageEnum.getDesc(); + Integer processType = stageEnum.getCode(); + alarmsFlowsNow.add(DataDTO.of(processName,computeFlowWarningNow(processType,records))); + } + res.setAlarmsFlowsNow(alarmsFlowsNow); + + //当前各填报报警数 + List alarmsFillingNow = Lists.newArrayList(); + for(WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()){ + String processName = fillingEnum.getDesc(); + Integer projectStutas = fillingEnum.getProjectStutas(); + alarmsFillingNow.add(DataDTO.of(processName,computeFillingNow(projectStutas,records,projects))); + } + res.setAlarmsFillingNow(alarmsFillingNow); + + //实施预警 + List alarmsConstruction = Lists.newArrayList(); + for(WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()){ + String name = noticeTypeEnum.getDesc(); + Integer noticeType = noticeTypeEnum.getCode(); + alarmsConstruction.add(DataDTO.of(name,computeConstruction(noticeType,records,projects))); + } + res.setConstructionAlarms(alarmsConstruction); + + //安全监测 + List safetyMonitoring = Lists.newArrayList(); + //--1 安全设计 + safetyMonitoring.add(DataDTO.of("安全设计",0)); + //--2 安全投入低于5% + safetyMonitoring.add(DataDTO.of("安全投入低于5%",computeSafeLessFive(projects))); + //--3 非信创 + safetyMonitoring.add(DataDTO.of("非信创",computeNotXinChuang(projects))); + //--4 等保未做 + safetyMonitoring.add(DataDTO.of("等保未做",0)); + //--5 密评未做 + safetyMonitoring.add(DataDTO.of("密评未做",0)); + res.setSafetyMonitoring(safetyMonitoring); + return res; + } + + //计算非信创 + private Integer computeNotXinChuang(List projects) { + return projects.stream().filter(p -> StringUtils.isNotBlank(p.getCloudType()) && + !p.getCloudType().contains("2")) + .collect(Collectors.toList()).size(); + } + + //计算安全投入低于5% + private Integer computeSafeLessFive(List projects) { + return projects.stream().filter(p -> { + //计算出 安全投入 + BigDecimal rate = new BigDecimal(DashboardProjectManage.convertSafetyInputRate(p)); + if (rate.compareTo(new BigDecimal(5)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + + private Integer computeConstruction(Integer noticeType, List records, + List projects) { + //终验告警 + List constructionRecords = records.stream().filter(r -> { + if (Objects.nonNull(r.getRuleType()) && + WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) && + WarningOperationTypeEnum.ZHONGYAN.getCode().equals(r.getBiz())) + .collect(Collectors.toList()); + if(CollUtil.isEmpty(constructionRecords)){ + return 0; + } + Map> recordsMap = constructionRecords.stream().collect(Collectors.groupingBy( + WflowEarlyWarningRecords::getProjectCode)); + + //待终验的项目 + List tobeFinalProjects = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + + return tobeFinalProjects.stream().filter(p -> { + if(recordsMap.containsKey(p.getProjectCode())){ + List warningRecords = recordsMap.get(p.getProjectCode()); + //如果是临期的 不能包含有超期的 + if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())){ + for(WflowEarlyWarningRecords warningRecord : warningRecords){ + if(Objects.isNull(warningRecord.getNoticeType()) || warningRecord.getNoticeType() + .equals(WarningNoticeTypeEnum.OVER.getCode())){ + return Boolean.FALSE; + } + } + } + //这个状态有告警 并且 这个项目也是这个类型 + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + + private Integer computeFillingNow(Integer projectStutas, List records, + List projects) { + List fillingRecords = records.stream().filter(r -> { + if (Objects.nonNull(r.getRuleType()) && + WarningRuleTypeEnum.DECLARED_WARNING.getCode().equals(r.getRuleType())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); + if(CollUtil.isEmpty(fillingRecords)){ + return 0; + } + Map> warningMap = fillingRecords.stream() + .collect(Collectors.groupingBy(WflowEarlyWarningRecords::getProjectCode)); + + List thisStatusProjects = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(projectStutas)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + + return thisStatusProjects.stream().filter(p -> { + if(warningMap.containsKey(p.getProjectCode())){ + //这个状态有告警 并且 这个项目也是这个类型 + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + + //计算某个流程当前正在告警的数量 + private Integer computeFlowWarningNow(Integer processType,List records) { + List processRecords = records.stream().filter(r -> { + if (Objects.nonNull(r.getRuleType()) && + WarningRuleTypeEnum.PROCESS_WARNING.getCode().equals(r.getRuleType())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); + if(CollUtil.isEmpty(processRecords)){ + return 0; + } + Map> warningMap = processRecords.stream() + .collect(Collectors.groupingBy(WflowEarlyWarningRecords::getNodeId)); + + //1.先查出 所育 这个类型的 流程 + List proInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstType, processType)); + if(CollUtil.isEmpty(proInsts)){ + return 0; + } + //2.再筛选一下 选出 正在审核 未完成的 + Set instCodes = proInsts.stream().map(ProjectInst::getInstCode) + .collect(Collectors.toSet()); + List processes = historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(instCodes) + .unfinished() + .orderByProcessInstanceStartTime() + .asc() + .list(); + if(CollUtil.isEmpty(processes)){ + return 0; + } + //查出所有正在执行的工作流任务 + List tasks = taskService.createTaskQuery() + .list(); + if(CollUtil.isEmpty(tasks)){ + return 0; + } + Map> taskMap = tasks.stream() + .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + return processes.stream().filter(p -> { + if(taskMap.containsKey(p.getId())){ + List tasksThis = taskMap.get(p.getId()); + for(Task taskThis : tasksThis){ + //说明 当前有告警 + if(warningMap.containsKey(taskThis.getTaskDefinitionKey())){ + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java new file mode 100644 index 0000000..228847a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java @@ -0,0 +1,341 @@ +package com.hz.pm.api.dashboard.manage; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.entity.DataDTO; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.model.vo.ExpertStatisticsVO; +import com.hz.pm.api.expert.constant.ExpertUserInfoStepEnum; +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.meta.service.IExpertTagService; +import com.hz.pm.api.meta.service.IMetaDictionaryService; +import com.hz.pm.api.meta.service.IMetaTagService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; + +/** + * @Classname ExpertStatisticsManage + * @Description + * @Date 2023/12/04 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ExpertStatisticsManage { + + private final RegionCacheHelper regionCacheHelper; + + private final IExpertUserFullInfoService userFullInfoService; + + private final IExpertIntentionWorkRegionService expertIntentionWorkRegionService; + + private final IExpertTagService expertTagService; + + private final IMetaTagService metaTagService; + + private final IExpertDictionaryService expertDictionaryService; + + private final IMetaDictionaryService metaDictionaryService; + + private Integer[] years = new Integer[]{LocalDateTime.now().getYear()-2, + LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear(), + LocalDateTime.now().getYear()+1,LocalDateTime.now().getYear()+2}; + + private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, + LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; + + private String[] SHENGWEIDU = new String[]{DashboardConstant.Expert.NETWORK_CODE, + DashboardConstant.Expert.DANGZHENG_CODE,DashboardConstant.Expert.FANGAN_CODE, + DashboardConstant.Expert.JISHU_CODE,DashboardConstant.Expert.XINCHUANG_CODE, + DashboardConstant.Expert.RUANYING_CODE}; + + private String[] SHIWEIDU = new String[]{DashboardConstant.Expert.CAIWU_CODE, + DashboardConstant.Expert.XINXIHUA_CODE,DashboardConstant.Expert.XINCHUANG_OTTHER_CODE}; + + private String[] TYPES = new String[]{DashboardConstant.Expert.EXPERT_TYPE_INNER, + DashboardConstant.Expert.EXPERT_TYPE_OUT}; + + private String[] LEVELS = new String[]{DashboardConstant.Expert.EXPERT_LEVEL_ZHENGGAO, + DashboardConstant.Expert.EXPERT_LEVEL_FUGAO,DashboardConstant.Expert.EXPERT_LEVEL_MID, + DashboardConstant.Expert.EXPERT_LEVEL_CHUJI,DashboardConstant.Expert.EXPERT_LEVEL_NULL}; + + /** + * 专家统计 + * @param year + * @return + */ + public ExpertStatisticsVO statistics(Integer year) { + List experts = userFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .eq(ExpertUserFullInfo::getExpertAccountStatus, DashboardConstant.Expert.ACCOUNT_STATUS_OK) + .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); + List intentionWorkRegions = expertIntentionWorkRegionService.list(); + + List expertTags = expertTagService.list(); + + List tags = metaTagService.queryAll(); + + List dictionaries = metaDictionaryService.queryAll(); + Set code = Sets.newHashSet(); + Map dictionMap = dictionaries.stream().filter(d -> code.add(d.getDictionaryCode())) + .collect(Collectors.toMap(DictionaryDTO::getDictionaryCode, DictionaryDTO::getName)); + + List expertDictionaries = expertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) + .eq(ExpertDictionary::getExpertInfoField, DashboardConstant.Expert.EXPERT_TYPE)); + + ExpertStatisticsVO res = new ExpertStatisticsVO(); + CompletableFuture.allOf( + CompletableFuture.runAsync(() -> { + //选择的年份去计算的数据 + yearCompleteExpert(res,year,experts,intentionWorkRegions,expertTags, + tags,expertDictionaries,dictionMap); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + //近三年 + threeYearsCompleteExpert(res,experts); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + //近一年 + lastYearsCompleteExpert(res,experts); + }, ForkJoinPool.commonPool()) + ).join(); + + return res; + } + + /** + * 近一年 + * @param res + */ + private void lastYearsCompleteExpert(ExpertStatisticsVO res,List experts) { + List lastYear = experts.stream().filter(expert -> { + if (expert.getCreateOn().compareTo(LocalDateTime.now().plusYears(-1)) >= 0 && + expert.getCreateOn().compareTo(LocalDateTime.now()) <= 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + res.setThisYearAdded(lastYear.size()); + } + + /** + * 近三年 + * @param res + */ + private void threeYearsCompleteExpert(ExpertStatisticsVO res,List experts) { + List threeYearsAdds = Lists.newArrayList(); + for (Integer year : threeYears){ + threeYearsAdds.add(DataDTO.of(year.toString(),year.toString(), + experts.stream().filter(e -> { + if (Objects.nonNull(e.getCreateOn()) && year.equals(e.getCreateOn().getYear())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size())); + } + res.setThreeYearsAdded(threeYearsAdds); + } + + /** + * 选择年份或者全部 + * @param res + * @param year + */ + private void yearCompleteExpert(ExpertStatisticsVO res, Integer year, + List experts,List intentionWorkRegions, + List expertTags,List tags,List expertDictionaries, + Map dictionMap) { + res.setTotal(experts.size()); + + Set userSet = Sets.newHashSet(); + Map expertMap = experts.stream().filter(e -> userSet.add(e.getUserId())) + .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); + + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) + .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) + .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); + + //是否要筛选年 + experts = experts.stream().filter(e -> { + if (Objects.nonNull(e.getCreateOn()) && + (Objects.isNull(year) || year.equals(e.getCreateOn().getYear()))) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + + //计算区域专家 + computeRegionExperts(res, intentionWorkRegions, expertMap, regions); + + //计算专家特长 + computeRegionDistribution(res,experts,expertTags,tags); + + //计算专家类型 + computeTypes(res,experts,expertDictionaries,dictionMap); + + //计算专家等级 + computeLevels(res,experts,expertDictionaries,dictionMap); + } + + /** + * 计算 专家等级 + * @param res + * @param experts + */ + private void computeLevels(ExpertStatisticsVO res, List experts, + List expertDictionaries,Map dictionMap) { + List levels = Lists.newArrayList(); + + Set userSets = Sets.newHashSet(); + Map expertUserFullInfoMap = experts.stream() + .filter(u -> userSets.add(u.getUserId())) + .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); + + Map> dictionaryMap = expertDictionaries.stream() + .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); + for(String levelCode : LEVELS){ + int num = 0; + if(dictionaryMap.containsKey(levelCode)){ + List dictionaries = dictionaryMap.get(levelCode); + num = dictionaries.stream().filter(d -> { + if (expertUserFullInfoMap.containsKey(d.getUserId())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + levels.add(DataDTO.of(dictionMap.get(levelCode),levelCode,num)); + } + + res.setLevels(levels); + } + + /** + * 计算 专家类型 + * @param res + * @param experts + */ + private void computeTypes(ExpertStatisticsVO res, List experts, + List expertDictionaries,Map dictionMap) { + List types = Lists.newArrayList(); + + Set userSets = Sets.newHashSet(); + Map expertUserFullInfoMap = experts.stream() + .filter(u -> userSets.add(u.getUserId())) + .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); + + Map> dictionaryMap = expertDictionaries.stream() + .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); + for(String typeCode : TYPES){ + int num = 0; + if(dictionaryMap.containsKey(typeCode)){ + List dictionaries = dictionaryMap.get(typeCode); + num = dictionaries.stream().filter(d -> { + if(expertUserFullInfoMap.containsKey(d.getUserId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + types.add(DataDTO.of(dictionMap.get(typeCode),typeCode,num)); + } + + res.setTypes(types); + } + + //计算专家特长 + private void computeRegionDistribution(ExpertStatisticsVO res, List experts, + List expertTags, List tags) { + Set userSets = Sets.newHashSet(); + Map expertUserFullInfoMap = experts.stream() + .filter(u -> userSets.add(u.getUserId())) + .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); + + Map> typeDistribution = Maps.newHashMap(); + + Map> tagsMap = + expertTags.stream().filter(e -> Objects.nonNull(e.getTagCode())) + .collect(Collectors.groupingBy(ExpertTag::getTagCode)); + + Set tagSets = Sets.newHashSet(); + Map tagNameMap = tags.stream().filter(t -> tagSets.add(t.getTagCode())) + .collect(Collectors.toMap(TagDTO::getTagCode, TagDTO::getTagName)); + + //1.省维度 + List shengWeidu = Lists.newArrayList(); + for(String code : SHENGWEIDU){ + shengWeidu.add(getExpertData(expertUserFullInfoMap, + tagsMap, tagNameMap, code)); + } + + //2.市维度 + List shiWeidu = Lists.newArrayList(); + for(String code : SHIWEIDU){ + shiWeidu.add(getExpertData(expertUserFullInfoMap, + tagsMap, tagNameMap, code)); + } + + typeDistribution.put(DashboardConstant.Expert.DISTRIBUTION_SHENG,shengWeidu); + typeDistribution.put(DashboardConstant.Expert.DISTRIBUTION_SHI,shiWeidu); + res.setTypeDistribution(typeDistribution); + } + + /** + * 包装 + * @param expertUserFullInfoMap + * @param tagsMap + * @param tagNameMap + * @param code + * @return + */ + private static DataDTO getExpertData(Map expertUserFullInfoMap, Map> tagsMap, Map tagNameMap, String code) { + int num = 0; + if(tagsMap.containsKey(code)){ + List ets = tagsMap.get(code); + num = ets.stream().filter(e -> { + if(expertUserFullInfoMap.containsKey(e.getUserId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + } + return DataDTO.of(tagNameMap.get(code),code,num); + } + + //计算区域专家 + private static void computeRegionExperts(ExpertStatisticsVO res, List intentionWorkRegions, Map expertMap, List regions) { + List regionExpert = Lists.newArrayList(); + for(RegionDTO region : regions){ + regionExpert.add(DataDTO.of(region.getRegionName(),region.getRegionCode(), + intentionWorkRegions.stream().filter(w -> { + if(Objects.nonNull(w) && Objects.nonNull(w.getRegionCode()) && + w.getRegionCode().equals(region.getRegionCode()) && + expertMap.containsKey(w.getUserId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size())); + } + res.setRegionExpert(regionExpert); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java new file mode 100644 index 0000000..bd7f81b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java @@ -0,0 +1,471 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.dashboard.model.vo.FundStatisticsVO; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; +import com.hz.pm.api.gov.model.entity.GovBizProjectApprove; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.model.entity.GovBizProjectProcure; +import com.hz.pm.api.gov.service.IGovBizProjectApplyService; +import com.hz.pm.api.gov.service.IGovBizProjectApproveService; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import com.hz.pm.api.gov.service.IGovBizProjectProcureService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @Classname FundStatisticsManage + * @Description + * @Date 2023/11/24 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class FundStatisticsManage { + private final IProjectService projectService; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovBizProjectApplyService applyService; + + private final IGovBizProjectApproveService approveService; + + private final IGovBizProjectProcureService procureService; + + private Integer[] years = new Integer[]{2021,2022,2023,2024,2025}; + + private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, + LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; + + /** + * 项目统计 + * @param year + * @return + */ + public FundStatisticsVO statistics(Integer year) { + FundStatisticsVO res = new FundStatisticsVO(); + + CompletableFuture.allOf( + CompletableFuture.runAsync(() -> { + //选择的年份去计算的数据 + yearCompleteAmount(res,year); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + //近三年 + threeYearsCompleteAmount(res); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + //所有年 用于算累积 + allYearsCompleteAmount(res); + }, ForkJoinPool.commonPool()) + ).join(); + + return res; + } + + /** + * 计算 所有年的 + * @param res + */ + private void allYearsCompleteAmount(FundStatisticsVO res) { + //1.申报项目 和 归集项目 + //申报项目 + List allProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .in(Project::getProjectYear, years)); + + //项目归集 + List allApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjSetYear, years)); + + List allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId) + .collect(Collectors.toList()); + + List allBaseInfos = Lists.newArrayList(); + List allApplies = Lists.newArrayList(); + List allApproves = Lists.newArrayList(); + List allProcures = Lists.newArrayList(); + + if(CollUtil.isNotEmpty(allProjIds)){ + allBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .in(GovBizProjectBaseinfo::getBaseProjId,allProjIds)); + if(CollUtil.isNotEmpty(allBaseInfos)){ + List allBaseProjIds = allBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + allApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,allBaseProjIds)); + allApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId,allBaseProjIds)); + allProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId,allBaseProjIds)); + } + } + + //2.4 累积 核减 + res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects,allApplies, + allApproves,allProcures)); + } + + /** + * 计算核减资金的方法 + * @param projects + * @param applies + * @param approves + * @param procures + * @return + */ + private BigDecimal completeDeductionAmount(List projects, + List applies, List approves, + List procures) { + //首先完成年度计划 并且未注销的项目 + List normalProjects = projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.BE_SUSPENDED.getCode()) > 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + //计划核减 + FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(normalProjects,applies,approves); + //批复核减 + FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(normalProjects,approves,planHejian.getApproval()); + //合同核减 + FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(normalProjects,procures,approvalHejian.getApproval()); + + return planHejian.getDiff().add(approvalHejian.getDiff()).add(contractHejian.getDiff()); + } + + //计算 计划阶段的 核减金额 + private FundStatisticsVO.HeJianAmount computePlanHeJian(List projects, List applies, + List approves) { + FundStatisticsVO.HeJianAmount heJianAmount = new FundStatisticsVO.HeJianAmount(); + + //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) + final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; + projects.stream().map(p -> { + BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? + p.getDeclareAmount() : BigDecimal.ZERO; + return declareAmount; + }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); + final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; + applies.stream().map(g -> { + BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; + return totalAmount; + }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); + BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); + heJianAmount.setApprove(declaredAmountApproveTotal); + + //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) + final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; + projects.stream().map(p -> { + BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; + return declareAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); + final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; + approves.stream().map(p -> { + BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; + return expertTotalMoney; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); + BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); + heJianAmount.setApproval(approvalAmountApproveTotal); + //申报的差额 + BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); + heJianAmount.setDiff(subtractApprove); + return heJianAmount; + } + + //计算 批复阶段的 核减金额 + private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List projects,List approves, + BigDecimal approvalAmountApproveTotal){ + FundStatisticsVO.HeJianAmount approvalHejian = new FundStatisticsVO.HeJianAmount(); + approvalHejian.setApprove(approvalAmountApproveTotal); + //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) + final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; + projects.stream().map(p -> { + BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; + return proposeTotalInvest; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); + final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; + approves.stream().map(p -> { + BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; + return reviewTotalMoney; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); + BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); + approvalHejian.setApproval(approvalAmountApprovalTotal); + //批复的差额 + BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); + approvalHejian.setDiff(subtractApproval); + return approvalHejian; + } + + //计算 合同阶段的 核减金额 + private FundStatisticsVO.HeJianAmount computeContractHeJian(List projects,List procures, + BigDecimal approvalAmountApprovalTotal){ + FundStatisticsVO.HeJianAmount contractHejian = new FundStatisticsVO.HeJianAmount(); + contractHejian.setApprove(approvalAmountApprovalTotal); + //合同的批复金额(申报项目:成交金额 项目归集:成交金额) + final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; + projects.stream().map(p -> { + BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; + return transactionAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); + final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; + procures.stream().map(p -> { + BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? + p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; + return purchaseAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); + BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); + contractHejian.setApproval(approvalAmountContractTotal); + //合同的差额 + BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); + contractHejian.setDiff(subtractContract); + return contractHejian; + } + + /** + * 近三年 + * @param res + */ + private void threeYearsCompleteAmount(FundStatisticsVO res) { + //申报项目 + List threeYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .in(Project::getProjectYear, threeYears)); + //项目归集 + List threeYearsApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjSetYear, threeYears)); + List threeYearsProjIds = threeYearsApplieYears.stream().map(GovBizProjectApply::getBaseProjId) + .collect(Collectors.toList()); + List threeYearsBaseInfos = Lists.newArrayList(); + List threeYearsApplies = Lists.newArrayList(); + List threeYearsApproves = Lists.newArrayList(); + List threeYearsProcures = Lists.newArrayList(); + + if(CollUtil.isNotEmpty(threeYearsProjIds)){ + threeYearsBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); + if(CollUtil.isNotEmpty(threeYearsBaseInfos)){ + List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + threeYearsApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); + threeYearsApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); + threeYearsProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); + } + } + + //2.4 近三年 核减 + res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects,threeYearsApplies, + threeYearsApproves,threeYearsProcures)); + + //安全起见 再排序下 + Arrays.sort(threeYears); + + List threeYearsDeduction = Lists.newArrayList(); + for(Integer year : threeYears){ + FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData(); + //申报项目 + List thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getProjectYear, year)); + //项目归集 + List thisYearApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjSetYear, year)); + List thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId) + .collect(Collectors.toList()); + List thisYearBaseInfos = Lists.newArrayList(); + List thisYearApplies = Lists.newArrayList(); + List thisYearApproves = Lists.newArrayList(); + List thisYearProcures = Lists.newArrayList(); + + if(CollUtil.isNotEmpty(thisYearProjIds)){ + thisYearBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); + if(CollUtil.isNotEmpty(thisYearBaseInfos)){ + List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + thisYearApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); + thisYearApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); + thisYearProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); + } + } + amountData.setName(year.toString()); + amountData.setAmount(completeDeductionAmount(thisYearsProjects,thisYearApplies, + thisYearApproves,thisYearProcures)); + threeYearsDeduction.add(amountData); + } + res.setThreeYearsDeduction(threeYearsDeduction); + } + + /** + * 选择年份去计算 + * @param res + */ + private void yearCompleteAmount(FundStatisticsVO res, Integer year) { + //申报项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Objects.nonNull(year), Project::getProjectYear, year) + .in(Objects.isNull(year), Project::getProjectYear, years)); + //项目归集 + List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(Objects.nonNull(year), GovBizProjectApply::getBaseProjSetYear, year) + .in(Objects.isNull(year), GovBizProjectApply::getBaseProjSetYear, years)); + List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) + .collect(Collectors.toList()); + List baseInfos = Lists.newArrayList(); + List applies = Lists.newArrayList(); + List approves = Lists.newArrayList(); + List procures = Lists.newArrayList(); + if(CollUtil.isNotEmpty(yearProjIds)){ + baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); + if(CollUtil.isNotEmpty(baseInfos)){ + List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,baseProjIds)); + approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId,baseProjIds)); + procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId,baseProjIds)); + } + } + //2 + //2.1 总申请金额 + final BigDecimal[] declaredTotalAmount = {BigDecimal.ZERO}; + projects.stream() + .map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmount[0] = b); + final BigDecimal[] declaredTotalAmountGov = {BigDecimal.ZERO}; + applies.stream() + .map(a -> Objects.nonNull(a.getBaseProjTotalAmount()) ? a.getBaseProjTotalAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmountGov[0] = b); + res.setDeclaredTotalAmount(declaredTotalAmount[0].add(declaredTotalAmountGov[0])); + //2.2 总批复金额 + final BigDecimal[] approvalTotalAmount = {BigDecimal.ZERO}; + projects.stream() + .map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmount[0] = b); + final BigDecimal[] approvalTotalAmountGov = {BigDecimal.ZERO}; + approves.stream() + .map(a -> Objects.nonNull(a.getBaseExpertTotalMoney()) ? a.getBaseExpertTotalMoney() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmountGov[0] = b); + res.setApprovalTotalAmount(approvalTotalAmount[0].add(approvalTotalAmountGov[0])); + //2.3 总合同金额 + final BigDecimal[] contractTotalAmount = {BigDecimal.ZERO}; + projects.stream() + .map(p -> Objects.nonNull(p.getContractAmount()) ? p.getContractAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmount[0] = b); + final BigDecimal[] contractTotalAmountGov = {BigDecimal.ZERO}; + procures.stream() + .map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmountGov[0] = b); + res.setApprovalTotalAmount(contractTotalAmount[0].add(contractTotalAmountGov[0])); + + //计划核减 + FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(projects,applies,approves); + //批复核减 + FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(projects,approves,planHejian.getApproval()); + //合同核减 + FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(projects,procures,approvalHejian.getApproval()); + res.setPlanDeduction(planHejian); + res.setApprovalDeduction(approvalHejian); + res.setContractDeduction(contractHejian); + + //部门TOP10 + res.setDepartmentTop10(computeTop10(projects,baseInfos,applies,approves,procures)); + } + + /** + * 计算 部门TOP10 + * @param projects + * @param applies + * @param approves + * @param procures + * @return + */ + private List computeTop10(List projects,List baseInfos, + List applies, List approves, + List procures) { + //申报项目颗粒度 + Map> groupProjectMap = projects.stream() + .filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode())) + .collect(Collectors.groupingBy(Project::getBuildOrgCode)); + List projectAmounts = Lists.newArrayList(); + for(Map.Entry> entry : groupProjectMap.entrySet()){ + FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData(); + List ps = entry.getValue(); + if(CollUtil.isNotEmpty(ps)){ + orgAmount.setName(ps.get(0).getBuildOrgName()); + } + orgAmount.setAmount(completeDeductionAmount(entry.getValue(), + Collections.emptyList(), Collections.emptyList(), + Collections.emptyList())); + projectAmounts.add(orgAmount); + } + + //项目归集颗粒度 + Map> groupGovMap = baseInfos.stream() + .filter(b -> StringUtils.isNotBlank(b.getBaseBuildDeprtDing())) + .collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing)); + List govAmounts = Lists.newArrayList(); + for(Map.Entry> entry : groupGovMap.entrySet()){ + FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData(); + List bs = entry.getValue(); + List baseProjIds = Lists.newArrayList(); + if(CollUtil.isNotEmpty(bs)){ + govAmount.setName(bs.get(0).getBaseBuildDeprt()); + baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + } + + List finalBaseProjIds = baseProjIds; + List appliesThis = applies.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) + && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); + List approvesThis = approves.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) + && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); + List procuresThis = procures.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) + && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); + govAmount.setAmount(completeDeductionAmount(Collections.emptyList(), + appliesThis, approvesThis,procuresThis)); + govAmounts.add(govAmount); + } + + //求出TOP10 + return Stream.concat(projectAmounts.stream(), govAmounts.stream()) + .collect(Collectors.toMap(FundStatisticsVO.AmountData::getName, Function.identity(), + (v1, v2) -> { + v1.setAmount(v1.getAmount().add(v2.getAmount())); + return v1; + })).values().stream() + .sorted(Comparator.comparing(FundStatisticsVO.AmountData::getAmount).reversed()) + .limit(10).collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java new file mode 100644 index 0000000..e323b16 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java @@ -0,0 +1,206 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.entity.DataDTO; +import com.hz.pm.api.dashboard.model.vo.MeetingStatisticsVO; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.expert.constant.ReviewResultEnum; +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; +import com.hz.pm.api.expert.service.IExpertReviewService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname MeetingStatisticsManage + * @Description + * @Date 2023/12/05 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class MeetingStatisticsManage { + + private final IMeetingService meetingService; + + private final IExpertReviewService expertReviewService; + + private final RegionCacheHelper regionCacheHelper; + + private final IDingOrganizationService dingOrganizationService; + + private final IProjectService projectService; + + public MeetingStatisticsVO statistics(Integer year) { + MeetingStatisticsVO res = new MeetingStatisticsVO(); + List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); + //查出 年份的 会议数据 + meetings = meetings.stream().filter(m -> { + if(Objects.nonNull(m.getStartTime()) && + (Objects.isNull(year) || year.equals(m.getStartTime().getYear()))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + List meetingIds = meetings.stream().map(Meeting::getId) + .collect(Collectors.toList()); + + //会议总数 + res.setMeetingTotal(meetings.size()); + + //评审数 + List expertReviews = Lists.newArrayList(); + Integer reviewsTotal = 0; + if(CollUtil.isNotEmpty(meetingIds)){ + expertReviews = expertReviewService.list(Wrappers.lambdaQuery(ExpertReview.class) + .eq(ExpertReview::getIsFinal, Boolean.TRUE) + .in(ExpertReview::getMeetingId,meetingIds)); + reviewsTotal = expertReviews.size(); + } + //通过的评审 + List passExpertReviews = expertReviews.stream() + .filter(r -> Objects.nonNull(r.getReviewResult()) && + r.getReviewResult().equals(ReviewResultEnum.PASSED.getCode())) + .collect(Collectors.toList()); + //不通过的评审 + List notpassExpertReviews = expertReviews.stream() + .filter(r -> Objects.nonNull(r.getReviewResult()) && + r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) + .collect(Collectors.toList()); + res.setPassReview(passExpertReviews.size()); + res.setNotPassRate(reviewsTotal.compareTo(0) == 0 ? BigDecimal.ZERO : + BigDecimal.valueOf(notpassExpertReviews.size()).multiply(BigDecimal.valueOf(100) + .divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); + + //各区域 + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) + .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) + .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); + List regionMeetngs = Lists.newArrayList(); + for(RegionDTO region : regions){ + regionMeetngs.add(DataDTO.of(region.getRegionName(),region.getRegionCode(),meetings.stream().filter(m -> { + if(StringUtils.isNotBlank(m.getRegionCode()) && + m.getRegionCode().equals(region.getRegionCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size())); + } + res.setRegionMeetings(regionMeetngs); + + //预审 验收 会议 + List meetingTypes = Lists.newArrayList(); + meetingTypes.add(DataDTO.of("预审会议",ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(), + meetings.stream().filter(m -> { + if(StringUtils.isNotBlank(m.getType()) && + m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() + .toString())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size())); + Long yanshouCount = meetings.stream().filter(m -> { + if (StringUtils.isNotBlank(m.getType()) && + m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode() + .toString())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).count(); + meetingTypes.add(DataDTO.of("验收会议",ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), + yanshouCount.intValue())); + res.setMeetingTypes(meetingTypes); + + //各区县评审 不通过率 + List regionNotpassReview = Lists.newArrayList(); + for(RegionDTO region : regions){ + DataDTO data = new DataDTO(); + data.setCode(region.getRegionCode()); + data.setName(region.getRegionName()); + //先求出 此区域会议 + List regionMeetingIds = meetings.stream().filter(m -> { + if (StringUtils.isNotBlank(m.getRegionCode()) && + m.getRegionCode().equals(region.getRegionCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).map(Meeting::getId).collect(Collectors.toList()); + + List regionReviews = expertReviews.stream().filter(r -> { + if (Objects.nonNull(r.getMeetingId()) && + regionMeetingIds.contains(r.getMeetingId())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + long regionNotpass = regionReviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) && + r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) + .count(); + + data.setRate(CollUtil.isEmpty(regionReviews) ? BigDecimal.ZERO : + BigDecimal.valueOf(regionNotpass).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(regionReviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); + + regionNotpassReview.add(data); + } + res.setNotPassRegionMeetings(regionNotpassReview); + + //各部门 不通过项目TOP10 + List organizations = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE, + DingOrganizationContant.GOV_TEMPORARY))); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE)); + + //TOP10 + List finalExpertReviews = expertReviews; + List notpassTop10 = organizations.stream() + .map(o -> { + DataDTO data = new DataDTO(); + data.setCode(o.getOrganizationCode()); + data.setName(o.getOrganizationName()); + List orgProjects = projects.stream().filter(p -> Objects.nonNull(p.getBuildOrgCode()) && + p.getBuildOrgCode().equals(o.getOrganizationCode())) + .collect(Collectors.toList()); + List projectCodes = orgProjects.stream().map(Project::getProjectCode) + .collect(Collectors.toList()); + if(CollUtil.isEmpty(projectCodes)){ + data.setRate(BigDecimal.ZERO); + return data; + } + List reviews = finalExpertReviews.stream().filter(r -> Objects.nonNull(r.getProjectCode()) && + projectCodes.contains(r.getProjectCode())).collect(Collectors.toList()); + long orgNotpass = reviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) && + r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) + .count(); + data.setRate(CollUtil.isEmpty(reviews) ? BigDecimal.ZERO : + BigDecimal.valueOf(orgNotpass).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(reviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); + return data; + }) + .sorted(Comparator.comparing(DataDTO::getRate).reversed()) + .limit(10).collect(Collectors.toList()); + res.setNotPassTop10(notpassTop10); + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/PerformanceStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/PerformanceStatisticsManage.java new file mode 100644 index 0000000..80401f6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/PerformanceStatisticsManage.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.dashboard.manage; + +import com.google.common.collect.Lists; +import com.hz.pm.api.dashboard.model.vo.PerformanceStatisticsVO; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PerformanceStatisticsManage + * @Description + * @Date 2023/12/05 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class PerformanceStatisticsManage { + + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + + List thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1 + ,LocalDateTime.now().getYear()); + + public PerformanceStatisticsVO statistics(Integer year) { + PerformanceStatisticsVO res = new PerformanceStatisticsVO(); + + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java new file mode 100644 index 0000000..541ea5e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java @@ -0,0 +1,100 @@ +package com.hz.pm.api.dashboard.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.model.entity.DataDTO; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.model.vo.CostStatisticsVO; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCostStatisticsManage + * @Description + * @Date 2023/12/05 17:44 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProjectCostStatisticsManage { + + private final IMeetingExpertService meetingExpertService; + + private final IMeetingService meetingService; + + List thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1 + ,LocalDateTime.now().getYear()); + + public CostStatisticsVO statistics() { + CostStatisticsVO res = new CostStatisticsVO(); + List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); + List meetingIds = meetings.stream().map(Meeting::getId) + .collect(Collectors.toList()); + //算出所有的 同意的专家 + List meetingExperts = meetingExpertService.listAgreedExperts(meetingIds); + + //评审费 每人500 (0.05万) + BigDecimal reviewAoumtExpert = DashboardConstant.Expert.REVIEW_AOUMT_EXPERT; + + //计算累积 + res.setReviewAmount(reviewAoumtExpert.multiply(BigDecimal.valueOf(meetingExperts.size()))); + res.setPricingAmount(BigDecimal.ZERO); + + //近两年 + List twoYearsReviews = Lists.newArrayList(); + List twoYearsPricing = Lists.newArrayList(); + List twoYearsAvg = Lists.newArrayList(); + + DataDTO reviewAvg = new DataDTO(); + reviewAvg.setName("评审费"); + DataDTO pricingAvg = new DataDTO(); + pricingAvg.setName("核价费"); + BigDecimal reviewTwoYearTotal = BigDecimal.ZERO; + BigDecimal pricingTwoYearTotal = BigDecimal.ZERO; + for(Integer thisYear : thisTwoYears){ + //查出 年份的 会议数据 + List yearMeetings = meetings.stream().filter(m -> { + if(Objects.nonNull(m.getStartTime()) && + ( thisYear.equals(m.getStartTime().getYear()))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + List yearMeetingIds = yearMeetings.stream().map(Meeting::getId) + .collect(Collectors.toList()); + //算出所有的 同意的专家 + List yearMeetingExperts = Lists.newArrayList(); + if(CollUtil.isNotEmpty(yearMeetingIds)){ + yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); + } + twoYearsReviews.add(DataDTO.of(thisYear.toString(),reviewAoumtExpert.multiply(BigDecimal + .valueOf(yearMeetingExperts.size())))); + twoYearsPricing.add(DataDTO.of(thisYear.toString(),BigDecimal.ZERO)); + + reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal + .valueOf(yearMeetingExperts.size()))); + } + reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2),BigDecimal.ROUND_CEILING, + RoundingMode.HALF_UP)); + twoYearsAvg.add(reviewAvg); + twoYearsAvg.add(pricingAvg); + res.setTwoYearsReviews(twoYearsReviews); + res.setTwoYearsPricing(twoYearsPricing); + res.setTwoYearsAvg(twoYearsAvg); + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitApplicationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitApplicationMapper.java new file mode 100644 index 0000000..5c7bce7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitApplicationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.dashboard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface CockpitApplicationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.java new file mode 100644 index 0000000..8ca755c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.dashboard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.po.SecrecyPasswordGradePO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface CockpitStatsMapper extends BaseMapper { + + SecrecyPasswordGradePO getSecrecyPasswordGrade(@Param("regionCode") String regionCode, + @Param("year") Integer year); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.xml new file mode 100644 index 0000000..241745b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.xml @@ -0,0 +1,31 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisChart.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisChart.java new file mode 100644 index 0000000..fe135e0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisChart.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.dashboard.model.basic; + +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisData.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisData.java new file mode 100644 index 0000000..1cf441f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/AnalysisData.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/CompanyProjectCntBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/CompanyProjectCntBO.java new file mode 100644 index 0000000..24a1a46 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/CompanyProjectCntBO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.dashboard.model.basic; + +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/ProjectATIISBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/ProjectATIISBO.java new file mode 100644 index 0000000..6e7cfd9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/ProjectATIISBO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.dashboard.model.basic; + +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/QueryTimeYearBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/QueryTimeYearBO.java new file mode 100644 index 0000000..1ffa8c9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/QueryTimeYearBO.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/StarExpertBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/StarExpertBO.java new file mode 100644 index 0000000..3aa2cd4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/StarExpertBO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/YearTrendBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/YearTrendBO.java new file mode 100644 index 0000000..720c91e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/basic/YearTrendBO.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitApplicationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitApplicationDTO.java new file mode 100644 index 0000000..a1c0f55 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitApplicationDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.dashboard.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@ApiModel(value = "驾驶舱统计应用对象", description = "") +public class CockpitApplicationDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("介绍") + private String introduce; + + @ApiModelProperty("年份") + private LocalDateTime createOn; + + @ApiModelProperty("建设单位") + private String buildOrgName; + + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("标签") + private String tags; + + @ApiModelProperty("类型 1最佳应用 2重大应用") + private Integer type; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitStatsSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitStatsSaveDTO.java new file mode 100644 index 0000000..9940ac8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/dto/CockpitStatsSaveDTO.java @@ -0,0 +1,257 @@ +package com.hz.pm.api.dashboard.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +@ApiModel(value = "CockpitStatsSaveDTO", description = "") +public class CockpitStatsSaveDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("年份") + private LocalDateTime createOn; + + @ApiModelProperty("项目监控-超期建设项目数") + private Integer monitorOverdueConstructionProjectsNum; + + @ApiModelProperty("项目监控-超期建设项目-增长比例") + private String monitorOverdueConstructionProjectsRise; + + @ApiModelProperty("项目监控-环节滞后项目数") + private Integer monitorLaggingProjectsNum; + + @ApiModelProperty("项目监控-环节滞后项目-增长比例") + private String monitorLaggingProjectsRise; + + @ApiModelProperty("项目监控-预审驳回项目数") + private Integer monitorRejectedPreReviewProjectsNum; + + @ApiModelProperty("项目监控-预审驳回项目-增长比例") + private String monitorRejectedPreReviewProjectsRise; + + @ApiModelProperty("项目监控-评审驳回项目数") + private Integer monitorRejectedApproveProjectsNum; + + @ApiModelProperty("项目监控-评审驳回项目-增长比例") + private String monitorRejectedApproveProjectsRise; + @ApiModelProperty("项目监控-验收条件未达标") + private Integer monitorAcceptConditionsNotStandardsNum; + + @ApiModelProperty("项目监控-验收条件未达标-增长比例") + private String monitorAcceptConditionsNotStandardsRise; + + @ApiModelProperty("项目监控-安全投入金额(用于算安全投入占比)") + private BigDecimal monitorSafetyInputAmount; + + @ApiModelProperty("项目监控-总申报金额(用于算安全投入占比)") + private BigDecimal monitorDeclaredAmount; + + @ApiModelProperty("项目监控-等保1级数量") + private Integer monitorSecrecyGrade1Num; + + @ApiModelProperty("项目监控-等保2级数量") + private Integer monitorSecrecyGrade2Num; + + @ApiModelProperty("项目监控-等保3级数量") + private Integer monitorSecrecyGrade3Num; + + @ApiModelProperty("项目监控-等保4级数量") + private Integer monitorSecrecyGrade4Num; + + @ApiModelProperty("项目监控-等保5级数量") + private Integer monitorSecrecyGrade5Num; + + @ApiModelProperty("项目监控-密评1级数量") + private Integer monitorPasswordGrade1Num; + + @ApiModelProperty("项目监控-密评2级数量") + private Integer monitorPasswordGrade2Num; + + @ApiModelProperty("项目监控-密评3级数量") + private Integer monitorPasswordGrade3Num; + + @ApiModelProperty("项目监控-密评4级数量") + private Integer monitorPasswordGrade4Num; + + @ApiModelProperty("项目监控-密评5级数量") + private Integer monitorPasswordGrade5Num; + + @ApiModelProperty("专家-总人数") + private Integer expertTotalNum; + + @ApiModelProperty("专家-方案合理性") + private Integer expertPlanRationalityNum; + + @ApiModelProperty("专家-计数可行性评估") + private Integer expertTechnicalFeasibilityAssessmentNum; + + @ApiModelProperty("专家-信创") + private Integer expertXinchuangNum; + + @ApiModelProperty("专家-软硬件核价") + private Integer expertSoftHardPricingNum; + + @ApiModelProperty("专家-党政信息") + private Integer expertPartyGovInfoNum; + + @ApiModelProperty("专家-网络安全") + private Integer expertNetworkSecurityNum; + + @ApiModelProperty("专家-信息化专家") + private Integer expertPromotionInfoTechnologyNum; + + @ApiModelProperty("专家-财务专家") + private Integer expertFinancialNum; + + @ApiModelProperty("顶部-计划项目数") + private Integer topPlanProjectsNum; + + @ApiModelProperty("顶部-批复项目数") + private Integer topApprovalProjectsNum ; + + @ApiModelProperty("顶部-批复金额") + private BigDecimal topApprovalProjectsAmount; + + @ApiModelProperty("顶部-平均建设周期") + private Integer topAverageConstructionPeriod; + + @ApiModelProperty("顶部-在建项目数") + private Integer topOngoingProjectsNum; + + @ApiModelProperty("项目总数") + private Integer projectsTotal; + + @ApiModelProperty("项目总数-计划状态") + private Integer projectsTotalPlan; + + @ApiModelProperty("项目总数-申报状态") + private Integer projectsTotalApply; + + @ApiModelProperty("项目总数-审批状态") + private Integer projectsTotalApprove; + + @ApiModelProperty("项目总数-建设状态") + private Integer projectsTotalConstruction; + + @ApiModelProperty("项目总数-验收状态") + private Integer projectsTotalAccept; + + @ApiModelProperty("项目总数-运维状态") + private Integer projectsTotalOperation; + + @ApiModelProperty("项目总数-绩效状态") + private Integer projectsTotalPerformance; + + @ApiModelProperty("项目总数-注销状态") + private Integer projectsTotalLogOff; + + @ApiModelProperty("优秀项目-最佳应用") + private Integer excellentBestAppNum; + + @ApiModelProperty("优秀项目-重大应用") + private Integer excellentMajorAppNum; + + @ApiModelProperty("优秀项目-跨域共享数") + private Integer excellentCrossDomainSharingNum; + + @ApiModelProperty("优秀项目-跨域共享数") + private Integer excellentCrossLevelSharingNum; + + @ApiModelProperty("核减资金") + private BigDecimal reduceFundsTotal; + + @ApiModelProperty("驳回节约资金") + private BigDecimal rejectSavingsFunds; + + @ApiModelProperty("申报金额-申报状态") + private BigDecimal declaredAmountApprove; + @ApiModelProperty("批复金额-申报状态") + private BigDecimal approvalAmountApprove; + @ApiModelProperty("差额-申报状态") + private BigDecimal differenceApprove; + + @ApiModelProperty("申报金额-批复状态") + private BigDecimal declaredAmountApproval; + @ApiModelProperty("批复金额-批复状态") + private BigDecimal approvalAmountApproval; + @ApiModelProperty("差额-批复状态") + private BigDecimal differenceApproval; + + @ApiModelProperty("申报金额-合同状态") + private BigDecimal declaredAmountContract; + @ApiModelProperty("批复金额-合同状态") + private BigDecimal approvalAmountContract; + @ApiModelProperty("差额-合同状态") + private BigDecimal differenceContract; + + @ApiModelProperty("产出-应用数量") + private Integer produceAppNum; + @ApiModelProperty("产出-数据产品") + private Integer produceDataNum; + @ApiModelProperty("产出-组件数") + private Integer produceComponentNum; + @ApiModelProperty("产出-大脑要素") + private Integer produceBrainElementsNum; + @ApiModelProperty("产出-大脑要素 模型数") + private Integer produceBrainModelNum; + + @ApiModelProperty("绩效-项目总数量") + private Integer performanceTotal; + + @ApiModelProperty("绩效-未评价数量") + private Integer performanceTobeReviewTotal; + + @ApiModelProperty("绩效-已评价数量") + private Integer performanceReviewedTotal; + + @ApiModelProperty("绩效-top1分数") + private BigDecimal performanceTop1Score; + + @ApiModelProperty("绩效-top1名称") + private String performanceTop1Name; + + @ApiModelProperty("绩效-top2分数") + private BigDecimal performanceTop2Score; + + @ApiModelProperty("绩效-top2名称") + private String performanceTop2Name; + + @ApiModelProperty("绩效-top3分数") + private BigDecimal performanceTop3Score; + + @ApiModelProperty("绩效-top3名称") + private String performanceTop3Name; + + @ApiModelProperty("绩效-top4分数") + private BigDecimal performanceTop4Score; + + @ApiModelProperty("绩效-top4名称") + private String performanceTop4Name; + + @ApiModelProperty("绩效-top5分数") + private BigDecimal performanceTop5Score; + + @ApiModelProperty("绩效-top5名称") + private String performanceTop5Name; + + @ApiModelProperty("数据质量") + private BigDecimal dataQuality; + + @ApiModelProperty("数据质量") + private List cockpitApplications; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitApplication.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitApplication.java new file mode 100644 index 0000000..eb8b2a9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitApplication.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.dashboard.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.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@TableName("nd_project_cockpit_applition") +@ApiModel(value = "驾驶舱统计应用对象", description = "") +public class CockpitApplication implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("介绍") + private String introduce; + + @ApiModelProperty("年份") + private LocalDateTime createOn; + + @ApiModelProperty("建设单位") + private String buildOrgName; + + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("标签") + private String tags; + + @ApiModelProperty("类型 1最佳应用 2重大应用") + private Integer type; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitStats.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitStats.java new file mode 100644 index 0000000..c855509 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/entity/CockpitStats.java @@ -0,0 +1,268 @@ +package com.hz.pm.api.dashboard.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.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@TableName("nd_cockpit_stats") +@ApiModel(value = "驾驶舱统计数据对象", description = "") +public class CockpitStats implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("年份") + private LocalDateTime createOn; + + @ApiModelProperty("项目监控-超期建设项目数") + private Integer monitorOverdueConstructionProjectsNum; + + @ApiModelProperty("项目监控-超期建设项目-增长比例") + private String monitorOverdueConstructionProjectsRise = "0"; + + @ApiModelProperty("项目监控-环节滞后项目数") + private Integer monitorLaggingProjectsNum; + + @ApiModelProperty("项目监控-环节滞后项目-增长比例") + private String monitorLaggingProjectsRise = "0"; + + @ApiModelProperty("项目监控-预审驳回项目数") + private Integer monitorRejectedPreReviewProjectsNum; + + @ApiModelProperty("项目监控-预审驳回项目-增长比例") + private String monitorRejectedPreReviewProjectsRise = "0"; + + @ApiModelProperty("项目监控-评审驳回项目数") + private Integer monitorRejectedApproveProjectsNum; + + @ApiModelProperty("项目监控-评审驳回项目-增长比例") + private String monitorRejectedApproveProjectsRise = "0"; + @ApiModelProperty("项目监控-验收条件未达标") + private Integer monitorAcceptConditionsNotStandardsNum; + + @ApiModelProperty("项目监控-验收条件未达标-增长比例") + private String monitorAcceptConditionsNotStandardsRise = "0"; + + @ApiModelProperty("项目监控-安全投入金额(用于算安全投入占比)") + private BigDecimal monitorSafetyInputAmount; + + @ApiModelProperty("项目监控-总申报金额(用于算安全投入占比)") + private BigDecimal monitorDeclaredAmount; + + @ApiModelProperty("项目监控-等保1级数量") + private Integer monitorSecrecyGrade1Num = 0; + + @ApiModelProperty("项目监控-等保2级数量") + private Integer monitorSecrecyGrade2Num = 0; + + @ApiModelProperty("项目监控-等保3级数量") + private Integer monitorSecrecyGrade3Num = 0; + + @ApiModelProperty("项目监控-等保4级数量") + private Integer monitorSecrecyGrade4Num = 0; + + @ApiModelProperty("项目监控-等保5级数量") + private Integer monitorSecrecyGrade5Num = 0; + + @ApiModelProperty("项目监控-密评1级数量") + private Integer monitorPasswordGrade1Num = 0; + + @ApiModelProperty("项目监控-密评2级数量") + private Integer monitorPasswordGrade2Num = 0; + + @ApiModelProperty("项目监控-密评3级数量") + private Integer monitorPasswordGrade3Num = 0; + + @ApiModelProperty("项目监控-密评4级数量") + private Integer monitorPasswordGrade4Num = 0; + + @ApiModelProperty("项目监控-密评5级数量") + private Integer monitorPasswordGrade5Num = 0; + + @ApiModelProperty("专家-总人数") + private Integer expertTotalNum = 0; + + @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") + private Integer specialExpertNum = 0; + + @ApiModelProperty("专家-方案合理性-擅长") + private Integer expertPlanRationalityNum = 0; + + @ApiModelProperty("专家-计数可行性评估-擅长") + private Integer expertTechnicalFeasibilityAssessmentNum = 0; + + @ApiModelProperty("专家-信创-擅长") + private Integer expertXinchuangNum = 0; + + @ApiModelProperty("专家-软硬件核价-擅长") + private Integer expertSoftHardPricingNum = 0; + + @ApiModelProperty("专家-党政信息-擅长") + private Integer expertPartyGovInfoNum = 0; + + @ApiModelProperty("专家-网络安全-擅长") + private Integer expertNetworkSecurityNum = 0; + + @ApiModelProperty("专家-信息化专家") + private Integer expertPromotionInfoTechnologyNum = 0; + + @ApiModelProperty("专家-信创专家") + private Integer expertXinchuangOtherNum = 0; + + @ApiModelProperty("专家-财务专家") + private Integer expertFinancialNum = 0; + + @ApiModelProperty("顶部-计划项目数") + private Integer topPlanProjectsNum = 0; + + @ApiModelProperty("顶部-批复项目数") + private Integer topApprovalProjectsNum = 0; + + @ApiModelProperty("顶部-批复金额") + private BigDecimal topApprovalProjectsAmount; + + @ApiModelProperty("顶部-平均建设周期") + private Integer topAverageConstructionPeriod; + + @ApiModelProperty("顶部-在建项目数") + private Integer topOngoingProjectsNum; + + @ApiModelProperty("项目总数") + private Integer projectsTotal; + + @ApiModelProperty("项目总数-计划状态") + private Integer projectsTotalPlan; + + @ApiModelProperty("项目总数-申报状态") + private Integer projectsTotalApply; + + @ApiModelProperty("项目总数-审批状态") + private Integer projectsTotalApprove; + + @ApiModelProperty("项目总数-建设状态") + private Integer projectsTotalConstruction; + + @ApiModelProperty("项目总数-验收状态") + private Integer projectsTotalAccept; + + @ApiModelProperty("项目总数-运维状态") + private Integer projectsTotalOperation; + + @ApiModelProperty("项目总数-绩效状态") + private Integer projectsTotalPerformance; + + @ApiModelProperty("项目总数-注销状态") + private Integer projectsTotalLogOff; + + @ApiModelProperty("优秀项目-最佳应用") + private Integer excellentBestAppNum; + + @ApiModelProperty("优秀项目-重大应用") + private Integer excellentMajorAppNum; + + @ApiModelProperty("优秀项目-跨域共享数") + private Integer excellentCrossDomainSharingNum; + + @ApiModelProperty("优秀项目-提级共享数") + private Integer excellentCrossLevelSharingNum; + + @ApiModelProperty("核减资金") + private BigDecimal reduceFundsTotal; + + @ApiModelProperty("驳回节约资金") + private BigDecimal rejectSavingsFunds; + + @ApiModelProperty("申报金额-申报状态") + private BigDecimal declaredAmountApprove; + @ApiModelProperty("批复金额-申报状态") + private BigDecimal approvalAmountApprove; + @ApiModelProperty("差额-申报状态") + private BigDecimal differenceApprove; + + @ApiModelProperty("申报金额-批复状态") + private BigDecimal declaredAmountApproval; + @ApiModelProperty("批复金额-批复状态") + private BigDecimal approvalAmountApproval; + @ApiModelProperty("差额-批复状态") + private BigDecimal differenceApproval; + + @ApiModelProperty("申报金额-合同状态") + private BigDecimal declaredAmountContract; + @ApiModelProperty("批复金额-合同状态") + private BigDecimal approvalAmountContract; + @ApiModelProperty("差额-合同状态") + private BigDecimal differenceContract; + + @ApiModelProperty("产出-应用数量") + private Integer produceAppNum = 0; + @ApiModelProperty("产出-数据产品") + private Integer produceDataNum = 0; + @ApiModelProperty("产出-组件数") + private Integer produceComponentNum = 0; + @ApiModelProperty("产出-大脑要素") + private Integer produceBrainElementsNum = 0; + @ApiModelProperty("产出-大脑要素 模型数") + private Integer produceBrainModelNum = 0; + + @ApiModelProperty("绩效-项目总数量") + private Integer performanceTotal = 0; + + @ApiModelProperty("绩效-未评价数量") + private Integer performanceTobeReviewTotal = 0; + + @ApiModelProperty("绩效-已评价数量") + private Integer performanceReviewedTotal = 0; + + @ApiModelProperty("绩效-top1分数") + private BigDecimal performanceTop1Score = BigDecimal.ZERO; + + @ApiModelProperty("绩效-top1名称") + private String performanceTop1Name; + + @ApiModelProperty("绩效-top2分数") + private BigDecimal performanceTop2Score = BigDecimal.ZERO; + + @ApiModelProperty("绩效-top2名称") + private String performanceTop2Name; + + @ApiModelProperty("绩效-top3分数") + private BigDecimal performanceTop3Score = BigDecimal.ZERO; + + @ApiModelProperty("绩效-top3名称") + private String performanceTop3Name; + + @ApiModelProperty("绩效-top4分数") + private BigDecimal performanceTop4Score = BigDecimal.ZERO; + + @ApiModelProperty("绩效-top4名称") + private String performanceTop4Name; + + @ApiModelProperty("绩效-top5分数") + private BigDecimal performanceTop5Score = BigDecimal.ZERO; + + @ApiModelProperty("绩效-top5名称") + private String performanceTop5Name; + + @ApiModelProperty("数据质量") + private BigDecimal dataQuality = BigDecimal.ZERO; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/QueryYearPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/QueryYearPO.java new file mode 100644 index 0000000..0589ae5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/QueryYearPO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/SecrecyPasswordGradePO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/SecrecyPasswordGradePO.java new file mode 100644 index 0000000..c07bebe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/po/SecrecyPasswordGradePO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.dashboard.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel(value = "等保密评PO", description = "") +public class SecrecyPasswordGradePO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目监控-等保1级数量") + private Integer monitorSecrecyGrade1Num = 0; + + @ApiModelProperty("项目监控-等保2级数量") + private Integer monitorSecrecyGrade2Num = 0; + + @ApiModelProperty("项目监控-等保3级数量") + private Integer monitorSecrecyGrade3Num = 0; + + @ApiModelProperty("项目监控-等保4级数量") + private Integer monitorSecrecyGrade4Num = 0; + + @ApiModelProperty("项目监控-等保5级数量") + private Integer monitorSecrecyGrade5Num = 0; + + @ApiModelProperty("项目监控-密评1级数量") + private Integer monitorPasswordGrade1Num = 0; + + @ApiModelProperty("项目监控-密评2级数量") + private Integer monitorPasswordGrade2Num; + + @ApiModelProperty("项目监控-密评3级数量") + private Integer monitorPasswordGrade3Num; + + @ApiModelProperty("项目监控-密评4级数量") + private Integer monitorPasswordGrade4Num; + + @ApiModelProperty("项目监控-密评5级数量") + private Integer monitorPasswordGrade5Num; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CockpitStatsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CockpitStatsVO.java new file mode 100644 index 0000000..0380d0f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CockpitStatsVO.java @@ -0,0 +1,378 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; +import com.hz.pm.api.portrait.model.entity.Tag; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +@Data +@ApiModel(value = "驾驶舱统计数据对象VO", description = "") +public class CockpitStatsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("年份") + private LocalDateTime createOn; + + @ApiModelProperty("项目监测数据") + private Monitor monitorData; + + @ApiModelProperty("项目专家数据") + private Expert expertData; + + @ApiModelProperty("顶部数据") + private TopData topData; + + @ApiModelProperty("地图-项目数") + private List mapProjectData; + + @ApiModelProperty("状态-项目数") + private StatusProjectsData statusProjectsData; + + @ApiModelProperty("优秀项目数据") + private ExcellentData excellentData; + + @ApiModelProperty("核减数据") + private ReduceData reduceData; + + @ApiModelProperty("产出数据") + private ProduceData produceData; + + @ApiModelProperty("绩效数据") + private PerformanceData performanceData; + + @ApiModelProperty("最佳应用or重大应用") + private Map> appDatas; + + @ApiModelProperty("数据质量区域信息") + private List qualityDatas; + + @Data + public static class Monitor { + @ApiModelProperty("项目监控-超期建设项目数") + private Integer monitorOverdueConstructionProjectsNum; + + @ApiModelProperty("项目监控-超期建设项目-增长比例") + private String monitorOverdueConstructionProjectsRise; + + @ApiModelProperty("项目监控-环节滞后项目数") + private Integer monitorLaggingProjectsNum; + + @ApiModelProperty("项目监控-环节滞后项目-增长比例") + private String monitorLaggingProjectsRise; + + @ApiModelProperty("项目监控-预审驳回项目数") + private Integer monitorRejectedPreReviewProjectsNum; + + @ApiModelProperty("项目监控-预审驳回项目-增长比例") + private String monitorRejectedPreReviewProjectsRise; + + @ApiModelProperty("项目监控-评审驳回项目数") + private Integer monitorRejectedApproveProjectsNum; + + @ApiModelProperty("项目监控-评审驳回项目-增长比例") + private String monitorRejectedApproveProjectsRise; + + @ApiModelProperty("项目监控-验收条件未达标") + private Integer monitorAcceptConditionsNotStandardsNum; + + @ApiModelProperty("项目监控-验收条件未达标-增长比例") + private String monitorAcceptConditionsNotStandardsRise; + + @ApiModelProperty("项目监控-安全投入占比 图") + private List monitorSafetyInputRate; + + @ApiModelProperty("项目监控-等保等级图") + private List secrecyGradeCharts; + + @ApiModelProperty("项目监控-密保等级图") + private List passwordGradeCharts; + } + + @Data + public static class SecrecyGradeChart { + public SecrecyGradeChart (Integer level,Integer num){ + this.level = level; + this.num = num; + } + + @ApiModelProperty("等保等级") + private Integer level; + + @ApiModelProperty("等保数量") + private Integer num; + } + + @Data + public static class PasswordGradeChart { + public PasswordGradeChart (Integer level,Integer num){ + this.level = level; + this.num = num; + } + + @ApiModelProperty("密保等级") + private Integer level; + + @ApiModelProperty("密保数量") + private Integer num; + } + + @Data + public static class SafetyInput { + private Integer year; + private BigDecimal rate; + private Integer amount; + } + + @Data + public static class Expert { + @ApiModelProperty("专家-各区域专家数") + private List expertRegionData; + + @ApiModelProperty("专家-总人数") + private Integer expertTotalNum; + + @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") + private Integer specialExpertNum; + + @ApiModelProperty("专家-方案合理性 数量") + private Integer expertPlanRationalityNum; + + @ApiModelProperty("专家-计数可行性评估 数量") + private Integer expertTechnicalFeasibilityAssessmentNum; + + @ApiModelProperty("专家-信创 数量") + private Integer expertXinchuangNum; + + @ApiModelProperty("专家-软硬件核价 数量") + private Integer expertSoftHardPricingNum; + + @ApiModelProperty("专家-党政信息 数量") + private Integer expertPartyGovInfoNum; + + @ApiModelProperty("专家-网络安全 数量") + private Integer expertNetworkSecurityNum; + + @ApiModelProperty("专家-信息化专家 数量") + private Integer expertPromotionInfoTechnologyNum; + + @ApiModelProperty("专家-财务专家 数量") + private Integer expertFinancialNum; + + @ApiModelProperty("专家-信创专家 数量") + private Integer expertXinchuangOtherNum; + } + + @Data + public static class ExpertRegion { + @ApiModelProperty("区域CODE") + private String regionCode; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("专家数量") + private Integer expertNum; + } + + @Data + public static class TopData { + @ApiModelProperty("顶部-计划项目数") + private Integer topPlanProjectsNum; + + @ApiModelProperty("顶部-批复项目数") + private Integer topApprovalProjectsNum; + + @ApiModelProperty("顶部-批复金额") + private BigDecimal topApprovalProjectsAmount; + + @ApiModelProperty("顶部-平均建设周期") + private Integer topAverageConstructionPeriod; + + @ApiModelProperty("顶部-在建项目数") + private Integer topOngoingProjectsNum; + } + + @Data + public static class MapProjectsData { + @ApiModelProperty("区域CODE") + private String regionCode; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("项目数量") + private Integer projectsNum; + } + + @Data + public static class QualityData { + @ApiModelProperty("区域CODE") + private String regionCode; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("质量分数") + private BigDecimal quality = BigDecimal.ZERO; + } + + @Data + public static class StatusProjectsData { + @ApiModelProperty("项目总数-计划状态") + private Integer projectsTotalPlan; + + @ApiModelProperty("项目总数-申报状态") + private Integer projectsTotalApply; + + @ApiModelProperty("项目总数-审批状态") + private Integer projectsTotalApprove; + + @ApiModelProperty("项目总数-建设状态") + private Integer projectsTotalConstruction; + + @ApiModelProperty("项目总数-验收状态") + private Integer projectsTotalAccept; + + @ApiModelProperty("项目总数-运维状态") + private Integer projectsTotalOperation; + + @ApiModelProperty("项目总数-绩效状态") + private Integer projectsTotalPerformance; + + @ApiModelProperty("项目总数-注销状态") + private Integer projectsTotalLogOff; + } + + @Data + public static class ExcellentData { + @ApiModelProperty("优秀项目-最佳应用") + private Integer excellentBestAppNum; + + @ApiModelProperty("优秀项目-重大应用") + private Integer excellentMajorAppNum; + + @ApiModelProperty("优秀项目-跨域共享数") + private Integer excellentCrossDomainSharingNum; + + @ApiModelProperty("优秀项目-跨域共享数") + private Integer excellentCrossLevelSharingNum; + + @ApiModelProperty("优秀项目-列表") + private List excellentProjects; + } + + @Data + public static class ExcellentProjects { + @ApiModelProperty("项目CODE") + private String projectCode; + + @ApiModelProperty("项目名") + private String projectName; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("标签") + private List tags; + } + + @Data + public static class ReduceData { + @ApiModelProperty("核减资金") + private BigDecimal reduceFundsTotal; + + @ApiModelProperty("驳回节约资金") + private BigDecimal rejectSavingsFunds; + + @ApiModelProperty("资金对比图") + private List amountComparisonCharts; + } + + @Data + public static class AmountComparisonChart { + public AmountComparisonChart (String statusName,BigDecimal declaredAmount,BigDecimal approvalAmount,BigDecimal differenceAmount){ + this.statusName = statusName; + this.declaredAmount = declaredAmount; + this.approvalAmount = approvalAmount; + this.differenceAmount = differenceAmount; + } + + @ApiModelProperty("状态名") + private String statusName; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("批复金额") + private BigDecimal approvalAmount; + + @ApiModelProperty("差额") + private BigDecimal differenceAmount; + } + + @Data + public static class ProduceData { + @ApiModelProperty("产出-应用数量") + private Integer produceAppNum; + @ApiModelProperty("产出-数据产品") + private Integer produceDataNum; + @ApiModelProperty("产出-组件数") + private Integer produceComponentNum; + @ApiModelProperty("产出-大脑要素") + private Integer produceBrainElementsNum; + @ApiModelProperty("产出-大脑要素") + private Integer produceBrainModelNum; + } + + @Data + public static class PerformanceData { + @ApiModelProperty("绩效-项目总数量") + private Integer performanceTotal; + + @ApiModelProperty("绩效-未评价数量") + private Integer performanceTobeReviewTotal; + + @ApiModelProperty("绩效-已评价数量") + private Integer performanceReviewedTotal; + + @ApiModelProperty("绩效-top数据") + private List performanceTops; + } + + @Data + public static class PerformanceTop { + public PerformanceTop (String topName,BigDecimal score,String appName){ + this.topName = topName; + this.score = score; + this.appName = appName; + } + + @ApiModelProperty("绩效-top") + private String topName; + + @ApiModelProperty("分数") + private BigDecimal score; + + @ApiModelProperty("应用名称") + private String appName; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CostStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CostStatisticsVO.java new file mode 100644 index 0000000..779774f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/CostStatisticsVO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.model.entity.DataDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "项目成本统计", description = "") +public class CostStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("累积专家评审费用") + private BigDecimal reviewAmount = BigDecimal.ZERO; + + @ApiModelProperty("累积专家核价费用") + private BigDecimal pricingAmount = BigDecimal.ZERO; + + @ApiModelProperty("市本级近两年人工核价费") + private List twoYearsPricing; + + @ApiModelProperty("市本级近两年人工评审费") + private List twoYearsReviews; + + @ApiModelProperty("市本级近两年平均专家评审/核价费") + private List twoYearsAvg; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardInvestmentSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardInvestmentSummaryVO.java new file mode 100644 index 0000000..eaf1dfa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardInvestmentSummaryVO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.dashboard.model.basic.CompanyProjectCntBO; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectCntSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectCntSummaryVO.java new file mode 100644 index 0000000..b9ceb9a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectCntSummaryVO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectProtraitVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectProtraitVO.java new file mode 100644 index 0000000..d954a76 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectProtraitVO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.portrait.model.entity.Tag; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @author ZPF + * @date 2023/10/9 下午3:07 + */ + +@Data +@ApiModel("驾驶舱项目画像VO") +public class DashboardProjectProtraitVO { + + @ApiModelProperty("项目信息") + private ProtraitProjectInfoVO projectInfo; + + @ApiModelProperty("项目特征(就是标签)") + private List projectFeatures; + + @ApiModelProperty("项目产出") + private Map projectOutput; + +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectSummaryVO.java new file mode 100644 index 0000000..3a0cc34 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/DashboardProjectSummaryVO.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java new file mode 100644 index 0000000..1f16e4e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.model.entity.DataDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "预警统计", description = "") +public class EarlyWarningStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("累积报警数") + private Integer accumulatedAlarmsTotal = 0; + + @ApiModelProperty("流程累积报警数") + private Integer accumulatedAlarmsFlow = 0; + + @ApiModelProperty("填报累积报警数") + private Integer accumulatedAlarmsFilling = 0; + + @ApiModelProperty("近三年累积报警数") + private List threeYearsAlarms; + + @ApiModelProperty("当前各流程报警情况") + private List alarmsFlowsNow; + + @ApiModelProperty("当前各填报报警情况") + private List alarmsFillingNow; + + @ApiModelProperty("建设周期预警监测") + private List constructionAlarms; + + @ApiModelProperty("安全监测") + private List safetyMonitoring; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertDashboardSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertDashboardSummaryVO.java new file mode 100644 index 0000000..99aed40 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertDashboardSummaryVO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertStatisticsVO.java new file mode 100644 index 0000000..febd583 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ExpertStatisticsVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.model.entity.DataDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +@ApiModel(value = "专家统计", description = "") +public class ExpertStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("入驻专家总数") + private Integer total = 0; + + @ApiModelProperty("近一年新增专家数") + private Integer thisYearAdded = 0; + + @ApiModelProperty("活跃专家数") + private Integer active = 0; + + @ApiModelProperty("各区县专家数") + private List regionExpert; + + @ApiModelProperty("近三年专家数") + private List threeYearsAdded; + + @ApiModelProperty("专家类型分布") + private Map> typeDistribution; + + @ApiModelProperty("专家类型") + private List types; + + @ApiModelProperty("专家等级") + private List levels; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/FundStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/FundStatisticsVO.java new file mode 100644 index 0000000..12e887b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/FundStatisticsVO.java @@ -0,0 +1,67 @@ +package com.hz.pm.api.dashboard.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "项目资金统计", description = "") +public class FundStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("累积核减总资金") + private BigDecimal accumulatedDeductionTotalAmount; + + @ApiModelProperty("近三年核减总资金") + private BigDecimal threeYearsDeductionTotalAmount; + + @ApiModelProperty("申请总金额") + private BigDecimal declaredTotalAmount; + + @ApiModelProperty("批复总金额") + private BigDecimal approvalTotalAmount; + + @ApiModelProperty("合同总金额") + private BigDecimal contractTotalAmount; + + @ApiModelProperty("近三年核减数据") + private List threeYearsDeduction; + + @ApiModelProperty("计划阶段核减情况") + private HeJianAmount planDeduction; + + @ApiModelProperty("批复阶段阶段核减情况") + private HeJianAmount approvalDeduction; + + @ApiModelProperty("合同阶段阶段核减情况") + private HeJianAmount contractDeduction; + + @ApiModelProperty("各部门核减TOP10") + private List departmentTop10; + + + @Data + public static class AmountData{ + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("名称") + private String name; + } + + @Data + public static class HeJianAmount{ + @ApiModelProperty("申请金额") + private BigDecimal approve; + + @ApiModelProperty("批复金额") + private BigDecimal approval; + + @ApiModelProperty("差额") + private BigDecimal diff; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/MeetingStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/MeetingStatisticsVO.java new file mode 100644 index 0000000..53c8ea6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/MeetingStatisticsVO.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.model.entity.DataDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "评审会议统计", description = "") +public class MeetingStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("评审召开总数") + private Integer meetingTotal = 0; + + @ApiModelProperty("评审通过数") + private Integer passReview = 0; + + @ApiModelProperty("评审不通过率") + private BigDecimal notPassRate = BigDecimal.ZERO; + + @ApiModelProperty("各区县召开总数") + private List regionMeetings; + + @ApiModelProperty("预审/验收 会议情况") + private List meetingTypes; + + @ApiModelProperty("各区县不通过率") + private List notPassRegionMeetings; + + @ApiModelProperty("各部门不通过top10") + private List notPassTop10; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java new file mode 100644 index 0000000..20207c3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.model.entity.DataDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "绩效统计", description = "") +public class PerformanceStatisticsVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("当前已完成项目总数") + private Integer finishedTotalNow = 0; + + @ApiModelProperty("当前已完成自评总数") + private Integer finishedSelfNow = 0; + + @ApiModelProperty("当前已完成复评总数") + private Integer finishedReAppraisalNow = 0; + + @ApiModelProperty("当前需整改项目总数") + private Integer rectifyTotalNow = 0; + + @ApiModelProperty("是否评价") + private List regionMeetings; + + @ApiModelProperty("预审/验收 会议情况") + private List meetingTypes; + + @ApiModelProperty("各区县不通过率") + private List notPassRegionMeetings; + + @ApiModelProperty("各部门不通过top10") + private List notPassTop10; +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectInfoVO.java new file mode 100644 index 0000000..d0cc276 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectInfoVO.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.dashboard.model.basic.AnalysisChart; +import com.hz.pm.api.dashboard.model.basic.StarExpertBO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author ZPF + * @date 2023/10/9 下午3:07 + */ + +@Data +@ApiModel("驾驶舱项目画像里的项目信息VO") +public class ProtraitProjectInfoVO { + + @ApiModelProperty("项目名字") + private String projectName; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("建设单位code") + private String buildOrgCode; + + @ApiModelProperty("建设单位名") + private String buildOrgName; + + @ApiModelProperty("批复金额") + private BigDecimal approvalAmount; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("项目安全投入占比") + private String safetyInputRate; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("超期情况") + private String overdueSituation; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("项目状态情况") + private List statusSituation; + + @ApiModelProperty("系统定位") + private String systemPosition; +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectOutputVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectOutputVO.java new file mode 100644 index 0000000..2676c8e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectOutputVO.java @@ -0,0 +1,117 @@ +package com.hz.pm.api.dashboard.model.vo; + +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + * @author ZPF + * @date 2023/10/9 下午3:07 + */ + +@Data +@Builder +@ApiModel("驾驶舱项目画像里的项目产出VO") +public class ProtraitProjectOutputVO { + + public ProtraitProjectOutputVO(){ + + } + + public ProtraitProjectOutputVO(String name,CloudResourceUsage cloudResourceUsage,DataUsage dataUsage, + ComponentUsage componentUsage,GenerateData generateData,OperationReport operationReport){ + this.name = name; + this.cloudResourceUsage = cloudResourceUsage; + this.dataUsage = dataUsage; + this.componentUsage = componentUsage; + this.generateData = generateData; + this.operationReport = operationReport; + } + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("云资源使用情况") + private CloudResourceUsage cloudResourceUsage = new CloudResourceUsage(); + + @ApiModelProperty("数据使用情况") + private DataUsage dataUsage = new DataUsage(); + + @ApiModelProperty("组件使用情况") + private ComponentUsage componentUsage = new ComponentUsage(); + + @ApiModelProperty("产生数据") + private GenerateData generateData = new GenerateData(); + + @ApiModelProperty("试运行报告") + private OperationReport operationReport = new OperationReport(); + + @Data + public static class CloudResourceUsage{ + @ApiModelProperty("云资源实例使用数") + private String instancesNum = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("云资源实例利用率") + private String utilizationRate = DashboardConstant.Protrait.NONE; + } + + @Data + public static class DataUsage{ + @ApiModelProperty("数据共享申请量") + private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("数据共享使用量") + private String sharedUsage = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("数据共享接口调用量") + private String sharedInterfaceCallVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("协同接口使用量") + private String collaborativeInterfaceCallVolume= DashboardConstant.Protrait.NONE; + } + + @Data + public static class ComponentUsage{ + @ApiModelProperty("组件申请量") + private String applicationVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("组件使用量") + private String useVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("组件调用量") + private String callVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("统一组件调用量") + private String unifyCallolVolume = DashboardConstant.Protrait.NONE; + } + + @Data + public static class GenerateData{ + @ApiModelProperty("产生数据量") + private String volume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("产生数据共享申请量") + private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("产生数据共享使用量") + private String sharedUseVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("产生数据审批通过率") + private String approvalPassRate = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("数据接口被调用量") + private String dataInterfaceCallsVolume = DashboardConstant.Protrait.NONE; + + @ApiModelProperty("协同接口使用量") + private String collaborativeInterfaceCallVolume = DashboardConstant.Protrait.NONE; + } + + @Data + public static class OperationReport{ + @ApiModelProperty("试运行报告通过率") + private String passRate = DashboardConstant.Protrait.NONE; + } +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectStatusSituationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectStatusSituationVO.java new file mode 100644 index 0000000..abe727b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProtraitProjectStatusSituationVO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.dashboard.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import java.time.LocalDateTime; + +/** + * @author ZPF + * @date 2023/10/9 下午3:07 + */ + +@Data +@Builder +@ApiModel("驾驶舱项目画像里的项目状态信息VO") +public class ProtraitProjectStatusSituationVO { + + public ProtraitProjectStatusSituationVO(){ + + } + + public ProtraitProjectStatusSituationVO(String statusName,LocalDateTime statusTime){ + this.statusName = statusName; + this.statusTime = statusTime; + } + + @ApiModelProperty("状态名") + private String statusName; + + @ApiModelProperty("状态时间节点") + private LocalDateTime statusTime; +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitApplicationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitApplicationService.java new file mode 100644 index 0000000..728a1a6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitApplicationService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.dashboard.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface ICockpitApplicationService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitStatsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitStatsService.java new file mode 100644 index 0000000..ba388b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/ICockpitStatsService.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.dashboard.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.po.SecrecyPasswordGradePO; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface ICockpitStatsService extends IService { + + SecrecyPasswordGradePO getSecrecyPasswordGrade(String regionCode,Integer year); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitApplicationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitApplicationServiceImpl.java new file mode 100644 index 0000000..c3c9390 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitApplicationServiceImpl.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.dashboard.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.dashboard.mapper.CockpitApplicationMapper; +import com.hz.pm.api.dashboard.model.entity.CockpitApplication; +import com.hz.pm.api.dashboard.service.ICockpitApplicationService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +@RequiredArgsConstructor +public class CockpitApplicationServiceImpl extends ServiceImpl + implements ICockpitApplicationService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitStatsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitStatsServiceImpl.java new file mode 100644 index 0000000..4a65044 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/service/impl/CockpitStatsServiceImpl.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.dashboard.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.dashboard.mapper.CockpitStatsMapper; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.po.SecrecyPasswordGradePO; +import com.hz.pm.api.dashboard.service.ICockpitStatsService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +@RequiredArgsConstructor +public class CockpitStatsServiceImpl extends ServiceImpl + implements ICockpitStatsService { + + private final CockpitStatsMapper cockpitStatsMapper; + + @Override + public SecrecyPasswordGradePO getSecrecyPasswordGrade(String regionCode, Integer year) { + return cockpitStatsMapper.getSecrecyPasswordGrade(regionCode,year); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/DataScopeColumnConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/DataScopeColumnConst.java new file mode 100644 index 0000000..b8aaa40 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/DataScopeColumnConst.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.datascope.contants; + +/** + *

+ * DataScopeColumnConst + *

+ * + * @author WendyYang + * @since 16:24 2022/11/3 + */ +public interface DataScopeColumnConst { + + String REGION_ID = "region_id"; + + String REGION_CODE = "region_code"; + + String ORG_CODE = "org_code"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/LambdaDataScopeTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/LambdaDataScopeTypeEnum.java new file mode 100644 index 0000000..7a73c9d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/LambdaDataScopeTypeEnum.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.datascope.contants; + +import io.swagger.annotations.ApiModel; + +/** + * @Classname DataScopeTypeEnum + * @Description + * @Date 2022/11/18 11:15 + * @Created by PoffyZhang + */ +@ApiModel(value = "DataScopeTypeEnum", description = "数据范围类型-枚举") +public enum LambdaDataScopeTypeEnum { + /** + * 地区 + */ + REGION, + + /** + * 公司 + */ + ORG, + + /** + * 员工 + */ + EMPLOYEE, + + /** + * 都没有 + */ + NONE; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java new file mode 100644 index 0000000..728f26e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.datascope.model; + +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import lombok.Data; + +import java.util.List; + +/** + *

+ * DataScopeDto + *

+ * + * @author WendyYang + * @since 13:42 2022/11/4 + */ +@Data +public class DataScopeDTO { + + private RoleEnum role; + + private List regionIds; + + private List regionCodes; + + private String orgCode; + + private String employeeCode; + + private Long userId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeEntity.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeEntity.java new file mode 100644 index 0000000..90937d9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeEntity.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.datascope.model; + +import lombok.Data; + +/** + * @Classname DataScopEntity + * @Description + * @Date 2022/11/11 16:25 + * @Created by PoffyZhang + */ +@Data +public class DataScopeEntity { + + protected Long id; + + protected Long regionId; + + protected String regionCode; + + protected Long orgCode; + + protected Long userId; + + protected String employeeCode; + + protected String dataScopeSql; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java new file mode 100644 index 0000000..59e5a92 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.datascope.provider; + +import com.ningdatech.basic.util.SpringUtils; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import lombok.RequiredArgsConstructor; + +import java.io.Serializable; +import java.util.Map; +import java.util.Optional; + +/** + *

+ * 数据权限获取 + *

+ * + * @author WendyYang + * @since 2022/1/9 23:28 + */ +@RequiredArgsConstructor +public class DataScopeContext implements Serializable { + + private static final String WARN_MSG = "请先创建数据权限[%s]的实现类,使其实现 DataScopeProvider"; + + private static final Map DSP_MAP; + + static { + DSP_MAP = SpringUtils.getBeansOfType(DataScopeProvider.class); + } + + public static Optional getDataScope(String roleCode) { + DataScopeProvider dataScopeProvider = DSP_MAP.get(roleCode); + if (dataScopeProvider == null) { + throw new IllegalArgumentException(String.format(WARN_MSG, roleCode)); + } + return dataScopeProvider.findDataFieldProperty(); + } + + public static Optional getDataScopeHasUserId(String roleCode,Long userId) { + DataScopeProvider dataScopeProvider = DSP_MAP.get(roleCode); + if (dataScopeProvider == null) { + throw new IllegalArgumentException(String.format(WARN_MSG, roleCode)); + } + return dataScopeProvider.findDataFieldProperty(userId); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeProvider.java new file mode 100644 index 0000000..826bfea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeProvider.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.datascope.provider; + + +import com.hz.pm.api.datascope.model.DataScopeDTO; + +import java.util.Optional; + +/** + *

+ * 数据权限获取接口 + *

+ * + * @author zpf + * @since 2023/3/27 23:28 + */ +public interface DataScopeProvider { + + /** + * 获取登录人的数据权限 + * + * @return 数据权限 + **/ + Optional findDataFieldProperty(); + + Optional findDataFieldProperty(Long userId); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java new file mode 100644 index 0000000..41dbe97 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.google.common.collect.Lists; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +/** + *

+ * 数据权限 数据看板角色 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("DASHBOARD") +public class DashboardUserDataScopeProviderImpl implements DataScopeProvider { + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); + ds.setUserId(userFullInfo.getUserId()); + ds.setRole(RoleEnum.DASHBOARD); + return Optional.ofNullable(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); + ds.setUserId(userFullInfo.getUserId()); + ds.setRole(RoleEnum.DASHBOARD); + return Optional.ofNullable(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java new file mode 100644 index 0000000..fc841dd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * ExpertAdminDataScopeProviderImpl + *

+ * + * @author WendyYang + * @since 10:39 2023/12/11 + */ +@Component("EXPERT_ADMIN") +@RequiredArgsConstructor +public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + DataScopeDTO ds = new DataScopeDTO(); + if (Objects.isNull(user.getRegionLevel())) { + ds.setRegionIds(Collections.emptyList()); + ds.setRegionCodes(Collections.emptyList()); + } else { + List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); + ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); + ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); + } + ds.setRole(RoleEnum.EXPERT_ADMIN); + ds.setUserId(user.getUserId()); + ds.setEmployeeCode(user.getEmployeeCode()); + ds.setOrgCode(user.getOrganizationCode()); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); + DataScopeDTO ds = new DataScopeDTO(); + if (Objects.isNull(user.getRegionLevel())) { + ds.setRegionIds(Collections.emptyList()); + ds.setRegionCodes(Collections.emptyList()); + } else { + List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); + ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); + ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); + } + ds.setRole(RoleEnum.EXPERT_ADMIN); + ds.setUserId(user.getUserId()); + ds.setEmployeeCode(user.getEmployeeCode()); + ds.setOrgCode(user.getOrganizationCode()); + return Optional.of(ds); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java new file mode 100644 index 0000000..f48d28e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + *

+ * 专家 数据看板角色 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("EXPERT") +public class ExpertDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + //所有 丽水市的code + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + RegionConst.RL_CITY); + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.EXPERT); + return Optional.ofNullable(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + //所有 丽水市的code + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + RegionConst.RL_CITY); + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.EXPERT); + return Optional.ofNullable(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java new file mode 100644 index 0000000..2164383 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.datascope.provider.impl; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; + +/** + *

+ * 数据权限 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("HIGH_MEMBER") +public class HigherUserDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + private final UserInfoHelper userInfoHelper; + + //和区域管理员一样 + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + //借由 丽水市的code 来映射市本级的regionCode + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), + RegionConst.RL_CITY); + //如果不是市本级的话 就直接放入本区域的县就好了 + if(CollUtil.isEmpty(regionCodes)){ + regionCodes = Lists.newArrayList(); + regionCodes.add(userFullInfo.getRegionCode()); + } + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.REGION_MANAGER); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + //借由 丽水市的code 来映射市本级的regionCode + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), + RegionConst.RL_CITY); + //如果不是市本级的话 就直接放入本区域的县就好了 + if(CollUtil.isEmpty(regionCodes)){ + regionCodes = Lists.newArrayList(); + regionCodes.add(userFullInfo.getRegionCode()); + } + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.REGION_MANAGER); + return Optional.of(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java new file mode 100644 index 0000000..10e44f1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.google.common.collect.Lists; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import java.util.Optional; + +/** + *

+ * 数据权限 普通用户 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("NORMAL_MEMBER") +public class OrdinaryUserDataScopeProviderImpl implements DataScopeProvider { + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); + ds.setUserId(userFullInfo.getUserId()); + ds.setRole(RoleEnum.NORMAL_MEMBER); + return Optional.ofNullable(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); + ds.setUserId(userFullInfo.getUserId()); + ds.setRole(RoleEnum.NORMAL_MEMBER); + return Optional.ofNullable(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java new file mode 100644 index 0000000..5ae717f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import java.util.Optional; + +/** + *

+ * 数据权限 单位管理员 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("COMPANY_MANAGER") +public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + DataScopeDTO ds = new DataScopeDTO(); + ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.COMPANY_MANAGER); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + DataScopeDTO ds = new DataScopeDTO(); + ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.COMPANY_MANAGER); + return Optional.of(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java new file mode 100644 index 0000000..db86b0b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java @@ -0,0 +1,76 @@ +package com.hz.pm.api.datascope.provider.impl; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; + +/** + *

+ * 数据权限 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("REGION_MANAGER") +public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + //借由 丽水市的code 来映射市本级的regionCode + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), + RegionConst.RL_CITY); + //如果不是市本级的话 就直接放入本区域的县就好了 + if(CollUtil.isEmpty(regionCodes)){ + regionCodes = Lists.newArrayList(); + regionCodes.add(userFullInfo.getRegionCode()); + } + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.REGION_MANAGER); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + //借由 丽水市的code 来映射市本级的regionCode + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), + RegionConst.RL_CITY); + //如果不是市本级的话 就直接放入本区域的县就好了 + if(CollUtil.isEmpty(regionCodes)){ + regionCodes = Lists.newArrayList(); + regionCodes.add(userFullInfo.getRegionCode()); + } + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.REGION_MANAGER); + return Optional.of(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java new file mode 100644 index 0000000..26c7e74 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; + +/** + *

+ * 数据权限 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("SUPER_ADMIN") +public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + //所有 丽水市的code + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + RegionConst.RL_CITY); + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + //所有 丽水市的code + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + RegionConst.RL_CITY); + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(new ArrayList<>(regionCodes)); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.of(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java new file mode 100644 index 0000000..87c3c49 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import java.util.Optional; + +/** + *

+ * 数据权限 访客 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("VISITOR") +public class VisitoyDataScopeProviderImpl implements DataScopeProvider { + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.ofNullable(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + DataScopeDTO ds = new DataScopeDTO(); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.ofNullable(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java new file mode 100644 index 0000000..6c063ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.datascope.utils; + +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeContext; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import java.util.Objects; +import java.util.Optional; + +/** + * @Classname DataScopeUtil + * @Description + * @Date 2023/3/28 16:00 + * @Author PoffyZhang + */ +public class DataScopeUtil { + + public static Optional getCurrentUserDataScope(UserFullInfoDTO user) { + if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { + return Optional.empty(); + } + return DataScopeContext.getDataScope(user.getRoleCode().name()); + } + + public static Optional getCurrentUserDataScopeHasUserId(UserFullInfoDTO user) { + if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { + return Optional.empty(); + } + return DataScopeContext.getDataScopeHasUserId(user.getRoleCode().name(),user.getUserId()); + } + + public static Optional getCurrentUserDataScope() { + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + if (Objects.isNull(loginUser) || Objects.isNull(loginUser.getRoleCode())) { + return Optional.empty(); + } + return DataScopeContext.getDataScope(loginUser.getRoleCode().name()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/constants/DingOrganizationContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/constants/DingOrganizationContant.java new file mode 100644 index 0000000..20fd70a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/constants/DingOrganizationContant.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.ding.constants; + +/** + * @Classname DingOrganizationContant + * @Description + * @Date 2023/7/10 17:58 + * @Author PoffyZhang + */ +public interface DingOrganizationContant { + + String UNIT_TYPE = "GOV_UNIT"; + String GOV_TEMPORARY = "GOV_TEMPORARY"; + String HOLLOW = "GOV_HOLLOW_DIVISION_NODE"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java new file mode 100644 index 0000000..e0182fb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java @@ -0,0 +1,305 @@ +package com.hz.pm.api.ding.controller; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.RefreshKeyUtil; +import com.hz.pm.api.ding.task.EmployeeBatchGetTask; +import com.hz.pm.api.ding.task.GovBusinessStripsTask; +import com.hz.pm.api.ding.task.OrganizationBatchGetTask; +import com.hz.pm.api.irs.manage.AppIrsManage; +import com.hz.pm.api.irs.model.dto.ForwardDTO; +import com.hz.pm.api.organization.manage.ProcDefManage; +import com.hz.pm.api.projectdeclared.manage.IrsManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; +import javax.validation.Valid; +import java.io.*; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + *

+ * PullDingInfoController + *

+ * + * @author WendyYang + * @since 2023/6/2 + **/ +@RestController +@RequestMapping("/api/v1/zwdd/pull") +@RequiredArgsConstructor +@Slf4j +public class DingInfoPullController { + + private final EmployeeBatchGetTask employeeBatchGetTask; + private final GovBusinessStripsTask businessStripsTask; + private final OrganizationBatchGetTask organizationBatchGetTask; + + private final ProcDefManage procDefManage; + + private final IrsManage irsManage; + + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + private final AppIrsManage appIrsManage; + + private final IProjectService projectService; + + @GetMapping("/employee") + public void employeeBatchGet() { + employeeBatchGetTask.batchGetEmployeeTask(); + } + + @GetMapping("/businessStrips") + public void businessStripsBatchGet() { + businessStripsTask.batchGetGovBusinessStripsTask(); + } + + @GetMapping("/organization") + public void organizationBatchGet() { + organizationBatchGetTask.batchGetOrganizationTask(); + } + + @GetMapping("/organization/{orgCode}") + public void organizationGetSubs(@PathVariable String orgCode) { + organizationBatchGetTask.organizationGetSubs(orgCode); + } + + @GetMapping("/organization-sub/{orgCode}") + public void organizationSubGetOrgs(@PathVariable String orgCode) { + organizationBatchGetTask.organizationSubGetOrgs(orgCode); + } + + @GetMapping("/employeeByRegionCode/{regionCode}") + public void employeeBatchGetByRegionCode(@PathVariable String regionCode) { + employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode); + } + + @GetMapping("/employeeByOrdCode/{orgCode}") + public void employeeBatchGetByOrdCode(@PathVariable String orgCode) { + employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); + } + + @GetMapping("/getEmployeeByCode/{empCode}") + public void getEmployeeByCode(@PathVariable String empCode) { + employeeBatchGetTask.getEmployeeByCode(empCode); + } + + @GetMapping("/getBatchEmployeeByCode/{orgCode}") + public void getBatchEmployeeByCode(@PathVariable String orgCode) { + employeeBatchGetTask.getBatchEmployeeByCode(orgCode); + } + + @GetMapping("/getToken") + public String getToken() { + return employeeBatchGetTask.getToken(); + } + + @GetMapping("/getAuthToken") + public String getAuthToken() { + return employeeBatchGetTask.getAuthToken(); + } + + @ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化") + @GetMapping("/init") + public String init() { + return procDefManage.init(); + } + + @ApiOperation(value = "系统流程配置初始化按区域", notes = "系统流程配置初始化按区域") + @GetMapping("/init/{areaCode}") + public String initByArea(@PathVariable String areaCode) { + return procDefManage.initByArea(areaCode); + } + + @ApiOperation(value = "项目详情推送", notes = "项目详情推送") + @GetMapping("/push-project") + public String pushProject() throws Exception { + File f = new File("/temp/遂昌归集项目信息(需补).xlsx"); +// File f = new File("C:\\Users\\PoffyZhang\\Desktop\\遂昌归集项目信息(需补).xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Assert.notNull(wb,"文件流为空"); + Row row; + Integer sucessNum = 0; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i forEntity = restTemplate.getForEntity(url, String.class); + + log.info(JSON.toJSONString(forEntity)); + + return forEntity.getBody(); + } + + @ApiOperation(value = "项目详情推送", notes = "项目详情推送") + @GetMapping("/push-project-detail") + public String pushProjectDetail() throws NoSuchAlgorithmException { + Project project = projectService.getById(189L); + ProjectDTO projectDto = new ProjectDTO(); + + projectDto.setProjectCode(project.getProjectCode()); + projectDto.setProjectName(project.getProjectName()); + projectDto.setArea(project.getArea()); + projectDto.setAreaCode(project.getAreaCode()); + projectDto.setBaseProjType("1"); + projectDto.setBaseConstructionType("03"); + projectDto.setBaseProjConsClass("C"); + projectDto.setBaseLowestLevel("C"); + projectDto.setProjectYear(project.getProjectYear()); + projectDto.setBaseProjBasis("1"); + projectDto.setBuildBasis("01"); + projectDto.setBaseProjSetProg("05"); + projectDto.setResponsibleMan(project.getResponsibleMan()); + projectDto.setResponsibleManMobile(project.getResponsibleManMobile()); + projectDto.setContactName(project.getContactName()); + projectDto.setContactPhone(project.getContactPhone()); + projectDto.setBuildOrgName(project.getBuildOrgName()); + projectDto.setBuildOrgCode(project.getBuildOrgCode()); + projectDto.setSuperOrg(project.getSuperOrg()); + projectDto.setSuperOrgCode(project.getSuperOrgCode()); + projectDto.setHigherSuperOrg(project.getHigherSuperOrg()); + projectDto.setHigherSuperOrgCode(project.getHigherSuperOrgCode()); + + log.info("projectDto :{}",JSON.toJSONString(projectDto)); + + if(StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))){ + return "推送成功"; + } + return "推送失败"; + } + + @ApiOperation(value = "同步企业信息 条线", notes = "同步企业信息 条线") + @GetMapping("/synchronouOrgBiz") + public String synchronouOrgBiz() { + return procDefManage.synchronouOrgBiz(); + } + + @ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于") + @PostMapping("/forward") + public String forward(@Valid @RequestBody ForwardDTO dto) { + return irsManage.forward(dto); + } + + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/model/DingOrgInfoTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/model/DingOrgInfoTreeDTO.java new file mode 100644 index 0000000..4d52eba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/model/DingOrgInfoTreeDTO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.ding.model; + +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/24 上午11:06 + * 钉钉组织结构树状结构 + */ +@Data +public class DingOrgInfoTreeDTO { + + /** + * 钉钉code码 + */ + private String code; + + /** + * 组织信息 + */ + private DingOrgInfoDTO dingOrgInfoDTO; + /** + * 子节点code + */ + private List childCodes; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java new file mode 100644 index 0000000..a7b2834 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java @@ -0,0 +1,491 @@ +package com.hz.pm.api.ding.task; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.zwdd.ZwddIntegrationProperties; +import com.ningdatech.zwdd.client.ZwddAuthClient; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; +import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; +import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; +import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; +import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/10 上午9:52 + */ + +@Component +@Slf4j +public class EmployeeBatchGetTask { + + private final static Integer PAGE_SIZE = 20; + + private final static Integer GROUP_SIZE = 100; + + private final static Integer MAX_SIZE = 10000; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private ZwddAuthClient zwddAuthClient; + + @Autowired + private IDingOrganizationService iDingOrganizationService; + + @Autowired + private IDingEmployeeInfoService iDingEmployeeInfoService; + + @Autowired + private ZwddIntegrationProperties zwddIntegrationProperties; + + @Autowired + private IUserInfoService iUserInfoService; + + @Transactional(rollbackFor = Exception.class) +// @Scheduled(cron = "0 0 1 * * ?") + public void batchGetEmployeeTask() { + // 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型) + List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); + log.info("所有待更新员工的单位数:{}",dingOrganizationList.size()); + if (CollUtil.isNotEmpty(dingOrganizationList)) { + //记录任务 单位数 + Integer index = 0; + for (DingOrganization dingOrganization : dingOrganizationList) { + log.info("当前单位:{},下标数,{}",dingOrganization.getOrganizationName(),index); + index++; + List allOrganizationEmployeePositionList = new ArrayList<>(); + String organizationCode = dingOrganization.getOrganizationCode(); + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(zwddIntegrationProperties.getTenantId()); + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(PAGE_SIZE); + + // 查询组织下 用户信息 + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + if (Objects.isNull(data)){ + log.info("响应为空:{}",organizationCode); + continue; + } + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + Long totalSize = data.getTotalSize(); + + log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); + + log.info("totalSize :{},{}", totalSize,dingOrganization.getOrganizationName()); + if (totalSize > PAGE_SIZE) { + if (totalSize > MAX_SIZE) { + //超过1万 按1万的处理 + totalSize = MAX_SIZE.longValue(); + } + + int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; + int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; + for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { + query.setPageNo(pageNo); + GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); +// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); + if(pageGenericResult.isSuccess()){ + allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); + }else{ + log.error(pageGenericResult.getMsg()); + } + } + } + + // 批量查询 成员的accountId + List dingEmployeeInfoSaveRecordList = new ArrayList<>(); + if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); + } else { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); + for (List segment : split) { + assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); + } + } + // 批量保存用户信息 + saveBatch(dingEmployeeInfoSaveRecordList); + } + } + } + + + private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { + List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); + GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); + List employeeAccountIdDTOList = listGenericResult.getData(); + if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { + Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) + .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); + + List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); + + dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { + r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); + return r; + }).collect(Collectors.toList()); + dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); + } + } + + private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { + List saveRecordList = new ArrayList<>(); + for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { + List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); + if (CollUtil.isNotEmpty(govEmployeePositions)) { + List segmentSaveRecordList = new ArrayList<>(); + for (GovEmployeePosition govEmployeePosition : govEmployeePositions) { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); + dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); + dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); + dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); + dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); + dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); + dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); + dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); + dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); + dingEmployeeInfo.setCreateOn(LocalDateTime.now()); + dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); + dingEmployeeInfo.setCreateBy(-1L); + dingEmployeeInfo.setUpdateBy(-1L); + segmentSaveRecordList.add(dingEmployeeInfo); + } + saveRecordList.addAll(segmentSaveRecordList); + } else { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + saveRecordList.add(dingEmployeeInfo); + } + } + return saveRecordList; + } + + private void saveBatch(List dingEmployeeInfoSaveRecordList) { + dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() + .filter(r -> "true".equals(r.getMainJob()) + && "A".equals(r.getEmpStatus()) + && StringUtils.isNotBlank(r.getEmpPosUnitCode()) + && StringUtils.isNotBlank(r.getEmployeeCode()) + ).collect(Collectors.toList()); + + Set uniqueKeySet = new HashSet(); + + List saveList = new ArrayList<>(); + + for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { + if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { + saveList.add(dingEmployeeInfo); + } + } + + List organizations = iDingOrganizationService.list(); + Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); + + for (DingEmployeeInfo dingEmployeeInfo : saveList) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + + DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .last(BizConst.LIMIT_1)); + if (Objects.isNull(employeeInfo)) { + iDingEmployeeInfoService.save(dingEmployeeInfo); + } else { + dingEmployeeInfo.setId(employeeInfo.getId()); + iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); + } + generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); + } + } + + public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode)); + if (Objects.isNull(userInfo)) { + userInfo = UserInfo.builder() + .accountId(dingEmployeeInfo.getAccountId()) + .username(dingEmployeeInfo.getEmployeeName()) + .realName(dingEmployeeInfo.getEmployeeName()) + .employeeCode(dingEmployeeInfo.getEmployeeCode()) + .available(UserAvailableEnum.DISABLE.name()) + .createBy(-1L) + .updateBy(-1L) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) + .avatar(dingEmployeeInfo.getAvatar()) + .build(); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.save(userInfo); + }else{ + userInfo.setAvatar(dingEmployeeInfo.getAvatar()); + userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.updateById(userInfo); + } + } + + /** + * 按区域 来更新员工 + * @param regionCode + */ + public void batchGetEmployeeTaskByRegionCode(String regionCode) { + List units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) + .eq(DingOrganization::getDivisionCode, regionCode)); + + + log.info("所有地区 {} 待更新员工的单位数:{}",regionCode,units.size()); + if (CollUtil.isNotEmpty(units)) { + //记录任务 单位数 + Integer index = 0; + for (DingOrganization dingOrganization : units) { + log.info("当前单位:{},下标数,{}",dingOrganization.getOrganizationName(),index); + index++; + List allOrganizationEmployeePositionList = new ArrayList<>(); + String organizationCode = dingOrganization.getOrganizationCode(); + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(zwddIntegrationProperties.getTenantId()); + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(PAGE_SIZE); + + // 查询组织下 用户信息 + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + if (Objects.isNull(data)){ + log.info("响应为空:{}",organizationCode); + continue; + } + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + Long totalSize = data.getTotalSize(); + + log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); + + log.info("totalSize :{},{}", totalSize,dingOrganization.getOrganizationName()); + if (totalSize > PAGE_SIZE) { + if (totalSize > MAX_SIZE) { + //超过1万 按1万的处理 + totalSize = MAX_SIZE.longValue(); + } + + int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; + int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; + for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { + query.setPageNo(pageNo); + GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); +// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); + if(pageGenericResult.isSuccess()){ + allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); + }else{ + log.error(pageGenericResult.getMsg()); + } + } + } + + // 批量查询 成员的accountId + List dingEmployeeInfoSaveRecordList = new ArrayList<>(); + if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); + } else { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); + for (List segment : split) { + assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); + } + } + // 批量保存用户信息 + saveBatch(dingEmployeeInfoSaveRecordList); + } + log.info("员工同步完成"); + } + } + + public void batchGetEmployeeTaskByOrdCode(String orgCode) { + DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, orgCode) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); + log.info("所属单位 {} 要更新员工信息了",org.getOrganizationName()); + + List allOrganizationEmployeePositionList = new ArrayList<>(); + String organizationCode = orgCode; + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(zwddIntegrationProperties.getTenantId()); + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(PAGE_SIZE); + + // 查询组织下 用户信息 + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + if (Objects.isNull(data)){ + log.info("响应为空:{}",organizationCode); + return; + } + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + Long totalSize = data.getTotalSize(); + + log.info("dingOrganization :{}", JSON.toJSONString(org)); + + log.info("totalSize :{},{}", totalSize,org.getOrganizationName()); + if (totalSize > PAGE_SIZE) { + if (totalSize > MAX_SIZE) { + //超过1万 按1万的处理 + totalSize = MAX_SIZE.longValue(); + } + + int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; + int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; + for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { + query.setPageNo(pageNo); + GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); +// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); + if(pageGenericResult.isSuccess()){ + allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); + }else{ + log.error(pageGenericResult.getMsg()); + } + } + } + + // 批量查询 成员的accountId + List dingEmployeeInfoSaveRecordList = new ArrayList<>(); + if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); + } else { + log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); + List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); + for (List segment : split) { + assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); + } + } + // 批量保存用户信息 + saveBatch(dingEmployeeInfoSaveRecordList); + + log.info("员工同步完成"); + + } + + /** + * 更新员工信息 主要是头像 + * @param empCode + */ + public void getEmployeeByCode(String empCode) { + GenericResult result = zwddClient.getEmployeeByCode(empCode); + log.error("请求员工信息 result:{}",JSON.toJSONString(result)); + if(!result.isSuccess()){ + log.error("请求员工信息失败 :{},mesg:{}",empCode,result.getMsg()); + return; + } + EmployeeInfoDTO data = result.getData(); + + if(Objects.isNull(data)){ + log.error("请求员工信息失败 返回为空"); + return; + } + + DingEmployeeInfo emp = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, empCode) + .last(BizConst.LIMIT_1)); + + if(Objects.nonNull(emp)){ + emp.setAvatar(data.getGovEmpAvatar()); + iDingEmployeeInfoService.updateById(emp); + } + + UserInfo user = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, empCode) + .last(BizConst.LIMIT_1)); + + if(Objects.nonNull(user)){ + user.setAvatar(data.getGovEmpAvatar()); + iUserInfoService.updateById(user); + } + } + + /** + * 更新一整个单位的 + * @param orgCode + */ + public void getBatchEmployeeByCode(String orgCode) { + + List employees = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode)); + + for(DingEmployeeInfo employee : employees){ + getEmployeeByCode(employee.getEmployeeCode()); + } + } + + /** + * 获取token + */ + public String getToken() { + GenericResult accessToken = zwddClient.getAccessToken(); + return accessToken.getData(); + } + + public String getAuthToken() { + GenericResult accessToken = zwddAuthClient.getAccessToken(); + return accessToken.getData(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java new file mode 100644 index 0000000..1ac4a44 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java @@ -0,0 +1,104 @@ +package com.hz.pm.api.ding.task; + +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.organization.entity.GovBusinessStrip; +import com.hz.pm.api.organization.service.IGovBusinessStripService; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; +import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/8 下午2:55 + */ + +@Component +@Slf4j +public class GovBusinessStripsTask { + + private final static Integer PAGE_SIZE = 20; + + private final static Integer GROUP_SIZE = 100; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private IGovBusinessStripService iGovBusinessStripService; + + @Transactional(rollbackFor = Exception.class) +// @Scheduled(cron = "0 0 1 * * ?") + public void batchGetGovBusinessStripsTask() { + PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); + pageSubGovBusinessStripsQuery.setPageNo(1); + pageSubGovBusinessStripsQuery.setPageSize(100); + GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); + + log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); + + if(!pageGenericResult.isSuccess()){ + return; + } + + Page data = pageGenericResult.getData(); + List govBusinessStripsDTOList = data.getData(); + + List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { + GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); + govBusinessStrip.setBusinessStripCode(r.getCode()); + govBusinessStrip.setBusinessStripName(r.getName()); + return govBusinessStrip; + }).collect(Collectors.toList()); + + saveBatch(govBusinessStripList); + + for (SubGovBusinessStripsDTO subGovBusinessStripsDTO : govBusinessStripsDTOList) { + saveSub(subGovBusinessStripsDTO); + } + + } + + + public void saveSub(SubGovBusinessStripsDTO parentGovBusinessStripsDTO) { + String parentCode = parentGovBusinessStripsDTO.getCode(); + String parentName = parentGovBusinessStripsDTO.getName(); + + PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); + pageSubGovBusinessStripsQuery.setPageNo(1); + pageSubGovBusinessStripsQuery.setPageSize(100); + pageSubGovBusinessStripsQuery.setBusinessStripCode(parentCode); + GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); + Page data = pageGenericResult.getData(); + List govBusinessStripsDTOList = data.getData(); + + if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) { + List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { + GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); + govBusinessStrip.setBusinessStripCode(r.getCode()); + govBusinessStrip.setBusinessStripName(r.getName()); + govBusinessStrip.setParentCode(parentCode); + govBusinessStrip.setParentName(parentName); + return govBusinessStrip; + }).collect(Collectors.toList()); + saveBatch(govBusinessStripList); + } + } + + + public void saveBatch(List govBusinessStripList) { + if (CollectionUtil.isNotEmpty(govBusinessStripList)) { + iGovBusinessStripService.saveBatch(govBusinessStripList); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/OrganizationBatchGetTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/OrganizationBatchGetTask.java new file mode 100644 index 0000000..a93c0e7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/OrganizationBatchGetTask.java @@ -0,0 +1,257 @@ + +package com.hz.pm.api.ding.task; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.ding.model.DingOrgInfoTreeDTO; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import com.ningdatech.zwdd.model.dto.DingScopesV2DTO; +import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/7 上午10:15 + */ + +@Slf4j +@Component +public class OrganizationBatchGetTask { + + @Autowired + private ZwddClient zwddClient; + + private static final Integer GROUP_SIZE = 100; + + @Autowired + private IDingOrganizationService iDingOrganizationService; + + @Autowired + private EmployeeBatchGetTask employeeBatchGetTask; + + /** + * 获取浙政钉组织架构 + */ + @Transactional(rollbackFor = Exception.class) +// @Scheduled(cron = "0 0 1 * * ?") + public void batchGetOrganizationTask() { +// List allList = iDingOrganizationService.list(); +// List currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); + // 全量删除 + iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); + // 获取顶级组织code + GenericResult scopesV2Result = zwddClient.getScopesV2(); + DingScopesV2DTO scopesV2 = scopesV2Result.getData(); + + if (Objects.nonNull(scopesV2)) { + // 顶级组织code + List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); + log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); + // 获取顶级节点信息 + GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); + log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); + List dingOrgInfoDtos = listGenericResult.getData(); + for (String orgCode : deptVisibleScopes) { +// if (currentAllOrganizationCodeList.contains(orgCode)) { +// log.info("已存在组织架构---{}", orgCode); +// continue; +// } + List treeDTOList = new ArrayList<>(); + + DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + //设置节点详情 + if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { + for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { + if (orgInfo.getOrganizationCode().equals(orgCode)) { + childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); + } + } + } + childDingOrgInfoTreeDTO.setCode(orgCode); + childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(childDingOrgInfoTreeDTO); + treeDTOList.add(childDingOrgInfoTreeDTO); + if (CollectionUtils.isNotEmpty(treeDTOList)) { + List saveRecordList = new ArrayList<>(); + buildSaveRecordList(treeDTOList, saveRecordList); + // 批量保存 + if (saveRecordList.size() <= GROUP_SIZE) { + iDingOrganizationService.saveBatch(saveRecordList); + } else { + List> split = Lists.partition(saveRecordList, GROUP_SIZE); + for (List segment : split) { + iDingOrganizationService.saveBatch(segment); + } + } + } + log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); + } + } + } + + /** + * 更新 其 子单位 + * @param orgCode + */ + public void organizationGetSubs(String orgCode) { + log.info("----拉取浙政钉组织子单位开始---,顶级code:" + orgCode); + DingOrganization topOrg = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, orgCode) + .last(BizConst.LIMIT_1)); + // 顶级组织code + GenericResult subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode); + log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult)); + PageSubOrganizationCodeDTO data = subOrganizationResult.getData(); + List subOrganizationCodeList = data.getSubOrganizationCodeList(); + + if(Objects.isNull(subOrganizationCodeList)){ + log.info("subOrganizationCodeList为null"); + return; + } + + employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); + + for(String subOrganizationCode : subOrganizationCodeList){ + GenericResult organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode); + DingOrgInfoDTO dingOrgInfo = organizationByCode.getData(); + DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(old)){ + log.info("该单位已经存在 :{}",old.getOrganizationName()); + organizationGetSubs(dingOrgInfo.getOrganizationCode()); +// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(dingOrgInfo.getOrganizationCode()); + continue; + } + + DingOrganization organization = new DingOrganization(); + organization.setOrganizationCode(dingOrgInfo.getOrganizationCode()); + organization.setOrganizationName(dingOrgInfo.getOrganizationName()); + //和顶级单位一个区域 + organization.setDivisionCode(topOrg.getDivisionCode()); + organization.setParentCode(dingOrgInfo.getParentCode()); + organization.setTypeName(dingOrgInfo.getTypeName()); + organization.setAddress(dingOrgInfo.getAddress()); + organization.setBusinessStripCodes(dingOrgInfo.getBusinessStripCodes()); + organization.setDisplayOrder(dingOrgInfo.getDisplayOrder()); + organization.setGmtCreate(LocalDateTime.now()); + organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode()); + organization.setParentName(dingOrgInfo.getParentName()); + if(iDingOrganizationService.save(organization)){ + organizationGetSubs(organization.getOrganizationCode()); +// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode()); + } + } + + log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode); + } + + /** + * 查看下 当前的子单位信息 + * @param orgCode + */ + public void organizationSubGetOrgs(String orgCode) { + // 顶级组织code + GenericResult subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode); + log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult)); + PageSubOrganizationCodeDTO data = subOrganizationResult.getData(); + List subOrganizationCodeList = data.getSubOrganizationCodeList(); + + if(Objects.isNull(subOrganizationCodeList)){ + log.info("subOrganizationCodeList为null"); + return; + } + + for(String subOrganizationCode : subOrganizationCodeList){ + GenericResult organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode); + DingOrgInfoDTO dingOrgInfo = organizationByCode.getData(); + log.info("dingOrgInfo :{}",JSON.toJSONString(dingOrgInfo)); + } + } + + private void buildSaveRecordList(List treeDTOList, List saveRecordList) { + if (CollectionUtils.isEmpty(treeDTOList)) { + return; + } + for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { + DingOrganization saveRecord = new DingOrganization(); + DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); + List childCodes = dingOrgInfoTreeDTO.getChildCodes(); + saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); +// saveRecord.setEnabled("1"); + saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); + saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); + saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); + saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); +// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); + saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); + saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode()); + saveRecordList.add(saveRecord); + if (CollectionUtils.isNotEmpty(childCodes)) { + buildSaveRecordList(childCodes, saveRecordList); + } + } + } + + private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { + String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); + DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); + boolean leaf = orgInfoDTO.getLeaf(); + if (!leaf) { + int currentPage = 1; + int pageSize = 100; + GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); + + if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { + List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); + Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); + + while (totalSize > (long) currentPage * pageSize) { + GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient + .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); + if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { + subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); + } + } + + if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { + GenericResult> listGenericResult = zwddClient + .listOrganizationsByCodes(subOrganizationCodeList); + List dingOrgInfoDtos = listGenericResult.getData(); + List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { + DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); + dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); + dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(dingOrgInfoTreeDTO); + return dingOrgInfoTreeDTO; + }).collect(Collectors.toList()); + parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); + } + } + } + } +} + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/DictionaryAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/DictionaryAssembler.java new file mode 100644 index 0000000..338e4ec --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/DictionaryAssembler.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.expert.assembler; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:30 + */ + +public class DictionaryAssembler { + + public static List toDictFieldInfoList(List expertDictList) { + if (CollUtil.isEmpty(expertDictList)) { + return new ArrayList<>(); + } + return expertDictList.stream().map(r -> { + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + return dictionaryFieldInfo; + }).collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java new file mode 100644 index 0000000..d2f8c98 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -0,0 +1,130 @@ +package com.hz.pm.api.expert.assembler; + +import cn.hutool.core.collection.CollectionUtil; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.constant.QueryExpertAccountStatusEnum; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.expert.model.dto.ExpertAdminExpertManageListDTO; +import com.hz.pm.api.expert.model.vo.ExpertAdminExpertManageListVO; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.impl.TagsCacheImpl; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/8/5 下午4:32 + */ +@Component +@RequiredArgsConstructor +public class ExpertAdminExpertManageAssembler { + + private final DictionaryCache dictionaryCache; + private final TagsCacheImpl tagCache; + private final RegionCacheHelper regionCache; + + public List toExpertAdminExpertManageListVOList( + List expertManageListDTOList) { + if (CollectionUtil.isEmpty(expertManageListDTOList)) { + return new ArrayList<>(); + } + return expertManageListDTOList.stream().map(r -> { + ExpertAdminExpertManageListVO expertAdminExpertManageListVO = new ExpertAdminExpertManageListVO(); + expertAdminExpertManageListVO.setUserId(r.getUserId()); + expertAdminExpertManageListVO.setExpertName(r.getExpertName()); + expertAdminExpertManageListVO.setPhoneNo(r.getPhoneNo()); + expertAdminExpertManageListVO.setIsDingUser(r.getIsDingUser()); + expertAdminExpertManageListVO.setCompany(r.getCompany()); + expertAdminExpertManageListVO.setLegalEntityCode(r.getLegalEntityCode()); + + if (StringUtils.isNotBlank(r.getExpertAccountStatus())) { + ExpertAccountStatusEnum statusEnum = ExpertAccountStatusEnum.of(r.getExpertAccountStatus()); + switch (statusEnum) { + case FREEZE: + expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.FREEZING.getKey()); + break; + case AVAILABLE: + expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.NORMAL.getKey()); + break; + default: + break; + } + } + ExpertRegionInfo expertRegionInfo = r.getExpertRegionInfo(); + if (Objects.nonNull(expertRegionInfo)) { + Integer regionLevel = expertRegionInfo.getRegionLevel(); + String regionCode = expertRegionInfo.getRegionCode(); + RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); + if (Objects.nonNull(regionDTO)) { + expertRegionInfo.setRegionCode(regionDTO.getRegionCode()); + expertRegionInfo.setRegionLevel(regionDTO.getRegionLevel()); + expertRegionInfo.setRegionName(regionDTO.getRegionName()); + expertAdminExpertManageListVO.setExpertRegionInfo(expertRegionInfo); + } + } + List expertType = r.getExpertType(); + if (CollectionUtils.isNotEmpty(expertType)) { + expertType = assembleDictionaryName(expertType); + expertAdminExpertManageListVO.setExpertType(expertType); + } + List companyAttribute = r.getCompanyAttribute(); + if (CollectionUtils.isNotEmpty(companyAttribute)) { + companyAttribute = assembleDictionaryName(companyAttribute); + expertAdminExpertManageListVO.setCompanyAttribute(companyAttribute); + } + List titleLevel = r.getTitleLevel(); + if (CollectionUtils.isNotEmpty(titleLevel)) { + titleLevel = assembleDictionaryName(titleLevel); + expertAdminExpertManageListVO.setTitleLevel(titleLevel); + } + + List expertSource = r.getExpertSource(); + if (CollectionUtils.isNotEmpty(expertSource)) { + expertSource = assembleTagName(expertSource); + expertAdminExpertManageListVO.setExpertSource(expertSource); + } + expertAdminExpertManageListVO.setCreateTime(r.getCreateTime()); + return expertAdminExpertManageListVO; + }).collect(Collectors.toList()); + + } + + public List assembleDictionaryName(List collect) { + if (CollectionUtil.isEmpty(collect)){ + return new ArrayList<>(); + } + return collect.stream().peek(r -> { + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + if (Objects.nonNull(dictionaryDTO)) { + r.setDictionaryName(dictionaryDTO.getName()); + } + }).collect(Collectors.toList()); + } + + + public List assembleTagName(List collect) { + if (CollectionUtil.isEmpty(collect)){ + return new ArrayList<>(); + } + return collect.stream().peek(r -> { + TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); + if (Objects.nonNull(tagDTO)) { + r.setTagName(tagDTO.getTagName()); + } + }).collect(Collectors.toList()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java new file mode 100644 index 0000000..769db09 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java @@ -0,0 +1,266 @@ +package com.hz.pm.api.expert.assembler; + + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; +import com.hz.pm.api.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.hz.pm.api.expert.model.cmd.ExpertInfoModifyCmd; +import com.hz.pm.api.expert.model.dto.*; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:19 + */ + +public class ExpertInfoCmdAssembler { + + public static ExpertFullInfoSaveCmd buildExpertFullInfoSaveCmd(Long userId + , ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo + , ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo) { + + ExpertFullInfoSaveCmd expertFullInfoSaveCmd = new ExpertFullInfoSaveCmd(); + ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO( + expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null, null); + List expertDictionaryList = + buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); + List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, null); + // 专家履职意向(区域编码) + List expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); + List expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); + + expertFullInfoSaveCmd.setUserId(userId); + expertFullInfoSaveCmd.setExpertUserInfoDTO(expertUserInfoDTO); + expertFullInfoSaveCmd.setExpertDictionaryList(expertDictionaryList); + expertFullInfoSaveCmd.setExpertTagList(expertTagList); + expertFullInfoSaveCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); + expertFullInfoSaveCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); + + return expertFullInfoSaveCmd; + } + + + private static List buildExpertAvoidCompanyList(ExpertProfessionalInfo professionalInfo) { + List expertAvoidCompanyList = new ArrayList<>(); + List avoidCompanyList = professionalInfo.getAvoidCompanyList(); + if (CollectionUtils.isNotEmpty(avoidCompanyList)) { + expertAvoidCompanyList = avoidCompanyList.stream().map(r -> { + ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); + expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); + expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); + return expertAvoidCompanyDTO; + }).collect(Collectors.toList()); + } + return expertAvoidCompanyList; + } + + private static List buildExpertRegionList(ExpertBasicInfo basicInfo) { + List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); + if (CollectionUtils.isEmpty(expertIntentionWorkRegions)) { + return new ArrayList<>(); + } + return expertIntentionWorkRegions.stream().map(r -> { + ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); + expertRegionDTO.setRegionCode(r.getRegionCode()); + expertRegionDTO.setRegionLevel(r.getRegionLevel()); + return expertRegionDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertTagList(ExpertProfessionalInfo professionalInfo + , ExpertBasicInfo basicInfo, ExpertOtherInfo otherInfo) { + List goodAt = professionalInfo.getGoodAt(); + List technicalExpertise = professionalInfo.getTechnicalExpertise(); + List industrySector = professionalInfo.getIndustrySector(); + List expertSource = basicInfo.getExpertSource(); + List other; + if (Objects.nonNull(otherInfo)) { + other = otherInfo.getOther(); + } else { + other = professionalInfo.getOther(); + } + if (other == null) { + other = Collections.emptyList(); + } + List tagFieldInfoList = new ArrayList<>(); + assemblerTagExpertInfoFieldName(tagFieldInfoList, goodAt, ExpertTagEnum.GOOD_AT); + assemblerTagExpertInfoFieldName(tagFieldInfoList, technicalExpertise, ExpertTagEnum.TECHNICAL_EXPERTISE); + assemblerTagExpertInfoFieldName(tagFieldInfoList, industrySector, ExpertTagEnum.INDUSTRY_SECTOR); + assemblerTagExpertInfoFieldName(tagFieldInfoList, expertSource, ExpertTagEnum.EXPERT_SOURCE); + assemblerTagExpertInfoFieldName(tagFieldInfoList, other, ExpertTagEnum.OTHER); + + return tagFieldInfoList.stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setTagCode(r.getTagCode()); + expertTagDTO.setExpertInfoField(r.getTagFieldName()); + return expertTagDTO; + }).collect(Collectors.toList()); + } + + private static void assemblerTagExpertInfoFieldName(List allTagList + , List targetTagList, ExpertTagEnum expertTagEnum) { + if (CollUtil.isNotEmpty(targetTagList)) { + targetTagList.forEach(r -> r.setTagFieldName(expertTagEnum.getKey())); + allTagList.addAll(targetTagList); + } + } + + private static List buildExpertDictionaryList(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo + , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo) { + List political = basicInfo.getPolitical(); + List expertType = basicInfo.getExpertType(); + List edu = eduInfo.getEdu(); + List degree = eduInfo.getDegree(); + List jobStatus = jobInfo.getJobStatus(); + List companyAttribute = jobInfo.getCompanyAttribute(); + List administrativeRank = jobInfo.getAdministrativeRank(); + List titleLevel = professionalInfo.getTitleLevel(); + + List recommendedWay = new ArrayList<>(); + if (Objects.nonNull(recommendInfo)) { + recommendedWay = recommendInfo.getRecommendedWay(); + } + List dictionaryFieldInfoList = new ArrayList<>(); + assemblerDictionaryFieldName(dictionaryFieldInfoList, political, DictExpertInfoTypeEnum.POLITICAL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, expertType, DictExpertInfoTypeEnum.EXPERT_TYPE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, edu, DictExpertInfoTypeEnum.EDU); + assemblerDictionaryFieldName(dictionaryFieldInfoList, degree, DictExpertInfoTypeEnum.DEGREE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, jobStatus, DictExpertInfoTypeEnum.JOB_STATUS); + assemblerDictionaryFieldName(dictionaryFieldInfoList, companyAttribute, DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, administrativeRank, DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK); + assemblerDictionaryFieldName(dictionaryFieldInfoList, titleLevel, DictExpertInfoTypeEnum.TITLE_LEVEL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, recommendedWay, DictExpertInfoTypeEnum.RECOMMENDED_WAY); + + return dictionaryFieldInfoList.stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); + return expertDictionaryDTO; + }).collect(Collectors.toList()); + } + + private static void assemblerDictionaryFieldName( + List allDictionaryFieldInfoList, List originalDictionaryFieldInfoList + , DictExpertInfoTypeEnum dictExpertInfoTypeEnum) { + if (CollectionUtils.isNotEmpty(originalDictionaryFieldInfoList)) { + originalDictionaryFieldInfoList = originalDictionaryFieldInfoList.stream().map(r -> { + r.setDictionaryFieldName(dictExpertInfoTypeEnum.getKey()); + return r; + }).collect(Collectors.toList()); + allDictionaryFieldInfoList.addAll(originalDictionaryFieldInfoList); + } + } + + private static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo + , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo, ExpertOtherInfo otherInfo) { + ExpertUserFullInfoDTO expertFullInfo = new ExpertUserFullInfoDTO(); + + expertFullInfo.setIsDingUser(basicInfo.getIsDingUser()); + expertFullInfo.setPhoneNo(basicInfo.getPhoneNo()); + expertFullInfo.setGender(basicInfo.getGender()); + expertFullInfo.setName(basicInfo.getName()); + if (Objects.nonNull(basicInfo.getAvatarFile())) { + expertFullInfo.setAvatarFileId(basicInfo.getAvatarFile().getFileId()); + } + expertFullInfo.setIdCard(basicInfo.getIdCard()); + expertFullInfo.setOfficePhone(basicInfo.getOfficePhone()); + expertFullInfo.setBirth(basicInfo.getBirth()); + expertFullInfo.setBankNo(basicInfo.getBankNo()); + expertFullInfo.setBank(basicInfo.getBank()); + expertFullInfo.setEmail(basicInfo.getEmail()); + expertFullInfo.setHometown(basicInfo.getHometown()); + expertFullInfo.setNationality(basicInfo.getNationality()); + if (Objects.nonNull(otherInfo)) { + expertFullInfo.setRemark(otherInfo.getRemark()); + } + expertFullInfo.setSchool(eduInfo.getSchool()); + expertFullInfo.setGraduatedAt(eduInfo.getGraduatedAt()); + expertFullInfo.setAcademicTitle(eduInfo.getAcademicTitle()); + + if (CollectionUtils.isNotEmpty(eduInfo.getGraduationCertificateFile())) { + expertFullInfo.setGraduationCertificateFileIdList(eduInfo.getGraduationCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + if (CollectionUtils.isNotEmpty(eduInfo.getDegreeCertificateFile())) { + + expertFullInfo.setDegreeCertificateFileIdList(eduInfo.getDegreeCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + + expertFullInfo.setRetiredAt(jobInfo.getRetiredAt()); + expertFullInfo.setCompany(jobInfo.getCompany()); + expertFullInfo.setCompanyUniqCode(jobInfo.getCompanyUniqCode()); + expertFullInfo.setLegalEntityCode(jobInfo.getLegalEntityCode()); + expertFullInfo.setAdministrativeDuties(jobInfo.getAdministrativeDuties()); + expertFullInfo.setStartWorkAt(jobInfo.getStartWorkAt()); + expertFullInfo.setAddress(jobInfo.getAddress()); + expertFullInfo.setExperience(jobInfo.getExperience()); + + expertFullInfo.setTechnicalTitles(professionalInfo.getTechnicalTitles()); + if (CollectionUtils.isNotEmpty(professionalInfo.getTitleCertificateFile())) { + expertFullInfo.setTitleCertificateFileIdList(CollUtils.fieldList(professionalInfo.getTitleCertificateFile(), FileBasicInfo::getFileId)); + } + expertFullInfo.setAwards(professionalInfo.getAwards()); + expertFullInfo.setRecognitionReward(professionalInfo.getRecognitionReward()); + + if (Objects.nonNull(basicInfo.getExpertRegionInfo())) { + expertFullInfo.setRegionCode(basicInfo.getExpertRegionInfo().getRegionCode()); + expertFullInfo.setRegionLevel(basicInfo.getExpertRegionInfo().getRegionLevel()); + } + // 推荐证明材料单独装配 + if (Objects.nonNull(recommendInfo)) { + List recommendationProofFile = recommendInfo.getRecommendationProofFile(); + if (CollectionUtils.isNotEmpty(recommendationProofFile)) { + expertFullInfo.setRecommendationProofFileIdList(CollUtils.fieldList(recommendationProofFile, FileBasicInfo::getFileId)); + + } + } + return expertFullInfo; + } + + public static ExpertInfoModifyCmd buildExpertInfoModifyCmd(Long userId + , ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo + , ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo + , ExpertRecommendInfo recommendInfo + , ExpertOtherInfo otherInfo + , ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO + , ModifyApplyExtraInfo modifyApplyExtraInfo) { + ExpertInfoModifyCmd expertInfoModifyCmd = new ExpertInfoModifyCmd(); + ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo, otherInfo); + + List expertDictionaryList = buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo); + List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, otherInfo); + // 专家履职意向(区域编码) + List expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); + List expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); + + if (Objects.nonNull(modifyApplyExtraInfo)) { + ModifyApplyExtraInfoDTO modifyApplyExtraInfoDTO = new ModifyApplyExtraInfoDTO(); + modifyApplyExtraInfoDTO.setEvidenceList(modifyApplyExtraInfo.getEvidenceList()); + modifyApplyExtraInfoDTO.setFactSheet(modifyApplyExtraInfo.getFactSheet()); + expertInfoModifyCmd.setModifyApplyExtraInfo(modifyApplyExtraInfoDTO); + } + + expertInfoModifyCmd.setUserId(userId); + expertInfoModifyCmd.setExpertUserInfoDTO(expertUserInfoDTO); + expertInfoModifyCmd.setExpertDictionaryList(expertDictionaryList); + expertInfoModifyCmd.setExpertTagList(expertTagList); + expertInfoModifyCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); + expertInfoModifyCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); + expertInfoModifyCmd.setExpertInfoSensitiveFieldCheckBO(expertInfoSensitiveFieldCheckBO); + expertInfoModifyCmd.setBusinessStrips(expertJobInfo.getBusinessStrips()); + return expertInfoModifyCmd; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java new file mode 100644 index 0000000..91953ca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java @@ -0,0 +1,462 @@ +package com.hz.pm.api.expert.assembler; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.hz.pm.api.common.enumeration.BoolDisplayEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import com.hz.pm.api.expert.entity.*; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.dto.*; +import com.hz.pm.api.expert.model.vo.ExpertFullInfoVO; +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/27 上午10:46 + */ +@Component +@RequiredArgsConstructor +public class ExpertUserInfoAssembler { + + private final TagCache tagCache; + private final DictionaryCache dictionaryCache; + private final RegionCacheHelper regionCacheHelper; + + public ExpertFullInfoVO buildExpertFullInfo(List attachFiles, ExpertFullInfoAllDTO expertFullInfoAll) { + ExpertUserFullInfoDTO expertUserInfo = expertFullInfoAll.getExpertUserInfoDTO(); + // 字典字典段map + Map> dictMap = buildDictInfoMap(expertFullInfoAll.getExpertDictionaryList()); + // 专家文件资料map + Map fileMap = buildFileBasicInfoMap(attachFiles); + // 专家标签字段map + Map> tagMap = buildTagFieldInfoMap(expertFullInfoAll.getExpertTagList()); + // 专家履职意向地 + List intentionWorkRegions = expertFullInfoAll.getExpertIntentionWorkRegionInfo(); + // 专家回避单位列表 + List avoidCompanies = expertFullInfoAll.getExpertAvoidCompanyList(); + // 基本信息 + ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfo, dictMap, tagMap, intentionWorkRegions, fileMap); + // 学历信息 + ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfo, dictMap, fileMap); + // 职业信息 + ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfo, dictMap); + jobInfo.setBusinessStrips(expertFullInfoAll.getBusinessStrips()); + // 专业信息 + ExpertProfessionalInfo profession = buildExpertProfessionalInfo(expertUserInfo, dictMap, tagMap, fileMap, avoidCompanies); + // 推荐信息 + ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); + recommendInfo.setRecommendedWay(dictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey())); + recommendInfo.setRecommendationProofFile(getFileBasicInfoList(fileMap, expertUserInfo.getRecommendationProofFileIdList())); + // 其他信息 + ExpertOtherInfo otherInfo = new ExpertOtherInfo(); + otherInfo.setOther(tagMap.get(ExpertTagEnum.OTHER.getKey())); + otherInfo.setRemark(expertUserInfo.getRemark()); + + // 专家申请履职意向展示列表 + List applyIntentionWorkRegions = expertFullInfoAll.getExpertApplyIntentionWorkRegionInfo().stream().map(r -> { + ExpertRegionInfo intentionWorkRegion = new ExpertRegionInfo(); + intentionWorkRegion.setRegionLevel(r.getRegionLevel()); + intentionWorkRegion.setRegionCode(r.getRegionCode()); + intentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel())); + return intentionWorkRegion; + }).collect(Collectors.toList()); + + if (CollUtil.isEmpty(basicInfo.getExpertIntentionWorkRegions())) { + basicInfo.setExpertIntentionWorkRegions(applyIntentionWorkRegions); + } + ExpertFullInfoVO resExpertFullInfo = new ExpertFullInfoVO(); + resExpertFullInfo.setUserId(expertUserInfo.getUserId()); + resExpertFullInfo.setBasicInfo(basicInfo); + resExpertFullInfo.setEduInfo(eduInfo); + resExpertFullInfo.setJobInfo(jobInfo); + resExpertFullInfo.setProfessionalInfo(profession); + resExpertFullInfo.setRecommendInfo(recommendInfo); + resExpertFullInfo.setExpertOtherInfo(otherInfo); + resExpertFullInfo.setExpertApplyIntentionWorkRegions(applyIntentionWorkRegions); + return resExpertFullInfo; + } + + public static Map buildFileBasicInfoMap(List attachFiles) { + return attachFiles.stream().map(r -> { + FileBasicInfo fileBasicInfo = new FileBasicInfo(); + fileBasicInfo.setFileId(r.getFileId()); + fileBasicInfo.setFileName(r.getOriginalFileName()); + return fileBasicInfo; + }).collect(Collectors.toMap(FileBasicInfo::getFileId, Function.identity())); + } + + public Map> buildTagFieldInfoMap(List expertTagList) { + return expertTagList.stream().map(r -> { + TagFieldInfo tagFieldInfo = new TagFieldInfo(); + tagFieldInfo.setTagCode(r.getTagCode()); + tagFieldInfo.setTagFieldName(r.getExpertInfoField()); + TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); + if (Objects.nonNull(tagDTO)) { + tagFieldInfo.setTagName(tagDTO.getTagName()); + } + return tagFieldInfo; + }).collect(Collectors.groupingBy(TagFieldInfo::getTagFieldName)); + } + + public Map> buildDictInfoMap(List expertDictList) { + return expertDictList.stream().map(r -> { + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + if (Objects.nonNull(dictionaryDTO)) { + dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); + } + return dictionaryFieldInfo; + }).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName)); + } + + public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO, + Map> dictInfoMap, + Map> tagFieldInfoMap, + Map fileInfoMap, + List expertAvoidCompanyList) { + ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); + professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); + professionalInfo.setTitleLevel(dictInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())); + professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList())); + professionalInfo.setGoodAt(tagFieldInfoMap.get(ExpertTagEnum.GOOD_AT.getKey())); + professionalInfo.setTechnicalExpertise(tagFieldInfoMap.get(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey())); + professionalInfo.setAwards(expertUserInfoDTO.getAwards()); + professionalInfo.setIndustrySector(tagFieldInfoMap.get(ExpertTagEnum.INDUSTRY_SECTOR.getKey())); + professionalInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); + professionalInfo.setAvoidCompanyList(expertAvoidCompanyList.stream().map(r -> { + ExpertAvoidCompanyInfo avoidCompanyInfo = new ExpertAvoidCompanyInfo(); + avoidCompanyInfo.setCompanyName(r.getCompanyName()); + avoidCompanyInfo.setCompanyUniqCode(r.getCompanyUniqCode()); + return avoidCompanyInfo; + }).collect(Collectors.toList())); + return professionalInfo; + } + + public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO, + Map> dictInfoMap) { + ExpertJobInfo jobInfo = new ExpertJobInfo(); + jobInfo.setJobStatus(dictInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey())); + jobInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); + jobInfo.setCompany(expertUserInfoDTO.getCompany()); + jobInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); + jobInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); + jobInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); + jobInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); + jobInfo.setAdministrativeRank(dictInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey())); + jobInfo.setCompanyAttribute(dictInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey())); + jobInfo.setAddress(expertUserInfoDTO.getAddress()); + jobInfo.setExperience(expertUserInfoDTO.getExperience()); + return jobInfo; + } + + public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertFullInfo, + Map> dictInfoMap, + Map fileInfoMap) { + // 学历信息 + ExpertEduInfo eduInfo = new ExpertEduInfo(); + eduInfo.setSchool(expertFullInfo.getSchool()); + eduInfo.setGraduatedAt(expertFullInfo.getGraduatedAt()); + eduInfo.setAcademicTitle(expertFullInfo.getAcademicTitle()); + eduInfo.setEdu(dictInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey())); + eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getGraduationCertificateFileIdList())); + eduInfo.setDegree(dictInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey())); + eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getDegreeCertificateFileIdList())); + return eduInfo; + } + + private static List getFileBasicInfoList(Map fileBasicInfoMap, List fileIdList) { + if (CollUtil.isEmpty(fileIdList)) { + return new ArrayList<>(); + } + List fileBasicInfoList = new ArrayList<>(); + for (Long fileId : fileIdList) { + FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId); + if (Objects.nonNull(fileBasicInfo)) { + fileBasicInfoList.add(fileBasicInfo); + } + } + return fileBasicInfoList; + } + + public static FileBasicInfo getFileBasicInfo(Map fileBasicInfoMap, Long fileId) { + if (Objects.isNull(fileId)) { + return null; + } + return fileBasicInfoMap.get(fileId); + } + + public ExpertBasicInfo buildExpertBasicInfo(ExpertUserFullInfoDTO expertUserInfoDTO + , Map> dictionaryFieldInfoMap + , Map> tagFieldInfoMap + , List expertIntentionWorkRegionInfo + , Map fileBasicInfoMap) { + //专家层级 + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); + expertRegionInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); + + // 基本信息 + ExpertBasicInfo basicInfo = new ExpertBasicInfo(); + basicInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser()); + basicInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); + basicInfo.setName(expertUserInfoDTO.getName()); + basicInfo.setAvatarFile(getFileBasicInfo(fileBasicInfoMap, expertUserInfoDTO.getAvatarFileId())); + basicInfo.setGender(expertUserInfoDTO.getGender()); + basicInfo.setPolitical(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey())); + basicInfo.setIdCard(expertUserInfoDTO.getIdCard()); + basicInfo.setOfficePhone(expertUserInfoDTO.getPhoneNo()); + basicInfo.setBirth(expertUserInfoDTO.getBirth()); + basicInfo.setBank(expertUserInfoDTO.getBank()); + basicInfo.setBankNo(expertUserInfoDTO.getBankNo()); + basicInfo.setEmail(expertUserInfoDTO.getEmail()); + basicInfo.setHometown(expertUserInfoDTO.getHometown()); + basicInfo.setNationality(expertUserInfoDTO.getNationality()); + basicInfo.setExpertSource(tagFieldInfoMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey())); + expertRegionInfo.setRegionName(regionCacheHelper.getUnionPath(expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel())); + basicInfo.setExpertRegionInfo(expertRegionInfo); + + basicInfo.setExpertIntentionWorkRegions(expertIntentionWorkRegionInfo.stream().map(r -> { + ExpertRegionInfo expertIntentionWorkRegion = new ExpertRegionInfo(); + expertIntentionWorkRegion.setRegionCode(r.getRegionCode()); + expertIntentionWorkRegion.setRegionLevel(r.getRegionLevel()); + expertIntentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel())); + return expertIntentionWorkRegion; + }).collect(Collectors.toList())); + basicInfo.setExpertType(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + return basicInfo; + } + + public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo, + List expertTagList, + List expertDictionaryList, + List intentionWorkRegionList, + List expertMetaApplyList, + List expertAvoidCompanyList, + List businessStrips) { + ExpertUserFullInfoDTO expertFullInfoDto = buildExpertUserFullInfoDTO(expertUserFullInfo); + List expertDicts = buildExpertDictionaryDTOList(expertDictionaryList); + List expertTags = buildExpertTagDTOList(expertTagList); + List intentionWorkRegions = buildExpertIntentionWorkRegionInfo(intentionWorkRegionList); + + // 专家申请履职意向展示列表 + List applyIntentionWorkRegions = buildExpertApplyIntentionWorkRegionInfo(intentionWorkRegionList, expertMetaApplyList); + List expertAvoidCompanyDTOList = buildExpertAvoidCompanyDTOList(expertAvoidCompanyList); + ExpertFullInfoAllDTO expertFullInfoAll = new ExpertFullInfoAllDTO(); + expertFullInfoAll.setUserId(expertUserFullInfo.getUserId()); + expertFullInfoAll.setExpertUserInfoDTO(expertFullInfoDto); + expertFullInfoAll.setExpertDictionaryList(expertDicts); + expertFullInfoAll.setExpertTagList(expertTags); + expertFullInfoAll.setExpertIntentionWorkRegionInfo(intentionWorkRegions); + expertFullInfoAll.setExpertApplyIntentionWorkRegionInfo(applyIntentionWorkRegions); + expertFullInfoAll.setExpertAvoidCompanyList(expertAvoidCompanyDTOList); + expertFullInfoAll.setBusinessStrips(BeanUtil.copyToList(businessStrips, GovBusinessStripVO.class)); + return expertFullInfoAll; + } + + private static List buildExpertApplyIntentionWorkRegionInfo(List expertIntentionWorkRegionList, + List expertMetaApplyList) { + Set set = new HashSet<>(); + for (ExpertIntentionWorkRegion expertIntentionWorkRegion : expertIntentionWorkRegionList) { + RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); + regionDtoMapKey.setRegionCode(expertIntentionWorkRegion.getRegionCode()); + regionDtoMapKey.setRegionLevel(expertIntentionWorkRegion.getRegionLevel()); + set.add(regionDtoMapKey); + } + + for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { + String regionCode = expertMetaApply.getRegionCode(); + Integer regionLevel = expertMetaApply.getRegionLevel(); + if (Objects.nonNull(regionLevel) && StringUtils.isNotBlank(regionCode)) { + String applyType = expertMetaApply.getApplyType(); + RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); + regionDtoMapKey.setRegionCode(regionCode); + regionDtoMapKey.setRegionLevel(regionLevel); + ExpertApplyTypeEnum typeEnum = ExpertApplyTypeEnum.of(applyType); + switch (typeEnum) { + case EXPERT_INTENTION_LEAVE: { + set.remove(regionDtoMapKey); + } + break; + case EXPERT_INTENTION_JOIN: { + set.add(regionDtoMapKey); + } + break; + default: + break; + } + } + } + return set.stream().map(r -> { + ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); + expertRegionDTO.setRegionCode(r.getRegionCode()); + expertRegionDTO.setRegionLevel(r.getRegionLevel()); + return expertRegionDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertAvoidCompanyDTOList(List expertAvoidCompanyList) { + return expertAvoidCompanyList.stream().map(r -> { + ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); + expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); + expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); + return expertAvoidCompanyDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertIntentionWorkRegionInfo(List expertIntentionWorkRegionList) { + return expertIntentionWorkRegionList.stream().map(r -> { + ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); + expertRegionDTO.setRegionLevel(r.getRegionLevel()); + expertRegionDTO.setRegionCode(r.getRegionCode()); + return expertRegionDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertTagDTOList(List expertTagList) { + return expertTagList.stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setExpertInfoField(r.getExpertInfoField()); + expertTagDTO.setTagCode(r.getTagCode()); + return expertTagDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertDictionaryDTOList(List expertDictionaryList) { + return expertDictionaryList.stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setExpertInfoField(r.getExpertInfoField()); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + return expertDictionaryDTO; + }).collect(Collectors.toList()); + } + + public static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertUserFullInfo expertUserFullInfo) { + ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO(); + expertUserFullInfoDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); + expertUserFullInfoDTO.setPhoneNo(expertUserFullInfo.getPhoneNo()); + expertUserFullInfoDTO.setGender(expertUserFullInfo.getGender()); + expertUserFullInfoDTO.setName(expertUserFullInfo.getExpertName()); + expertUserFullInfoDTO.setAvatarFileId(expertUserFullInfo.getAvatarFileId()); + expertUserFullInfoDTO.setIdCard(expertUserFullInfo.getIdCard()); + expertUserFullInfoDTO.setOfficePhone(expertUserFullInfo.getOfficePhone()); + expertUserFullInfoDTO.setBirth(expertUserFullInfo.getBirth()); + expertUserFullInfoDTO.setBankNo(expertUserFullInfo.getBankNo()); + expertUserFullInfoDTO.setBank(expertUserFullInfo.getBank()); + expertUserFullInfoDTO.setEmail(expertUserFullInfo.getEmail()); + expertUserFullInfoDTO.setHometown(expertUserFullInfo.getHometown()); + expertUserFullInfoDTO.setNationality(expertUserFullInfo.getNationality()); + + expertUserFullInfoDTO.setSchool(expertUserFullInfo.getSchool()); + expertUserFullInfoDTO.setGraduatedAt(expertUserFullInfo.getGraduatedAt()); + expertUserFullInfoDTO.setAcademicTitle(expertUserFullInfo.getAcademicTitle()); + if (StringUtils.isNotBlank(expertUserFullInfo.getGraduationCertificateFileIdList())) { + expertUserFullInfoDTO.setGraduationCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getGraduationCertificateFileIdList(), Long.class)); + } + if (StringUtils.isNotBlank(expertUserFullInfo.getDegreeCertificateFileIdList())) { + expertUserFullInfoDTO.setDegreeCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getDegreeCertificateFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setRetiredAt(expertUserFullInfo.getRetiredAt()); + expertUserFullInfoDTO.setCompany(expertUserFullInfo.getCompany()); + expertUserFullInfoDTO.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode()); + expertUserFullInfoDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); + expertUserFullInfoDTO.setAdministrativeDuties(expertUserFullInfo.getAdministrativeDuties()); + expertUserFullInfoDTO.setStartWorkAt(expertUserFullInfo.getStartWorkAt()); + expertUserFullInfoDTO.setAddress(expertUserFullInfo.getAddress()); + expertUserFullInfoDTO.setExperience(expertUserFullInfo.getExperience()); + + expertUserFullInfoDTO.setTechnicalTitles(expertUserFullInfo.getTechnicalTitles()); + if (StringUtils.isNotBlank(expertUserFullInfo.getTitleCertificateFileIdList())) { + expertUserFullInfoDTO.setTitleCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getTitleCertificateFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setAwards(expertUserFullInfo.getAwards()); + expertUserFullInfoDTO.setRecognitionReward(expertUserFullInfo.getRecognitionReward()); + + expertUserFullInfoDTO.setRegionCode(expertUserFullInfo.getRegionCode()); + expertUserFullInfoDTO.setRegionLevel(expertUserFullInfo.getRegionLevel()); + + if (StringUtils.isNotBlank(expertUserFullInfo.getRecommendationProofFileIdList())) { + expertUserFullInfoDTO.setRecommendationProofFileIdList(JSONObject.parseArray(expertUserFullInfo.getRecommendationProofFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setRemark(expertUserFullInfo.getRemark()); + + return expertUserFullInfoDTO; + } + + public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo, + Map> expertDictMap, + Map> expertTagMap) { + Long userId = expertUserFullInfo.getUserId(); + ExpertAdminExpertManageListDTO adminManageExpertListItem = new ExpertAdminExpertManageListDTO(); + adminManageExpertListItem.setUserId(expertUserFullInfo.getUserId()); + adminManageExpertListItem.setExpertName(expertUserFullInfo.getExpertName()); + adminManageExpertListItem.setPhoneNo(expertUserFullInfo.getPhoneNo()); + adminManageExpertListItem.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); + adminManageExpertListItem.setCompany(expertUserFullInfo.getCompany()); + adminManageExpertListItem.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); + adminManageExpertListItem.setExpertAccountStatus(expertUserFullInfo.getExpertAccountStatus()); + + // 装配字典数据 + List userExpertDictList = expertDictMap.getOrDefault(userId, Collections.emptyList()); + Map> fieldExpertDictMap = userExpertDictList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField)); + adminManageExpertListItem.setExpertType( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()))); + adminManageExpertListItem.setCompanyAttribute( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()))); + adminManageExpertListItem.setTitleLevel( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()))); + // 装配标签数据 + List expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); + Map> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField)); + adminManageExpertListItem.setExpertSource(TagAssembler.toTagFieldInfoList(fieldExpertTagMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey()))); + + if (StrUtil.isNotBlank(expertUserFullInfo.getRegionCode()) && Objects.nonNull(expertUserFullInfo.getRegionLevel())) { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); + expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); + adminManageExpertListItem.setExpertRegionInfo(expertRegionInfo); + } + + // 以下数据为专家excel导出使用 + adminManageExpertListItem.setGender(expertUserFullInfo.getGender()); + adminManageExpertListItem.setBirth(expertUserFullInfo.getBirth()); + adminManageExpertListItem.setHometown(expertUserFullInfo.getHometown()); + adminManageExpertListItem.setNationality(expertUserFullInfo.getNationality()); + adminManageExpertListItem.setPolitical( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()))); + adminManageExpertListItem.setIdCard(expertUserFullInfo.getIdCard()); + adminManageExpertListItem.setBankNo(expertUserFullInfo.getBankNo()); + adminManageExpertListItem.setEdu( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EDU.getKey()))); + adminManageExpertListItem.setRecommendedWay( + DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()))); + + adminManageExpertListItem.setCreateTime(expertUserFullInfo.getCreateOn()); + return adminManageExpertListItem; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/RegionWrapperAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/RegionWrapperAssembler.java new file mode 100644 index 0000000..57a9c94 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/RegionWrapperAssembler.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.expert.assembler; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.meta.model.bo.RegionContainsBO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/10 下午5:36 + */ + +public class RegionWrapperAssembler { + + public static void expertUserFullInfoRegionContainsWrapperAssembler(LambdaQueryWrapper wrapperQuery, List containsRegionList) { + for (RegionContainsBO regionContainsBO : containsRegionList) { + List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); + Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); + if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { + wrapperQuery.and(wrapper -> wrapper.in(ExpertUserFullInfo::getRegionCode, containsRegionCodeList) + .ge(ExpertUserFullInfo::getRegionLevel, parentRegionTreeLevel)); + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java new file mode 100644 index 0000000..590532e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.expert.assembler; + +import cn.hutool.core.collection.CollectionUtil; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.meta.model.entity.ExpertTag; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:30 + */ + +public class TagAssembler { + + public static List toTagFieldInfoList(List expertTagList) { + if (CollectionUtil.isEmpty(expertTagList)) { + return new ArrayList<>(); + } + return expertTagList.stream().map(r -> { + TagFieldInfo dictionaryFieldInfo = new TagFieldInfo(); + dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setTagCode(r.getTagCode()); + return dictionaryFieldInfo; + }).collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertAccountStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertAccountStatusEnum.java new file mode 100644 index 0000000..1563229 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertAccountStatusEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:21 + */ +@AllArgsConstructor +@Getter +public enum ExpertAccountStatusEnum { + + /** + * 可用 + */ + AVAILABLE("available"), + + /** + * 冻结中 + */ + FREEZE("freeze"), + + /** + * 已出库 + */ + DELIVERY("delivery"), + + /** + * 申请中 + */ + APPLYING("applying"); + + private final String key; + + public static ExpertAccountStatusEnum of(String key) { + for (ExpertAccountStatusEnum statusEnum : ExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal ExpertAccountStatusEnum = %s", key)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyStatusEnum.java new file mode 100644 index 0000000..a881014 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyStatusEnum.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/26 下午1:38 + */ +@AllArgsConstructor +@Getter +public enum ExpertApplyStatusEnum { + + // 待审核 + PENDING_REVIEW("pending_review"), + // 审核通过 + PASSED("passed"), + // 审核不通过 + REFUSED("refused"), + // 已撤销 + REVOKED("revoked"); + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static ExpertApplyStatusEnum of(String key) { + for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal ExpertApplyStatusEnum = %s", key)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeEnum.java new file mode 100644 index 0000000..929e491 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeEnum.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/26 下午1:40 + * 专家审核申请类型 + */ +@AllArgsConstructor +@Getter +public enum ExpertApplyTypeEnum { + + // 专家入库 + EXPERT_STORAGE("expert_storage"), + // 专家出库 + EXPERT_DELIVERY("expert_delivery"), + // 专家履职意向加入 + EXPERT_INTENTION_JOIN("expert_intention_join"), + // 专家履职意向退出 + EXPERT_INTENTION_LEAVE("expert_intention_leave"), + // 长期请假申请 + LONG_TERM_LEAVE("long_term_leave"), + // 专家信息修改申请 + EXPERT_INFO_MODIFY("expert_info_modify"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static ExpertApplyTypeEnum of(String key) { + for (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return typeEnum; + } + } + throw new IllegalArgumentException(String.format("IllegalExpertApplyTypeEnum = %s", key)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeQueryEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeQueryEnum.java new file mode 100644 index 0000000..b298cb5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertApplyTypeQueryEnum.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/26 下午1:40 + * 专家 申请类型用于前端筛选时入参展示 + */ +@AllArgsConstructor +@Getter +public enum ExpertApplyTypeQueryEnum { + + // 专家入库 + EXPERT_STORAGE("expert_storage"), + // 专家出库 + EXPERT_DELIVERY("expert_delivery"), + // 专家履职意变更 + EXPERT_INTENTION_CHANGE("expert_intention_change"), + // 长期请假申请 + LONG_TERM_LEAVE("long_term_leave"), + // 专家信息修改申请 + EXPERT_INFO_MODIFY("expert_info_modify"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static ExpertApplyTypeQueryEnum of(String key) { + for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { + if (typeEnum.key.equals(key)) { + return typeEnum; + } + } + throw new IllegalArgumentException(String.format("ExpertApplyTypeQueryEnum = %s", key)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertSensitiveFieldTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertSensitiveFieldTypeEnum.java new file mode 100644 index 0000000..0232103 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertSensitiveFieldTypeEnum.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/28 上午11:19 + */ +@AllArgsConstructor +@Getter +public enum ExpertSensitiveFieldTypeEnum { + + /** + * 专家敏感信息修改 + */ + expert_sensitive_info_field, + + /** + * 专家层级修改 + */ + expert_region_field, + + /** + * 专家履职意向修改 + */ + expert_intention_field; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoSensitiveFieldEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoSensitiveFieldEnum.java new file mode 100644 index 0000000..03279f2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoSensitiveFieldEnum.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.expert.constant; + + +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 下午3:34 + * 专家修改信息需要审核的字段 + */ +@AllArgsConstructor +@Getter +public enum ExpertUserInfoSensitiveFieldEnum { + + // 手机号码 + phone_no("phone_no", "手机号码", String.class, UnitType.single), + // 电子邮箱 + email("email", "电子邮箱", String.class, UnitType.single), + // 专家层级 + expert_region("expert_region", "专家层级", ExpertRegionInfo.class, UnitType.single), + // 履职意向 + expert_intention_work_region("expert_intention_work_region", "履职意向", ExpertRegionInfo.class, UnitType.list), + // 工作单位(单位code和单位法人编号是关联的) + company("company", "工作单位", String.class, UnitType.single), + company_uniq_code("company_uniq_code", "工作单位编码", String.class, UnitType.single), + legal_entity_code("legal_entity_code", "单位法人编号", String.class, UnitType.single), + // 行政职级 + administrative_rank("administrative_rank", "行政职级", DictionaryFieldInfo.class, UnitType.list), + // 职称级别 + title_level("title_level", "职称级别", DictionaryFieldInfo.class, UnitType.list), + // 擅长方向 + good_at("good_at", "擅长方向", TagFieldInfo.class, UnitType.list), + // 技术专长 + technical_expertise("technical_expertise", "技术专长", TagFieldInfo.class, UnitType.list), + // 行业领域 + industry_sector("industry_sector", "行业领域", TagFieldInfo.class, UnitType.list), + // 其他标签 + other("other", "其他标签", TagFieldInfo.class, UnitType.list); + + private final String key; + private final String value; + private final Class aClass; + private final UnitType type; + + public static List getSensitiveDictionaryList() { + return Arrays.asList(administrative_rank.name(), title_level.name()); + } + + @AllArgsConstructor + public enum UnitType { + /** + * 单个 + */ + single, + + /** + * list + */ + list; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoStepEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoStepEnum.java new file mode 100644 index 0000000..dd5870e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ExpertUserInfoStepEnum.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:26 + */ +@AllArgsConstructor +@Getter +public enum ExpertUserInfoStepEnum { + + /** + * 待提交信息 + */ + INFORMATION_TO_BE_SUBMITTED("information_to_be_submitted"), + + /** + * 已提交基本信息 + */ + BASIC_INFORMATION_SUBMITTED("basic_information_submitted"), + + /** + * 已提交证明材料 + */ + EVIDENCE_HAS_BEEN_SUBMITTED("evidence_has_been_submitted"); + + private final String key; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/QueryExpertAccountStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/QueryExpertAccountStatusEnum.java new file mode 100644 index 0000000..af9915c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/QueryExpertAccountStatusEnum.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:14 + */ +@AllArgsConstructor +@Getter +public enum QueryExpertAccountStatusEnum { + + + /** + * 冻结中 + */ + FREEZING("freezing"), + + /** + * 正常 + */ + NORMAL("normal"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return true; + } + } + return false; + } + + + public static QueryExpertAccountStatusEnum of(String key) { + for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal QueryExpertAccountStatusEnum = %s", key)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ReviewResultEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ReviewResultEnum.java new file mode 100644 index 0000000..fafa42e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/constant/ReviewResultEnum.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * ReviewResultEnum + *

+ * + * @author WendyYang + * @since 14:17 2023/3/20 + */ +@Getter +@AllArgsConstructor +public enum ReviewResultEnum { + + PASSED(1, "通过"), + TO_BE_REVIEWED(2, "需复核"), + REFUSED(3, "不通过"); + + private final int code; + private final String value; + + public static ReviewResultEnum getByCode(int code) { + return Arrays.stream(values()) + .filter(w -> w.getCode() == code) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的审核结果编码")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java new file mode 100644 index 0000000..48adce3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java @@ -0,0 +1,116 @@ +package com.hz.pm.api.expert.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.expert.manage.ExpertAdminManage; +import com.hz.pm.api.expert.manage.ExpertManage; +import com.hz.pm.api.expert.model.ExpertAdminExpertManageQuery; +import com.hz.pm.api.expert.model.req.AdminExpertBasicInfoModifyRequest; +import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; +import com.hz.pm.api.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.hz.pm.api.expert.model.req.GetZzdInfoRequest; +import com.hz.pm.api.expert.model.vo.ExpertAdminExpertManageListVO; +import com.hz.pm.api.expert.model.vo.ExpertBasicInfoModifyResultVO; +import com.hz.pm.api.expert.model.vo.ExpertFullInfoVO; +import com.hz.pm.api.expert.model.vo.ZzdInfoByMobileVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.io.IOException; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@RestController +@Api(tags = "专家管理相关接口") +@RequestMapping(value = {"/api/v1/expert", "/expert"}) +@RequiredArgsConstructor +public class ExpertController { + + private final ExpertManage expertManage; + private final ExpertAdminManage expertAdminManage; + + /** + * 生成专家报名临时地址 + * + * @return 生成专家报名临时地址 + */ + @GetMapping("/getRegistrationUrl") + public String getRegistrationUrl() { + return expertManage.getRegistrationUrl(); + } + + @ApiIgnore + @GetMapping("/ephemeral/{uniqueId}/registration") + public void getRegistrationUrl(@PathVariable String uniqueId, HttpServletResponse response) throws IOException { + expertManage.redirectToRegistrationUrl(uniqueId, response); + } + + + @PostMapping("/registration") + @ApiOperation("社会专家报名") + @WebLog("社会专家报名") + public void expertRegistration(@Valid @RequestBody ExpertRegistrationRequest request) { + expertManage.expertRegistration(request); + } + + @PostMapping("/basic-info-submit") + @ApiOperation("专家管理员新增专家)") + @WebLog("专家管理员新增专家") + public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) { + expertManage.expertBasicInfoSubmit(request); + } + + @PostMapping("/basic-info-submit-notvalid") + @ApiOperation("专家管理员新增专家 参数不校检") + @WebLog("专家管理员新增专家 参数不校检") + public void expertBasicInfoSubmitNotValid(@RequestBody ExpertUserBasicInfoSubmitRequest request) { + expertManage.expertBasicInfoSubmit(request); + } + + @GetMapping("/detail") + @ApiOperation("专家获取专家详细信息") + public ExpertFullInfoVO getExpertFullInfoDetail() { + return expertManage.getExpertFullInfoDetail(null); + } + + + @GetMapping("/admin/detail") + @ApiOperation("专家管理员获取专家详细信息") + public ExpertFullInfoVO getExpertFullInfoDetail(@RequestParam(value = "expertUserId") @NotNull Long expertUserId) { + return expertManage.getExpertFullInfoDetail(expertUserId); + } + + @PostMapping("/expert-library/list") + @ApiOperation("专家库列表查询接口") + public PageVo getExpertLibraryList(@RequestBody @Valid ExpertAdminExpertManageQuery query) { + return expertAdminManage.getExpertLibraryList(query); + } + + @PostMapping("/basic-info-modify") + @ApiOperation("专家信息编辑") + @WebLog("专家信息编辑") + public ExpertBasicInfoModifyResultVO expertBasicInfoModify(@Valid @RequestBody AdminExpertBasicInfoModifyRequest request) { + return expertAdminManage.adminModifyExpertBasicInfo(request); + } + + @PostMapping("/get-zzd-info") + @ApiOperation("获取浙政钉用户信息") + @WebLog("获取浙政钉用户信息") + public ZzdInfoByMobileVO getZzdInfo(@Valid @RequestBody GetZzdInfoRequest request) { + return expertAdminManage.getZzdInfo(request); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertMetaApplyController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertMetaApplyController.java new file mode 100644 index 0000000..4c42cf7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertMetaApplyController.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.expert.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.expert.manage.ExpertMetaApplyManage; +import com.hz.pm.api.expert.model.cmd.MetaApplyListQuery; +import com.hz.pm.api.expert.model.req.MetaApplyResultRequest; +import com.hz.pm.api.expert.model.vo.ExpertApplyMetaVO; +import com.hz.pm.api.expert.model.vo.MetaApplyResultVo; +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.*; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-01 + */ +@RestController +@RequestMapping("/api/v1/apply/meta/") +@Validated +@RequiredArgsConstructor +@Api(value = "ExpertMetaApplyController", tags = "专家申请管理相关接口") +public class ExpertMetaApplyController { + + private final ExpertMetaApplyManage expertMetaApplyManage; + + @PostMapping("/list") + @ApiOperation(value = "审核列表筛选") + public PageVo metaApplyListQuery(@RequestBody @Valid MetaApplyListQuery metaApplyListQuery) { + return expertMetaApplyManage.metaApplyListQuery(metaApplyListQuery); + } + + @PostMapping("/result") + @ApiOperation(value = "审核结果处理") + public void metaApplyResult(@RequestBody @Valid MetaApplyResultRequest applyResultRequest) { + expertMetaApplyManage.metaApplyResult(applyResultRequest); + } + + @PostMapping("/revoke/{applyId}") + @ApiOperation(value = "申请撤销") + @WebLog("申请撤销") + public void metaApplyRevoke(@PathVariable Long applyId) { + expertMetaApplyManage.metaApplyRevoke(applyId); + } + + @ApiOperation("申请审核详情") + @GetMapping("/detail/{applyId}") + public MetaApplyResultVo applyAuditDetail(@PathVariable Long applyId) { + return expertMetaApplyManage.metaApplyResult(applyId); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertReviewController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertReviewController.java new file mode 100644 index 0000000..534d3e6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertReviewController.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.expert.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.expert.manage.ExpertReviewManage; +import com.hz.pm.api.expert.model.req.ExpertReviewDetailReq; +import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; +import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@RestController +@AllArgsConstructor +@Api(tags = "专家评审") +@RequestMapping("/api/v1/expertReview") +public class ExpertReviewController { + + private final ExpertReviewManage expertReviewManage; + + @PostMapping("/save") + @ApiOperation("填写评审意见") + @WebLog("填写评审意见") + public void expertReview(@RequestBody @Valid ExpertReviewDetailReq req) { + expertReviewManage.expertReview(req); + } + + @GetMapping("/detail/{meetingId}/{projectId}/{userId}") + @ApiOperation("获取专家评审详情") + @WebLog("获取专家评审详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "专家ID"), + @ApiImplicitParam(name = "projectId", value = "项目ID") + }) + public ExpertReviewDetailVO getExpertReviewDetail(@PathVariable Long userId, + @PathVariable Long projectId, + @PathVariable Long meetingId) { + return expertReviewManage.getExpertReviewDetail(userId, projectId, meetingId); + } + + @GetMapping("/listForGroupLeader/{projectId}/{meetingId}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectId", value = "项目ID"), + @ApiImplicitParam(name = "meetingId", value = "会议ID") + }) + @ApiOperation("查看组员评审意见") + @WebLog("查看组员评审意见") + public List listForGroupLeader(@PathVariable Long meetingId, + @PathVariable Long projectId) { + return expertReviewManage.listReviews(projectId, meetingId, true); + } + + @GetMapping("/list/{projectId}/{meetingId}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectId", value = "项目ID"), + @ApiImplicitParam(name = "meetingId", value = "会议ID") + }) + @ApiOperation("查看项目某次会议的所有评审意见") + @WebLog("查看项目某次会议的所有评审意见") + public List list(@PathVariable Long meetingId, + @PathVariable Long projectId) { + return expertReviewManage.listReviews(projectId, meetingId, false); + } + + @GetMapping("/detail/{projectCode}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectCode", value = "项目编号"), + }) + @ApiOperation("查看项目的所有评审意见") + @WebLog("查看项目的所有评审意见") + public ProjectReviewDetailVO projectExpertReviewDetail(@PathVariable String projectCode) { + return expertReviewManage.projectExpertReviewDetail(projectCode); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java new file mode 100644 index 0000000..31a09f3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@Controller +@RequestMapping("/pmapi.expert/expert-sensitive-info-modify-detail-record") +public class ExpertSensitiveInfoModifyDetailRecordController { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ReviewTemplateSettingsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ReviewTemplateSettingsController.java new file mode 100644 index 0000000..3b35621 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ReviewTemplateSettingsController.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.expert.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.expert.manage.ReviewTemplateSettingsManage; +import com.hz.pm.api.expert.model.req.ReviewTemplateReq; +import com.hz.pm.api.expert.model.vo.ReviewTemplateVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 评审模版配置表 前端控制器 + *

+ * + * @author WendyYang + * @since 2023-02-14 + */ +@RestController +@AllArgsConstructor +@Api(tags = "评审模版配置") +@RequestMapping("/api/v1/reviewTemplateSettings") +public class ReviewTemplateSettingsController { + + private final ReviewTemplateSettingsManage reviewTemplateSettingsManage; + + @GetMapping("/template/{templateType}/{regionCode}") + @ApiOperation("根据模版类型获取模版") + public ReviewTemplateVO getReviewTemplateByType(@PathVariable Integer templateType, @PathVariable String regionCode) { + return reviewTemplateSettingsManage.getReviewTemplateSettings(templateType, regionCode); + } + + @PostMapping("/modify") + @ApiOperation("修改或保存模版配置") + @WebLog("修改或保存模版配置") + public void modifyReviewTemplateSettings(@RequestBody @Valid ReviewTemplateReq req) { + reviewTemplateSettingsManage.saveOrUpdate(req); + } + + @GetMapping("/template") + @ApiOperation("根据模版ID获取评审模版") + @ApiImplicitParam(name = "templateId", defaultValue = "模版ID") + public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) { + return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); + } + + @GetMapping("/templates") + @ApiOperation("(批量)根据模版ID获取评审模版") + @ApiImplicitParam(name = "templateIds", defaultValue = "模版ID集合") + public List getTemplateById(@RequestParam List templateIds) { + return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertAvoidCompany.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertAvoidCompany.java new file mode 100644 index 0000000..371a852 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertAvoidCompany.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.expert.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +@TableName("expert_avoid_company") +@ApiModel(value = "ExpertAvoidCompany对象", description = "") +@Data +public class ExpertAvoidCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String companyName; + + private String companyUniqCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertGovBusinessStrip.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertGovBusinessStrip.java new file mode 100644 index 0000000..9e1ce32 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertGovBusinessStrip.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-04-17 + */ +@Data +@TableName("expert_gov_business_strip") +@ApiModel(value = "ExpertGovBusinessStrip对象") +public class ExpertGovBusinessStrip implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private String businessStripCode; + + private String businessStripName; + + private Long expertUserId; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertIntentionWorkRegion.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertIntentionWorkRegion.java new file mode 100644 index 0000000..daf692d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertIntentionWorkRegion.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.expert.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 lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("expert_intention_work_region") +@Data +@ApiModel(value = "ExpertIntentionWorkRegion对象", description = "") +public class ExpertIntentionWorkRegion implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String regionCode; + + private Integer regionLevel; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertMetaApply.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertMetaApply.java new file mode 100644 index 0000000..0bd870a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertMetaApply.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.expert.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 lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-03-01 + */ +@Data +@TableName("expert_meta_apply") +@ApiModel(value = "ExpertMetaApply对象") +public class ExpertMetaApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + + private String applyType; + + private Long userId; + + private Long approverUserId; + + private String applyStatus; + + private LocalDateTime reviewTime; + + private String auditOpinion; + + private String regionCode; + + private String approver; + + private Integer regionLevel; + + private Long applicantId; + + private String extraMaterial; + + private String displayEnable; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java new file mode 100644 index 0000000..addb954 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@Data +@TableName("expert_sensitive_info_modify_detail_record") +@ApiModel(value = "ExpertSensitiveInfoModifyDetailRecord对象", description = "") +public class ExpertSensitiveInfoModifyDetailRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String originalJson; + + private String modifyJson; + + private Long metaApplyId; + + private String extraMaterial; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java new file mode 100644 index 0000000..9e6e674 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java @@ -0,0 +1,110 @@ +package com.hz.pm.api.expert.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 lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("nd_expert_user_full_info") +@ApiModel(value = "NdExpertUserFullInfo对象", description = "") +public class ExpertUserFullInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String expertAccountStatus; + + private String isDingUser; + + private String userInfoStep; + + private String phoneNo; + + private String gender; + + private String expertName; + + private Long avatarFileId; + + private String idCard; + + private String officePhone; + + private String bankNo; + + private String bank; + + private String email; + + private String school; + + private LocalDateTime graduatedAt; + + private String academicTitle; + + private String graduationCertificateFileIdList; + + private String degreeCertificateFileIdList; + + private LocalDateTime retiredAt; + + private String company; + + private String companyUniqCode; + + private String legalEntityCode; + + private String administrativeDuties; + + private LocalDateTime startWorkAt; + + private String address; + + private String experience; + + private String technicalTitles; + + private String titleCertificateFileIdList; + + private String awards; + + private String recognitionReward; + + private String recommendationProofFileIdList; + + private String regionCode; + + private Integer regionLevel; + + private String recommendedWay; + + private String remark; + + private String hometown; + + private String nationality; + + private LocalDateTime birth; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoCommonHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoCommonHelper.java new file mode 100644 index 0000000..a095430 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoCommonHelper.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.expert.helper; + +import com.hz.pm.api.expert.model.dto.ExpertFullInfoAllDTO; +import com.hz.pm.api.expert.model.dto.ExpertUserFullInfoDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/28 上午10:18 + */ +@Component +public class ExpertInfoCommonHelper { + + /** + * 获取专家的所有文件id + * 头像,学位证书,毕业证书,推荐证明材料,职称证明 + * + * @param expertUserFullInfoAll + * @return + */ + public List getExpertFileIdList(ExpertFullInfoAllDTO expertUserFullInfoAll) { + ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); + List fileIdList = new ArrayList<>(); + if (Objects.nonNull(expertUserInfoDTO.getAvatarFileId())) { + fileIdList.add(expertUserInfoDTO.getAvatarFileId()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getDegreeCertificateFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getGraduationCertificateFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getRecommendationProofFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getTitleCertificateFileIdList()); + } + return fileIdList; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java new file mode 100644 index 0000000..99d2453 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java @@ -0,0 +1,165 @@ +package com.hz.pm.api.expert.helper; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; +import com.hz.pm.api.expert.constant.ExpertSensitiveFieldTypeEnum; +import com.hz.pm.api.expert.constant.ExpertUserInfoSensitiveFieldEnum; +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; +import com.hz.pm.api.expert.model.dto.ExpertFullInfoAllDTO; +import com.hz.pm.api.expert.model.dto.ExpertUserFullInfoDTO; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/28 上午10:09 + */ +@Component +@RequiredArgsConstructor +public class ExpertInfoSensitiveFieldModifyCheckHelper { + + private final ExpertInfoService expertInfoService; + private final ExpertInfoCommonHelper expertInfoCommonHelper; + private final FileService fileService; + private final ExpertUserInfoAssembler expertUserInfoAssembler; + private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService; + + + public ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldModifyCheck(ExpertBasicInfo applyBasicInfo + , ExpertEduInfo applyEduInfo, ExpertJobInfo applyJobInfo, ExpertProfessionalInfo applyProfessionalInfo, Long expertUserId) { + + ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); + if (Objects.isNull(expertUserFullInfoAll)) { + throw new BizException("当前账号尚未有专家相关信息,无法更新"); + } + List attachFiles = fileService.getByIds(expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll)); + + ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); + // 字典字典段map + Map> dictionaryFieldInfoMap = + expertUserInfoAssembler.buildDictInfoMap(expertUserFullInfoAll.getExpertDictionaryList()); + // 专家文件资料map + Map fileBasicInfoMap = ExpertUserInfoAssembler.buildFileBasicInfoMap(attachFiles); + // 专家标签字段map + Map> tagFieldInfoMap = expertUserInfoAssembler.buildTagFieldInfoMap(expertUserFullInfoAll.getExpertTagList()); + ExpertBasicInfo originalBasicInfo = expertUserInfoAssembler + .buildExpertBasicInfo(expertUserInfoDTO, dictionaryFieldInfoMap + , tagFieldInfoMap, expertUserFullInfoAll.getExpertIntentionWorkRegionInfo(), fileBasicInfoMap); + + ExpertJobInfo originalJobInfo = ExpertUserInfoAssembler.buildExpertJobInfo(expertUserInfoDTO, dictionaryFieldInfoMap); + ExpertProfessionalInfo originalProfessionalInfo = ExpertUserInfoAssembler.buildExpertProfessionalInfo(expertUserInfoDTO + , dictionaryFieldInfoMap, tagFieldInfoMap, fileBasicInfoMap, expertUserFullInfoAll.getExpertAvoidCompanyList()); + + + // 敏感字段 手机号/电子邮箱/专家层级/履职意向/工作单位/单位法人编号/行政职级/职称级别/擅长方向/技术专长/行业领域/其他标签 + // 敏感信息字段修改 + List sensitiveModifySegmentList = new ArrayList<>(); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.phone_no + , originalBasicInfo.getPhoneNo(), applyBasicInfo.getPhoneNo())); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.email + , originalBasicInfo.getEmail(), applyBasicInfo.getEmail())); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company + , originalJobInfo.getCompany(), applyJobInfo.getCompany())); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company_uniq_code + , originalJobInfo.getCompanyUniqCode(), applyJobInfo.getCompanyUniqCode())); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.legal_entity_code + , originalJobInfo.getLegalEntityCode(), applyJobInfo.getLegalEntityCode())); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.administrative_rank + , originalJobInfo.getAdministrativeRank() + , assemblerDictionaryFieldInfoList(applyJobInfo.getAdministrativeRank(), ExpertUserInfoSensitiveFieldEnum.administrative_rank.getKey()))); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.title_level + , originalProfessionalInfo.getTitleLevel() + , assemblerDictionaryFieldInfoList(applyProfessionalInfo.getTitleLevel(), ExpertUserInfoSensitiveFieldEnum.title_level.getKey()))); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.good_at + , originalProfessionalInfo.getGoodAt() + , assemblerTagFieldInfoList(applyProfessionalInfo.getGoodAt(), ExpertUserInfoSensitiveFieldEnum.good_at.getKey()))); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.technical_expertise + , originalProfessionalInfo.getTechnicalExpertise() + , assemblerTagFieldInfoList(applyProfessionalInfo.getTechnicalExpertise(), ExpertUserInfoSensitiveFieldEnum.technical_expertise.getKey()))); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.industry_sector + , originalProfessionalInfo.getIndustrySector() + , assemblerTagFieldInfoList(applyProfessionalInfo.getIndustrySector(), ExpertUserInfoSensitiveFieldEnum.industry_sector.getKey()))); + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.other + , originalProfessionalInfo.getOther() + , assemblerTagFieldInfoList(applyProfessionalInfo.getOther(), ExpertUserInfoSensitiveFieldEnum.other.getKey()))); + // 专家层级修改 + sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertSensitiveFieldTypeEnum.expert_region_field, ExpertUserInfoSensitiveFieldEnum.expert_region + , originalBasicInfo.getExpertRegionInfo(), applyBasicInfo.getExpertRegionInfo())); + // 履职意向修改 + sensitiveModifySegmentList + .add(new SensitiveModifySegment( + ExpertSensitiveFieldTypeEnum.expert_intention_field, ExpertUserInfoSensitiveFieldEnum.expert_intention_work_region + , originalBasicInfo.getExpertIntentionWorkRegions(), applyBasicInfo.getExpertIntentionWorkRegions())); + + return new ExpertInfoSensitiveFieldCheckBO(sensitiveModifySegmentList); + } + + public ExpertInfoSensitiveFieldCheckBO intentionWorkRegionsModifyCheck(Long expertUserId, List applyExpertIntentionWorkRegions) { + List sensitiveModifySegmentList = new ArrayList<>(); + + LambdaQueryWrapper expertIntentionWorkRegionEq = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .eq(ExpertIntentionWorkRegion::getUserId, expertUserId); + List expertIntentionWorkRegions = iExpertIntentionWorkRegionService.list(expertIntentionWorkRegionEq); + + List currentExpertIntentionWorkRegions = new ArrayList<>(); + if (CollUtil.isNotEmpty(expertIntentionWorkRegions)) { + expertIntentionWorkRegions.forEach(r -> { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionLevel(r.getRegionLevel()); + expertRegionInfo.setRegionCode(r.getRegionCode()); + currentExpertIntentionWorkRegions.add(expertRegionInfo); + }); + } + // 履职意向修改 + sensitiveModifySegmentList + .add(new SensitiveModifySegment( + ExpertSensitiveFieldTypeEnum.expert_intention_field, ExpertUserInfoSensitiveFieldEnum.expert_intention_work_region + , currentExpertIntentionWorkRegions, applyExpertIntentionWorkRegions)); + + return new ExpertInfoSensitiveFieldCheckBO(sensitiveModifySegmentList); + } + + + private List assemblerDictionaryFieldInfoList(List dictionaryFieldInfoList, String fieldName) { + if (CollUtil.isNotEmpty(dictionaryFieldInfoList)) { + dictionaryFieldInfoList.forEach(r -> r.setDictionaryFieldName(fieldName)); + } + return dictionaryFieldInfoList; + } + + private List assemblerTagFieldInfoList(List tagFieldInfoList, String fieldName) { + if (CollUtil.isNotEmpty(tagFieldInfoList)) { + tagFieldInfoList.forEach(r -> r.setTagFieldName(fieldName)); + } + return tagFieldInfoList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java new file mode 100644 index 0000000..76a9284 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java @@ -0,0 +1,115 @@ +package com.hz.pm.api.expert.helper; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/23 上午9:18 + */ + +@Component +public class ExpertManageHelper { + +// @Autowired +// private RegionCache regionCache; + + @Autowired + private TagCache tagCache; + + @Autowired + private DictionaryCache dictionaryCache; + + + /** + * 校验区域code + * + * @param expertRegionInfo + */ + public void expertRegionInfoCheck(ExpertRegionInfo expertRegionInfo) { +// // todo 必须为叶子节点编码 +// String regionCode = expertRegionInfo.getRegionCode(); +// Integer regionLevel = expertRegionInfo.getRegionLevel(); +// RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); +// if (Objects.isNull(regionDTO)) { +// throw new BadRequestException("illegal regionInfo"); +// } + } + + + /** + * 校验标签code是否合法 + * + * @param expertProfessionalInfo + * @param expertBasicInfo + */ + public void tagFieldCheck(ExpertProfessionalInfo expertProfessionalInfo, ExpertBasicInfo expertBasicInfo) { + List goodAt = expertProfessionalInfo.getGoodAt(); + List technicalExpertise = expertProfessionalInfo.getTechnicalExpertise(); + List industrySector = expertProfessionalInfo.getIndustrySector(); + List expertSource = expertBasicInfo.getExpertSource(); + + List tagFieldInfoList = new ArrayList<>(); + tagFieldInfoList.addAll(goodAt); + tagFieldInfoList.addAll(technicalExpertise); + tagFieldInfoList.addAll(industrySector); + if (CollUtil.isNotEmpty(expertSource)) { + tagFieldInfoList.addAll(expertSource); + } + for (TagFieldInfo tagFieldInfo : tagFieldInfoList) { + String tagCode = tagFieldInfo.getTagCode(); + TagDTO tagCodeDTO = tagCache.getByTagCode(tagCode); + if (Objects.isNull(tagCodeDTO)) { + throw new BizException("illegal tagCode: tagField=" + tagFieldInfo.getTagFieldName() + ",tagCode=" + tagCode); + } + } + } + + + /** + * 校验字典code是否合法 + * + * @param expertBasicInfo + * @param expertEduInfo + * @param expertJobInfo + */ + public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo + , ExpertJobInfo expertJobInfo) { + List political = expertBasicInfo.getPolitical(); + List edu = expertEduInfo.getEdu(); + List degree = expertEduInfo.getDegree(); + List jobStatus = expertJobInfo.getJobStatus(); + List companyAttribute = expertJobInfo.getCompanyAttribute(); + List administrativeRank = expertJobInfo.getAdministrativeRank(); + + List dictionaryFieldInfoList = new ArrayList<>(); + dictionaryFieldInfoList.addAll(political); + dictionaryFieldInfoList.addAll(edu); + dictionaryFieldInfoList.addAll(degree); + dictionaryFieldInfoList.addAll(jobStatus); + dictionaryFieldInfoList.addAll(companyAttribute); + dictionaryFieldInfoList.addAll(administrativeRank); + + for (DictionaryFieldInfo dictionaryFieldInfo : dictionaryFieldInfoList) { + String dictionaryFieldName = dictionaryFieldInfo.getDictionaryFieldName(); + String dictionaryCode = dictionaryFieldInfo.getDictionaryCode(); + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(dictionaryCode); + if (Objects.isNull(dictionaryDTO)) { + throw new BizException("illegal dictionaryCode: dictionaryFieldName=" + dictionaryFieldName + ",dictionaryCode=" + dictionaryCode); + } + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/PermissionCheckHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/PermissionCheckHelper.java new file mode 100644 index 0000000..2a4f7c5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/PermissionCheckHelper.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.expert.helper; + +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2022/8/18 上午10:02 + * 校验是否一个账号对一个专家有操作的权限 + */ +@Component +@RequiredArgsConstructor +public class PermissionCheckHelper { + + public boolean isSuperAdmin() { + UserInfoDetails details = LoginUserUtil.loginUserDetail(); + return details.getUserRoleList().stream().anyMatch(w -> w.getCode().equals(RoleEnum.SUPER_ADMIN.name())); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java new file mode 100644 index 0000000..81e9533 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java @@ -0,0 +1,295 @@ +package com.hz.pm.api.expert.manage; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.enumeration.BoolDisplayEnum; +import com.hz.pm.api.common.helper.RegionLimitHelper; +import com.hz.pm.api.common.model.CommonPage; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.expert.assembler.ExpertAdminExpertManageAssembler; +import com.hz.pm.api.expert.assembler.ExpertInfoCmdAssembler; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import com.hz.pm.api.expert.constant.QueryExpertAccountStatusEnum; +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.helper.ExpertInfoSensitiveFieldModifyCheckHelper; +import com.hz.pm.api.expert.helper.PermissionCheckHelper; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; +import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.hz.pm.api.expert.model.cmd.ExpertInfoModifyCmd; +import com.hz.pm.api.expert.model.dto.ExpertAdminExpertManageListDTO; +import com.hz.pm.api.expert.model.query.ExpertDictionaryQuery; +import com.hz.pm.api.expert.model.query.ExpertTagQuery; +import com.hz.pm.api.expert.model.req.AdminExpertBasicInfoModifyRequest; +import com.hz.pm.api.expert.model.req.GetZzdInfoRequest; +import com.hz.pm.api.expert.model.req.MetaApplyResultRequest; +import com.hz.pm.api.expert.model.vo.ExpertAdminExpertManageListVO; +import com.hz.pm.api.expert.model.vo.ExpertBasicInfoModifyResultVO; +import com.hz.pm.api.expert.model.vo.ZzdInfoByMobileVO; +import com.hz.pm.api.expert.service.ExpertAdminManageService; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertMetaApplyService; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.bo.RegionContainsBO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; +import com.ningdatech.zwdd.model.dto.EmployeePositionsDTO; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.*; + +/** + * @author liuxinxin + * @date 2023/3/1 下午2:12 + */ + +@Component +@RequiredArgsConstructor +public class ExpertAdminManage { + + private final PermissionCheckHelper permissionCheckHelper; + private final RegionLimitHelper regionLimitHelper; + private final IExpertMetaApplyService iExpertMetaApplyService; + private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; + private final ExpertInfoService expertInfoService; + private final ExpertMetaApplyManage expertMetaApplyManage; + private final ExpertAdminManageService expertAdminManageService; + private final ExpertAdminExpertManageAssembler expertAdminExpertManageAssembler; + private final ZwddClient zwddClient; + + /** + * 专家管理员使用 专家库列表查询 + * + * @param query + * @return + */ + public PageVo getExpertLibraryList(ExpertAdminExpertManageQuery query) { + Long userId = LoginUserUtil.getUserId(); + ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); + if (queryCmd.isHasNonData()) { + return PageVo.empty(); + } + CommonPage pageResult = expertAdminManageService.getExpertLibraryList(queryCmd); + + PageVo pageVo = new PageVo<>(); + pageVo.setTotal(pageResult.getItemsTotal()); + pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); + return pageVo; + } + + + private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(ExpertAdminExpertManageQuery query, Long userId) { + ExpertAdminExpertManageQueryCmd queryCmd = new ExpertAdminExpertManageQueryCmd(); + queryCmd.setPageNumber(query.getPageNumber()); + queryCmd.setPageSize(query.getPageSize()); + if (StrUtils.isNotBlank(query.getExpertName())) { + queryCmd.setExpertName(query.getExpertName()); + } + if (StrUtils.isNotBlank(query.getCompany())) { + queryCmd.setCompany(query.getCompany()); + } + List expertDictQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { + ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); + expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); + expertDictQueryList.add(expertDictQuery); + } + if (StringUtils.isNotBlank(query.getCompanyAttributeDictionaryCode())) { + ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); + expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()); + expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getCompanyAttributeDictionaryCode())); + expertDictQueryList.add(expertDictQuery); + } + if (StringUtils.isNotBlank(query.getExpertTypeDictionaryCode())) { + ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); + expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()); + expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getExpertTypeDictionaryCode())); + expertDictQueryList.add(expertDictQuery); + } + List expertTagQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getExpertSourceTagCode())) { + ExpertTagQuery expertTagQuery = new ExpertTagQuery(); + expertTagQuery.setExpertInfoField(ExpertTagEnum.EXPERT_SOURCE.getKey()); + expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getExpertSourceTagCode())); + expertTagQueryList.add(expertTagQuery); + } + if (StringUtils.isNotBlank(query.getGoodAtTagCode())) { + ExpertTagQuery expertTagQuery = new ExpertTagQuery(); + expertTagQuery.setExpertInfoField(ExpertTagEnum.GOOD_AT.getKey()); + expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getGoodAtTagCode())); + expertTagQueryList.add(expertTagQuery); + } + if (StringUtils.isNotBlank(query.getExpertAccountStatus())) { + QueryExpertAccountStatusEnum queryExpertAccountStatus = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); + switch (queryExpertAccountStatus) { + case NORMAL: + queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE)); + break; + case FREEZING: + queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.FREEZE)); + break; + default: + break; + } + } else { + queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE, ExpertAccountStatusEnum.FREEZE)); + } + + List expertAdminContainsRegionList; + // 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 + boolean isSuperAdmin; + if (!(isSuperAdmin = permissionCheckHelper.isSuperAdmin())) { + expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); + } else { + expertAdminContainsRegionList = Collections.emptyList(); + } + + List containsRegion = null; + if (Objects.nonNull(query.getExpertRegionInfo())) { + RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() + , query.getExpertRegionInfo().getRegionCode()); + if (isSuperAdmin) { + containsRegion = Collections.singletonList(containsRegionBo); + } else { + containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); + if (containsRegion.isEmpty()) { + queryCmd.setHasNonData(true); + return queryCmd; + } + } + } + + List intentionRegions = null; + if (query.getIntentionRegionInfo() != null) { + ExpertRegionInfo intentionRegionInfo = query.getIntentionRegionInfo(); + RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(intentionRegionInfo.getRegionLevel() + , intentionRegionInfo.getRegionCode()); + if (isSuperAdmin) { + intentionRegions = Collections.singletonList(containsRegionBo); + } else { + intentionRegions = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); + if (intentionRegions.isEmpty()) { + queryCmd.setHasNonData(true); + return queryCmd; + } + } + } + if (containsRegion == null && intentionRegions == null) { + containsRegion = expertAdminContainsRegionList; + } + queryCmd.setExpertDictionaryQueryList(expertDictQueryList); + queryCmd.setExpertTagQueryList(expertTagQueryList); + queryCmd.setIsDingUser(query.getIsDingUser()); + queryCmd.setRegionContainsList(containsRegion); + queryCmd.setIntentionRegionList(intentionRegions); + queryCmd.setPageSize(query.getPageSize()); + queryCmd.setPageNumber(query.getPageNumber()); + return queryCmd; + } + + + /** + * 专家管理员修改专家的个人信息接口(包含专家层级变更) + * + * @param request + * @return + */ + public ExpertBasicInfoModifyResultVO adminModifyExpertBasicInfo(AdminExpertBasicInfoModifyRequest request) { + Long adminUserId = LoginUserUtil.getUserId(); + Long expertUserId = request.getExpertUserId(); + // 手机号不能更改 + request.getBasicInfo().setPhoneNo(null); + + // 校验当前是否有信息变更审核 如有,无法变更信息 + LambdaQueryWrapper infoModifyEq = Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, expertUserId) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()); + ExpertMetaApply infoModifyApply = iExpertMetaApplyService.getOne(infoModifyEq); + if (Objects.nonNull(infoModifyApply)) { + throw new BizException("该账号还有信息修审核审核未审批,请撤销或审批后处理"); + } + // 校验当前是否有层级变更审核,如有需要审核通过或撤销审核后重新提交 + LambdaQueryWrapper expertStorageEq = Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, expertUserId) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()); + ExpertMetaApply expertStorageApply = iExpertMetaApplyService.getOne(expertStorageEq); + if (Objects.nonNull(expertStorageApply)) { + throw new BizException("当前账号还有入库审核未审批,请撤销或审批后处理"); + } + + ExpertBasicInfo basicInfo = request.getBasicInfo(); + ExpertEduInfo eduInfo = request.getEduInfo(); + ExpertJobInfo jobInfo = request.getJobInfo(); + ExpertProfessionalInfo professionalInfo = request.getProfessionalInfo(); + ExpertRecommendInfo recommendInfo = request.getRecommendInfo(); + ExpertOtherInfo otherInfo = request.getExpertOtherInfo(); + + ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = + expertInfoSensitiveFieldModifyCheckHelper.expertInfoSensitiveFieldModifyCheck(basicInfo, eduInfo, jobInfo, professionalInfo, expertUserId); + ExpertInfoModifyCmd expertInfoModifyCmd = ExpertInfoCmdAssembler + .buildExpertInfoModifyCmd(expertUserId, basicInfo, eduInfo, jobInfo, professionalInfo, recommendInfo, otherInfo, expertInfoSensitiveFieldCheckBO, null); + List applyIdList = expertInfoService.adminModifyExpertInfo(expertInfoModifyCmd, adminUserId); + + // 批量通过专家管理员审核 + for (Long applyId : applyIdList) { + MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); + applyResult.setApplyId(applyId); + applyResult.setAuditOpinion("同意"); + applyResult.setApplyResult(true); + expertMetaApplyManage.metaApplyResult(applyResult); + } + return new ExpertBasicInfoModifyResultVO(false); + } + + + public ZzdInfoByMobileVO getZzdInfo(GetZzdInfoRequest request) { + ZzdInfoByMobileVO zzdInfoByMobileVO = new ZzdInfoByMobileVO(); + String phoneNo = request.getPhoneNo(); + zzdInfoByMobileVO.setPhoneNo(phoneNo); + + GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile(phoneNo); + DingInfoByMobileDTO dingInfo = dingInfoByMobile.getData(); + if (Objects.nonNull(dingInfo) && StringUtils.isNotBlank(dingInfo.getEmployeeCode())) { + zzdInfoByMobileVO.setIsDingUser(true); + String employeeCode = dingInfo.getEmployeeCode(); + GenericResult> listGenericResult = zwddClient.listEmployeePositionsByEmployeeCode(employeeCode); + List employeePositionsDTOS = listGenericResult.getData(); + if (CollectionUtils.isNotEmpty(employeePositionsDTOS)) { + EmployeePositionsDTO employeePositionsDTO = employeePositionsDTOS.get(0); + String organizationCode = employeePositionsDTO.getOrganizationCode(); + GenericResult dingOrgInfoDTOGenericResult = zwddClient.getOrganizationByCode(organizationCode); + DingOrgInfoDTO organizationByCode = dingOrgInfoDTOGenericResult.getData(); + String organizationName = organizationByCode.getOrganizationName(); + zzdInfoByMobileVO.setCompanyName(organizationName); + } + GenericResult infoDTOGenericResult = zwddClient.getEmployeeByCode(employeeCode); + EmployeeInfoDTO employeeInfoDTO = infoDTOGenericResult.getData(); + if (Objects.nonNull(employeeInfoDTO)) { + String employeeName = employeeInfoDTO.getEmployeeName(); + zzdInfoByMobileVO.setName(employeeName); + } + } else { + zzdInfoByMobileVO.setIsDingUser(false); + } + return zzdInfoByMobileVO; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java new file mode 100644 index 0000000..504b366 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java @@ -0,0 +1,299 @@ +package com.hz.pm.api.expert.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.expert.assembler.ExpertInfoCmdAssembler; +import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.constant.ExpertUserInfoStepEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.helper.ExpertInfoCommonHelper; +import com.hz.pm.api.expert.helper.ExpertManageHelper; +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.hz.pm.api.expert.model.cmd.ExpertRecommendProofSaveCmd; +import com.hz.pm.api.expert.model.dto.ExpertDictionaryDTO; +import com.hz.pm.api.expert.model.dto.ExpertFullInfoAllDTO; +import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; +import com.hz.pm.api.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.hz.pm.api.expert.model.vo.ExpertFullInfoVO; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.entity.config.WebProperties; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.sys.service.IUserRoleService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.service.IUserInfoService; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/23 上午8:55 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ExpertManage { + + private final ExpertManageHelper expertManageHelper; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final ExpertInfoService expertInfoService; + private final ExpertInfoCommonHelper expertInfoCommonHelper; + private final FileService fileService; + private final ExpertUserInfoAssembler expertUserInfoAssembler; + private final IUserInfoService userInfoService; + private final ExpertMetaApplyManage expertMetaApplyManage; + private final IUserRoleService userRoleService; + private final IRoleService roleService; + private final VerifyCodeCheckHelper verifyCodeCheckHelper; + private final CachePlusOps cachePlusOps; + private final ZwddClient zwddClient; + + @Value("${expert-registration.verify-code.check:true}") + private Boolean expertRegistrationVerifyCodeCheck; + + private static final Duration REGISTER_EXPIRED_DURATION = Duration.ofDays(3); + private static final Duration REGISTER_GEN_DURATION = Duration.ofMinutes(30); + + private static final String RK_REGISTER_UNIQUE_ID = "expert_registration_id:"; + private static final String RK_REGISTER_UNIQUE_ID_LAST = RK_REGISTER_UNIQUE_ID + "last"; + + public synchronized String getRegistrationUrl() { + CacheKey lastKey = new CacheKey(RK_REGISTER_UNIQUE_ID_LAST, REGISTER_GEN_DURATION); + String lastUniqueId = cachePlusOps.get(lastKey); + if (StrUtil.isBlank(lastUniqueId)) { + lastUniqueId = BizUtils.uuid32(); + CacheKey key = new CacheKey(); + key.setKey(RK_REGISTER_UNIQUE_ID + lastUniqueId); + key.setExpire(REGISTER_EXPIRED_DURATION); + cachePlusOps.set(lastKey, lastUniqueId); + String gmtUserTime = LoginUserUtil.getUserId() + "#" + System.currentTimeMillis(); + cachePlusOps.set(key, gmtUserTime); + } + return WebProperties.webUrl + "/pm/expert/ephemeral/" + lastUniqueId + "/registration"; + } + + public void redirectToRegistrationUrl(String uniqueId, HttpServletResponse response) throws IOException { + CacheKey cacheKey = new CacheKey(RK_REGISTER_UNIQUE_ID + uniqueId); + response.setContentType(MediaType.TEXT_PLAIN_VALUE); + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + try { + if (cachePlusOps.exists(cacheKey)) { + response.sendRedirect(WebProperties.webUrl + WebProperties.expertRegistrationUrl); + } else { + response.getWriter().write("专家报名链接已失效"); + } + } catch (Exception e) { + log.error("专家报名链接重定向异常:", e); + response.getWriter().write("专家报名链接访问异常"); + } + } + + + /** + * 专家管理员新增专家 + * + * @param req / + */ + @Transactional(rollbackFor = Exception.class) + public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest req) { + Long operatorId = LoginUserUtil.getUserId(); + // 用户id + Long userId = assemblerAndGenerateExpert(req, operatorId); + // 批量通过专家入库审核/专家履职意向审核 + expertMetaApplyManage.autoPassExpertApply(userId); + + // 增加用户专家角色 + Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); + UserRole expertRole = userRoleService.getOne(userId, role.getId()); + if (Objects.isNull(expertRole)) { + expertRole = new UserRole(); + expertRole.setUserId(userId); + expertRole.setRoleId(role.getId()); + userRoleService.save(expertRole); + } + } + + + @Transactional(rollbackFor = Exception.class) + public Long expertRecommendProofSubmit + (List recommendedWay, List recommendProofFile, Long expertUserId) { + // 用户id + ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(expertUserId); + // 判断专家状态,是否可以进行证明材料提交 + if (Objects.isNull(expertUserFullInfo) + || !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) + || ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())) { + throw new BizException("当前状态无法提交证明材料"); + } + + // 证明材料提交 + ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd = new ExpertRecommendProofSaveCmd(); + if (CollectionUtils.isNotEmpty(recommendProofFile)) { + expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + List recommendedWayDictionaryDTOList = new ArrayList<>(); + if (CollUtil.isNotEmpty(recommendedWay)) { + recommendedWay.forEach(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); + recommendedWayDictionaryDTOList.add(expertDictionaryDTO); + }); + } + expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); + expertRecommendProofSaveCmd.setUserId(expertUserId); + return expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd); + } + + public ExpertFullInfoVO getExpertFullInfoDetail(Long expertUserId) { + Long currentUserId = LoginUserUtil.getUserId(); + if (Objects.isNull(expertUserId)) { + expertUserId = currentUserId; + } + ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); + if (Objects.isNull(expertUserFullInfoAll)) { + return null; + } + List fileIdList = expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll); + List attachFiles = fileService.getByIds(fileIdList); + return expertUserInfoAssembler.buildExpertFullInfo(attachFiles, expertUserFullInfoAll); + } + + @Transactional(rollbackFor = Exception.class) + public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { + String phoneNo = basicInfo.getPhoneNo(); + UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); + if (Objects.isNull(userInfo)) { + GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile(basicInfo.getPhoneNo()); + if (dingInfoByMobile.isSuccess()) { + DingInfoByMobileDTO data = dingInfoByMobile.getData(); + String accountId = data.getAccountId(); + userInfo = userInfoService.getUserInfoByAccountId(Long.parseLong(accountId)); + } + if (userInfo == null) { + userInfo = UserInfo.builder() + .username(basicInfo.getName()) + .realName(basicInfo.getName()) + .available(UserAvailableEnum.DISABLE.name()) + .mobile(phoneNo) + .createBy(operatorId) + .updateBy(operatorId) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .build(); + userInfoService.save(userInfo); + } else if (!StrUtil.equals(userInfo.getRealName(), basicInfo.getName())) { + log.warn("相似账户为:{} ==> {}", basicInfo.getPhoneNo(), userInfo); + throw BizException.wrap("已存在同手机号,但不同名的账号"); + } else if (StrUtil.isBlank(userInfo.getMobile())) { + userInfo.setMobile(basicInfo.getPhoneNo()); + userInfoService.updateById(userInfo); + } + } + ExpertUserFullInfo one = expertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); + if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { + throw new BizException("该手机号已被专家注册,请确认后再填写"); + } + return userInfo.getId(); + } + + /** + * 社会专家报名 需要校验手机号 + * + * @param request + */ + @Transactional(rollbackFor = Exception.class) + public void expertRegistration(ExpertRegistrationRequest request) { + String verificationCode = request.getVerificationCode(); + String phoneNo = request.getBasicInfo().getPhoneNo(); + //校验 专家验证码 + if (expertRegistrationVerifyCodeCheck) { + verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); + } + assemblerAndGenerateExpert(request, null); + } + + + @Transactional(rollbackFor = Exception.class) + public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req, Long operatorId) { + if (Objects.isNull(operatorId)) { + operatorId = -1L; + } + ExpertBasicInfo basicInfo = req.getBasicInfo(); + Long userId = generateOrGetUserId(basicInfo, operatorId); + + // 校验区域编码合法性 校验履职意向编码合法性 + ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); + expertManageHelper.expertRegionInfoCheck(expertRegionInfo); + List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); + for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { + expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); + } + ExpertEduInfo eduInfo = req.getEduInfo(); + ExpertJobInfo jobInfo = req.getJobInfo(); + ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo(); + // 校验标签字段 + expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); + // 校验字典字段 + expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); + // 判断专家提交状态,判断是否可以进行此操作 + ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(userId); + + boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) + || (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) + && !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); + if (submitBasicInfoStatusEnable) { + // 新建 保存 + ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler + .buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); + expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); + } + + ExpertRecommendInfo recommendInfo = req.getRecommendInfo(); + // 推荐证明材料 + List recommendedWay = recommendInfo.getRecommendedWay(); + // 推荐方式 + List recommendProofFile = recommendInfo.getRecommendationProofFile(); + expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId); + return userId; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java new file mode 100644 index 0000000..7ee2c93 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java @@ -0,0 +1,573 @@ +package com.hz.pm.api.expert.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +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.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.enumeration.BoolDisplayEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.RegionLimitHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeQueryEnum; +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.expert.model.cmd.*; +import com.hz.pm.api.expert.model.dto.ExpertDictionaryDTO; +import com.hz.pm.api.expert.model.dto.ExpertTagDTO; +import com.hz.pm.api.expert.model.query.ExpertDictionaryQuery; +import com.hz.pm.api.expert.model.req.MetaApplyResultRequest; +import com.hz.pm.api.expert.model.req.MetaApplyResultRequest.StorageApplyResultExtraInfo; +import com.hz.pm.api.expert.model.vo.ExpertApplyMetaVO; +import com.hz.pm.api.expert.model.vo.MetaApplyResultVo; +import com.hz.pm.api.expert.service.ExpertAdminManageService; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertMetaApplyService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.ExpertUserInfoHelper; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.bo.RegionContainsBO; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/1 上午10:38 + */ + +@Component +@RequiredArgsConstructor +public class ExpertMetaApplyManage { + + private final IExpertMetaApplyService iMetaApplyService; + private final IExpertDictionaryService expertDictionaryService; + private final RegionCacheHelper regionCacheHelper; + private final IExpertUserFullInfoService userFullInfoService; + private final DictionaryCache dictionaryCache; + private final ExpertInfoService expertInfoService; + private final UserInfoHelper userInfoHelper; + private final RegionLimitHelper regionLimitHelper; + private final ExpertUserInfoHelper expertUserInfoHelper; + private final ExpertAdminManageService expertAdminManageService; + private final IExpertDictionaryService iExpertDictionaryService; + + public PageVo metaApplyListQuery(MetaApplyListQuery req) { + // 筛选符合专家类型的用户id + List filterExpertTypeUserIdList = null; + DictionaryFieldInfo expertType = req.getExpertType(); + if (Objects.nonNull(expertType) && StringUtils.isNotBlank(expertType.getDictionaryCode())) { + List expertTypeDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) + .eq(ExpertDictionary::getDictionaryCode, expertType.getDictionaryCode())); + filterExpertTypeUserIdList = expertTypeDictionaryList.stream().map(ExpertDictionary::getUserId).distinct().collect(Collectors.toList()); + } + + // 查找符合专家条件的用户id + ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req); + List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); + + // 取交集 + List finalFilterExpertUserIdList = new ArrayList<>(); + if (Objects.nonNull(filterExpertTypeUserIdList)) { + for (Long userId : filterExpertUserIdList) { + if (filterExpertTypeUserIdList.contains(userId)) { + finalFilterExpertUserIdList.add(userId); + } + } + } else { + finalFilterExpertUserIdList = filterExpertUserIdList; + } + + if (CollUtil.isEmpty(finalFilterExpertUserIdList)) { + return PageVo.empty(); + } + + LambdaQueryWrapper expertMetaApplyListQuery = + buildMetaApplyListQueryWrapper(req, finalFilterExpertUserIdList); + Page pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); + PageVo result = new PageVo<>(); + result.setTotal(pageResult.getTotal()); + BizUtils.notEmpty(pageResult.getRecords(), records -> { + List expertIds = CollUtils.fieldList(records, ExpertMetaApply::getUserId); + // 根据用户id 获取专家基本信息 + List expertList = userFullInfoService.listByUserIds(expertIds); + Map expertMap = CollUtils.listToMap(expertList, ExpertUserFullInfo::getUserId); + List titleLevelDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.TITLE_LEVEL); + Map> titleLevelDictMap = CollUtils.group(titleLevelDictList, ExpertDictionary::getUserId); + + List expertTypeDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.EXPERT_TYPE); + Map> expertTypeDictMap = CollUtils.group(expertTypeDictList, ExpertDictionary::getUserId); + result.setRecords(buildExpertApplyMetaVOList(records, expertMap, titleLevelDictMap, expertTypeDictMap)); + }); + return result; + } + + @Transactional(rollbackFor = Exception.class) + public void metaApplyResult(MetaApplyResultRequest req) { + Long applyId = req.getApplyId(); + ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); + Long userId = LoginUserUtil.getUserId(); + // 校验专家管理员区域权限,是否可以审核当前专家申请 + // permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId()); + String applyStatus = expertMetaApply.getApplyStatus(); + if (!ExpertApplyStatusEnum.PENDING_REVIEW.getKey().equals(applyStatus)) { + throw BizException.wrap("apply is already processed"); + } + ExpertApplyTypeEnum applyType = ExpertApplyTypeEnum.of(expertMetaApply.getApplyType()); + boolean applyResult = req.getApplyResult(); + + switch (applyType) { + // 专家入库 + case EXPERT_STORAGE: { + ExpertStorageDealCmd expertStorageDealCmd = buildExpertStorageDealCmd(req, expertMetaApply.getUserId(), expertMetaApply); + expertInfoService.expertStorageDeal(expertStorageDealCmd); + // 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核 + if (applyResult) { + Long expertUserId = expertMetaApply.getUserId(); + List joinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, expertUserId) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name())); + BizUtils.notEmpty(joinApplyList, list -> list.forEach(r -> { + MetaApplyResultRequest resultRequest = new MetaApplyResultRequest(); + resultRequest.setApplyId(r.getId()); + resultRequest.setApplyResult(true); + resultRequest.setAuditOpinion("同意"); + metaApplyResult(resultRequest); + })); + } + } + break; + // 专家出库 + case EXPERT_DELIVERY: + // ExpertDeliveryDealCmd expertDeliveryDealCmd = buildExpertDeliveryDealCmd(req, expertMetaApply.getUserId()); + // expertInfoService.expertDeliveryDeal(expertDeliveryDealCmd); + break; + // 长期请假 + case LONG_TERM_LEAVE: + // leaveManage.leaveAuditCallback(req.getApplyResult(), applyId); + break; + // 专家信息审核 + case EXPERT_INFO_MODIFY: + ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId); + expertInfoService.expertInfoModifyDeal(applyDealCmd); + break; + // 专家履职意向加入/离开 + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: + ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply); + expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd); + break; + default: + break; + } + + String auditOpinion = req.getAuditOpinion(); + // 发送审核结果短信 + // sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId); + // 更新申请结果 + expertMetaApply.setApproverUserId(userId); + String adminUserName = userInfoHelper.getUserName(userId); + expertMetaApply.setApprover(adminUserName); + expertMetaApply.setAuditOpinion(auditOpinion); + expertMetaApply.setApplyStatus(applyResult ? ExpertApplyStatusEnum.PASSED.getKey() : ExpertApplyStatusEnum.REFUSED.getKey()); + expertMetaApply.setReviewTime(LocalDateTime.now()); + expertMetaApply.setUpdateOn(LocalDateTime.now()); + iMetaApplyService.saveOrUpdate(expertMetaApply); + } + + public MetaApplyResultVo metaApplyResult(Long applyId) { + ExpertMetaApply metaApply = iMetaApplyService.getById(applyId); + if (Objects.isNull(metaApply)) { + throw BizException.wrap("当前审核不存在"); + } + MetaApplyResultVo metaApplyResultVo = MetaApplyResultVo.builder() + .applyTime(metaApply.getCreateOn()) + .auditor(metaApply.getApprover()) + .expertUserId(metaApply.getUserId()) + .auditOption(metaApply.getAuditOpinion()) + .auditStatus(metaApply.getApplyStatus()) + .auditTime(metaApply.getReviewTime()) + .build(); + String extraMaterialStr = metaApply.getExtraMaterial(); +// if (StringUtils.isNotBlank(extraMaterialStr)) { +// ExtraMaterialDO extraMaterialDO = JSONObject.parseObject(extraMaterialStr, ExtraMaterialDO.class); +// ModifyApplyExtraInfo modifyApplyExtraInfo = new ModifyApplyExtraInfo(); +// BizUtils.notEmpty(extraMaterialDO.getEvidenceList(), list -> { +// List fileIdList = CollUtils.fieldList(list, FileBasicInfo::getFileId); +// List attachFiles = fileService.getByIds(fileIdList); +// List tempList = attachFiles.stream().map(r -> { +// FileBasicInfo fileBasicInfo = new FileBasicInfo(); +// fileBasicInfo.setFileId(r.getFileId()); +// fileBasicInfo.setFileName(r.getOriginalFileName()); +// return fileBasicInfo; +// }).collect(Collectors.toList()); +// modifyApplyExtraInfo.setEvidenceList(tempList); +// }); +// modifyApplyExtraInfo.setFactSheet(extraMaterialDO.getFactSheet()); +// metaApplyResultVo.setModifyApplyExtraInfo(modifyApplyExtraInfo); +// } + String applyType = metaApply.getApplyType(); + ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType); + switch (applyTypeEnum) { +// case EXPERT_INFO_MODIFY: +// buildInfoModifyApplyDisplayVO(metaApplyResultVo, metaApply); +// break; + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: + buildIntentionApplyDisplayVO(metaApplyResultVo, metaApply, applyTypeEnum); + break; + case EXPERT_DELIVERY: + case LONG_TERM_LEAVE: + case EXPERT_STORAGE: + default: + break; + } + metaApplyResultVo.setApplyType(applyTypeTrans(applyTypeEnum)); + return metaApplyResultVo; + } + + + public void metaApplyRevoke(Long applyId) { + Long userId = LoginUserUtil.getUserId(); + ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); + if (Objects.isNull(expertMetaApply)) { + throw new BizException("apply not exist"); + } + if (!expertMetaApply.getUserId().equals(userId)) { + throw new BizException("has not right to operate"); + } + String applyStatus = expertMetaApply.getApplyStatus(); + ExpertApplyStatusEnum expertApplyStatusEnum = ExpertApplyStatusEnum.of(applyStatus); + if (!ExpertApplyStatusEnum.PENDING_REVIEW.equals(expertApplyStatusEnum)) { + throw new BizException("apply is already deal"); + } + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.REVOKED.getKey()); + expertMetaApply.setUpdateOn(LocalDateTime.now()); + iMetaApplyService.updateById(expertMetaApply); + } + + + private void buildIntentionApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply metaApply, ExpertApplyTypeEnum applyTypeEnum) { + String regionCode = metaApply.getRegionCode(); + Integer regionLevel = metaApply.getRegionLevel(); + MetaApplyResultVo.IntentionApplyDisplayVO intentionApplyDisplayVO = new MetaApplyResultVo.IntentionApplyDisplayVO(); + intentionApplyDisplayVO.setExpertApplyId(metaApply.getId()); + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(regionCode); + expertRegionInfo.setRegionLevel(regionLevel); + switch (applyTypeEnum) { + case EXPERT_INTENTION_LEAVE: { + intentionApplyDisplayVO.setReduceExpertRegion(expertRegionInfo); + } + break; + case EXPERT_INTENTION_JOIN: { + intentionApplyDisplayVO.setAddExpertRegion(expertRegionInfo); + } + break; + default: + break; + } + metaApplyResultVo.setIntentionApplyDisplayVo(intentionApplyDisplayVO); + } + + private String applyTypeTrans(ExpertApplyTypeEnum applyTypeEnum) { + switch (applyTypeEnum) { + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: { + return ExpertApplyTypeQueryEnum.EXPERT_INTENTION_CHANGE.getKey(); + } + case EXPERT_INFO_MODIFY: { + return ExpertApplyTypeQueryEnum.EXPERT_INFO_MODIFY.getKey(); + } + case LONG_TERM_LEAVE: { + return ExpertApplyTypeQueryEnum.LONG_TERM_LEAVE.getKey(); + } + case EXPERT_DELIVERY: { + return ExpertApplyTypeQueryEnum.EXPERT_DELIVERY.getKey(); + } + case EXPERT_STORAGE: { + return ExpertApplyTypeQueryEnum.EXPERT_STORAGE.getKey(); + } + default: + return null; + } + } + + private List applyTypeTrans(ExpertApplyTypeQueryEnum applyTypeQueryEnum) { + List applyTypeList = new ArrayList<>(); + switch (applyTypeQueryEnum) { + case EXPERT_INTENTION_CHANGE: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()); + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey()); + } + break; + case EXPERT_INFO_MODIFY: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); + } + break; + case LONG_TERM_LEAVE: { + applyTypeList.add(ExpertApplyTypeEnum.LONG_TERM_LEAVE.getKey()); + } + break; + case EXPERT_DELIVERY: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_DELIVERY.getKey()); + } + break; + case EXPERT_STORAGE: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); + } + break; + default: + break; + } + return applyTypeList; + } + + private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query) { + ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + if (StringUtils.isNotBlank(query.getExpertName())) { + expertAdminExpertManageQueryCmd.setExpertName(query.getExpertName()); + } + if (StringUtils.isNotBlank(query.getCompanyName())) { + expertAdminExpertManageQueryCmd.setCompany(query.getCompanyName()); + } + List expertDictionaryQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { + ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); + expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); + expertDictionaryQueryList.add(expertDictionaryQuery); + } + + List containsRegion = null; + if (Objects.nonNull(query.getExpertRegionInfo())) { + RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() + , query.getExpertRegionInfo().getRegionCode()); + containsRegion = CollUtil.toList(containsRegionBo); + } + + expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); + expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + return expertAdminExpertManageQueryCmd; + } + + /** + * 装配 专家审核列表筛选返回VO + * + * @param expertMetaApplyList + * @param expertUserFullInfoMap + * @param titleLevelDictMap + * @param expertTypeDictMap + * @return + */ + private List buildExpertApplyMetaVOList(List expertMetaApplyList + , Map expertUserFullInfoMap + , Map> titleLevelDictMap + , Map> expertTypeDictMap) { + List expertApplyMetaVOList = new ArrayList<>(); + for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { + ExpertApplyMetaVO expertApplyMetaVO = new ExpertApplyMetaVO(); + Long userId = expertMetaApply.getUserId(); + ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoMap.get(userId); + expertApplyMetaVO.setId(expertMetaApply.getId()); + expertApplyMetaVO.setUserId(userId); + expertApplyMetaVO.setApplyStatus(expertMetaApply.getApplyStatus()); + + String applyType = expertMetaApply.getApplyType(); + if (Objects.nonNull(applyType)) { + expertApplyMetaVO.setApplyType(applyTypeTrans(ExpertApplyTypeEnum.of(applyType))); + } + expertApplyMetaVO.setName(expertUserFullInfo.getExpertName()); + + RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel()); + + if (Objects.nonNull(regionDTO)) { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); + expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); + expertRegionInfo.setRegionName(regionDTO.getRegionName()); + expertApplyMetaVO.setExpertRegionInfo(expertRegionInfo); + } + + List titleLevelDictionaryList = titleLevelDictMap.get(userId); + if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { + expertApplyMetaVO.setTitleLevel(titleLevelDictionaryList.stream().map(r -> { + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + if (Objects.nonNull(dictionaryDTO)) { + dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); + } + return dictionaryFieldInfo; + }).collect(Collectors.toList())); + } + + // 装配专家类型 + List expertTypeDictionaryList = expertTypeDictMap.get(userId); + if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { + expertApplyMetaVO.setExpertType(expertTypeDictionaryList.stream().map(r -> { + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + if (Objects.nonNull(dictionaryDTO)) { + dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); + } + return dictionaryFieldInfo; + }).collect(Collectors.toList())); + } + + expertApplyMetaVO.setCompany(expertUserFullInfo.getCompany()); + expertApplyMetaVO.setPhoneNo(expertUserFullInfo.getPhoneNo()); + expertApplyMetaVO.setApplyTime(expertMetaApply.getCreateOn()); + expertApplyMetaVOList.add(expertApplyMetaVO); + } + return expertApplyMetaVOList; + } + + private LambdaQueryWrapper buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, + List expertIdList) { + // 审核类型 + List applyTypeList = new ArrayList<>(); + if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { + List applyTypeQueryEnumList = applyListReq.getApplyTypeList(); + for (ExpertApplyTypeQueryEnum applyTypeQueryEnum : applyTypeQueryEnumList) { + applyTypeList.addAll(applyTypeTrans(applyTypeQueryEnum)); + } + } + // 审核结果 + List applyStatusList = new ArrayList<>(); + if (CollUtil.isNotEmpty(applyListReq.getApplyStatusList())) { + applyStatusList = CollUtils.fieldList(applyListReq.getApplyStatusList(), ExpertApplyStatusEnum::getKey); + ; + } + + LocalDateTime applyStartTime = applyListReq.getApplyStartTime(); + LocalDateTime applyEndTime = applyListReq.getApplyEndTime(); + + // 不展示撤回的申请记录 + LambdaQueryWrapper expertMetaApplyListQuery = Wrappers.lambdaQuery(ExpertMetaApply.class) + .in(CollectionUtils.isNotEmpty(applyTypeList), ExpertMetaApply::getApplyType, applyTypeList) + .in(CollectionUtils.isNotEmpty(applyStatusList), ExpertMetaApply::getApplyStatus, applyStatusList) + .in(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()) + .in(CollectionUtils.isNotEmpty(expertIdList), ExpertMetaApply::getUserId, expertIdList) + .gt(Objects.nonNull(applyStartTime), ExpertMetaApply::getCreateOn, applyStartTime) + .lt(Objects.nonNull(applyEndTime), ExpertMetaApply::getCreateOn, applyEndTime) + .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) + .orderByDesc(ExpertMetaApply::getCreateOn); + + return expertMetaApplyListQuery; + } + + private ExpertStorageDealCmd buildExpertStorageDealCmd(MetaApplyResultRequest applyResultRequest, + Long expertUserId, + ExpertMetaApply expertMetaApply) { + StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo(); + ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd(); + Boolean applyResult = applyResultRequest.getApplyResult(); + expertStorageDealCmd.setApplyResult(applyResult); + + if (Objects.nonNull(extraInfo)) { + List expertType = extraInfo.getExpertType(); + if (CollUtil.isNotEmpty(expertType)) { + expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + return expertDictionaryDTO; + }).collect(Collectors.toList())); + } + List other = extraInfo.getOther(); + if (CollUtil.isNotEmpty(other)) { + expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setExpertInfoField(r.getTagFieldName()); + expertTagDTO.setTagCode(r.getTagCode()); + return expertTagDTO; + }).collect(Collectors.toList())); + } + expertStorageDealCmd.setRemark(extraInfo.getRemark()); + } + expertStorageDealCmd.setExpertUserId(expertUserId); + expertStorageDealCmd.setJoinRegionCode(expertMetaApply.getRegionCode()); + expertStorageDealCmd.setJoinRegionLevel(expertMetaApply.getRegionLevel()); + return expertStorageDealCmd; + } + + + private ExpertInfoModifyApplyDealCmd buildExpertInfoModifyApplyDealCmd(MetaApplyResultRequest applyResultRequest, + Long userId, Long applyId) { + ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd = new ExpertInfoModifyApplyDealCmd(); + Boolean applyResult = applyResultRequest.getApplyResult(); + expertInfoModifyApplyDealCmd.setApplyResult(applyResult); + expertInfoModifyApplyDealCmd.setExpertUserId(userId); + expertInfoModifyApplyDealCmd.setApplyId(applyId); + return expertInfoModifyApplyDealCmd; + } + + private ExpertIntentionApplyDealCmd buildExpertIntentionApplyDealCmd(MetaApplyResultRequest applyResultRequest, + ExpertMetaApply expertMetaApply) { + Boolean applyResult = applyResultRequest.getApplyResult(); + String applyType = expertMetaApply.getApplyType(); + ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType); + + ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = new ExpertIntentionApplyDealCmd(); + expertIntentionApplyDealCmd.setApplyResult(applyResult); + expertIntentionApplyDealCmd.setApplyTypeEnum(applyTypeEnum); + expertIntentionApplyDealCmd.setExpertUserId(expertMetaApply.getUserId()); + expertIntentionApplyDealCmd.setExpertRegionCode(expertMetaApply.getRegionCode()); + expertIntentionApplyDealCmd.setExpertRegionLevel(expertMetaApply.getRegionLevel()); + return expertIntentionApplyDealCmd; + } + + /** + * 专家管理员 新增专家使用使用 + * + * @param expertUserId \ + */ + @Transactional(rollbackFor = Exception.class) + public void autoPassExpertApply(Long expertUserId) { + final List applyTypes = Arrays.asList(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), + ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, expertUserId) + .in(ExpertMetaApply::getApplyType, applyTypes) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + List expertIntentionJoinApplyList = iMetaApplyService.list(query); + for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) { + MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); + applyResult.setApplyId(expertMetaApply.getId()); + applyResult.setAuditOpinion("同意"); + applyResult.setApplyResult(true); + metaApplyResult(applyResult); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertReviewManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertReviewManage.java new file mode 100644 index 0000000..acaf708 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertReviewManage.java @@ -0,0 +1,243 @@ +package com.hz.pm.api.expert.manage; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.cache.lock.DistributedLock; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.expert.constant.ReviewResultEnum; +import com.hz.pm.api.expert.model.dto.ReviewTemplateOptionDTO; +import com.hz.pm.api.expert.model.dto.ReviewTemplateSettingsDTO; +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.hz.pm.api.expert.model.entity.ReviewTemplateSettings; +import com.hz.pm.api.expert.model.req.ExpertReviewDetailReq; +import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; +import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; +import com.hz.pm.api.expert.model.vo.ReviewTemplateVO; +import com.hz.pm.api.expert.service.IExpertReviewService; +import com.hz.pm.api.expert.service.IReviewTemplateSettingsService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +import static com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO.ReviewDetailByTypeVO; +import static com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED; + +/** + *

+ * ExpertReviewManage + *

+ * + * @author WendyYang + * @since 14:25 2023/2/15 + */ +@Component +@RequiredArgsConstructor +public class ExpertReviewManage { + + private final IExpertReviewService expertReviewService; + private final DistributedLock distributedLock; + private final IMeetingExpertService meetingExpertService; + private final FileService fileService; + private final IMeetingInnerProjectService meetingInnerProjectService; + private final IMeetingService meetingService; + private final IReviewTemplateSettingsService templateSettingsService; + + private static final String EXPERT_REVIEW_KEY = "expert_review:"; + + private String buildExpertReviewKey(Long projectId, Long expertId) { + return EXPERT_REVIEW_KEY + projectId + ":" + expertId; + } + + private ExpertReviewDetailVO buildExpertReviewDetail(ExpertReview review) { + return ExpertReviewDetailVO.builder() + .reviewResult(review.getReviewResult()) + .creator(review.getCreator()) + .projectId(review.getProjectId()) + .templateId(review.getTemplateId()) + .otherAdvice(review.getOtherAdvice()) + .isFinal(review.getIsFinal()) + .createOn(review.getCreateOn()) + .attachFileId(review.getAttachFileId()) + .reviewTemplateOptions(JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class)) + .build(); + } + + public void expertReview(ExpertReviewDetailReq req) { + Long userId = LoginUserUtil.getUserId(); + Long projectId = req.getProjectId(); + Long meetingId = req.getMeetingId(); + String expertReviewKey = buildExpertReviewKey(projectId, userId); + if (!distributedLock.lock(expertReviewKey)) { + throw BizException.wrap("保存评审意见失败,请重试"); + } + try { + List reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); + if (req.getIsFinal()) { + if (reviews.isEmpty()) { + throw BizException.wrap("请先填写个人评审意见"); + } + if (reviews.size() > 1) { + throw BizException.wrap("不可重复填写最终评审意见"); + } + int agreeCnt = meetingExpertService.countExpertByStatusAndMeetingId(AGREED, req.getMeetingId(), null); + if (agreeCnt > 1) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class) + .eq(ExpertReview::getProjectId, req.getProjectId()) + .eq(ExpertReview::getMeetingId, req.getMeetingId()) + .ne(ExpertReview::getCreateBy, userId); + if (expertReviewService.count(query) < agreeCnt - 1) { + throw BizException.wrap("所有组员填写完评审意见后,方可填写最终评审意见"); + } + } + } else { + if (!reviews.isEmpty()) { + throw BizException.wrap("不可重复填写评审意见"); + } + } + ExpertReview review = new ExpertReview(); + review.setReviewResult(req.getReviewResult()); + review.setContent(JSONUtil.toJsonStr(req.getReviewTemplateOptions())); + review.setProjectId(req.getProjectId()); + review.setProjectCode(req.getProjectCode()); + review.setTemplateId(req.getTemplateId()); + review.setMeetingId(req.getMeetingId()); + review.setOtherAdvice(req.getOtherAdvice()); + review.setAttachFileId(req.getAttachFileId()); + review.setIsFinal(req.getIsFinal()); + review.setCreator(LoginUserUtil.getUsername()); + expertReviewService.save(review); + } finally { + distributedLock.releaseLock(expertReviewKey); + } + } + + public ExpertReviewDetailVO getExpertReviewDetail(Long projectId, Long userId, Long meetingId) { + List reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); + reviews.removeIf(ExpertReview::getIsFinal); + if (reviews.isEmpty()) { + throw BizException.wrap("评审记录不存在"); + } + return buildExpertReviewDetail(reviews.get(0)); + } + + public List listReviews(Long projectId, Long meetingId, boolean onlyTeamMember) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); + query.eq(ExpertReview::getProjectId, projectId); + query.eq(ExpertReview::getMeetingId, meetingId); + query.eq(onlyTeamMember, ExpertReview::getIsFinal, Boolean.FALSE); + query.orderByDesc(ExpertReview::getCreateOn); + List reviews = expertReviewService.list(query); + if (reviews.isEmpty()) { + return Collections.emptyList(); + } + List attachFileIds = CollUtils.fieldList(reviews, ExpertReview::getAttachFileId); + Map fileMap = new HashMap<>(attachFileIds.size()); + if (attachFileIds.size() > 0) { + List files = fileService.getByIds(attachFileIds); + files.forEach(w -> fileMap.put(w.getFileId(), w)); + } + return CollUtils.convert(reviews, w -> { + ExpertReviewDetailVO reviewDetail = buildExpertReviewDetail(w); + reviewDetail.setAttachFile(fileMap.get(w.getAttachFileId())); + return reviewDetail; + }); + } + + public ProjectReviewDetailVO projectExpertReviewDetail(String projectCode) { + ProjectReviewDetailVO detail = new ProjectReviewDetailVO(); + List meetingIds = meetingInnerProjectService.listMeetingIdByProjectCode(projectCode); + if (meetingIds.isEmpty()) { + return detail; + } + List meetings = meetingService.listByIds(meetingIds); + Collection tmpMeetingIds = meetings.stream() + .collect(Collectors.groupingBy(Meeting::getType, + Collectors.collectingAndThen(Collectors.toList(), w -> { + w.sort(Comparator.comparing(Meeting::getCreateOn)); + return w.get(w.size() - 1).getId(); + }))).values(); + LambdaQueryWrapper erQuery = Wrappers.lambdaQuery(ExpertReview.class) + .in(ExpertReview::getMeetingId, tmpMeetingIds) + .eq(ExpertReview::getProjectCode, projectCode) + .orderByDesc(ExpertReview::getCreateOn); + List expertReviews = expertReviewService.list(erQuery); + if (expertReviews.isEmpty()) { + return detail; + } + List templateIds = CollUtils.fieldList(expertReviews, ExpertReview::getTemplateId); + List templates = templateSettingsService.listByIds(templateIds); + Map templateMap = CollUtils.listToMap(templates, + ReviewTemplateSettings::getId, + ReviewTemplateSettingsManage::buildTemplateDetail); + detail.setTemplates(templateMap.values()); + Map map = new HashMap<>(8); + expertReviews.forEach(review -> { + ReviewTemplateVO template = templateMap.get(review.getTemplateId()); + ReviewDetailByTypeVO reviewDetailByType = map.computeIfAbsent(template.getTemplateType(), k -> { + ReviewDetailByTypeVO tmpReviewDetail = new ReviewDetailByTypeVO(); + tmpReviewDetail.setReviewType(k); + tmpReviewDetail.setTeamMemberReviews(new ArrayList<>()); + return tmpReviewDetail; + }); + ExpertReviewDetailVO tmpReview = buildExpertReviewDetail(review); + if (review.getIsFinal()) { + reviewDetailByType.setFinalReview(tmpReview); + } else { + reviewDetailByType.getTeamMemberReviews().add(tmpReview); + } + }); + detail.setReviews(map.values()); + return detail; + } + + public List listFinalExpertReviews(Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class) + .eq(ExpertReview::getIsFinal, Boolean.TRUE) + .eq(ExpertReview::getMeetingId, meetingId); + return expertReviewService.list(query); + } + + public Map buildExpertReviewToStr(Long meetingId) { + List reviews = listFinalExpertReviews(meetingId); + if (reviews.isEmpty()) { + return Collections.emptyMap(); + } + List templateIds = CollUtils.fieldList(reviews, ExpertReview::getTemplateId); + List ts = templateSettingsService.listByIds(templateIds); + Map tsMap = CollUtils.listToMap(ts, ReviewTemplateSettings::getId); + Map resMap = new HashMap<>(8); + for (ExpertReview review : reviews) { + ReviewTemplateSettings settings = tsMap.get(review.getTemplateId()); + List optionTemplates = JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class); + List options = JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class); + Map optionsMap = CollUtils.listToMap(options, ReviewTemplateOptionDTO::getQuestionSerialNo); + StringBuilder str = new StringBuilder(); + optionTemplates.forEach(ot -> { + ReviewTemplateOptionDTO rto = optionsMap.get(ot.getSerialNo()); + String optionsContent = ot.getOptions().stream() + .filter(w -> rto.getOptionSerialNo().contains(w.getSerialNo())) + .map(ReviewTemplateSettingsDTO.OptionDTO::getOption) + .collect(Collectors.joining("、")); + str.append("").append(ot.getTitle()).append(":").append(optionsContent).append(";"); + }); + str.append("").append("其他意见或建议").append(":") + .append(StrUtil.blankToDefault(review.getOtherAdvice(), "--")).append(";"); + str.append("").append("评审结果").append(":") + .append(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()).append(";"); + resMap.put(review.getProjectId(), str.toString()); + } + return resMap; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ReviewTemplateSettingsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ReviewTemplateSettingsManage.java new file mode 100644 index 0000000..65e1faf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ReviewTemplateSettingsManage.java @@ -0,0 +1,84 @@ +package com.hz.pm.api.expert.manage; + +import cn.hutool.json.JSONUtil; +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.expert.model.dto.ReviewTemplateSettingsDTO; +import com.hz.pm.api.expert.model.entity.ReviewTemplateSettings; +import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; +import com.hz.pm.api.expert.model.req.ReviewTemplateReq; +import com.hz.pm.api.expert.model.vo.ReviewTemplateVO; +import com.hz.pm.api.expert.service.IReviewTemplateSettingsService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * ReviewTemplateSettingsManage + *

+ * + * @author WendyYang + * @since 09:41 2023/2/15 + */ +@Component +@AllArgsConstructor +public class ReviewTemplateSettingsManage { + + private final IReviewTemplateSettingsService reviewTemplateSettingsService; + + @Transactional(rollbackFor = Exception.class) + public void saveOrUpdate(ReviewTemplateReq req) { + ReviewTemplateTypeEnum type = ReviewTemplateTypeEnum.getByCode(req.getTemplateType()); + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(ReviewTemplateSettings.class) + .eq(ReviewTemplateSettings::getTemplateType, type.getCode()) + .eq(ReviewTemplateSettings::getRegionCode, req.getRegionCode()) + .eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) + .set(ReviewTemplateSettings::getIsLast, Boolean.FALSE); + reviewTemplateSettingsService.update(update); + ReviewTemplateSettings settings = new ReviewTemplateSettings(); + settings.setTemplateType(type.getCode()); + settings.setRegionCode(req.getRegionCode()); + settings.setIsLast(Boolean.TRUE); + settings.setContent(JSONUtil.toJsonStr(req.getTemplates())); + reviewTemplateSettingsService.save(settings); + } + + public ReviewTemplateVO getReviewTemplateSettings(Integer templateType, String regionCode) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ReviewTemplateSettings.class) + .eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) + .eq(ReviewTemplateSettings::getRegionCode, regionCode) + .eq(ReviewTemplateSettings::getTemplateType, templateType) + .last(BizConst.LIMIT_1); + ReviewTemplateSettings settings = reviewTemplateSettingsService.getOne(query); + return buildTemplateDetail(settings); + } + + public ReviewTemplateVO getReviewTemplateSettings(Long templateId) { + ReviewTemplateSettings settings = reviewTemplateSettingsService.getById(templateId); + return buildTemplateDetail(settings); + } + + public List listReviewTemplateSettings(List templateIds) { + List settings = reviewTemplateSettingsService.listByIds(templateIds); + return CollUtils.convert(settings, ReviewTemplateSettingsManage::buildTemplateDetail); + } + + protected static ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) { + if (settings == null) { + throw BizException.wrap("模版不存在"); + } + return ReviewTemplateVO.builder() + .templateId(settings.getId()) + .templateType(settings.getTemplateType()) + .templates(JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class)) + .build(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.java new file mode 100644 index 0000000..dabe875 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.model.query.ListExpertQuery; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午10:27 + */ +@Repository +public interface ExpertAdminManageMapper { + + /** + * 获取所有符合查询条件的专家user_id + * + * @param query + * @return + */ + List listExpertUserId(@Param("query") ListExpertQuery query); + + List listExpertDictionaryUserId(@Param("query") ListExpertQuery query); + + List listExpertTagUserId(@Param("query") ListExpertQuery query); + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.xml new file mode 100644 index 0000000..cf2e4c9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAdminManageMapper.xml @@ -0,0 +1,137 @@ + + + + + + SELECT user_id FROM nd_expert_user_full_info + + + AND expert_name LIKE CONCAT('%',#{query.expertName, jdbcType=BIGINT},'%') + + + AND company LIKE CONCAT('%',#{query.company, jdbcType=BIGINT},'%') + + + AND expert_account_status IN + + #{expertAccountStatus} + + + + AND region_code = #{query.regionCode} AND region_level = #{query.regionLevel} + + + AND is_ding_user = 'Y' + + + AND is_ding_user = 'N' + + + AND ( + + (= #{regionContains.parentRegionTreeLevel} AND region_code IN ]]> + #{containsRegionCode} + + ) + + ) + + + AND exists(select 1 from expert_intention_work_region eiwr where eiwr.user_id = nd_expert_user_full_info.user_id and + + (= #{intentionRegions.parentRegionTreeLevel} AND region_code IN ]]> + #{intentionRegionCode} + + ) + + ) + + + ORDER BY update_on DESC + + + + SELECT + user_id + FROM + ( + SELECT DISTINCT + et.user_id, + et.expert_info_field + FROM + expert_tag et + WHERE + + (et.expert_info_field = #{expertTagQuery.expertInfoField} + AND et.tag_code IN + + #{tagCode} + ) + + ) temp + GROUP BY + user_id + HAVING + count( user_id )= ${query.expertTagQueryList.size()} + + + + + SELECT + user_id + FROM + ( + SELECT DISTINCT + ed.user_id, + ed.expert_info_field + FROM + expert_dictionary ed + WHERE + + (ed.expert_info_field = #{expertDictionaryQuery.expertInfoField} + AND ed.dictionary_code IN + + #{dictionaryCode} + ) + + ) temp + GROUP BY + user_id + HAVING + count( user_id )= ${query.expertDictionaryQueryList.size()} + + + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.java new file mode 100644 index 0000000..07b64f5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertAvoidCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +public interface ExpertAvoidCompanyMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.xml new file mode 100644 index 0000000..d096d92 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertAvoidCompanyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.java new file mode 100644 index 0000000..1558a8e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-04-17 + */ +public interface ExpertGovBusinessStripMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.xml new file mode 100644 index 0000000..1387513 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertGovBusinessStripMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.java new file mode 100644 index 0000000..629133b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertIntentionWorkRegionMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.xml new file mode 100644 index 0000000..307c192 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertIntentionWorkRegionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.java new file mode 100644 index 0000000..bfc6baf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-03-01 + */ +public interface ExpertMetaApplyMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.xml new file mode 100644 index 0000000..9e2e193 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertMetaApplyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.java new file mode 100644 index 0000000..bb05444 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +public interface ExpertReviewMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.xml new file mode 100644 index 0000000..0d1ed0f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertReviewMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java new file mode 100644 index 0000000..2d29e70 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertSensitiveInfoModifyDetailRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +public interface ExpertSensitiveInfoModifyDetailRecordMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml new file mode 100644 index 0000000..873a5ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.java new file mode 100644 index 0000000..5730a96 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface NdExpertUserFullInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.xml new file mode 100644 index 0000000..392c8ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/NdExpertUserFullInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.java new file mode 100644 index 0000000..49e559c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.mapper; + +import com.hz.pm.api.expert.model.entity.ReviewTemplateSettings; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 评审模版配置表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-14 + */ +public interface ReviewTemplateSettingsMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.xml new file mode 100644 index 0000000..b8a501c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/mapper/ReviewTemplateSettingsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/DictionaryFieldInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/DictionaryFieldInfo.java new file mode 100644 index 0000000..48e9ffa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/DictionaryFieldInfo.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:03 + * 专家信息字典字段信息 + */ +@Data +@ApiModel("字典字段信息") +public class DictionaryFieldInfo { + + /** + * 字段名称 + */ + @NotBlank + @ApiModelProperty("字典字段名称") + private String dictionaryFieldName; + + /** + * 字典code + */ + @ApiModelProperty(value = "字典code") + private String dictionaryCode; + + + @ApiModelProperty(value = "字典code含义", required = false) + private String dictionaryName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAdminExpertManageQuery.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAdminExpertManageQuery.java new file mode 100644 index 0000000..a13f4be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAdminExpertManageQuery.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.expert.model; + + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/4 上午10:18 + */ +@Data +@ApiModel("专家库筛选接口") +public class ExpertAdminExpertManageQuery extends PagePo { + + @ApiModelProperty("专家姓名(精准匹配)") + private String expertName; + + @ApiModelProperty("工作单位(模糊匹配)") + private String company; + + @ApiModelProperty("职称级别字典编码") + private String titleLevelDictionaryCode; + + @ApiModelProperty("单位属性字典编码") + private String companyAttributeDictionaryCode; + + @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") + private String expertAccountStatus; + + @ApiModelProperty("专家区域区域信息") + private ExpertRegionInfo expertRegionInfo; + + @ApiModelProperty("履职意向地区域信息") + private ExpertRegionInfo intentionRegionInfo; + + @ApiModelProperty(value = "是否浙政钉用户") + private Boolean isDingUser; + + @ApiModelProperty("内外围字典编码") + private String expertTypeDictionaryCode; + + @ApiModelProperty("专家来源标签编码") + private String expertSourceTagCode; + + @ApiModelProperty("擅长方向标签编码") + private String goodAtTagCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAvoidCompanyInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAvoidCompanyInfo.java new file mode 100644 index 0000000..8513226 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertAvoidCompanyInfo.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.expert.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:16 + */ +@Data +public class ExpertAvoidCompanyInfo { + + @NotBlank + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("公司唯一标识 即 调用获取组织架构的树状结构(单位筛选列表) 接口是对应公司的 organizationCode") + private String companyUniqCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertBasicInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertBasicInfo.java new file mode 100644 index 0000000..85613bc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertBasicInfo.java @@ -0,0 +1,148 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:44 + * 专家信息中的基本信息一栏 + */ +@Data +@ApiModel(value = "ExpertBasicInfo", description = "专家基本信息") +public class ExpertBasicInfo { + + /** + * 是否浙政钉用户Y/N + */ + @NotNull + @ApiModelProperty(value = "是否浙政钉用户Y/N") + private Boolean isDingUser; + + /** + * 手机号 + */ + @NotBlank + @ApiModelProperty(value = "手机号") + private String phoneNo; + + /** + * 专家姓名 + */ + @NotBlank + @ApiModelProperty(value = "专家姓名") + private String name; + + /** + * 免冠照图片地址 + */ + @NotBlank + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + /** + * 性别 0,1:女,男 + */ + @NotBlank + @ApiModelProperty(value = "性别 0,1:女,男") + private String gender; + + /** + * 政治面貌(字典code) + */ + @NotNull + @ApiModelProperty(value = "政治面貌(字典code)") + private List political; + + /** + * 身份证号码 + */ + @NotBlank + @ApiModelProperty(value = "身份证号码") + private String idCard; + + /** + * 办公电话 + */ + @ApiModelProperty(value = "办公电话") + private String officePhone; + + /** + * 出生日期 + */ + @NotNull + @ApiModelProperty(value = "出生日期") + private LocalDateTime birth; + + /** + * 开户银行 + */ + @NotBlank + @ApiModelProperty(value = "开户银行") + private String bank; + + /** + * 银行卡号 + */ + @NotBlank + @ApiModelProperty(value = "银行卡号") + private String bankNo; + + /** + * 电子邮箱 + */ + @NotBlank + @ApiModelProperty(value = "电子邮箱") + @Email + private String email; + + /** + * 专家来源(标签code) + */ + @NotNull + @ApiModelProperty(value = "专家来源(标签code)") + private List expertSource; + + /** + * 专家层级 + */ + @NotNull + @ApiModelProperty(value = "专家层级") + private ExpertRegionInfo expertRegionInfo; + + /** + * 履职意向 + */ + @NotEmpty + @ApiModelProperty(value = "履职意向") + private List expertIntentionWorkRegions; + + /** + * 专家类型(内外围) + */ + @ApiModelProperty(value = "专家类型(内外围)") + private List expertType; + + /** + * 籍贯 + */ + @ApiModelProperty(value = "籍贯") + private String hometown; + + /** + * 民族 + */ + @ApiModelProperty(value = "民族") + private String nationality; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertEduInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertEduInfo.java new file mode 100644 index 0000000..08315bf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertEduInfo.java @@ -0,0 +1,67 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:50 + */ +@Data +@ApiModel(value = "ExpertEduInfo", description = "学历信息") +public class ExpertEduInfo { + + /** + * 毕业院校 + */ + @NotBlank + @ApiModelProperty("毕业院校") + private String school; + + /** + * 毕业时间 + */ + @NotNull + @ApiModelProperty("毕业时间") + private LocalDateTime graduatedAt; + + /** + * 所学专业 + */ + @NotBlank + @ApiModelProperty("所学专业") + private String academicTitle; + + /** + * 学历(字典code) + */ + @NotNull + @ApiModelProperty("学历(字典code)") + private List edu; + + /** + * 毕业证附件信息 + */ + @ApiModelProperty("毕业证附件信息") + private List graduationCertificateFile; + + /** + * 学位(字典code) + */ + @NotNull + @ApiModelProperty("学位(字典code)") + private List degree; + + /** + * 学位证附件信息 + */ + @ApiModelProperty("学位证附件信息") + private List degreeCertificateFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertJobInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertJobInfo.java new file mode 100644 index 0000000..9114f5c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertJobInfo.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:58 + */ +@Data +@ApiModel(value = "ExpertJobInfo", description = "职业信息") +public class ExpertJobInfo { + + /** + * 在职状态(字典code) + */ + @NotNull + @ApiModelProperty("在职状态(字典code)") + private List jobStatus; + + /** + * 退休时间 + */ + @ApiModelProperty("退休时间") + private LocalDateTime retiredAt; + + /** + * 工作单位 + */ + @NotBlank + @ApiModelProperty("工作单位,组织结构name") + private String company; + + @ApiModelProperty("工作单位,前端使用标识") + private String companyUniqCode; + + /** + * 单位法人编号 + */ + @NotBlank + @ApiModelProperty(" 单位法人编号") + private String legalEntityCode; + + /** + * 行政职务 + */ + @NotBlank + @ApiModelProperty("行政职务") + private String administrativeDuties; + + /** + * 开始工作时间 + */ + @NotNull + @ApiModelProperty("开始工作时间") + private LocalDateTime startWorkAt; + + /** + * 行政职级(字典code) + */ + @NotNull + @ApiModelProperty("行政职级(字典code)") + private List administrativeRank; + + /** + * 单位类型(字典code) + */ + @NotNull + @ApiModelProperty("单位类型(字典code)") + private List companyAttribute; + + /** + * 工作地址 + */ + @NotBlank + @ApiModelProperty("工作地址") + private String address; + + /** + * 工作经历 + */ + @NotBlank + @ApiModelProperty("工作经历") + private String experience; + + @ApiModelProperty("专家条线") + private List businessStrips; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertOtherInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertOtherInfo.java new file mode 100644 index 0000000..8c2792d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertOtherInfo.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/19 下午6:43 + */ +@Data +@ApiModel(description = "其他信息") +public class ExpertOtherInfo { + + @ApiModelProperty(value = "其他标签(标签code)") + private List other; + + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertProfessionalInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertProfessionalInfo.java new file mode 100644 index 0000000..bf51d15 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertProfessionalInfo.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:07 + */ +@Data +@ApiModel(description = "专业信息") +public class ExpertProfessionalInfo { + + @NotBlank + @ApiModelProperty(value = "技术职称") + private String technicalTitles; + + @NotNull + @ApiModelProperty(value = "职称级别") + private List titleLevel; + + @ApiModelProperty(value = "职称证明") + private List titleCertificateFile; + + @NotNull + @ApiModelProperty(value = "擅长方向(标签code)") + private List goodAt; + + @NotNull + @ApiModelProperty(value = "技术专长(标签code)") + private List technicalExpertise; + + @NotBlank + @ApiModelProperty(value = " 获奖情况") + private String awards; + + @NotNull + @ApiModelProperty(value = "行业领域(标签code)") + private List industrySector; + + @NotBlank + @ApiModelProperty(value = "表彰奖励") + private String recognitionReward; + + @ApiModelProperty(value = "回避单位列表") + private List avoidCompanyList; + + @ApiModelProperty(value = "其他标签") + private List other; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertRecommendInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertRecommendInfo.java new file mode 100644 index 0000000..a74f1d9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExpertRecommendInfo.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 上午11:52 + */ +@Data +@ApiModel(description = "推荐信息") +public class ExpertRecommendInfo { + + /** + * 推荐方式 + */ + @ApiModelProperty("推荐方式") + private List recommendedWay; + + @ApiModelProperty("推荐证明材料") + private List recommendationProofFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExtraMaterialDO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExtraMaterialDO.java new file mode 100644 index 0000000..dcae331 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ExtraMaterialDO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 下午4:18 + * 提交修改申请额外信息 + */ +@Data +@ApiModel("提交修改申请额外信息,保存于expert_meta_apply表的 extra_material 字段") +public class ExtraMaterialDO { + + /** + * 情况说明 + */ + @ApiModelProperty("申请说明") + private String factSheet; + + /** + * 证明材料 + */ + @ApiModelProperty("证明材料") + private List evidenceList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ModifyApplyExtraInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ModifyApplyExtraInfo.java new file mode 100644 index 0000000..d59b48a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/ModifyApplyExtraInfo.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.expert.model; + +import com.hz.pm.api.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 下午4:18 + * 提交修改申请额外信息 + */ +@Data +@ApiModel("提交修改申请额外信息") +public class ModifyApplyExtraInfo { + + /** + * 情况说明 + */ + @ApiModelProperty("申请说明") + private String factSheet; + + /** + * 证明材料 + */ + @ApiModelProperty("证明材料") + private List evidenceList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/RegionDtoMapKey.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/RegionDtoMapKey.java new file mode 100644 index 0000000..360e6be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/RegionDtoMapKey.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.model; + +import lombok.Data; + +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:07 + */ +@Data +public class RegionDtoMapKey { + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区级别 + */ + private Integer regionLevel; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RegionDtoMapKey regionDtoMapKey = (RegionDtoMapKey) o; + return regionCode.equals(regionDtoMapKey.getRegionCode()) && + regionLevel.equals(regionDtoMapKey.getRegionLevel()); + } + + @Override + public int hashCode() { + return Objects.hash(regionCode, regionLevel); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java new file mode 100644 index 0000000..a6b4c37 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java @@ -0,0 +1,88 @@ +package com.hz.pm.api.expert.model; + + +import com.hz.pm.api.common.util.DictUtils; +import com.hz.pm.api.common.util.RegionUtils; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.common.util.TagUtils; +import com.hz.pm.api.expert.constant.ExpertSensitiveFieldTypeEnum; +import com.hz.pm.api.expert.constant.ExpertUserInfoSensitiveFieldEnum; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/28 上午11:28 + */ +@Data +@ApiModel("需要审核字段部分") +public class SensitiveModifySegment { + + public SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum fieldName, Object original, Object apply) { + this.fieldName = fieldName; + this.original = original; + this.apply = apply; + } + + public SensitiveModifySegment(ExpertSensitiveFieldTypeEnum fieldType, ExpertUserInfoSensitiveFieldEnum fieldName, Object original, Object apply) { + this.fieldType = fieldType; + this.fieldName = fieldName; + this.original = original; + this.apply = apply; + } + + + private ExpertSensitiveFieldTypeEnum fieldType = ExpertSensitiveFieldTypeEnum.expert_sensitive_info_field; + + private ExpertUserInfoSensitiveFieldEnum fieldName; + + private Object original; + + private Object apply; + + public Boolean isValueEquals() { + switch (fieldName) { + case phone_no: + case email: + case company: + case legal_entity_code: { + return StrUtils.trimEquals((String) this.original, (String) this.apply); + } + case administrative_rank: + case title_level: { + return DictUtils.isValueEquals((List) this.original + , (List) this.apply); + } + case good_at: + case technical_expertise: + case industry_sector: + case other: { + return TagUtils.isValueEquals((List) this.original, (List) this.apply); + } + case expert_region: + return RegionUtils.isValueEquals((ExpertRegionInfo) this.original, (ExpertRegionInfo) this.apply); + case expert_intention_work_region: + return RegionUtils.isValueEquals((List) this.original, (List) this.apply); + default: + return Objects.equals(this.original, this.apply); + } + } + + public static Boolean isModify(List segmentList) { + if (CollectionUtils.isEmpty(segmentList)) { + return false; + } + for (SensitiveModifySegment segment : segmentList) { + if (!segment.isValueEquals()) { + return true; + } + } + return false; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/TagFieldInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/TagFieldInfo.java new file mode 100644 index 0000000..84ddd1e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/TagFieldInfo.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:12 + */ +@Data +@ApiModel("标签信息") +public class TagFieldInfo { + + @ApiModelProperty("标签字段名称") + private String tagFieldName; + + @ApiModelProperty("标签字段code") + private String tagCode; + + @ApiModelProperty(value = "标签code含义", required = false) + private String tagName; +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java new file mode 100644 index 0000000..fc72741 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.expert.model.bo; + + +import com.hz.pm.api.expert.constant.ExpertSensitiveFieldTypeEnum; +import com.hz.pm.api.expert.model.SensitiveModifySegment; +import lombok.Data; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/28 上午11:18 + */ +@Data +public class ExpertInfoSensitiveFieldCheckBO { + + private Boolean hasModify; + + /** + * 专家敏感信息是否修改 + */ + private Boolean isExpertSensitiveInfoModify; + + /** + * 专家敏感信息原值和申请值 + */ + private List expertSensitiveInfoFieldSegmentList; + + /** + * 专家层级是否修改 + */ + private Boolean isExpertRegionModify; + /** + * 专家层级修改原值和申请值 + */ + private List expertRegionFieldSegmentList; + + /** + * 专家履职意向是否修改 + */ + private Boolean isExpertIntentionModify; + + /** + * 专家履职意向修改原值和申请值 + */ + private List expertIntentionFieldSegmentList; + + public ExpertInfoSensitiveFieldCheckBO(List sensitiveModifySegmentList) { + Map> collect = sensitiveModifySegmentList + .stream().collect(Collectors.groupingBy(SensitiveModifySegment::getFieldType)); + + this.expertSensitiveInfoFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_sensitive_info_field); + if (CollectionUtils.isEmpty(expertSensitiveInfoFieldSegmentList)) { + this.expertSensitiveInfoFieldSegmentList = new ArrayList<>(); + } + this.isExpertSensitiveInfoModify = SensitiveModifySegment.isModify(expertSensitiveInfoFieldSegmentList); + + this.expertRegionFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_region_field); + if (CollectionUtils.isEmpty(expertRegionFieldSegmentList)) { + this.expertRegionFieldSegmentList = new ArrayList<>(); + } + this.isExpertRegionModify = SensitiveModifySegment.isModify(expertRegionFieldSegmentList); + + this.expertIntentionFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_intention_field); + if (CollectionUtils.isEmpty(expertIntentionFieldSegmentList)) { + this.expertIntentionFieldSegmentList = new ArrayList<>(); + } + this.isExpertIntentionModify = SensitiveModifySegment.isModify(expertIntentionFieldSegmentList); + + this.hasModify = this.isExpertSensitiveInfoModify || this.isExpertRegionModify || this.isExpertIntentionModify; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java new file mode 100644 index 0000000..25a44e2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java @@ -0,0 +1,37 @@ +//package com.hz.pm.api.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO; +//import com.ningdatech.emapi.expert.entity.dto.*; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/7/28 下午2:43 +// */ +//@Data +//public class AdminModifyExpertInfoCmd { +// +// private Long userId; +// +// private ExpertUserFullInfoDTO expertUserInfoDTO; +// +// private List expertDictionaryList; +// +// private List expertTagList; +// +// /** +// * 专家履职意向(区域编码) +// */ +// private List expertIntentionWorkRegionInfo; +// +// /** +// * 回避单位列表 +// */ +// private List expertAvoidCompanyList; +// +// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; +// +// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; +//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java new file mode 100644 index 0000000..52fc0f5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.expert.model.cmd; + + +import com.hz.pm.api.common.model.CommonPageReq; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.model.query.ExpertDictionaryQuery; +import com.hz.pm.api.expert.model.query.ExpertTagQuery; +import com.hz.pm.api.meta.model.bo.RegionContainsBO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:11 + */ +@Data +public class ExpertAdminExpertManageQueryCmd extends CommonPageReq { + + @ApiModelProperty("专家姓名(精准匹配)") + private String expertName; + + @ApiModelProperty("工作单位(模糊匹配)") + private String company; + + @ApiModelProperty("专家账号状态") + private List expertAccountStatusList; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + private String regionCode; + + /** + * 区域级别 + */ + @ApiModelProperty("区域级别") + private Integer regionLevel; + + /** + * 专家管理区域范围 + */ + List regionContainsList; + + /** + * 专家履职意向地区域范围 + */ + List intentionRegionList; + + /** + * 专家字典信息 + */ + private List expertDictionaryQueryList; + + /** + * 专家标签信息 + */ + private List expertTagQueryList; + + /** + * 是否为钉用户 + */ + private Boolean isDingUser; + + /** + * 无数据可供查询 + */ + private transient boolean hasNonData = false; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertDeliveryDealCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertDeliveryDealCmd.java new file mode 100644 index 0000000..456b336 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertDeliveryDealCmd.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.model.cmd; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/26 下午6:28 + * 专家出库审核处理cmd + */ +@Data +public class ExpertDeliveryDealCmd { + + private Long expertUserId; + + private Boolean applyResult; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertFullInfoSaveCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertFullInfoSaveCmd.java new file mode 100644 index 0000000..9bef42a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertFullInfoSaveCmd.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.expert.model.cmd; + +import com.hz.pm.api.expert.model.dto.*; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:41 + */ +@Data +public class ExpertFullInfoSaveCmd { + + private Long userId; + + private ExpertUserFullInfoDTO expertUserInfoDTO; + + private List expertDictionaryList; + + private List expertTagList; + + /** + * 专家履职意向(区域编码) + */ + private List expertIntentionWorkRegionInfo; + + /** + * 回避单位列表 + */ + private List expertAvoidCompanyList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java new file mode 100644 index 0000000..3ea2cba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.expert.model.cmd; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/28 下午5:35 + */ +@Data +public class ExpertInfoModifyApplyDealCmd { + + private Long expertUserId; + + private Boolean applyResult; + + private Long applyId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyCmd.java new file mode 100644 index 0000000..0841d64 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertInfoModifyCmd.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.model.cmd; + + +import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; +import com.hz.pm.api.expert.model.dto.*; +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午2:43 + */ +@Data +public class ExpertInfoModifyCmd { + + private Long userId; + + private ExpertUserFullInfoDTO expertUserInfoDTO; + + private List expertDictionaryList; + + private List expertTagList; + + /** + * 专家履职意向(区域编码) + */ + private List expertIntentionWorkRegionInfo; + + /** + * 回避单位列表 + */ + private List expertAvoidCompanyList; + + private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; + + private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; + + private List businessStrips; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertIntentionApplyDealCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertIntentionApplyDealCmd.java new file mode 100644 index 0000000..0b56436 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertIntentionApplyDealCmd.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.expert.model.cmd; + +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/27 上午9:06 + */ +@Data +public class ExpertIntentionApplyDealCmd { + + private Long expertUserId; + + private Boolean applyResult; + + ExpertApplyTypeEnum applyTypeEnum; + + private String expertRegionCode; + + private Integer expertRegionLevel; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertRecommendProofSaveCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertRecommendProofSaveCmd.java new file mode 100644 index 0000000..efffd7e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertRecommendProofSaveCmd.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.expert.model.cmd; + +import com.hz.pm.api.expert.model.dto.ExpertDictionaryDTO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:59 + */ +@Data +public class ExpertRecommendProofSaveCmd { + + + private Long userId; + + private List recommendationProofFileIdList; + + private List recommendedWay; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertStorageDealCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertStorageDealCmd.java new file mode 100644 index 0000000..5f69b2d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/ExpertStorageDealCmd.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.expert.model.cmd; + + +import com.hz.pm.api.expert.model.dto.ExpertDictionaryDTO; +import com.hz.pm.api.expert.model.dto.ExpertTagDTO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午5:40 + */ +@Data +public class ExpertStorageDealCmd { + + private Long expertUserId; + + private Boolean applyResult; + + private String joinRegionCode; + + private Integer joinRegionLevel; + + /** + * 专家类型(内外围) + */ + private List expertType; + + /** + * 其他标签(标签code) + */ + private List other; + + private String remark; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/MetaApplyListQuery.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/MetaApplyListQuery.java new file mode 100644 index 0000000..8c04b02 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/MetaApplyListQuery.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.expert.model.cmd; + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeQueryEnum; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午2:35 + */ +@Data +@ApiModel("申请列表查询请求") +public class MetaApplyListQuery extends PagePo { + + @ApiModelProperty("审核类型") + private List applyTypeList; + + @ApiModelProperty("审核结果") + private List applyStatusList; + + @ApiModelProperty("工作单位") + private String companyName; + + @ApiModelProperty("专家姓名") + private String expertName; + + @ApiModelProperty("职称级别字典编码") + private String titleLevelDictionaryCode; + + @ApiModelProperty("专家层级") + private ExpertRegionInfo expertRegionInfo; + + @ApiModelProperty("筛选开始时间") + private LocalDateTime applyStartTime; + + @ApiModelProperty("筛选结束时间") + private LocalDateTime applyEndTime; + + @ApiModelProperty("专家类型") + private DictionaryFieldInfo expertType; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java new file mode 100644 index 0000000..6e5d31b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java @@ -0,0 +1,60 @@ +//package com.hz.pm.api.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.dto.ExpertAdminRegionDTO; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/8/1 上午10:54 +// */ +//@Data +//public class SaveExpertAdminCmd { +// +// /** +// * 用户id +// */ +// private Long userId; +// +// /** +// * 是否浙政钉用户Y/N +// */ +// private Boolean isDingUser; +// +// /** +// * 手机号 +// */ +// private String phoneNo; +// +// /** +// * 用户名称 +// */ +// private String name; +// +// /** +// * 工作单位 +// */ +// private String company; +// +// /** +// * 公司唯一标识 +// */ +// private String companyUniqCode; +// +// /** +// * 层级 +// */ +// private List regionInfoList; +// +// /** +// * 用户状态(启用/关闭) +// */ +// private Boolean isEnable; +// +// /** +// * 操作者id +// */ +// private Long operatorId; +// +//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/constant/ExpertAuditMsgTemplate.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/constant/ExpertAuditMsgTemplate.java new file mode 100644 index 0000000..963224b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/constant/ExpertAuditMsgTemplate.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.expert.model.constant; + +/** + *

+ * ExpertAuditMsgTemplate + *

+ * + * @author WendyYang + * @since 2023/8/7 + **/ +public interface ExpertAuditMsgTemplate { + + /** + * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请未通过,如有疑问请联系xxx确认。 + */ + String EXPERT_AUDIT_FAIL = "尊敬的%s专家您好,您提交的专家入库申请未通过,如有疑问请联系%s「%s」确认。"; + + /** + * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请已通过,请登录http://60.188.225.145/login查看,如有疑问请联系xxx。 + */ + String EXPERT_AUDIT_PASS = "尊敬的%s专家您好,您提交的专家入库申请已通过,请登录%s查看,如有疑问请联系%s「%s」。"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAdminExpertManageListDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAdminExpertManageListDTO.java new file mode 100644 index 0000000..c974f3b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAdminExpertManageListDTO.java @@ -0,0 +1,138 @@ +package com.hz.pm.api.expert.model.dto; + + +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:36 + */ +@Data +public class ExpertAdminExpertManageListDTO { + + /** + * 用户id + */ + private Long userId; + + /** + * 专家姓名 + */ + private String expertName; + + /** + * 工作单位 + */ + private String company; + + /** + * 单位属性(字典code) + */ + private List companyAttribute; + + /** + * 专家联系方式 + */ + private String phoneNo; + + /** + * 性别 + */ + private String gender; + + /** + * 出生日期 + */ + private LocalDateTime birth; + + /** + * 籍贯 + */ + private String hometown; + + /** + * 民族 + */ + private String nationality; + + /** + * 政治面貌(字典code) + */ + private List political; + + /** + * 身份证号码 + */ + private String idCard; + + /** + * 专家层级 + */ + private ExpertRegionInfo expertRegionInfo; + + /** + * 银行卡号 + */ + private String bankNo; + + /** + * 开户银行 + */ + private String bank; + + /** + * 学历(字典code) + */ + private List edu; + + /** + * 学位(字典code) + */ + private List degree; + + /** + * 职称级别 + */ + private List titleLevel; + + /** + * 推荐方式 + */ + private List recommendedWay; + + /** + * 单位法人编号 + */ + private String legalEntityCode; + + /** + * 专家类型(内外围) + */ + private List expertType; + + /** + * 是否浙政钉用户 + */ + private Boolean isDingUser; + + /** + * 账号状态 + */ + private String expertAccountStatus; + + /** + * 专家来源 + */ + private List expertSource; + + /** + * 创建时间 + */ + private LocalDateTime createTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAvoidCompanyDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAvoidCompanyDTO.java new file mode 100644 index 0000000..6dff25e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertAvoidCompanyDTO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午5:14 + */ +@Data +public class ExpertAvoidCompanyDTO { + /** + * 公司名称 + */ + private String companyName; + + /** + * 公司唯一标识 + */ + private String companyUniqCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertDictionaryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertDictionaryDTO.java new file mode 100644 index 0000000..c7f2513 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertDictionaryDTO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:13 + */ +@Data +public class ExpertDictionaryDTO { + + /** + * 字典编码 + */ + private String dictionaryCode; + + /** + * 手机对应专家信息字段号 + * 政治面貌 political + * 专家来源 expert_source + * 学历 edu + * 学位 degree + * 在职状态 job_status + * 行政职级 administrative_rank + * 内外围(专家类型) expert_type + * 单位类型 company_attribute + * 职称级别 title_level + */ + private String expertInfoField; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertFullInfoAllDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertFullInfoAllDTO.java new file mode 100644 index 0000000..f914c0d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertFullInfoAllDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.expert.model.dto; + +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 上午10:22 + * 专家全量信息表,包含履职意向,专家字典信息,专家标签信息,回避单位信息 + */ +@Data +public class ExpertFullInfoAllDTO { + + private Long userId; + + private ExpertUserFullInfoDTO expertUserInfoDTO; + + private List expertDictionaryList; + + private List expertTagList; + + /** + * 专家履职意向(区域编码) + */ + private List expertIntentionWorkRegionInfo; + + /** + * 专家申请履职意向展示列表 + */ + private List expertApplyIntentionWorkRegionInfo; + + /** + * 回避单位列表 + */ + private List expertAvoidCompanyList; + + private List businessStrips; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertRegionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertRegionDTO.java new file mode 100644 index 0000000..e82dfc8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertRegionDTO.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:10 + */ +@Data +public class ExpertRegionDTO { + + private String regionCode; + private Integer regionLevel; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertTagDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertTagDTO.java new file mode 100644 index 0000000..19b8bf4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertTagDTO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:13 + */ +@Data +public class ExpertTagDTO { + + /** + * 标签code + */ + private String tagCode; + + /** + * 对应专家信息字段 + */ + private String expertInfoField; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertUserFullInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertUserFullInfoDTO.java new file mode 100644 index 0000000..12921d6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ExpertUserFullInfoDTO.java @@ -0,0 +1,205 @@ +package com.hz.pm.api.expert.model.dto; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:43 + */ +@Data +public class ExpertUserFullInfoDTO { + + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 专家账号状态 + */ + private String expertAccountStatus; + + /** + * 是否浙政钉用户Y/N + */ + private Boolean isDingUser; + + /** + * 专家信息提交步骤 + * 0,1,2 + * 0 :待提交信息
1: 已提交基本信息
2:已提交推荐证明 + */ + private Integer userInfoStep; + + /** + * 手机号 + */ + private String phoneNo; + + /** + * 性别 + * 0,1
女,男 + */ + private String gender; + + /** + * 姓名 + */ + private String name; + + /** + * 免冠照图片文件地址 + */ + private Long avatarFileId; + + /** + * 身份证号码 + */ + private String idCard; + + /** + * 办公电话 + */ + private String officePhone; + + /** + * 出生日期 + */ + private LocalDateTime birth; + + /** + * 银行卡号 + */ + private String bankNo; + + /** + * 开户银行 + */ + private String bank; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 毕业院校 + */ + private String school; + + /** + * 毕业时间 + */ + private LocalDateTime graduatedAt; + + /** + * 所学专业 + */ + private String academicTitle; + + /** + * 毕业证 文件id + */ + private List graduationCertificateFileIdList; + + /** + * 学位证 文件id + */ + private List degreeCertificateFileIdList; + + /** + * 退休时间 + */ + private LocalDateTime retiredAt; + + /** + * 工作单位 + */ + private String company; + + /** + * 工作单位前端使用标识 + */ + private String companyUniqCode; + + /** + * 单位法人编号 + */ + private String legalEntityCode; + + /** + * 行政职务 + */ + private String administrativeDuties; + + /** + * 开始工作时间 + */ + private LocalDateTime startWorkAt; + + /** + * 工作地址 + */ + private String address; + + /** + * 工作经历 + */ + private String experience; + + /** + * 技术职称 + */ + private String technicalTitles; + + /** + * 职称证明 + * 文件id + */ + private List titleCertificateFileIdList; + + /** + * 获奖情况 + */ + private String awards; + + /** + * 表彰奖励 + */ + private String recognitionReward; + + /** + * 推荐证明材料文件id + */ + private List recommendationProofFileIdList; + + /** + * 专家层级(区域编码) + */ + private String regionCode; + + /** + * 区域级别 + */ + private Integer regionLevel; + + /** + * 专家管理员审核备注 + */ + private String remark; + + /** + * 籍贯 + */ + private String hometown; + + /** + * 民族 + */ + private String nationality; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ModifyApplyExtraInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ModifyApplyExtraInfoDTO.java new file mode 100644 index 0000000..422a576 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ModifyApplyExtraInfoDTO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.expert.model.dto; + +import com.hz.pm.api.common.model.FileBasicInfo; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/28 下午3:48 + */ +@Data +public class ModifyApplyExtraInfoDTO { + /** + * 情况说明 + */ + @NotBlank + private String factSheet; + + /** + * 证明材料 + */ + private List evidenceList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateOptionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateOptionDTO.java new file mode 100644 index 0000000..4976906 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateOptionDTO.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.expert.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * ReviewTemplateOptionVO + *

+ * + * @author WendyYang + * @since 16:12 2023/2/15 + */ +@Data +@Builder +public class ReviewTemplateOptionDTO { + + @Tolerate + public ReviewTemplateOptionDTO() { + } + + @ApiModelProperty("问题序号") + @NotNull(message = "问题序号不能为空") + private Integer questionSerialNo; + + @ApiModelProperty("选项序号") + @NotEmpty(message = "选项序号不能为空") + private List optionSerialNo; + + @ApiModelProperty("其他意见或建议") + private String otherAdvice; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateSettingsDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateSettingsDTO.java new file mode 100644 index 0000000..74f17b3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/dto/ReviewTemplateSettingsDTO.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.expert.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * ReviewTemplateSettingsDTO + *

+ * + * @author WendyYang + * @since 17:06 2023/2/14 + */ +@Data +public class ReviewTemplateSettingsDTO { + + @ApiModelProperty("序号") + @NotNull(message = "序号不能为空") + private Integer serialNo; + + @ApiModelProperty("标题") + @NotBlank(message = "标题不能为空") + private String title; + + @Valid + @ApiModelProperty("选项") + @NotEmpty(message = "选项不能为空") + private List options; + + @ApiModelProperty("选择类型:1 单选、2 多选") + @NotNull(message = "选择类型不能为空") + private Integer optionType; + + @Data + @ApiModel("选项实体") + public static class OptionDTO { + + @ApiModelProperty("序号") + @NotNull(message = "序号不能为空") + private Integer serialNo; + + @ApiModelProperty("选项内容") + @NotBlank(message = "选项内容不能为空") + private String option; + + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ExpertReview.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ExpertReview.java new file mode 100644 index 0000000..f45d0e6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ExpertReview.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.expert.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 WendyYang + * @since 2023-02-15 + */ +@Data +@TableName("nd_expert_review") +@ApiModel(value = "ExpertReview对象", description = "专家评价") +public class ExpertReview implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + private String projectCode; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("评审模版配置ID") + private Long templateId; + + @ApiModelProperty("评审内容") + private String content; + + @ApiModelProperty("意见或建议") + private String otherAdvice; + + @ApiModelProperty("附件ID") + private Long attachFileId; + + @ApiModelProperty("评审结果") + private Integer reviewResult; + + @ApiModelProperty("创建人姓名") + private String creator; + + @ApiModelProperty("创建人") + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("修改人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("是否是最终意见") + private Boolean isFinal; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ReviewTemplateSettings.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ReviewTemplateSettings.java new file mode 100644 index 0000000..25477bc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/entity/ReviewTemplateSettings.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.expert.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 WendyYang + * @since 2023-02-14 + */ +@Data +@TableName("nd_review_template_settings") +@ApiModel(value = "NdReviewTemplateSettings对象", description = "评审模版配置表") +public class ReviewTemplateSettings implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("模版类型:1 初步方案评审模版、2 建设方案评审模版、3 验收方案评审模版") + private Integer templateType; + + @ApiModelProperty("模版内容") + private String content; + + @ApiModelProperty("是否是最新") + private Boolean isLast; + + @ApiModelProperty("区域编码") + private String regionCode; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/enumeration/ReviewTemplateTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/enumeration/ReviewTemplateTypeEnum.java new file mode 100644 index 0000000..478b27d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/enumeration/ReviewTemplateTypeEnum.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.expert.model.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * ReviewTemplateTypeEnum + *

+ * + * @author WendyYang + * @since 09:48 2023/2/15 + */ +@Getter +public enum ReviewTemplateTypeEnum { + /** + * 评审模版类型 + */ + PRELIMINARY_SCHEME_REVIEW("初步方案评审", 1), + + CONSTRUCTION_SCHEME_REVIEW("建设方案评审", 2), + + ACCEPTANCE_SCHEME_REVIEW("验收方案评审", 3), + + DEPT_JOIN_REVIEW("部门联审", 4), + + FAIRNESS_REVIEW("公平性审查", 5); + + private final String value; + private final Integer code; + + ReviewTemplateTypeEnum(String value, Integer code) { + this.value = value; + this.code = code; + } + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + public static ReviewTemplateTypeEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("评审模版类型编码无效")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertDictionaryQuery.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertDictionaryQuery.java new file mode 100644 index 0000000..07d2068 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertDictionaryQuery.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.expert.model.query; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午11:16 + */ +@Data +public class ExpertDictionaryQuery { + + private String expertInfoField; + + private List dictionaryCodeList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertTagQuery.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertTagQuery.java new file mode 100644 index 0000000..a2f20f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ExpertTagQuery.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.expert.model.query; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午11:16 + */ +@Data +public class ExpertTagQuery { + + private String expertInfoField; + + private List tagCodeList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ListExpertQuery.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ListExpertQuery.java new file mode 100644 index 0000000..a47459c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/query/ListExpertQuery.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.expert.model.query; + +import com.hz.pm.api.meta.model.bo.RegionContainsBO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午10:52 + */ +@Data +public class ListExpertQuery { + + private Integer limit; + private Integer offset; + + /** + * 专家姓名(精准匹配) + */ + private String expertName; + + /** + * 工作单位(模糊匹配) + */ + private String company; + + /** + * 专家账号状态 + */ + private List expertAccountStatusList; + + /** + * 区域编码 + */ + private String regionCode; + + /** + * 区域级别 + */ + private Integer regionLevel; + + /** + * 专家管理区域范围 + */ + List regionContainsList; + /** + * 专家管理区域范围 + */ + List intentionRegionList; + + /** + * 专家字典信息 + */ + private List expertDictionaryQueryList; + + /** + * 专家标签信息 + */ + private List expertTagQueryList; + + private Boolean isDingUser; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/AdminExpertBasicInfoModifyRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/AdminExpertBasicInfoModifyRequest.java new file mode 100644 index 0000000..69b3eed --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/AdminExpertBasicInfoModifyRequest.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.expert.model.req; + + +import com.hz.pm.api.expert.model.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/8/19 下午6:40 + */ +@Data +@ApiModel("专家管理员专家信息更新请求") +public class AdminExpertBasicInfoModifyRequest { + + @ApiModelProperty("专家用户id") + private Long expertUserId; + + @NotNull + @ApiModelProperty("基本信息") + private ExpertBasicInfo basicInfo; + + @NotNull + @ApiModelProperty("学历信息") + private ExpertEduInfo eduInfo; + + @NotNull + @ApiModelProperty("职业信息") + private ExpertJobInfo jobInfo; + + @NotNull + @ApiModelProperty("专业信息") + private ExpertProfessionalInfo professionalInfo; + + @NotNull + @ApiModelProperty("推荐信息") + private ExpertRecommendInfo recommendInfo; + + @ApiModelProperty("其他信息") + private ExpertOtherInfo expertOtherInfo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertRegistrationRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertRegistrationRequest.java new file mode 100644 index 0000000..2cb4052 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertRegistrationRequest.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.expert.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:21 + */ +@Data +@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "社会专家报名接口") +public class ExpertRegistrationRequest extends ExpertUserBasicInfoSubmitRequest { + + @NotBlank(message = "手机验证码不能为空") + @ApiModelProperty("手机验证码") + private String verificationCode; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertReviewDetailReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertReviewDetailReq.java new file mode 100644 index 0000000..07ff5c2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertReviewDetailReq.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.expert.model.req; + +import com.hz.pm.api.expert.model.dto.ReviewTemplateOptionDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * ExpertReviewDetailVO + *

+ * + * @author WendyYang + * @since 14:37 2023/2/15 + */ +@Data +public class ExpertReviewDetailReq { + + @ApiModelProperty("模版ID") + @NotNull(message = "模版ID不能为空") + private Long templateId; + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("项目编号") + @NotNull(message = "项目编号不能为空") + private String projectCode; + + @ApiModelProperty("会议ID") + @NotNull(message = "会议ID不能为空") + private Long meetingId; + + @Valid + @ApiModelProperty("配置模版") + @NotEmpty(message = "配置不能为空") + private List reviewTemplateOptions; + + @ApiModelProperty("其他意见或建议") + @NotEmpty(message = "其他意见或建议不能为空") + private String otherAdvice; + + @ApiModelProperty("附件ID") + private Long attachFileId; + + @ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") + @NotNull(message = "评审结果不能为空") + private Integer reviewResult; + + @ApiModelProperty("是否是最终意见") + @NotNull(message = "是否是最终意见不能为空") + private Boolean isFinal; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertUserBasicInfoSubmitRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertUserBasicInfoSubmitRequest.java new file mode 100644 index 0000000..bd354ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ExpertUserBasicInfoSubmitRequest.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.model.req; + +import com.hz.pm.api.expert.model.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:21 + */ +@Data +@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "专家基本信息填写入参") +public class ExpertUserBasicInfoSubmitRequest { + + @NotNull + @ApiModelProperty("基本信息") + private ExpertBasicInfo basicInfo; + + @NotNull + @ApiModelProperty("学历信息") + private ExpertEduInfo eduInfo; + + @NotNull + @ApiModelProperty("职业信息") + private ExpertJobInfo jobInfo; + + @NotNull + @ApiModelProperty("专业信息") + private ExpertProfessionalInfo professionalInfo; + + /** + * 补充推荐方式 + */ + @NotNull + @ApiModelProperty("推荐信息") + private ExpertRecommendInfo recommendInfo; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/GetZzdInfoRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/GetZzdInfoRequest.java new file mode 100644 index 0000000..52dd2ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/GetZzdInfoRequest.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/8/29 下午2:54 + */ +@Data +@ApiModel(description = "通过手机号获取浙政钉信息请求") +public class GetZzdInfoRequest { + + @NotBlank + @ApiModelProperty("手机号") + private String phoneNo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/MetaApplyResultRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/MetaApplyResultRequest.java new file mode 100644 index 0000000..50e5988 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/MetaApplyResultRequest.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.expert.model.req; + +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午4:20 + * 申请结果请求基类 + */ +@Data +@Validated +public class MetaApplyResultRequest { + + @NotNull + @ApiModelProperty("申请id") + private Long applyId; + + @NotNull + @ApiModelProperty("审核结果") + private Boolean applyResult; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("入库审核额外参数,只有入库审核结果审批才需要填写") + private StorageApplyResultExtraInfo storageApplyResultExtraInfo; + + + @Data + @ApiModel("入库审核额外参数") + public static class StorageApplyResultExtraInfo { + @ApiModelProperty("专家类型-内外围") + private List expertType; + + @ApiModelProperty("其他标签(标签code)") + private List other; + + @ApiModelProperty("备注") + private String remark; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ReviewTemplateReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ReviewTemplateReq.java new file mode 100644 index 0000000..cb0fb21 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/req/ReviewTemplateReq.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.expert.model.req; + +import com.hz.pm.api.expert.model.dto.ReviewTemplateSettingsDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * ReviewTemplateReq + *

+ * + * @author WendyYang + * @since 10:11 2023/2/15 + */ +@Data +public class ReviewTemplateReq { + + @ApiModelProperty("模版类型") + @NotNull(message = "模版类型不能为空") + private Integer templateType; + + @ApiModelProperty("区域编码") + @NotBlank(message = "不能在根节点添加") + private String regionCode; + + @Valid + @NotEmpty(message = "模版不能为空") + @ApiModelProperty("模版数据") + private List templates; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertAdminExpertManageListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertAdminExpertManageListVO.java new file mode 100644 index 0000000..50a1792 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertAdminExpertManageListVO.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.expert.model.vo; + + +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:04 + */ +@Data +@ApiModel("专家库列表查询返回model") +public class ExpertAdminExpertManageListVO { + + @ApiModelProperty(value = "用户id") + private Long userId; + + @ApiModelProperty(value = "专家姓名") + private String expertName; + + @ApiModelProperty(value = "职称级别") + private List titleLevel; + + @ApiModelProperty("工作单位") + private String company; + + @ApiModelProperty(" 单位法人编号") + private String legalEntityCode; + + @ApiModelProperty("单位类型(字典code)") + private List companyAttribute; + + @ApiModelProperty(value = "手机号") + private String phoneNo; + + @ApiModelProperty(value = "专家类型(内外围)") + private List expertType; + + @ApiModelProperty(value = "专家层级") + private ExpertRegionInfo expertRegionInfo; + + @ApiModelProperty(value = "是否浙政钉用户") + private Boolean isDingUser; + + @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") + private String expertAccountStatus; + + @ApiModelProperty(value = "专家来源") + private List expertSource; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertApplyMetaVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertApplyMetaVO.java new file mode 100644 index 0000000..74a2b74 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertApplyMetaVO.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.expert.model.vo; + +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 上午11:17 + * 专家审核列表展示VO基础类 + */ +@Data +@ApiModel("审核列表展示VO") +public class ExpertApplyMetaVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("用户id") + private Long userId; + + /** + * 审核结果 + */ + @ApiModelProperty("审核结果") + private String applyStatus; + + /** + * 审核类型 + */ + @ApiModelProperty("审核类型") + private String applyType; + + /** + * 专家姓名 + */ + @ApiModelProperty("专家姓名") + private String name; + + /** + * 专家层级 + */ + @ApiModelProperty("专家层级") + private ExpertRegionInfo expertRegionInfo; + + /** + * 职称级别 + */ + @ApiModelProperty("职称级别") + private List titleLevel; + + /** + * 工作单位 + */ + @ApiModelProperty("工作单位") + private String company; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phoneNo; + + /** + * 申请时间 + */ + @ApiModelProperty("申请时间") + private LocalDateTime applyTime; + + @ApiModelProperty("专家类型") + private List expertType; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertBasicInfoModifyResultVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertBasicInfoModifyResultVO.java new file mode 100644 index 0000000..fb0a14c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertBasicInfoModifyResultVO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.expert.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/7/27 下午4:29 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("专家信息修改是否需要额外材料") +public class ExpertBasicInfoModifyResultVO { + + /** + * 是否需要提交额外材料 + */ + @ApiModelProperty("是否需要额外材料-涉及修改需要审核数据需要提供额外材料") + private Boolean needExtraInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertFullInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertFullInfoVO.java new file mode 100644 index 0000000..344967d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertFullInfoVO.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.expert.model.vo; + +import com.hz.pm.api.expert.model.*; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:43 + */ +@Data +@ApiModel("专家全量信息") +public class ExpertFullInfoVO { + + @ApiModelProperty("专家用户id") + private Long userId; + + @ApiModelProperty("基本信息") + private ExpertBasicInfo basicInfo; + + @ApiModelProperty("学历信息") + private ExpertEduInfo eduInfo; + + @ApiModelProperty("职业信息") + private ExpertJobInfo jobInfo; + + @ApiModelProperty("专业信息") + private ExpertProfessionalInfo professionalInfo; + + @ApiModelProperty("推荐信息") + private ExpertRecommendInfo recommendInfo; + + @ApiModelProperty("其他信息") + private ExpertOtherInfo expertOtherInfo; + + @NotEmpty + @ApiModelProperty("专家申请履职意向展示列表") + private List expertApplyIntentionWorkRegions; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertReviewDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertReviewDetailVO.java new file mode 100644 index 0000000..6c9003a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ExpertReviewDetailVO.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.expert.model.vo; + +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.hz.pm.api.expert.model.dto.ReviewTemplateOptionDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * ExpertReviewDetailVO + *

+ * + * @author WendyYang + * @since 14:37 2023/2/15 + */ +@Data +@Builder +public class ExpertReviewDetailVO { + + @Tolerate + public ExpertReviewDetailVO() { + } + + @ApiModelProperty("模版ID") + private Long templateId; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("配置模版") + private List reviewTemplateOptions; + + @ApiModelProperty("其他意见或建议") + private String otherAdvice; + + @ApiModelProperty("附件ID") + private Long attachFileId; + + @ApiModelProperty("附件详情") + private AttachFileVo attachFile; + + @ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") + private Integer reviewResult; + + @ApiModelProperty("是否是最终意见") + private Boolean isFinal; + + @ApiModelProperty("评审时间") + private LocalDateTime createOn; + + @ApiModelProperty("专家名称") + private String creator; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java new file mode 100644 index 0000000..07e3648 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.expert.model.vo; + +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * LeaveAuditInfoVo + *

+ * + * @author WendyYang + * @since 13:46 2022/8/12 + */ +@Data +@Builder +@ApiModel("审核详情返回参数") +public class MetaApplyResultVo { + + @ApiModelProperty("审核人") + private String auditor; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核意见") + private String auditOption; + + @ApiModelProperty("审核状态") + private String auditStatus; + + @ApiModelProperty("申请时间") + private LocalDateTime applyTime; + + @ApiModelProperty("申请类型") + private String applyType; + + @ApiModelProperty("专家用户userId") + private Long expertUserId; + +// @ApiModelProperty("额外的材料") +// private ModifyApplyExtraInfo modifyApplyExtraInfo; +// +// @ApiModelProperty("信息修改申请展示列表-只有审核类型为信息变更审核时才有值") +// private InfoModifyApplyDisplayVO infoModifyApplyDisplayVo; + + @ApiModelProperty("履职意向修改申请展示列表-只有审核类型为履职意向变更时才会有值") + private IntentionApplyDisplayVO intentionApplyDisplayVo; + + + @Data + @ApiModel("履职意向修改申请展示列表") + public static class IntentionApplyDisplayVO { + + @ApiModelProperty("审核申请id") + private Long expertApplyId; + + @ApiModelProperty("履职意向增加") + private ExpertRegionInfo addExpertRegion; + + @ApiModelProperty("履职意向减少") + private ExpertRegionInfo reduceExpertRegion; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ProjectReviewDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ProjectReviewDetailVO.java new file mode 100644 index 0000000..cebfa6b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ProjectReviewDetailVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.expert.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * ProjectExpertReviewDetailVO + *

+ * + * @author WendyYang + * @since 2023/4/19 + **/ +@Data +public class ProjectReviewDetailVO { + + @ApiModelProperty("评审模版详情") + private Collection templates; + + private Collection reviews; + + @Data + public static class ReviewDetailByTypeVO { + + @ApiModelProperty("评审类型") + private Integer reviewType; + + @ApiModelProperty("最终评审意见") + private ExpertReviewDetailVO finalReview; + + @ApiModelProperty("组员评审意见") + private List teamMemberReviews; + + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ReviewTemplateVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ReviewTemplateVO.java new file mode 100644 index 0000000..af5b74c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ReviewTemplateVO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.expert.model.vo; + +import com.hz.pm.api.expert.model.dto.ReviewTemplateSettingsDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * ReviewTemplateReq + *

+ * + * @author WendyYang + * @since 10:11 2023/2/15 + */ +@Data +@Builder +public class ReviewTemplateVO { + + @ApiModelProperty("模版ID") + private Long templateId; + + @ApiModelProperty("模版类型") + private Integer templateType; + + @ApiModelProperty("模版数据") + private List templates; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ZzdInfoByMobileVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ZzdInfoByMobileVO.java new file mode 100644 index 0000000..7f3c442 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/ZzdInfoByMobileVO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.expert.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/29 下午3:21 + */ +@Data +@ApiModel("通过浙政钉获取手机号数据展示VO") +public class ZzdInfoByMobileVO { + + @ApiModelProperty("手机号") + private String phoneNo; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("姓名") + private String name; + + @ApiModelProperty("是否是浙政钉用户") + private Boolean isDingUser; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertAdminManageService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertAdminManageService.java new file mode 100644 index 0000000..9290012 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertAdminManageService.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.expert.service; + + +import com.hz.pm.api.common.model.CommonPage; +import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.hz.pm.api.expert.model.dto.ExpertAdminExpertManageListDTO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:32 + */ +public interface ExpertAdminManageService { + + /** + * 专家库条件筛选(管理员使用) + * + * @param expertAdminExpertManageQueryCmd + * @return + */ + CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); + + + /** + * 获取所有符合查询条件的专家user_id + * + * @param expertAdminExpertManageQueryCmd + * @return + */ + List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertInfoService.java new file mode 100644 index 0000000..a0fd130 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/ExpertInfoService.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.expert.service; + +import com.hz.pm.api.expert.model.cmd.*; +import com.hz.pm.api.expert.model.dto.ExpertFullInfoAllDTO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:39 + */ + +public interface ExpertInfoService { + + void saveExpertInfo(ExpertFullInfoSaveCmd cmd); + + /** + * 专家报名提交 推荐证明材料 + * + * @param expertRecommendProofSaveCmd + */ + Long expertRecommendProofSave(ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd); + + void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd); + + + /** + * 专家信息修改审核结果处理 + * + * @param expertInfoModifyApplyDealCmd \ + */ + void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd); + + /** + * 根据user_id 获取用户全量信息 + * + * @param userId \ + * @return \ + */ + ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId); + + /** + * 专家入库审核处理 + * + * @param cmd \ + **/ + void expertStorageDeal(ExpertStorageDealCmd cmd); + + + /** + * 批量获取用户全量信息 + **/ + List listExpertUserFullInfoAll(List userIds); + + + /** + * 管理员修改专家信息 + */ + List adminModifyExpertInfo(ExpertInfoModifyCmd cmd, Long adminUserId); + +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertAvoidCompanyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertAvoidCompanyService.java new file mode 100644 index 0000000..ed4bb0a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertAvoidCompanyService.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.expert.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.expert.entity.ExpertAvoidCompany; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +public interface IExpertAvoidCompanyService extends IService { + + default void removeByUserId(Long userId) { + remove(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertGovBusinessStripService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertGovBusinessStripService.java new file mode 100644 index 0000000..8d173d5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertGovBusinessStripService.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.expert.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-04-17 + */ +public interface IExpertGovBusinessStripService extends IService { + + default List listByUserIds(Collection userIds) { + LambdaQueryWrapper query = Wrappers + .lambdaQuery(ExpertGovBusinessStrip.class) + .in(ExpertGovBusinessStrip::getExpertUserId, userIds); + return list(query); + } + + default boolean removeByUserId(Long userId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertGovBusinessStrip.class) + .eq(ExpertGovBusinessStrip::getExpertUserId, userId); + return remove(query); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertIntentionWorkRegionService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertIntentionWorkRegionService.java new file mode 100644 index 0000000..9e58eb1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertIntentionWorkRegionService.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.expert.service; + +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertIntentionWorkRegionService extends IService { + + /** + * 根据履职意向地或许满足履职意向地的用户ID集合 + * + * @param regionCode regionCode + * @param regionLevel regionLevel + * @return java.util.List + * @author WendyYang + **/ + List userIdsMatchIntentionRegion(String regionCode, Integer regionLevel); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertMetaApplyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertMetaApplyService.java new file mode 100644 index 0000000..b0e14fd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertMetaApplyService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.expert.entity.ExpertMetaApply; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-03-01 + */ +public interface IExpertMetaApplyService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertReviewService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertReviewService.java new file mode 100644 index 0000000..f378ad5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertReviewService.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.expert.service; + +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +public interface IExpertReviewService extends IService { + + /** + * 根据项目ID和专家ID获取评审记录 + * + * @param projectId 项目ID + * @param expertId 专家ID + * @param meetingId 会议ID + * @return 评审记录 + * @author WendyYang + **/ + List listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId); + + /** + * 获取最终评审结果 + * + * @param meetingId 会议ID + * @param projectId 项目ID + * @return {@link ExpertReview} + * @author WendyYang + **/ + ExpertReview getFinalReview(Long meetingId, Long projectId); + + /** + * 获取最终评审结果 + * + * @param meetingId 会议ID + * @return {@link ExpertReview} + * @author WendyYang + **/ + Map listFinalReviewMap(Long meetingId); + + /** + * 获取最终评审结果 + * + * @param meetingId 会议ID + * @return {@link ExpertReview} + * @author WendyYang + **/ + List listFinalReview(Long meetingId); + + /** + * 查某个项目 某一个 阶段的 最终会议 + * @param meetingType + * @return + */ + ExpertReview getFinalReview(String projectCode,Integer meetingType); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java new file mode 100644 index 0000000..9aad582 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.service; + +import com.hz.pm.api.expert.entity.ExpertSensitiveInfoModifyDetailRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +public interface IExpertSensitiveInfoModifyDetailRecordService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertUserFullInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertUserFullInfoService.java new file mode 100644 index 0000000..c561819 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IExpertUserFullInfoService.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.expert.service; + +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.service.IService; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertUserFullInfoService extends IService { + + + /** + * 查询用户信息 + * + * @param userId 用户ID + * @return / + **/ + ExpertUserFullInfo getByUserId(Long userId); + + /** + * 查询用户信息 + * + * @param userId 用户ID + * @return / + **/ + List listByUserId(List userId); + + + /** + * 批量查询专家用户信息 + * + * @param userIds 用户ID + * @return / + */ + List listByUserIds(List userIds); + + default List listCompanyUniqCodeByUserIds(Collection userIds) { + LambdaQueryWrapper query = Wrappers + .lambdaQuery(ExpertUserFullInfo.class) + .select(ExpertUserFullInfo::getCompanyUniqCode) + .in(ExpertUserFullInfo::getUserId, userIds); + return CollUtils.fieldList(list(query), ExpertUserFullInfo::getCompanyUniqCode); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IReviewTemplateSettingsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IReviewTemplateSettingsService.java new file mode 100644 index 0000000..de1e329 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/IReviewTemplateSettingsService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.expert.service; + +import com.hz.pm.api.expert.model.entity.ReviewTemplateSettings; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 评审模版配置表 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-14 + */ +public interface IReviewTemplateSettingsService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java new file mode 100644 index 0000000..943a4be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -0,0 +1,138 @@ +package com.hz.pm.api.expert.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.model.CommonPage; +import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.constant.ExpertUserInfoStepEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.mapper.ExpertAdminManageMapper; +import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.hz.pm.api.expert.model.dto.ExpertAdminExpertManageListDTO; +import com.hz.pm.api.expert.model.query.ExpertDictionaryQuery; +import com.hz.pm.api.expert.model.query.ExpertTagQuery; +import com.hz.pm.api.expert.model.query.ListExpertQuery; +import com.hz.pm.api.expert.service.ExpertAdminManageService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.meta.service.IExpertTagService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/10 上午10:37 + */ +@Service +@RequiredArgsConstructor +public class ExpertAdminManageServiceImpl implements ExpertAdminManageService { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + private final IExpertDictionaryService iExpertDictionaryService; + private final IExpertTagService iExpertTagService; + private final ExpertAdminManageMapper expertAdminManageMapper; + + private List listExpertUserId(ListExpertQuery listExpertQuery) { + List userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); + + List expertTagQueryList = listExpertQuery.getExpertTagQueryList(); + if (CollectionUtils.isNotEmpty(expertTagQueryList)) { + List tagUserIdList = expertAdminManageMapper.listExpertTagUserId(listExpertQuery); + userIdList.retainAll(tagUserIdList); + } + + List expertDictQueryList = listExpertQuery.getExpertDictionaryQueryList(); + if (CollectionUtils.isNotEmpty(expertDictQueryList)) { + List dictionaryUserIdList = expertAdminManageMapper.listExpertDictionaryUserId(listExpertQuery); + userIdList.retainAll(dictionaryUserIdList); + } + return userIdList; + } + + + @Override + public CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) { + ListExpertQuery listExpertQuery = buildListExpertQuery(req); + List userIdList = listExpertUserId(listExpertQuery); + + List evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); + List evidenceHasBeenSubmittedExpertUserIdList = evidenceHasBeenSubmittedExpertInfoList + .stream().map(ExpertUserFullInfo::getUserId) + .distinct().collect(Collectors.toList()); + + Iterator iterator = userIdList.iterator(); + while (iterator.hasNext()) { + if (!evidenceHasBeenSubmittedExpertUserIdList.contains(iterator.next())) { + userIdList.remove(iterator.next()); + } + } + + CommonPage commonPage = new CommonPage<>(); + commonPage.setCurrentPageNumber(req.getPageNumber()); + commonPage.setItemsTotal((long) userIdList.size()); + + List recordList = new ArrayList<>(); + + if (userIdList.size() != 0) { + List currPageUserIdList = CollUtil.page(req.getPageNumber() - 1, req.getPageSize(), userIdList); + List expertUserList = iExpertUserFullInfoService.listByUserIds(currPageUserIdList); + + // 获取专家字典数据 + LambdaQueryWrapper in = Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIdList); + List expertDictionaryList = iExpertDictionaryService.list(in); + Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); + + // 获取专家标签数据 + LambdaQueryWrapper tagIn = Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getUserId, userIdList); + List expertTagList = iExpertTagService.list(tagIn); + Map> expertTagMap = CollUtils.group(expertTagList, ExpertTag::getUserId); + for (ExpertUserFullInfo expertUserFullInfo : expertUserList) { + ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = + ExpertUserInfoAssembler.buildExpertAdminExpertManageListDTO(expertUserFullInfo, expertDictMap, expertTagMap); + recordList.add(expertAdminExpertManageListDTO); + } + } + commonPage.setItems(recordList); + return commonPage; + } + + public ListExpertQuery buildListExpertQuery(ExpertAdminExpertManageQueryCmd queryCmd) { + ListExpertQuery listExpertQuery = new ListExpertQuery(); + listExpertQuery.setExpertName(queryCmd.getExpertName()); + listExpertQuery.setCompany(queryCmd.getCompany()); + listExpertQuery.setExpertDictionaryQueryList(queryCmd.getExpertDictionaryQueryList()); + listExpertQuery.setExpertTagQueryList(queryCmd.getExpertTagQueryList()); + listExpertQuery.setRegionContainsList(queryCmd.getRegionContainsList()); + listExpertQuery.setIntentionRegionList(queryCmd.getIntentionRegionList()); + listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); + listExpertQuery.setLimit(queryCmd.getLimit()); + listExpertQuery.setOffset(queryCmd.getOffset()); + listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); + if (CollectionUtils.isNotEmpty(queryCmd.getExpertAccountStatusList())) { + listExpertQuery.setExpertAccountStatusList( + queryCmd.getExpertAccountStatusList().stream().map(ExpertAccountStatusEnum::getKey).collect(Collectors.toList())); + } + return listExpertQuery; + } + + @Override + public List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) { + ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd); + return listExpertUserId(listExpertQuery); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAvoidCompanyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAvoidCompanyServiceImpl.java new file mode 100644 index 0000000..75020e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAvoidCompanyServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.service.impl; + +import com.hz.pm.api.expert.entity.ExpertAvoidCompany; +import com.hz.pm.api.expert.mapper.ExpertAvoidCompanyMapper; +import com.hz.pm.api.expert.service.IExpertAvoidCompanyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +@Service +public class ExpertAvoidCompanyServiceImpl extends ServiceImpl implements IExpertAvoidCompanyService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertGovBusinessStripServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertGovBusinessStripServiceImpl.java new file mode 100644 index 0000000..d662905 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertGovBusinessStripServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.service.impl; + +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.hz.pm.api.expert.mapper.ExpertGovBusinessStripMapper; +import com.hz.pm.api.expert.service.IExpertGovBusinessStripService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-04-17 + */ +@Service +public class ExpertGovBusinessStripServiceImpl extends ServiceImpl implements IExpertGovBusinessStripService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java new file mode 100644 index 0000000..a8f1626 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java @@ -0,0 +1,877 @@ +package com.hz.pm.api.expert.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.PhoneUtil; +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.enumeration.BoolDisplayEnum; +import com.hz.pm.api.common.model.ExpertRegionModifyDiffBO; +import com.hz.pm.api.common.util.ExpertRegionInfoUtils; +import com.hz.pm.api.common.util.GzipUtils; +import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; +import com.hz.pm.api.expert.constant.*; +import com.hz.pm.api.expert.entity.*; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.SensitiveModifySegment; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; +import com.hz.pm.api.expert.model.cmd.*; +import com.hz.pm.api.expert.model.constant.ExpertAuditMsgTemplate; +import com.hz.pm.api.expert.model.dto.*; +import com.hz.pm.api.expert.service.*; +import com.hz.pm.api.expert.utils.SensitiveModifySegmentUtils; +import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.meta.service.IExpertTagService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.sys.service.IUserRoleService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.service.IUserInfoService; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.yxt.utils.JSONUtils; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.hz.pm.api.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_FAIL; +import static com.hz.pm.api.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_PASS; +import static com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:39 + */ +@Component +@RequiredArgsConstructor +public class ExpertInfoServiceImpl implements ExpertInfoService { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + private final IExpertTagService iExpertTagService; + private final IExpertDictionaryService iExpertDictionaryService; + private final IExpertAvoidCompanyService iExpertAvoidCompanyService; + private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService; + private final IExpertMetaApplyService iExpertMetaApplyService; + private final IRoleService roleService; + private final IUserRoleService userRoleService; + private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; + private final IUserInfoService userInfoService; + private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + private final IExpertGovBusinessStripService expertGovBusinessStripService; + + @Value("${login.url:}") + private String loginUrl; + + /** + * 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 + * + * @param cmd + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveExpertInfo(ExpertFullInfoSaveCmd cmd) { + Long userId = cmd.getUserId(); + List expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); + List expertDictionaryList = cmd.getExpertDictionaryList(); + List expertIntentionWorkRegionInfoList = cmd.getExpertIntentionWorkRegionInfo(); + List expertTagList = cmd.getExpertTagList(); + ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); + + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + + ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); + if (Objects.nonNull(expertUserFullInfo)) { + // 专家信息审核通过之前,所有信息无需备份 + iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); + // 删除所有专家标签字段 + iExpertTagService.removeByUserId(userId); + // 删除所有专家字典字段 + iExpertDictionaryService.removeByUserId(userId); + // 删除所有专家履职意向申请 + // 补充审核逻辑 + LambdaQueryWrapper expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, userId) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name()); + iExpertMetaApplyService.remove(expertMetaApplyRemove); + // 删除回避单位 + iExpertAvoidCompanyService.removeByUserId(userId); + } + saveExpertUserFullInfo.setUserId(userId); + saveExpertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.APPLYING.getKey()); + saveExpertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.BASIC_INFORMATION_SUBMITTED.getKey()); + saveExpertUserFullInfo.setUpdateOn(LocalDateTime.now()); + saveExpertUserFullInfo.setCreateOn(LocalDateTime.now()); + iExpertUserFullInfoService.save(saveExpertUserFullInfo); + // 保存所有专家标签字段 + List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); + if (CollectionUtils.isNotEmpty(saveExpertTagList)) { + iExpertTagService.saveBatch(saveExpertTagList); + } + // 保存所有专家字典字段 + List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); + if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + // 保存所有专家履职意向申请 + + // 审核逻辑 + List saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList); + if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { + iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList); + } + // 保存所有专家回避单位 + List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); + if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { + iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); + } + } + + + private ExpertUserFullInfo buildSaveExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { + ExpertUserFullInfo expertUserFullInfo = new ExpertUserFullInfo(); + if (Objects.nonNull(expertUserInfoDTO.getIsDingUser())) { + expertUserFullInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser() ? BoolDisplayEnum.Y.name() : BoolDisplayEnum.N.name()); + } + expertUserFullInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); + expertUserFullInfo.setGender(expertUserInfoDTO.getGender()); + expertUserFullInfo.setExpertName(expertUserInfoDTO.getName()); + expertUserFullInfo.setAvatarFileId(expertUserInfoDTO.getAvatarFileId()); + expertUserFullInfo.setIdCard(expertUserInfoDTO.getIdCard()); + expertUserFullInfo.setOfficePhone(expertUserInfoDTO.getOfficePhone()); + expertUserFullInfo.setBirth(expertUserInfoDTO.getBirth()); + expertUserFullInfo.setBankNo(expertUserInfoDTO.getBankNo()); + expertUserFullInfo.setBank(expertUserInfoDTO.getBank()); + expertUserFullInfo.setEmail(expertUserInfoDTO.getEmail()); + expertUserFullInfo.setHometown(expertUserInfoDTO.getHometown()); + expertUserFullInfo.setNationality(expertUserInfoDTO.getNationality()); + + expertUserFullInfo.setSchool(expertUserInfoDTO.getSchool()); + expertUserFullInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt()); + expertUserFullInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle()); + + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { + expertUserFullInfo.setGraduationCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getGraduationCertificateFileIdList())); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { + expertUserFullInfo.setDegreeCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getDegreeCertificateFileIdList())); + } + expertUserFullInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); + expertUserFullInfo.setCompany(expertUserInfoDTO.getCompany()); + expertUserFullInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); + expertUserFullInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); + expertUserFullInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); + expertUserFullInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); + expertUserFullInfo.setAddress(expertUserInfoDTO.getAddress()); + expertUserFullInfo.setExperience(expertUserInfoDTO.getExperience()); + + expertUserFullInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { + expertUserFullInfo.setTitleCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getTitleCertificateFileIdList())); + } + expertUserFullInfo.setAwards(expertUserInfoDTO.getAwards()); + expertUserFullInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); + + expertUserFullInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); + expertUserFullInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { + expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); + } + expertUserFullInfo.setRemark(expertUserInfoDTO.getRemark()); + expertUserFullInfo.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode()); + return expertUserFullInfo; + } + + + private List buildSaveExpertTagList(Long userId, List expertTagList) { + if (CollectionUtils.isEmpty(expertTagList)) { + return new ArrayList<>(); + } + return expertTagList.stream().map(r -> { + ExpertTag expertTag = new ExpertTag(); + expertTag.setExpertInfoField(r.getExpertInfoField()); + expertTag.setTagCode(r.getTagCode()); + expertTag.setCreateOn(LocalDateTime.now()); + expertTag.setUpdateOn(LocalDateTime.now()); + expertTag.setUserId(userId); + return expertTag; + }).collect(Collectors.toList()); + } + + private List buildSaveExpertDictionaryList(Long userId, List expertDictionaryList) { + if (CollectionUtils.isEmpty(expertDictionaryList)) { + return new ArrayList<>(); + } + return expertDictionaryList.stream().map(r -> { + ExpertDictionary expertDictionary = new ExpertDictionary(); + expertDictionary.setUserId(userId); + expertDictionary.setExpertInfoField(r.getExpertInfoField()); + expertDictionary.setDictionaryCode(r.getDictionaryCode()); + expertDictionary.setUpdateOn(LocalDateTime.now()); + expertDictionary.setCreateOn(LocalDateTime.now()); + return expertDictionary; + }).collect(Collectors.toList()); + } + + + private List buildSaveExpertAvoidCompanyList(Long userId, List expertAvoidCompanyList) { + if (CollectionUtils.isEmpty(expertAvoidCompanyList)) { + return new ArrayList<>(); + } + return expertAvoidCompanyList.stream().map(r -> { + ExpertAvoidCompany expertAvoidCompany = new ExpertAvoidCompany(); + expertAvoidCompany.setCompanyName(r.getCompanyName()); + expertAvoidCompany.setUserId(userId); + expertAvoidCompany.setCompanyUniqCode(r.getCompanyUniqCode()); + expertAvoidCompany.setCreateOn(LocalDateTime.now()); + expertAvoidCompany.setUpdateOn(LocalDateTime.now()); + return expertAvoidCompany; + }).collect(Collectors.toList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long expertRecommendProofSave(ExpertRecommendProofSaveCmd cmd) { + // 保存专家证明材料 + Long userId = cmd.getUserId(); + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(cmd.getRecommendationProofFileIdList())); + expertUserFullInfo.setUpdateOn(LocalDateTime.now()); + expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey()); + iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo); + + List recommendedWayList = cmd.getRecommendedWay(); + if (CollectionUtils.isNotEmpty(recommendedWayList)) { + List saveExpertDictionaryList = recommendedWayList.stream().map(r -> { + ExpertDictionary expertDictionary = new ExpertDictionary(); + expertDictionary.setUserId(userId); + expertDictionary.setExpertInfoField(r.getExpertInfoField()); + expertDictionary.setDictionaryCode(r.getDictionaryCode()); + expertDictionary.setUpdateOn(LocalDateTime.now()); + expertDictionary.setCreateOn(LocalDateTime.now()); + return expertDictionary; + }).collect(Collectors.toList()); + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + + // 创建入库申请 + ExpertMetaApply expertRegionApply = new ExpertMetaApply(); + expertRegionApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); + expertRegionApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + expertRegionApply.setRegionCode(expertUserFullInfo.getRegionCode()); + expertRegionApply.setRegionLevel(expertUserFullInfo.getRegionLevel()); + expertRegionApply.setUserId(userId); + expertRegionApply.setDisplayEnable(BoolDisplayEnum.Y.name()); + if (LoginUserUtil.isLogin()) { + expertRegionApply.setCreateBy(LoginUserUtil.getUserId()); + } + expertRegionApply.setCreateOn(LocalDateTime.now()); + iExpertMetaApplyService.save(expertRegionApply); + + return expertRegionApply.getId(); + } + + @Override + public ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId) { + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + if (Objects.isNull(expertUserFullInfo)) { + return null; + } + // 所有专家标签字段 + List expertTagList = iExpertTagService + .list(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); + // 所有专家字典字段 + List expertDictionaryList = iExpertDictionaryService + .list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); + // 专家履职意向列表 + List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService + .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class).eq(ExpertIntentionWorkRegion::getUserId, userId)); + // 专家履职意向申请列表 + List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, userId) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); + // 所有专家回避单位 + List expertAvoidCompanyList = iExpertAvoidCompanyService + .list(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); + + List businessStrips = expertGovBusinessStripService.listByUserIds(Collections.singletonList(userId)); + + return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList + , expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList, businessStrips); + + } + + + private List buildSaveExpertIntentionWorkRegionApplyList(Long userId, List expertIntentionWorkRegionInfoList) { + if (CollectionUtils.isEmpty(expertIntentionWorkRegionInfoList)) { + return new ArrayList<>(); + } + return expertIntentionWorkRegionInfoList.stream().map(r -> { + ExpertMetaApply expertMetaApply = new ExpertMetaApply(); + expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()); + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + expertMetaApply.setRegionCode(r.getRegionCode()); + expertMetaApply.setRegionLevel(r.getRegionLevel()); + expertMetaApply.setUserId(userId); + expertMetaApply.setDisplayEnable(BoolDisplayEnum.N.name()); + expertMetaApply.setUpdateOn(LocalDateTime.now()); + expertMetaApply.setCreateOn(LocalDateTime.now()); + return expertMetaApply; + }).collect(Collectors.toList()); + } + + + @Override + public void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd cmd) { + Boolean applyResult = cmd.getApplyResult(); + ExpertApplyTypeEnum applyTypeEnum = cmd.getApplyTypeEnum(); + String expertRegionCode = cmd.getExpertRegionCode(); + Integer expertRegionLevel = cmd.getExpertRegionLevel(); + Long expertUserId = cmd.getExpertUserId(); + + if (applyResult) { + switch (applyTypeEnum) { + case EXPERT_INTENTION_JOIN: { + // 新增履职意向地 + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .eq(ExpertIntentionWorkRegion::getUserId, expertUserId) + .eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) + .eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); + ExpertIntentionWorkRegion one = iExpertIntentionWorkRegionService.getOne(query); + if (Objects.isNull(one)) { + ExpertIntentionWorkRegion intentionWorkRegion = new ExpertIntentionWorkRegion(); + intentionWorkRegion.setCreateOn(LocalDateTime.now()); + intentionWorkRegion.setUpdateOn(LocalDateTime.now()); + intentionWorkRegion.setRegionCode(expertRegionCode); + intentionWorkRegion.setRegionLevel(expertRegionLevel); + intentionWorkRegion.setUserId(expertUserId); + iExpertIntentionWorkRegionService.save(intentionWorkRegion); + } + } + break; + case EXPERT_INTENTION_LEAVE: { + // 删除履职意向地 + LambdaUpdateWrapper query = Wrappers.lambdaUpdate(ExpertIntentionWorkRegion.class) + .eq(ExpertIntentionWorkRegion::getUserId, expertUserId) + .eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) + .eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); + iExpertIntentionWorkRegionService.remove(query); + } + break; + default: + throw new BizException("illegal request"); + } + } + } + + /** + * 专家入库审核 + * + * @param cmd \ + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void expertStorageDeal(ExpertStorageDealCmd cmd) { + Long expertUserId = cmd.getExpertUserId(); + ExpertUserFullInfo expertInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String content; + if (cmd.getApplyResult()) { + // 修改专家状态为可用 + expertInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); + expertInfo.setRemark(cmd.getRemark()); + expertInfo.setRegionCode(cmd.getJoinRegionCode()); + expertInfo.setRegionLevel(cmd.getJoinRegionLevel()); + // 账号启用 + LambdaUpdateWrapper userInfoUpdate = Wrappers.lambdaUpdate(UserInfo.class) + .eq(UserInfo::getId, expertUserId) + .set(UserInfo::getAvailable, UserAvailableEnum.ENABLE); + userInfoService.update(userInfoUpdate); + + // 保存所有专家标签字段 + List saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther()); + iExpertTagService.saveBatch(saveExpertTagList); + // 保存所有专家字典字段 + List expertType = cmd.getExpertType(); + if (CollUtil.isNotEmpty(expertType)) { + expertType.forEach(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + List saveExpertDictList = buildSaveExpertDictionaryList(expertUserId, expertType); + iExpertDictionaryService.saveBatch(saveExpertDictList); + } + // 补充专家 专家角色 + Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT)); + if (Objects.nonNull(role)) { + UserRole one = userRoleService.getOne(expertUserId, role.getId()); + if (Objects.isNull(one)) { + UserRole saveUserRole = new UserRole(); + saveUserRole.setUserId(expertUserId); + saveUserRole.setRoleId(role.getId()); + userRoleService.save(saveUserRole); + } + } + content = String.format(EXPERT_AUDIT_PASS, expertInfo.getExpertName(), loginUrl, userDetail.getRealName(), userDetail.getMobile()); + } else { + expertInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); + content = String.format(EXPERT_AUDIT_FAIL, expertInfo.getExpertName(), userDetail.getRealName(), userDetail.getMobile()); + } + iExpertUserFullInfoService.saveOrUpdate(expertInfo); + if (PhoneUtil.isMobile(expertInfo.getPhoneNo())) { + SendSmsContext smsCtx = new SendSmsContext(); + smsCtx.setContent(content); + smsCtx.setReceiveNumber(expertInfo.getPhoneNo()); + yxtCallOrSmsHelper.sendSms(smsCtx); + } + } + + + @Override + public List listExpertUserFullInfoAll(List userIds) { + List expertUserFullInfos = iExpertUserFullInfoService.listByUserIds(userIds); + // 所有专家标签字段 + List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getUserId, userIds)); + Map> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId); + List businessStrips = expertGovBusinessStripService.listByUserIds(userIds); + Map> stripMap = CollUtils.group(businessStrips, ExpertGovBusinessStrip::getExpertUserId); + // 所有专家字典字段 + List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIds)); + Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); + // 专家履职意向列表 + List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService + .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .in(ExpertIntentionWorkRegion::getUserId, userIds)); + Map> intentionRegionMap = CollUtils.group(expertIntentionWorkRegionList, ExpertIntentionWorkRegion::getUserId); + // 专家履职意向申请列表 + List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .in(ExpertMetaApply::getUserId, userIds) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); + Map> metaApplyMap = CollUtils.group(expertMetaApplyList, ExpertMetaApply::getUserId); + // 所有专家回避单位 + List expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .in(ExpertAvoidCompany::getUserId, userIds)); + Map> avoidInfoMap = CollUtils.group(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); + return expertUserFullInfos.stream().map(w -> ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(w, + expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), + expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), + intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), + metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), + avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()), + stripMap.getOrDefault(w.getUserId(), Collections.emptyList()))) + .collect(Collectors.toList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public List adminModifyExpertInfo(ExpertInfoModifyCmd cmd, Long adminUserId) { + Long userId = cmd.getUserId(); + List expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); + List expertDictionaryList = cmd.getExpertDictionaryList(); + List expertTagList = cmd.getExpertTagList(); + ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); + List applyIdList = new ArrayList<>(); + + ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); + if (Objects.nonNull(originalExpertUserFullInfo)) { + saveExpertUserFullInfo.setId(originalExpertUserFullInfo.getId()); + // 删除所有专家字典字段(需审核敏感字段不删除) + LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) + .eq(ExpertDictionary::getUserId, userId) + .notIn(ExpertDictionary::getExpertInfoField, ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList()); + iExpertDictionaryService.remove(expertDictionaryRemove); + + + // 保存专家来源标签 + if (CollUtil.isNotEmpty(expertTagList)) { + // 删除专家来源标签 重新存入 + iExpertTagService.remove(Wrappers.lambdaQuery(ExpertTag.class) + .eq(ExpertTag::getUserId, userId) +// .eq(ExpertTag::getExpertInfoField, ExpertTagEnum.EXPERT_SOURCE.getKey()) + ); + + List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); + saveExpertTagList = saveExpertTagList.stream() +// .filter(r -> ExpertTagEnum.EXPERT_SOURCE.getKey().equals(r.getExpertInfoField())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(saveExpertTagList)) { + iExpertTagService.saveBatch(saveExpertTagList); + } + } + } + + saveExpertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); + saveExpertUserFullInfo.setUserId(userId); + // 专家提交修改,以下字段需要审批后才能更新 + saveExpertUserFullInfo.setPhoneNo(null); + saveExpertUserFullInfo.setEmail(null); + saveExpertUserFullInfo.setRegionLevel(null); + saveExpertUserFullInfo.setRegionCode(null); + saveExpertUserFullInfo.setCompany(null); + saveExpertUserFullInfo.setCompanyUniqCode(null); + saveExpertUserFullInfo.setLegalEntityCode(null); + iExpertUserFullInfoService.saveOrUpdate(saveExpertUserFullInfo); + + // 保存所有专家字典字段 + List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); + saveExpertDictionaryList = saveExpertDictionaryList + .stream().filter(r -> !ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList().contains(r.getExpertInfoField())) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + + // 保存所有专家回避单位 + List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); + if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { + // 删除回避单位 + LambdaQueryWrapper expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .eq(ExpertAvoidCompany::getUserId, userId); + iExpertAvoidCompanyService.remove(expertAvoidCompanyRemove); + // 重新保存 + iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); + } + // 保存专家条线 + expertGovBusinessStripService.removeByUserId(userId); + if (CollUtil.isNotEmpty(cmd.getBusinessStrips())) { + List strips = CollUtils.convert(cmd.getBusinessStrips(), w -> { + ExpertGovBusinessStrip strip = BeanUtil.copyProperties(w, ExpertGovBusinessStrip.class); + strip.setExpertUserId(userId); + return strip; + }); + expertGovBusinessStripService.saveBatch(strips); + } + // 敏感字段申请 + ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = cmd.getExpertInfoSensitiveFieldCheckBO(); + ModifyApplyExtraInfoDTO modifyApplyExtraInfo = cmd.getModifyApplyExtraInfo(); + if (expertInfoSensitiveFieldCheckBO.getHasModify()) { + // TODO 提交审核前判断是否已经有审核未审核,如果有,无法创建新的审核请求 + if (expertInfoSensitiveFieldCheckBO.getIsExpertSensitiveInfoModify()) { + // 创建信息修改审核 + List expertSensitiveInfoFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertSensitiveInfoFieldSegmentList(); + Long expertInfoModifyApplyId = createExpertInfoModifyApply(expertSensitiveInfoFieldSegmentList, originalExpertUserFullInfo, modifyApplyExtraInfo); + applyIdList.add(expertInfoModifyApplyId); + } + if (expertInfoSensitiveFieldCheckBO.getIsExpertRegionModify()) { + // 创建层级变更审核 + List expertRegionFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertRegionFieldSegmentList(); + Long expertRegionModifyApplyId = createExpertRegionModifyApply(expertRegionFieldSegmentList, originalExpertUserFullInfo, modifyApplyExtraInfo); + applyIdList.add(expertRegionModifyApplyId); + } + + if (expertInfoSensitiveFieldCheckBO.getIsExpertIntentionModify()) { + // 创建专家履职意向变更审核 + List expertIntentionFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertIntentionFieldSegmentList(); + SensitiveModifySegment segment = expertIntentionFieldSegmentList.get(0); + List apply = (List) segment.getApply(); + List original = (List) segment.getOriginal(); + ExpertRegionModifyDiffBO expertRegionModifyDiffBO = ExpertRegionInfoUtils.modifyDiff(original, apply); + List addList = expertRegionModifyDiffBO.getAddList(); + List removeList = expertRegionModifyDiffBO.getRemoveList(); + + for (ExpertRegionInfo expertRegionInfo : addList) { + Long expertIntentionModifyApplyId = createExpertIntentionModifyApply(originalExpertUserFullInfo.getUserId() + , modifyApplyExtraInfo, expertRegionInfo, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN); + applyIdList.add(expertIntentionModifyApplyId); + } + for (ExpertRegionInfo expertRegionInfo : removeList) { + Long expertIntentionModifyApplyId = createExpertIntentionModifyApply(originalExpertUserFullInfo.getUserId() + , modifyApplyExtraInfo, expertRegionInfo, ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE); + applyIdList.add(expertIntentionModifyApplyId); + } + } + // 专家管理修改批量通过审核 + // 专家批量通过审核由 facade层调用其他逻辑实现 + } + return applyIdList; + } + + + /** + * 创建信息修改审核 + */ + @Transactional(rollbackFor = Exception.class) + public Long createExpertInfoModifyApply(List expertSensitiveInfoFieldSegmentList + , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { + expertSensitiveInfoFieldSegmentList = expertSensitiveInfoFieldSegmentList.stream().filter(r -> !r.isValueEquals()).collect(Collectors.toList()); + String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertSensitiveInfoFieldSegmentList)); + + ExpertMetaApply expertMetaApply = new ExpertMetaApply(); + expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + expertMetaApply.setRegionCode(originalExpertUserFullInfo.getRegionCode()); + expertMetaApply.setRegionLevel(originalExpertUserFullInfo.getRegionLevel()); + expertMetaApply.setUserId(originalExpertUserFullInfo.getUserId()); + expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); + expertMetaApply.setCreateOn(LocalDateTime.now()); + expertMetaApply.setCreateBy(LoginUserUtil.getUserId()); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertMetaApplyService.save(expertMetaApply); + + ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); + expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); + expertSensitiveInfoModifyDetailRecord.setUserId(originalExpertUserFullInfo.getUserId()); + expertSensitiveInfoModifyDetailRecord.setOriginalJson(compressedModifyJsonStr); + expertSensitiveInfoModifyDetailRecord.setModifyJson(compressedModifyJsonStr); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); + return expertMetaApply.getId(); + } + + private Long createExpertIntentionModifyApply(Long expertUserId, ModifyApplyExtraInfoDTO modifyApplyExtraInfo + , ExpertRegionInfo expertIntention, ExpertApplyTypeEnum applyTypeEnum) { + ExpertMetaApply expertMetaApply = new ExpertMetaApply(); + expertMetaApply.setApplyType(applyTypeEnum.getKey()); + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + expertMetaApply.setRegionCode(expertIntention.getRegionCode()); + expertMetaApply.setRegionLevel(expertIntention.getRegionLevel()); + expertMetaApply.setUserId(expertUserId); + expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertMetaApplyService.save(expertMetaApply); + + ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); + expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setUserId(expertUserId); + expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); + return expertMetaApply.getId(); + } + + /** + * 创建层级变更审核 + * + * @param expertRegionFieldSegmentList + * @param originalExpertUserFullInfo + * @param modifyApplyExtraInfo + */ + private Long createExpertRegionModifyApply(List expertRegionFieldSegmentList + , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { + String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertRegionFieldSegmentList)); + SensitiveModifySegment segment = expertRegionFieldSegmentList.get(0); + ExpertRegionInfo apply = (ExpertRegionInfo) segment.getApply(); + + ExpertMetaApply expertMetaApply = new ExpertMetaApply(); + expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + expertMetaApply.setRegionCode(apply.getRegionCode()); + expertMetaApply.setRegionLevel(apply.getRegionLevel()); + expertMetaApply.setUserId(originalExpertUserFullInfo.getUserId()); + expertMetaApply.setCreateOn(LocalDateTime.now()); + expertMetaApply.setCreateBy(LoginUserUtil.getUserId()); + expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertMetaApplyService.save(expertMetaApply); + + ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); + expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); + expertSensitiveInfoModifyDetailRecord.setUserId(originalExpertUserFullInfo.getUserId()); + expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); + expertSensitiveInfoModifyDetailRecord.setOriginalJson(compressedModifyJsonStr); + expertSensitiveInfoModifyDetailRecord.setModifyJson(compressedModifyJsonStr); + if (Objects.nonNull(modifyApplyExtraInfo)) { + expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); + } + iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); + return expertMetaApply.getId(); + } + + + @Override + public void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd) { + Boolean applyResult = expertInfoModifyApplyDealCmd.getApplyResult(); + Long expertUserId = expertInfoModifyApplyDealCmd.getExpertUserId(); + Long applyId = expertInfoModifyApplyDealCmd.getApplyId(); + if (applyResult) { + ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + + LambdaQueryWrapper recordQuery = Wrappers.lambdaQuery(ExpertSensitiveInfoModifyDetailRecord.class) + .eq(ExpertSensitiveInfoModifyDetailRecord::getUserId, expertUserId) + .eq(ExpertSensitiveInfoModifyDetailRecord::getMetaApplyId, applyId); + ExpertSensitiveInfoModifyDetailRecord record = iExpertSensitiveInfoModifyDetailRecordService.getOne(recordQuery); + String modifyJson = record.getModifyJson(); + if (StringUtils.isNotEmpty(modifyJson)) { + modifyJson = GzipUtils.uncompress(modifyJson); + } + List sensitiveModifySegments = JSONUtils.parseArray(modifyJson, SensitiveModifySegment.class); + Map collectMap = sensitiveModifySegments + .stream().collect(Collectors.toMap(SensitiveModifySegment::getFieldName, Function.identity())); + + // 更新专家基 expert_user_full_info 表中数据 + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.phone_no, collectMap); + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.email, collectMap); + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company, collectMap); + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company_uniq_code, collectMap); + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.legal_entity_code, collectMap); + iExpertUserFullInfoService.saveOrUpdate(originalExpertUserFullInfo); + + // 更新专家字典字段 + executeExpertUserFullInfoDictionaryInfoUpdate(expertUserId, collectMap + , ExpertUserInfoSensitiveFieldEnum.administrative_rank + , ExpertUserInfoSensitiveFieldEnum.title_level); + + // 更新专家标签字段列表 + executeExpertUserFullInfoTagInfoUpdate(expertUserId, collectMap, ExpertUserInfoSensitiveFieldEnum.good_at + , ExpertUserInfoSensitiveFieldEnum.technical_expertise + , ExpertUserInfoSensitiveFieldEnum.industry_sector + , ExpertUserInfoSensitiveFieldEnum.other); + + } + + } + + private void executeExpertUserFullInfoDictionaryInfoUpdate(Long expertUserId, Map collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { + for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { + switch (sensitiveFieldEnum) { + case administrative_rank: + case title_level: { + SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); + if (Objects.nonNull(segment)) { + List dictionaryFieldInfoList = SensitiveModifySegmentUtils.getDictionaryFieldInfoListApply(segment); + updateExpertDictionaryList(expertUserId, dictionaryFieldInfoList, sensitiveFieldEnum.getKey()); + } + } + break; + default: + break; + } + } + } + + + private void executeExpertUserFullInfoTagInfoUpdate(Long expertUserId, Map collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { + for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { + switch (sensitiveFieldEnum) { + case good_at: + case technical_expertise: + case industry_sector: + case other: { + SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); + if (Objects.nonNull(segment)) { + List tagFieldInfoList = SensitiveModifySegmentUtils.getTagFieldInfoListApply(segment); + updateExpertTagList(expertUserId, tagFieldInfoList, sensitiveFieldEnum.getKey()); + } + } + break; + default: + break; + } + } + } + + /** + * 信息修改审核通过后 装配更新用户信息敏感字段 + * + * @param originalInfo / + * @param fieldEnum / + * @param collectMap / + */ + private void assemblerExpertUserFullInfoSensitiveFieldSaveRecord(ExpertUserFullInfo originalInfo, ExpertUserInfoSensitiveFieldEnum fieldEnum + , Map collectMap) { + SensitiveModifySegment segment = collectMap.get(fieldEnum); + if (Objects.nonNull(segment)) { + String segmentApplyValue = (String) segment.getApply(); + switch (fieldEnum) { + case phone_no: + originalInfo.setPhoneNo(segmentApplyValue); + break; + case email: + originalInfo.setEmail(segmentApplyValue); + break; + case company: + originalInfo.setCompany(segmentApplyValue); + break; + case company_uniq_code: + originalInfo.setCompanyUniqCode(segmentApplyValue); + break; + case legal_entity_code: + originalInfo.setLegalEntityCode(segmentApplyValue); + break; + default: + break; + } + } + } + + private void updateExpertTagList(Long expertUserId, List tagFieldInfoList, String... tagExpertInfoTypeArr) { + if (CollectionUtils.isNotEmpty(tagFieldInfoList)) { + // 删除专家字典字段 + LambdaQueryWrapper expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) + .eq(ExpertTag::getUserId, expertUserId) + .in(tagExpertInfoTypeArr.length > 0, ExpertTag::getExpertInfoField, tagExpertInfoTypeArr); + iExpertTagService.remove(expertTagRemove); + List expertDictionarySaveList = tagFieldInfoList.stream().map(r -> { + ExpertTag expertTag = new ExpertTag(); + expertTag.setUpdateOn(LocalDateTime.now()); + expertTag.setUserId(expertUserId); + expertTag.setExpertInfoField(r.getTagFieldName()); + expertTag.setTagCode(r.getTagCode()); + return expertTag; + }).collect(Collectors.toList()); + iExpertTagService.saveBatch(expertDictionarySaveList); + } + } + + private void updateExpertDictionaryList(Long expertUserId, List dictionaryFieldInfoList, String... dictionaryExpertInfoTypeArr) { + if (CollectionUtils.isNotEmpty(dictionaryFieldInfoList)) { + // 删除专家字典字段 + LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) + .eq(ExpertDictionary::getUserId, expertUserId) + .in(dictionaryExpertInfoTypeArr.length > 0, ExpertDictionary::getExpertInfoField, dictionaryExpertInfoTypeArr); + iExpertDictionaryService.remove(expertDictionaryRemove); + List expertDictionarySaveList = dictionaryFieldInfoList.stream().map(r -> { + ExpertDictionary expertDictionary = new ExpertDictionary(); + expertDictionary.setUpdateOn(LocalDateTime.now()); + expertDictionary.setCreateOn(LocalDateTime.now()); + expertDictionary.setUserId(expertUserId); + expertDictionary.setExpertInfoField(r.getDictionaryFieldName()); + expertDictionary.setDictionaryCode(r.getDictionaryCode()); + return expertDictionary; + }).collect(Collectors.toList()); + iExpertDictionaryService.saveBatch(expertDictionarySaveList); + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java new file mode 100644 index 0000000..4e46fad --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.expert.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.hz.pm.api.expert.mapper.ExpertIntentionWorkRegionMapper; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertIntentionWorkRegionServiceImpl extends ServiceImpl implements IExpertIntentionWorkRegionService { + + @Override + public List userIdsMatchIntentionRegion(String regionCode, Integer regionLevel) { + LambdaQueryWrapper intentionQuery = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .eq(ExpertIntentionWorkRegion::getRegionCode, regionCode) + .eq(ExpertIntentionWorkRegion::getRegionLevel, regionLevel) + .select(ExpertIntentionWorkRegion::getUserId); + List userIdMatchIntentionRegion = list(intentionQuery); + return CollUtils.fieldList(userIdMatchIntentionRegion, ExpertIntentionWorkRegion::getUserId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertMetaApplyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertMetaApplyServiceImpl.java new file mode 100644 index 0000000..3022f1e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertMetaApplyServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.service.impl; + +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.mapper.ExpertMetaApplyMapper; +import com.hz.pm.api.expert.service.IExpertMetaApplyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-03-01 + */ +@Service +public class ExpertMetaApplyServiceImpl extends ServiceImpl implements IExpertMetaApplyService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertReviewServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertReviewServiceImpl.java new file mode 100644 index 0000000..6814635 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertReviewServiceImpl.java @@ -0,0 +1,87 @@ +package com.hz.pm.api.expert.service.impl; + +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.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.expert.mapper.ExpertReviewMapper; +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; +import com.hz.pm.api.expert.service.IExpertReviewService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.mapper.MeetingMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@Service +@RequiredArgsConstructor +public class ExpertReviewServiceImpl extends ServiceImpl implements IExpertReviewService { + + private final MeetingMapper meetingMapper; + + @Override + public List listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); + query.eq(ExpertReview::getProjectId, projectId); + query.eq(ExpertReview::getCreateBy, expertId); + query.eq(ExpertReview::getMeetingId, meetingId); + query.orderByAsc(ExpertReview::getCreateOn); + return list(query); + } + + @Override + public ExpertReview getFinalReview(Long meetingId, Long projectId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); + query.eq(ExpertReview::getProjectId, projectId); + query.eq(ExpertReview::getMeetingId, meetingId); + query.eq(ExpertReview::getIsFinal, Boolean.TRUE); + query.last(BizConst.LIMIT_1); + return getOne(query); + } + + @Override + public Map listFinalReviewMap(Long meetingId) { + return CollUtils.listToMap(listFinalReview(meetingId), ExpertReview::getProjectId); + } + + @Override + public List listFinalReview(Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); + query.eq(ExpertReview::getMeetingId, meetingId); + query.eq(ExpertReview::getIsFinal, Boolean.TRUE); + return list(query); + } + + @Override + public ExpertReview getFinalReview(String projectCode, Integer meetingType) { + List constructMeetings = meetingMapper.selectList(Wrappers.lambdaQuery(Meeting.class) + .select(Meeting::getId) + .eq(Meeting::getType, meetingType)); + List meetingIds = constructMeetings.stream() + .map(Meeting::getId).collect(Collectors.toList()); + ExpertReview expertReview = null; + if(CollUtil.isNotEmpty(meetingIds)){ + expertReview = this.getOne(Wrappers.lambdaQuery(ExpertReview.class) + .eq(ExpertReview::getProjectCode, projectCode) + .eq(ExpertReview::getIsFinal, Boolean.TRUE) + .in(ExpertReview::getMeetingId,meetingIds) + .last(BizConst.LIMIT_1)); + } + return expertReview; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java new file mode 100644 index 0000000..1b78f33 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.service.impl; + +import com.hz.pm.api.expert.entity.ExpertSensitiveInfoModifyDetailRecord; +import com.hz.pm.api.expert.mapper.ExpertSensitiveInfoModifyDetailRecordMapper; +import com.hz.pm.api.expert.service.IExpertSensitiveInfoModifyDetailRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@Service +public class ExpertSensitiveInfoModifyDetailRecordServiceImpl extends ServiceImpl implements IExpertSensitiveInfoModifyDetailRecordService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertUserFullInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertUserFullInfoServiceImpl.java new file mode 100644 index 0000000..8713311 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertUserFullInfoServiceImpl.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.expert.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.mapper.NdExpertUserFullInfoMapper; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertUserFullInfoServiceImpl extends ServiceImpl implements IExpertUserFullInfoService { + + @Override + public ExpertUserFullInfo getByUserId(Long userId) { + return getOne(Wrappers.lambdaQuery().eq(ExpertUserFullInfo::getUserId, userId)); + } + + @Override + public List listByUserId(List userIds) { + return list(Wrappers.lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); + } + + @Override + public List listByUserIds(List userIds) { + return list(Wrappers.lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ReviewTemplateSettingsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ReviewTemplateSettingsServiceImpl.java new file mode 100644 index 0000000..d4cb0b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ReviewTemplateSettingsServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.expert.service.impl; + +import com.hz.pm.api.expert.model.entity.ReviewTemplateSettings; +import com.hz.pm.api.expert.mapper.ReviewTemplateSettingsMapper; +import com.hz.pm.api.expert.service.IReviewTemplateSettingsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 评审模版配置表 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-14 + */ +@Service +public class ReviewTemplateSettingsServiceImpl extends ServiceImpl implements IReviewTemplateSettingsService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/utils/SensitiveModifySegmentUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/utils/SensitiveModifySegmentUtils.java new file mode 100644 index 0000000..41d1b29 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/utils/SensitiveModifySegmentUtils.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.expert.utils; + + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.expert.model.DictionaryFieldInfo; +import com.hz.pm.api.expert.model.SensitiveModifySegment; +import com.hz.pm.api.expert.model.TagFieldInfo; +import com.ningdatech.yxt.utils.JSONUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/8/24 下午3:36 + */ + +public class SensitiveModifySegmentUtils { + + private SensitiveModifySegmentUtils() { + } + + public static List getTagFieldInfoListApply(SensitiveModifySegment segment) { + switch (segment.getFieldName()) { + case good_at: + case technical_expertise: + case industry_sector: + case other: + if (Objects.nonNull(segment.getApply())) { + return JSONUtils.parseArray(segment.getApply().toString(), TagFieldInfo.class); + } + return new ArrayList<>(); + default: + throw new BizException("非法格式"); + } + + } + + public static List getDictionaryFieldInfoListApply(SensitiveModifySegment segment) { + switch (segment.getFieldName()) { + case administrative_rank: + case title_level: { + if (Objects.nonNull(segment.getApply())) { + return JSONUtils.parseArray(segment.getApply().toString(), DictionaryFieldInfo.class); + } + return new ArrayList<>(); + } + default: + throw new BizException("非法格式"); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/DocumentationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/DocumentationController.java new file mode 100644 index 0000000..d989701 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/DocumentationController.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.filemanage.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.filemanage.manage.DocumentationManage; +import com.hz.pm.api.filemanage.model.dto.DocumentationGroupSaveDTO; +import com.hz.pm.api.filemanage.model.dto.DocumentationSaveDTO; +import com.hz.pm.api.filemanage.model.param.DocumentationListParam; +import com.hz.pm.api.filemanage.model.vo.DocumentationGroupVO; +import com.hz.pm.api.filemanage.model.vo.DocumentationVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import java.util.List; + +/** + * @Classname DocumentationController + * @Description + * @Date 2023/6/6 15:48 + * @Author PoffyZhang + */ +@RestController +@AllArgsConstructor +@Api(tags = "档案管理-资料文档控制器") +@RequestMapping("/api/v1/file-manage/documentation") +@Validated +public class DocumentationController { + + private final DocumentationManage documentationManage; + + @GetMapping("/group/list") + @ApiOperation(value = "分组列表", notes = "分组列表") + public List groupList(){ + return documentationManage.groupList(); + } + + @PostMapping("/group/add") + @ApiOperation(value = "分组添加", notes = "分组添加") + @WebLog("档案管理-资料文档-分组添加") + public String addGroup(@Validated @RequestBody DocumentationGroupSaveDTO dto){ + return documentationManage.addGroup(dto); + } + + @PostMapping("/group/delete/{id}") + @ApiOperation(value = "分组删除", notes = "分组删除") + @WebLog("档案管理-资料文档-分组删除") + public String deleteGroup(@PathVariable Long id){ + return documentationManage.deleteGroup(id); + } + + @GetMapping("/list") + @ApiOperation(value = "文档列表", notes = "文档列表") + public PageVo list(@ModelAttribute DocumentationListParam param){ + return documentationManage.list(param); + } + + @GetMapping("/detail/{id}") + @ApiOperation(value = "文档详情", notes = "文档详情") + public DocumentationVO detail(@PathVariable Long id){ + return documentationManage.detail(id); + } + + @PostMapping("/add") + @ApiOperation(value = "文档添加", notes = "文档添加") + @WebLog("档案管理-资料文档-文档添加") + public String addDoc(@Validated @RequestBody DocumentationSaveDTO dto){ + return documentationManage.addDoc(dto); + } + + @PostMapping("/delete/{id}") + @ApiOperation(value = "文档删除", notes = "文档删除") + @WebLog("档案管理-资料文档-文档删除") + public String deleteDoc(@PathVariable Long id){ + return documentationManage.deleteDoc(id); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/ProjectFileController.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/ProjectFileController.java new file mode 100644 index 0000000..edc9749 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/controller/ProjectFileController.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.filemanage.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.filemanage.manage.ProjectFileManage; +import com.hz.pm.api.filemanage.model.param.ProjectFileListParam; +import com.hz.pm.api.filemanage.model.vo.ProjectApplyBorrowVO; +import com.hz.pm.api.filemanage.model.vo.ProjectFileListVO; +import com.hz.pm.api.filemanage.model.vo.ProjectFileVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; + +/** + * @Classname ProjectFileController + * @Description + * @Date 2023/6/6 15:48 + * @Author PoffyZhang + */ +@RestController +@AllArgsConstructor +@Api(tags = "档案管理-项目档案") +@RequestMapping("/api/v1/file-manage/project-file") +@Validated +public class ProjectFileController { + + private final ProjectFileManage projectFileManage; + + @GetMapping("/list") + @ApiOperation(value = "档案列表", notes = "档案列表") + public PageVo list(@ModelAttribute ProjectFileListParam param){ + return projectFileManage.list(param); + } + + @GetMapping("/{projectId}") + @ApiOperation(value = "档案详情", notes = "档案详情") + public ProjectFileVO file(@PathVariable Long projectId){ + return projectFileManage.file(projectId); + } + + @PostMapping("/want-read/{projectId}") + @ApiOperation(value = "申请借阅", notes = "申请借阅") + @WebLog("档案管理-项目档案-申请借阅") + public String wantRead(@PathVariable Long projectId){ + String instanceId = projectFileManage.startApplyBorrowProcess(projectId); + return "启动申请借阅流程实例 【" + instanceId + "】 成功"; + } + + @GetMapping("/wantRead-detail/{instanceId}") + @ApiOperation(value = "借阅详情", notes = "借阅详情") + public ProjectApplyBorrowVO wantReadDetail(@PathVariable String instanceId){ + return projectFileManage.wantReadDetail(instanceId); + } + + @PostMapping("/download/{projectId}") + @ApiOperation(value = "档案下载",notes = "档案下载") + public void downloadFile(@PathVariable Long projectId,HttpServletResponse response){ + projectFileManage.downloadFile(projectId, response); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java new file mode 100644 index 0000000..7f751ea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java @@ -0,0 +1,174 @@ +package com.hz.pm.api.filemanage.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +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.file.entity.File; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.filemanage.model.dto.DocumentationGroupSaveDTO; +import com.hz.pm.api.filemanage.model.dto.DocumentationSaveDTO; +import com.hz.pm.api.filemanage.model.entity.Documentation; +import com.hz.pm.api.filemanage.model.entity.DocumentationGroup; +import com.hz.pm.api.filemanage.model.param.DocumentationListParam; +import com.hz.pm.api.filemanage.model.vo.DocumentationGroupVO; +import com.hz.pm.api.filemanage.model.vo.DocumentationVO; +import com.hz.pm.api.filemanage.service.IDocumentationGroupService; +import com.hz.pm.api.filemanage.service.IDocumentationService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +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.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname DocumentationManage + * @Description + * @Date 2023/6/6 16:04 + * @Author PoffyZhang + */ +@Component +@AllArgsConstructor +@Slf4j +public class DocumentationManage { + + private final IDocumentationService documentationService; + + private final IDocumentationGroupService documentationGroupService; + + private final FileService fileService; + + /** + * + * @return + */ + public List groupList() { + List list = documentationGroupService.list(); + + return list.stream().map(g -> BeanUtil.copyProperties(g,DocumentationGroupVO.class)).collect(Collectors.toList()); + } + + /** + * 文档列表 + * @param param + * @return + */ + public PageVo list(DocumentationListParam param) { + Page page = param.page(); + documentationService.page(page, Wrappers.lambdaQuery(Documentation.class) + .eq(Objects.nonNull(param.getGroupId()), Documentation::getGroupId, param.getGroupId())); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List vos = page.getRecords().stream() + .map(d -> BeanUtil.copyProperties(d,DocumentationVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(vos,page.getTotal()); + } + + /** + * 增加分组 + * @param dto + * @return + */ + public String addGroup(DocumentationGroupSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + if(documentationGroupService.count(Wrappers.lambdaQuery(DocumentationGroup.class) + .eq(DocumentationGroup::getName,dto.getName())) > 0){ + throw new BizException("此分组名 已经存在"); + } + + DocumentationGroup documentationGroup = BeanUtil.copyProperties(dto, DocumentationGroup.class); + documentationGroup.setCreateBy(user.getRealName()); + documentationGroup.setCreateOn(LocalDateTime.now()); + if(documentationGroupService.save(documentationGroup)){ + return "添加成功"; + } + return "添加失败"; + } + + /** + * 删除分组 同时删除文档 + * @param id + * @return + */ + @Transactional + public String deleteGroup(Long id) { + DocumentationGroup group = documentationGroupService.getById(id); + VUtils.isTrue(Objects.isNull(group)).throwMessage("该分组不存在!"); + + // + documentationService.remove(Wrappers.lambdaQuery(Documentation.class) + .eq(Documentation::getGroupId, id)); + documentationGroupService.removeById(id); + + return "删除成功"; + } + + /** + * 上传文档 + * @param dto + * @return + */ + public String addDoc(DocumentationSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + Long fileId = dto.getFileId(); + File file = fileService.getById(fileId); + + VUtils.isTrue(Objects.isNull(file)).throwMessage("该文件不存在!"); + + DocumentationGroup group = documentationGroupService.getById(dto.getGroupId()); + + VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在!"); + + Documentation documentation = new Documentation(); + documentation.setCreateBy(user.getRealName()); + documentation.setCreateOn(LocalDateTime.now()); + documentation.setSize(Objects.nonNull(file.getSize()) ? file.getSize()/1000L : 0L); + documentation.setFileId(fileId); + documentation.setGroupId(dto.getGroupId()); + documentation.setFileName(file.getOriginalFileName()); + if(documentationService.save(documentation)){ + documentation.setSort(documentation.getId().intValue()); + documentationService.updateById(documentation); + } + + return "添加成功"; + } + + /** + * 删除文档 + * @param id + * @return + */ + public String deleteDoc(Long id) { + Documentation doc = documentationService.getById(id); + VUtils.isTrue(Objects.isNull(doc)).throwMessage("该文档不存在!"); + + if(documentationService.removeById(id)){ + return "删除成功"; + } + return "删除失败"; + } + + public DocumentationVO detail(Long id) { + Documentation doc = documentationService.getById(id); + if(Objects.isNull(doc)){ + return null; + } + return BeanUtil.copyProperties(doc,DocumentationVO.class); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java new file mode 100644 index 0000000..6319409 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -0,0 +1,566 @@ +package com.hz.pm.api.filemanage.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.file.entity.File; +import com.ningdatech.file.service.FileService; +import com.ningdatech.file.utils.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.expert.manage.ExpertReviewManage; +import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; +import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.hz.pm.api.filemanage.model.param.ProjectFileListParam; +import com.hz.pm.api.filemanage.model.vo.ProjectApplyBorrowVO; +import com.hz.pm.api.filemanage.model.vo.ProjectFileListVO; +import com.hz.pm.api.filemanage.model.vo.ProjectFileVO; +import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.projectdeclared.manage.ConstructionManage; +import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; +import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage; +import com.hz.pm.api.projectdeclared.manage.PurchaseManage; +import com.hz.pm.api.projectdeclared.model.entity.Contract; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectdeclared.service.IContractService; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.dto.OrgInfoDTO; +import com.wflow.workflow.bean.process.FileBasicInfo; +import com.wflow.workflow.bean.process.ProcessComment; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessInstanceService; +import com.wflow.workflow.service.ProcessModelService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.task.Comment; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @Classname ProjectFileManage + * @Description + * @Date 2023/6/6 16:04 + * @Author PoffyZhang + */ +@Component +@AllArgsConstructor +@Slf4j +public class ProjectFileManage { + + private final IProjectService projectService; + private final ProjectLibManage projectLibManage; + private final UserInfoHelper userInfoHelper; + private final ProcessModelService processModelService; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final ProcessInstanceService processInstanceService; + private final NoticeManage noticeManage; + private final IProjectInstService projectInstService; + private final HistoryService historyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; + private final IDingOrganizationService dingOrganizationService; + private final IProjectApplicationService projectApplicationService; + private final TaskService taskService; + private final IPurchaseService purchaseService; + private final IContractService contractService; + private final ExpertReviewManage expertReviewManage; + private final FileService fileService; + private final PurchaseManage purchaseManage; + private final ConstructionManage constructionManage; + private final FinalAcceptanceManage finalAcceptanceManage; + + public PageVo list(ProjectFileListParam param) { + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = userFullInfo.getEmployeeCode(); + String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + + Page page = param.page(); + projectService.page(page, Wrappers.lambdaQuery(Project.class) + .like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) + .orderByDesc(Project::getUpdateOn)); + + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + // 获取本单位及下属单位的单位code + Set subOrgSet = getSubOrgList(empPosUnitCode); + + List vos = page.getRecords().stream().map(p -> { + ProjectFileListVO vo = new ProjectFileListVO(); + vo.setId(p.getId()); + // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 + if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet, p)) { + vo.setCanRead(Boolean.TRUE); + } + vo.setBuildOrgName(p.getBuildOrgName()); + vo.setPojectCode(p.getProjectCode()); + vo.setProjectName(p.getProjectName()); + // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) + .eq(ProjectApplyBorrow::getProjectId, p.getId()) + .orderByDesc(ProjectApplyBorrow::getCreateOn) + .last("limit 1")); + if (Objects.nonNull(projectApplyBorrow)) { + String instCode = projectApplyBorrow.getInstanceId(); + // 获取流程实例 + HistoricProcessInstance newInstance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); + ProjectInst projectInst = projectInstService + .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); + // 推送省局联审的项目流程实例为EMPTY + if (Objects.nonNull(projectInst)) { + Integer instType = projectInst.getInstType(); + // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 + ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers + .lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) + .eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); + // 延期申请流程还未审核结束 + if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) + && Objects.isNull(newInstance.getEndActivityId())) { + vo.setCanApplyBorrow(Boolean.FALSE); + } + // 如果是延期申请审核被驳回,设置项目可以申请延期申报 + else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && + HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { + vo.setCanApplyBorrow(Boolean.TRUE); + } + } + } + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(vos, page.getTotal()); + } + + private boolean checkCanRead(Set subOrgSet, Project project) { + // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 + HashSet borrowProjectIdSet = new HashSet<>(); + List applyBorrowProjectIdList = projectApplyBorrowService + .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) + .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); + return applyBorrowProjectIdList.contains(project.getId()); + } + + private Set getSubOrgList(String empPosUnitCode) { + HashSet orgSet = new HashSet<>(); + // 先将自己加入子集 + orgSet.add(empPosUnitCode); + Set subOrgList = dingOrganizationService + .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) + .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); + // 遍历子集 + for (String orgCode : subOrgList) { + orgSet.addAll(getSubOrgList(orgCode)); + } + return orgSet; + } + + public ProjectFileVO file(Long projectId) { + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + + // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 + Project project = projectService.getById(projectId); + Set subOrgList = getSubOrgList(empPosUnitCode); + + if (!checkCanRead(subOrgList, project)) { + throw new BizException("您没有权限查看此项目档案!"); + } + ProjectFileVO projectFileVo = new ProjectFileVO(); + String projectCode = project.getProjectCode(); + ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); + List processDetailVos = projectLibManage.processScheduleDetail(projectId); + ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode); + List purchaseVos = purchaseManage.detailByProjectId(projectId); + ContractVO contractVo = constructionManage.detailContractByProjectId(projectId); + PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId); + FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId); + + projectFileVo.setProjectDetailVo(projectDetailVo); + projectFileVo.setProcessDetailVos(processDetailVos); + projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo); + projectFileVo.setPurchaseVos(purchaseVos); + projectFileVo.setContractVo(contractVo); + projectFileVo.setPreInsVo(preInsVo); + projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo); + + return projectFileVo; + } + + public String wantRead(Long projectId) { + return "申请成功"; + } + + public String startApplyBorrowProcess(Long projectId) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Project project = projectService.getNewProject(projectId); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + // 首先要判断 项目当前状态 是不是 已归档 + VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); + + String regionCode = user.getRegionCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到申请借阅流程配置", regionCode)); + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + // 放入条件判断的项目字段 + // 把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params, project); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); + String instanceId = + processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); + log.info("申请借阅申报成功 【{}】", instanceId); + + // 保存项目借阅实例相关 + projectLibManage.saveProjectByApplyBorrow(project, user, instanceId); + + // 发送给第一个审批人消息 + noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, + MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + public void downloadFile(Long projectId, HttpServletResponse response) { + Project project = projectService.getById(projectId); + // 获取项目各阶段上传文件ID + List fileIdList = Lists.newArrayList(); + getProjectAppendix(project, fileIdList); + if (fileIdList.isEmpty()) { + throw BizException.wrap("暂无档案可供下载"); + } + List files = fileService.listByIds(fileIdList); + if (files.isEmpty()) { + throw BizException.wrap("暂无档案可供下载"); + } + String zipFileName = "项目档案"; + // 设置response的header + response.setContentType("application/zip"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); + + try { + // 创建ZipOutputStream + ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); + // 获取文件输入流 + for (File file : files) { + String originalFileName = file.getOriginalFileName(); + String name = originalFileName.substring(0, originalFileName.indexOf(StrPool.DOT)); + String fileName = name + StrPool.UNDERSCORE + file.getId() + + originalFileName.substring(originalFileName.indexOf(StrPool.DOT)); + InputStream fileInputStream = fileService.getFileInputStream(file); + // 文件 + ZipEntry zipEntry = new ZipEntry(fileName); + zos.putNextEntry(zipEntry); + byte[] bytes = new byte[1024]; + int length; + while ((length = fileInputStream.read(bytes)) >= 0) { + zos.write(bytes, 0, length); + } + fileInputStream.close(); + zos.closeEntry(); + } + zos.close(); + } catch (IOException e) { + log.error("项目档案下载失败:", e); + throw BizException.wrap("项目档案下载失败"); + } + } + + private void getProjectAppendix(Project project, List fileIdList) { + Long projectId = project.getId(); + // 项目申报阶段 + // 获取立项依据 + String buildBasis = project.getBuildBasis(); + List buildBasisFileArray = JSON.parseArray(buildBasis, JSONObject.class); + for (JSONObject jsonObject : buildBasisFileArray) { + String fileInfo = jsonObject.getString(CommonConst.FILE_LIST); + List buildBasisFileIdList = getFileIdList(fileInfo); + fileIdList.addAll(buildBasisFileIdList); + } + // 获取附件-初步方案 + String preliminaryPlanFile = project.getPreliminaryPlanFile(); + List prePlanFileIdList = getFileIdList(preliminaryPlanFile); + fileIdList.addAll(prePlanFileIdList); + // 获取附件-佐证材料 + String supMaterialsFile = project.getSupportingMaterialsFile(); + List supMaterialFileIdList = getFileIdList(supMaterialsFile); + fileIdList.addAll(supMaterialFileIdList); + // 获取附件-项目总投资测算明细 + String calTotalInvestFile = project.getCalculationTotalInvestmentFile(); + List calTotalInvestFileIdList = getFileIdList(calTotalInvestFile); + fileIdList.addAll(calTotalInvestFileIdList); + // 获取附件-申报单位主要职责(单位三定方案) + String mainResAppFile = project.getMainResponsibilitiesApplicantFile(); + List mainResAppFileIdList = getFileIdList(mainResAppFile); + fileIdList.addAll(mainResAppFileIdList); + // 获取附件-项目申报书 + String projectApplicationForm = project.getProjectApplicationForm(); + List projectAppFormFileIdList = getFileIdList(projectApplicationForm); + fileIdList.addAll(projectAppFormFileIdList); + // 获取项目应用信息中的文件 + List applicationList = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId)); + for (ProjectApplication projectApplication : applicationList) { + // 获取试点文件 + String experimentsFile = projectApplication.getExperimentsFile(); + List experimentsFileIdList = getFileIdList(experimentsFile); + fileIdList.addAll(experimentsFileIdList); + // 获取应用总投资测算明细 + String appEstimateFile = projectApplication.getApplicationEstimateFile(); + List appEstimateFileIdList = getFileIdList(appEstimateFile); + fileIdList.addAll(appEstimateFileIdList); + } + // 流程审核意见文件 + // 获取项目关联的流程实例 + List projectInstList = + projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId)); + // 从历史评论表中获取对应流程实例的评论附件信息 + for (ProjectInst projectInst : projectInstList) { + String instanceId = projectInst.getInstCode(); + List commentList = taskService.getProcessInstanceComments(instanceId); + for (Comment comment : commentList) { + ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); + List attachments = processComment.getAttachments(); + if (CollUtil.isNotEmpty(attachments)) { + List idList = attachments.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList()); + fileIdList.addAll(idList); + } + } + } + + // 预审申报阶段 + // 预审申报上级条线主管单位审核意见 + String higherLineSuperOrgReviewComments = project.getHigherLineSuperOrgReviewComments(); + if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)) { + List highSuperOrgFileIdList = getFileIdList(higherLineSuperOrgReviewComments); + fileIdList.addAll(highSuperOrgFileIdList); + } + + // 方案申报阶段 + // 获取建设方案文件 + String constructionPlanFile = project.getConstructionPlanFile(); + String str = StrPool.LEFT_SQ_BRACKET + StrPool.RIGHT_SQ_BRACKET; + if (!str.equals(constructionPlanFile)) { + JSONArray array = JSON.parseArray(constructionPlanFile); + array.forEach(o -> { + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(o)); + Long constructFileId = jsonObject.getLong(CommonConst.FILE_ID_STR); + fileIdList.add(constructFileId); + }); + } + + // 立项批复阶段 + // 获取批复文件 + String approvedFile = project.getApprovedFile(); + if (Objects.nonNull(approvedFile)) { + fileIdList.add(Long.valueOf(approvedFile)); + } + // 获取建设方案文件 + String approvedConstructionPlanFile = project.getApprovedConstructionPlanFile(); + if (Objects.nonNull(approvedConstructionPlanFile)) { + fileIdList.add(Long.valueOf(approvedConstructionPlanFile)); + } + + // 采购结果备案阶段 + Purchase purchase = purchaseService + .getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1)); + // 获取投标文件 + if (Objects.nonNull(purchase)) { + String biddingDoc = purchase.getBiddingDoc(); + List biddingFileIdList = getFileIdList(biddingDoc); + fileIdList.addAll(biddingFileIdList); + // 获取招标文件 + String bidDoc = purchase.getBidDoc(); + List bidFileIdList = getFileIdList(bidDoc); + fileIdList.addAll(bidFileIdList); + // 获取中标通知书 + String acceptanceLetter = purchase.getAcceptanceLetter(); + List acceptFileIdList = getFileIdList(acceptanceLetter); + fileIdList.addAll(acceptFileIdList); + } + + // 合同备案阶段 + Contract contract = contractService + .getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); + // 获取合同附件 + if (Objects.nonNull(contract)) { + String attachment = contract.getAttachment(); + List contractFileIdList = getFileIdList(attachment); + fileIdList.addAll(contractFileIdList); + } + // 初验备案阶段 + // 获取初验材料 + String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials(); + getInspectionMaterials(fileIdList, preliminaryInspectionMaterials); + + // 终验申报阶段 + // 获取终验材料 + String finalAcceptanceMaterials = project.getFinalAcceptanceMaterials(); + getInspectionMaterials(fileIdList, finalAcceptanceMaterials); + + // 专家评审记录-如果有初步方案评审会议、部门联审评审会议、建设方案评审会议、验收评审会议对应的附件 + // 获取项目的所有评审意见 + String projectCode = project.getProjectCode(); + ProjectReviewDetailVO projectReviewDetailVO = expertReviewManage.projectExpertReviewDetail(projectCode); + Collection reviews = projectReviewDetailVO.getReviews(); + // 获取最终评审意见附件 + if (CollUtil.isNotEmpty(reviews)) { + List finalReviewFileIdList = reviews.stream().map(r -> { + ExpertReviewDetailVO finalReview = r.getFinalReview(); + return finalReview.getAttachFileId(); + }).collect(Collectors.toList()); + fileIdList.addAll(finalReviewFileIdList); + // 获取组员评审意见 + for (ProjectReviewDetailVO.ReviewDetailByTypeVO review : reviews) { + List teamMemberReviews = review.getTeamMemberReviews(); + for (ExpertReviewDetailVO teamMemberReview : teamMemberReviews) { + Long attachFileId = teamMemberReview.getAttachFileId(); + fileIdList.add(attachFileId); + } + } + } + } + + private void getInspectionMaterials(List fileIdList, String preliminaryInspectionMaterials) { + List fileStrList = JSON.parseArray(preliminaryInspectionMaterials, String.class); + if (CollUtil.isNotEmpty(fileStrList)) { + for (String fileStr : fileStrList) { + JSONObject object = JSON.parseObject(fileStr, JSONObject.class); + String dataStr = object.getString("data"); + List array = JSON.parseArray(dataStr, String.class); + for (String file : array) { + JSONObject fileObject = JSON.parseObject(file, JSONObject.class); + String filesStr = fileObject.getString("files"); + List jsonObjects = JSON.parseArray(filesStr, JSONObject.class); + if (CollUtil.isEmpty(jsonObjects)) { + // 如果没有上传附件,跳过 + continue; + } + for (JSONObject json : jsonObjects) { + String response = json.getString("response"); + JSONObject responseJson = JSON.parseObject(response, JSONObject.class); + String fileData = responseJson.getString("data"); + JSONObject fileInfoObject = JSON.parseObject(fileData, JSONObject.class); + Long fileId = fileInfoObject.getLong("id"); + fileIdList.add(fileId); + } + } + } + } + } + + private List getFileIdList(String buildBasis) { + List prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class); + List prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); + return prePlanFileIdList; + } + + /** + * 查看 借阅的详情 + * + * @param instanceId + * @return + */ + public ProjectApplyBorrowVO wantReadDetail(String instanceId) { + ProjectApplyBorrow apply = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getInstanceId, instanceId) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(apply)) { + return null; + } + + ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply, ProjectApplyBorrowVO.class); + if (StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); + if (Objects.nonNull(user)) { + vo.setApplyBorrowEmployeeName(user.getUsername()); + } + } + if (StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())) { + DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) + .last(BizConst.LIMIT_1)); + if (Objects.nonNull(organization)) { + vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); + } + } + if (Objects.nonNull(vo.getProjectId())) { + Project project = projectService.getById(vo.getProjectId()); + if (Objects.nonNull(project)) { + vo.setProjectName(project.getProjectName()); + } + } + return vo; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.java new file mode 100644 index 0000000..77a2e43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.filemanage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.filemanage.model.entity.DocumentationGroup; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-02-27 + */ +public interface DocumentationGroupMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.xml new file mode 100644 index 0000000..29d9862 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationGroupMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.java new file mode 100644 index 0000000..1f9126e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.filemanage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.filemanage.model.entity.Documentation; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-02-27 + */ +public interface DocumentationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.xml new file mode 100644 index 0000000..0cfbe80 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/DocumentationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.java new file mode 100644 index 0000000..7971787 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.filemanage.mapper; + +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +public interface NdProjectApplyBorrowMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.xml new file mode 100644 index 0000000..b77c3bc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/mapper/NdProjectApplyBorrowMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationGroupSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationGroupSaveDTO.java new file mode 100644 index 0000000..9c0867c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationGroupSaveDTO.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.filemanage.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "DocumentationGroupSaveDTO", description = "DocumentationGroupSaveDTO") +public class DocumentationGroupSaveDTO { + + @ApiModelProperty("分组名") + private String name; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationSaveDTO.java new file mode 100644 index 0000000..656c810 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/dto/DocumentationSaveDTO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.filemanage.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "DocumentationSaveDTO", description = "DocumentationSaveDTO") +public class DocumentationSaveDTO { + + @ApiModelProperty("文档分类ID") + @NotNull(message = "请传分组ID") + private Long groupId; + + @ApiModelProperty("文档ID") + @NotNull(message = "请传文档ID") + private Long fileId; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/Documentation.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/Documentation.java new file mode 100644 index 0000000..f5dfd4b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/Documentation.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.filemanage.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.time.LocalDateTime; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@TableName("nd_documentation") +@ApiModel(value = "nd_documentation", description = "资料文档") +public class Documentation { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("上传人") + private String createBy; + + @ApiModelProperty("上传时间") + private LocalDateTime createOn; + + @ApiModelProperty("文档大小 kb") + private Long size; + + @ApiModelProperty("文档分类ID") + private Long groupId; + + @ApiModelProperty("文档ID") + private Long fileId; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/DocumentationGroup.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/DocumentationGroup.java new file mode 100644 index 0000000..2c4f890 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/DocumentationGroup.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.filemanage.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.time.LocalDateTime; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@TableName("nd_documentation_group") +@ApiModel(value = "nd_documentation_group", description = "资料文档分组") +public class DocumentationGroup { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("上传人") + private String createBy; + + @ApiModelProperty("上传时间") + private LocalDateTime createOn; + + @ApiModelProperty("分组名") + private String name; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java new file mode 100644 index 0000000..04b03fe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.filemanage.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-06-16 + */ +@Data +@TableName("nd_project_apply_borrow") +@ApiModel(value = "NdProjectApplyBorrow对象", description = "") +public class ProjectApplyBorrow implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("借阅项目ID") + private Long projectId; + + @ApiModelProperty("申请借阅员工code") + private String applyBorrowEmployeeCode; + + @ApiModelProperty("申请借阅用户任职单位code") + private String applyBorrowEmpPosUnitCode; + + @ApiModelProperty("申请借阅审批流程ID") + private String instanceId; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新人") + private Long updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("申请借阅是否成功") + private Boolean isSuccess; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/DocumentationListParam.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/DocumentationListParam.java new file mode 100644 index 0000000..c9148ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/DocumentationListParam.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.filemanage.model.param; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname DocumentationListParam + * @Description + * @Date 2023/6/6 16:06 + * @Author PoffyZhang + */ +@Data +public class DocumentationListParam extends PagePo { + + @ApiModelProperty("分组ID") + private Long groupId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/ProjectFileListParam.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/ProjectFileListParam.java new file mode 100644 index 0000000..b2bc2be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/param/ProjectFileListParam.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.filemanage.model.param; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname ProjectFileListParam + * @Description + * @Date 2023/6/6 16:06 + * @Author PoffyZhang + */ +@Data +public class ProjectFileListParam extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目单位") + private String buildOrgName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationGroupVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationGroupVO.java new file mode 100644 index 0000000..68abc2f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationGroupVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.filemanage.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "nd_documentation_group", description = "资料文档分组") +public class DocumentationGroupVO { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("上传人") + private String createBy; + + @ApiModelProperty("上传时间") + private LocalDateTime createOn; + + @ApiModelProperty("分组名") + private String name; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationVO.java new file mode 100644 index 0000000..7fce799 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/DocumentationVO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.filemanage.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "nd_documentation", description = "资料文档") +public class DocumentationVO { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("文档ID") + private Long fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("上传人") + private String createBy; + + @ApiModelProperty("上传时间") + private LocalDateTime createOn; + + @ApiModelProperty("文档大小 kb") + private Long size; + + @ApiModelProperty("文档分类ID") + private Long groupId; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java new file mode 100644 index 0000000..f11ac43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.filemanage.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-06-16 + */ +@Data +@ApiModel(value = "ProjectApplyBorrowVO", description = "") +public class ProjectApplyBorrowVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("借阅项目ID") + private Long projectId; + + @ApiModelProperty("借阅项目名") + private String projectName; + + @ApiModelProperty("申请借阅员工code") + private String applyBorrowEmployeeCode; + + @ApiModelProperty("申请借阅员工名字") + private String applyBorrowEmployeeName; + + @ApiModelProperty("申请借阅用户任职单位code") + private String applyBorrowEmpPosUnitCode; + + @ApiModelProperty("申请借阅用户任职单位") + private String applyBorrowEmpPosUnitName; + + @ApiModelProperty("申请借阅审批流程ID") + private String instanceId; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新人") + private Long updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("申请借阅是否成功") + private Boolean isSuccess; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileListVO.java new file mode 100644 index 0000000..e572aa4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileListVO.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.filemanage.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname Documentation + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ProjectFileListVO", description = "资料文档") +public class ProjectFileListVO { + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目单位") + private String buildOrgName; + + @ApiModelProperty("项目编号") + private String pojectCode; + + @ApiModelProperty("是否可阅") + private Boolean canRead = Boolean.FALSE; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("是否可以申请借阅") + private Boolean canApplyBorrow = Boolean.TRUE; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java new file mode 100644 index 0000000..f0374cf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.filemanage.model.vo; + +import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; +import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname ProjectFileVO + * @Description + * @Date 2023/6/6 14:41 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ProjectFileVO", description = "项目档案") +public class ProjectFileVO { + + @ApiModelProperty("项目档案详情") + private ProjectDetailVO projectDetailVo; + + @ApiModelProperty("流程进度详情") + private List processDetailVos; + + @ApiModelProperty("专家评审详情") + private ProjectReviewDetailVO projectReviewDetailVo; + + @ApiModelProperty("招标登记详情") + private List purchaseVos; + + @ApiModelProperty("合同登记详情") + private ContractVO contractVo; + + @ApiModelProperty("初验登记详情") + private PreInsVO preInsVo; + + @ApiModelProperty("终验信息详情") + private FinalAcceptanceVO finalAcceptanceVo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationGroupService.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationGroupService.java new file mode 100644 index 0000000..250f840 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationGroupService.java @@ -0,0 +1,9 @@ +package com.hz.pm.api.filemanage.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.filemanage.model.entity.DocumentationGroup; + +public interface IDocumentationGroupService extends IService { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationService.java new file mode 100644 index 0000000..2a6c524 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/IDocumentationService.java @@ -0,0 +1,9 @@ +package com.hz.pm.api.filemanage.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.filemanage.model.entity.Documentation; + +public interface IDocumentationService extends IService { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/INdProjectApplyBorrowService.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/INdProjectApplyBorrowService.java new file mode 100644 index 0000000..379a3fc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/INdProjectApplyBorrowService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.filemanage.service; + +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +public interface INdProjectApplyBorrowService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationGroupServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationGroupServiceImpl.java new file mode 100644 index 0000000..7889576 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationGroupServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.filemanage.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.filemanage.mapper.DocumentationGroupMapper; +import com.hz.pm.api.filemanage.model.entity.DocumentationGroup; +import com.hz.pm.api.filemanage.service.IDocumentationGroupService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +@Service +public class DocumentationGroupServiceImpl extends ServiceImpl implements IDocumentationGroupService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationServiceImpl.java new file mode 100644 index 0000000..0f814e4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/DocumentationServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.filemanage.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.filemanage.mapper.DocumentationMapper; +import com.hz.pm.api.filemanage.model.entity.Documentation; +import com.hz.pm.api.filemanage.service.IDocumentationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +@Service +public class DocumentationServiceImpl extends ServiceImpl implements IDocumentationService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java new file mode 100644 index 0000000..59c1a9a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.filemanage.service.impl; + +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.hz.pm.api.filemanage.mapper.NdProjectApplyBorrowMapper; +import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +@Service +public class NdProjectApplyBorrowServiceImpl extends ServiceImpl implements INdProjectApplyBorrowService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java new file mode 100644 index 0000000..dab39b4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.fiscal.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.fiscal.manage.CompanyFiscalCodeManage; +import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +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 Lierbao + * @since 2023-02-10 + */ +@RestController +@RequestMapping("/api/v1/fiscal-code") +@RequiredArgsConstructor +@Api(tags = "印章配置-财政编码配置") +public class CompanyFiscalCodeController { + + private final CompanyFiscalCodeManage companyFiscalCodeManage; + + @ApiOperation(value = "财政编码-配置", notes = "财政编码配置") + @PostMapping("/fiscal-and-seal/configure") + @WebLog("财政编码-配置") + public void fiscalAndSealCodeConfigure(@Valid @RequestBody ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { + companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); + } + + @ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置") + @PostMapping("/fiscal-and-seal/get-configure") + public ResCompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { + return companyFiscalCodeManage.getFiscalCodeConfigure(request); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/entity/CompanyFiscalCode.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/entity/CompanyFiscalCode.java new file mode 100644 index 0000000..c1ff6bd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/entity/CompanyFiscalCode.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.fiscal.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +@Data +@TableName("nd_company_fiscal_code") +@ApiModel(value = "NdCompanyFiscalCode对象", description = "") +public class CompanyFiscalCode implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private String fiscalCode; + + private String organizationCode; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java new file mode 100644 index 0000000..935d18c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java @@ -0,0 +1,91 @@ +package com.hz.pm.api.fiscal.manage; + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; +import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; +import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; +import com.hz.pm.api.signature.entity.CompanySignature; +import com.hz.pm.api.signature.service.ICompanySignatureService; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:23 + */ +@Component +@RequiredArgsConstructor +public class CompanyFiscalCodeManage { + + private final UserInfoHelper userInfoHelper; + + private final ICompanyFiscalCodeService iCompanyFiscalCodeService; + private final ICompanySignatureService iCompanySignatureService; + + + public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { + Long userId = LoginUserUtil.getUserId(); + + String organizationCode = reqCompanyFiscalCodeAndSealSnPO.getOrganizationCode(); + if (StringUtils.isBlank(organizationCode)) { + organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); + } + // TODO 校验用户权限 + + // 保存财政编码配置 + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); + if (Objects.isNull(companyFiscalCode)) { + companyFiscalCode = new CompanyFiscalCode(); + companyFiscalCode.setOrganizationCode(organizationCode); + companyFiscalCode.setCreateOn(LocalDateTime.now()); + companyFiscalCode.setCreateBy(userId); + } + String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode(); + companyFiscalCode.setFiscalCode(fiscalCode); + companyFiscalCode.setUpdateOn(LocalDateTime.now()); + companyFiscalCode.setUpdateBy(userId); + iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode); + + + // 保存印章配置 + CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); + if (Objects.isNull(companySignature)) { + companySignature = new CompanySignature(); + companySignature.setOrganizationCode(organizationCode); + companySignature.setCreateOn(LocalDateTime.now()); + } + String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn(); + companySignature.setSealSn(sealSn); + companySignature.setUpdateOn(LocalDateTime.now()); + companySignature.setCreateBy(userId); + companySignature.setUpdateBy(userId); + iCompanySignatureService.saveOrUpdate(companySignature); + } + + public ResCompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { + Long userId = LoginUserUtil.getUserId(); + String organizationCode = request.getOrganizationCode(); + if (StringUtils.isBlank(organizationCode)) { + organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); + } + CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); + + ResCompanyFiscalCodeAndSealSnVO returnVO = new ResCompanyFiscalCodeAndSealSnVO(); + if (Objects.isNull(companySignature)) { + return null; + } + returnVO.setCreateTime(companySignature.getCreateOn()); + returnVO.setUpdateTime(companySignature.getUpdateOn()); + returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); + returnVO.setSealSn(companySignature.getSealSn()); + return returnVO; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.java new file mode 100644 index 0000000..3f43f9e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.fiscal.mapper; + +import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +public interface NdCompanyFiscalCodeMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.xml new file mode 100644 index 0000000..0c5202f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/mapper/NdCompanyFiscalCodeMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java new file mode 100644 index 0000000..04fe139 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.fiscal.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:24 + */ +@Data +@ApiModel("财政编码配置") +public class ReqCompanyFiscalCodeAndSealSnPO { + +// @NotBlank(message = "组织编码 不能为空") + @ApiModelProperty("组织编码(需传入用户任职单位code)") + private String organizationCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @NotBlank(message = "印章编号 不能为空") + @ApiModelProperty("印章编号") + private String sealSn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java new file mode 100644 index 0000000..da29142 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.fiscal.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:24 + */ +@Data +@ApiModel("获取财政编码配置") +public class ReqGetCompanyFiscalCodeAndSealSnPO { + + @ApiModelProperty("组织编码(需传入用户任职单位code)") + private String organizationCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java new file mode 100644 index 0000000..b07d00d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.fiscal.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/3/23 上午10:58 + */ + +@Data +@ApiModel("财政编码配置VO") +public class ResCompanyFiscalCodeAndSealSnVO { + + @ApiModelProperty("组织编码") + private String organizationCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @ApiModelProperty("印章编号") + private String sealSn; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java new file mode 100644 index 0000000..992447c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.fiscal.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +public interface ICompanyFiscalCodeService extends IService { + + CompanyFiscalCode getByOrganizationCode(String orgCode); + + /** + * 获取 key orgCode fiscalCode + * + * @param orgCodeList + * @return + */ + Map getByOrgFiscalCodeMap(List orgCodeList); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java new file mode 100644 index 0000000..6035dc4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.fiscal.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; +import com.hz.pm.api.fiscal.mapper.NdCompanyFiscalCodeMapper; +import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +@Service + +public class CompanyFiscalCodeServiceImpl extends ServiceImpl implements ICompanyFiscalCodeService { + + + @Override + public CompanyFiscalCode getByOrganizationCode(String orgCode) { + if (StringUtils.isBlank(orgCode)) { + return null; + } + return this.getOne(Wrappers.lambdaQuery(CompanyFiscalCode.class) + .eq(CompanyFiscalCode::getOrganizationCode, orgCode)); + + } + + @Override + public Map getByOrgFiscalCodeMap(List orgCodeList) { + if (CollUtil.isNotEmpty(orgCodeList)) { + return new HashMap(); + } + List companyFiscalCodeList = this.list(Wrappers.lambdaQuery(CompanyFiscalCode.class) + .in(CompanyFiscalCode::getOrganizationCode, orgCodeList)); + + Map orgCodeAndFiscalCodeMap = companyFiscalCodeList.stream() + .collect(Collectors.toMap(CompanyFiscalCode::getOrganizationCode, CompanyFiscalCode::getFiscalCode)); + return orgCodeAndFiscalCodeMap; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/contants/BizProjectContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/contants/BizProjectContant.java new file mode 100644 index 0000000..9e714e5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/contants/BizProjectContant.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.gov.contants; + +/** + * @Classname BizProjectContant + * @Description + * @Date 2023/8/25 11:03 + * @Author PoffyZhang + */ +public interface BizProjectContant { + + String PUSH_URL = "http://10.53.168.41:38088/syn-data-task/open/api/v1/project-receive/save"; + String NOT_EFFECTIVE_URL = "http://10.53.168.41:38088/syn-data-task/open/api/v1/project-receive/not-effective"; + String NOT_EFFECTIVE_CODE = "1"; + + String EFFECTIVE_CODE = "2"; + + class ProjectCollection { + //有效 + public static final String IS_EFFECTIVE = "02"; + //有效 + public static final String NOT_EFFECTIVE = "01"; + public static final String DRAFT = "草稿"; + public static final String OP_INSERT = "insert"; + public static final String OP_UPDATE = "update"; + public static final String OP_DELETE = "delete"; + public static final String PDF_SUFFIX = ".pdf"; + public static final String MONTH = "月"; + + public static final String MISSING_HIS_PROJ_ID = "000000"; + + public static final String MISSING_HIS_PROJ_NAME = "历年项目数据缺失"; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/BelongOrgController.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/BelongOrgController.java new file mode 100644 index 0000000..3d55d4e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/BelongOrgController.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.gov.controller; + + +import com.hz.pm.api.gov.manage.BelongOrgManage; +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author liuxinxin + * @since 2023-04-18 + */ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@Api(value = "BelongOrgController", tags = "单位所属条线") +@RequestMapping("/api/v1/belong-org") +public class BelongOrgController { + + private final BelongOrgManage belongOrgManage; + + @GetMapping("/business-strip/list") + @ApiOperation("获取条线列表") + public List getGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) { + return belongOrgManage.getGovBusinessStripList(businessStripName); + } + + @GetMapping("/business-strip/expert/analysis") + @ApiOperation("分析专家数据") + public void analysisExpertOrg() { + belongOrgManage.analysisExpertOrg(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java new file mode 100644 index 0000000..528fa77 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java @@ -0,0 +1,214 @@ +package com.hz.pm.api.gov.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.dto.GovOperationProjectSaveDTO; +import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; +import com.hz.pm.api.gov.model.vo.GovBizProjectListVO; +import com.hz.pm.api.gov.model.vo.GovOperationProjectDetailVO; +import com.hz.pm.api.gov.model.vo.GovProjectDictionaryVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.scheduler.task.SynProjectCollectionTask; +import com.hz.pm.api.scheduler.task.SynProvinceOrgTask; +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 javax.validation.Valid; +import java.net.UnknownHostException; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author zpf + * @since 2023-08-21 + */ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@Api(value = "GovProjectCollectionController", tags = "新项目归集") +@RequestMapping("/api/v1/gov-project-collection") +public class GovProjectCollectionController { + + private final GovProjectCollectionManage collectionManage; + + private final SynProjectCollectionTask collectionTask; + + private final SynProvinceOrgTask synProvinceOrgTask; + + @GetMapping("/dictionary") + @ApiOperation("字典") + public List dictionary(@RequestParam(value = "type", required = false) String type) { + return collectionManage.dictionary(type); + } + + @GetMapping("/list") + @ApiOperation("项目归集列表") + public PageVo list(ProjectListReq req) { + return collectionManage.list(req); + } + + @GetMapping("/operation/list") + @ApiOperation("运维项目项目归集列表") + public PageVo operationList(ProjectListReq req) { + return collectionManage.operationList(req); + } + + @GetMapping("/detail/{projId}") + @ApiOperation("项目归集详情") + public GovBizProjectDetailVO detail(@PathVariable String projId) { + return collectionManage.detail(projId); + } + + @GetMapping("/operation/detail/{projId}") + @ApiOperation("运维项目归集详情") + public GovOperationProjectDetailVO operationDetail(@PathVariable String projId) { + return collectionManage.operationDetail(projId); + } + + @PostMapping("/save") + @ApiOperation("项目归集保存") + @WebLog("项目归集保存") + public String save(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { + return collectionManage.save(saveDTO,null); + } + + @PostMapping("/operation/save") + @ApiOperation("运维项目归集保存") + @WebLog("运维项目归集保存") + public String operationSave(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { + return collectionManage.operationSave(saveDTO,null); + } + + @PostMapping("/remove/{projId}") + @ApiOperation("项目归集删除") + @WebLog("项目归集删除") + public String remove(@PathVariable String projId) { + return collectionManage.remove(projId); + } + + @PostMapping("/operation/remove/{projId}") + @ApiOperation("运维项目归集删除") + @WebLog("运维项目归集删除") + public String operationRemove(@PathVariable String projId) { + return collectionManage.operationRemove(projId); + } + + @GetMapping("/draft-list") + @ApiOperation("项目归集草稿箱列表") + public PageVo draftList(ProjectListReq req) { + return collectionManage.draftList(req); + } + + @GetMapping("/operation/draft-list") + @ApiOperation("运维项目归集草稿箱列表") + public PageVo operationDraftList(ProjectListReq req) { + return collectionManage.operationDraftList(req); + } + + @GetMapping("/draft-detail/{draftId}") + @ApiOperation("项目归集草稿箱详情") + public GovBizProjectDetailVO draftDetail(@PathVariable Long draftId) { + return collectionManage.draftDetail(draftId); + } + + @GetMapping("/operation/draft-detail/{draftId}") + @ApiOperation("运维项目归集草稿箱详情") + public GovOperationProjectDetailVO operationDraftDetail(@PathVariable Long draftId) { + return collectionManage.operationDraftDetail(draftId); + } + + @PostMapping("/draft") + @ApiOperation("项目归集暂存草稿箱") + @WebLog("项目归集暂存草稿箱") + public String draft(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { + return collectionManage.draft(saveDTO,null); + } + + @PostMapping("/operation/draft") + @ApiOperation("运维项目归集暂存草稿箱") + @WebLog("运维项目归集暂存草稿箱") + public String operationDraft(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { + return collectionManage.operationDraft(saveDTO,null); + } + + @PostMapping("/draft-remove/{draftId}") + @ApiOperation("项目归集草稿箱删除") + @WebLog("项目归集草稿箱删除") + public String draftRemove(@PathVariable Long draftId) { + return collectionManage.draftRemove(draftId); + } + + @PostMapping("/operation/draft-remove/{draftId}") + @ApiOperation("运维项目归集草稿箱删除") + @WebLog("运维项目归集草稿箱删除") + public String operationDraftRemove(@PathVariable Long draftId) { + return collectionManage.operationDraftRemove(draftId); + } + + @PostMapping("/push-task") + @ApiOperation("主动调用定时器方法") + @WebLog("主动调用定时器方法") + public void pushTask() throws UnknownHostException { + collectionTask.doTask(); + } + + @PostMapping("/push-task-single") + @ApiOperation("主动调用定时器方法") + @WebLog("主动调用定时器方法") + public void pushTaskSingle(@RequestBody List projectCodes) throws UnknownHostException { + collectionTask.doTaskSingle(projectCodes); + } + + @PostMapping("/staging-convert-pdf") + @ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段") + @WebLog("主动转换库存的文件都为PDF文件") + public void stagingConvertPdf(@RequestParam(required = false) String projId) { + collectionTask.stagingConvertPdf(projId); + } + + @PostMapping("/staging-convert-pdf2") + @ApiOperation("把库存的项目归集的文件approval_file重新转换") + @WebLog("把库存的项目归集的文件approval_file重新转换") + public void stagingConvertPdf2(@RequestParam(required = false) String projId) { + collectionTask.stagingConvertPdf2(projId); + } + + @PostMapping("/staging-convert-pdf3") + @ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段 采购") + @WebLog("主动转换库存的文件都为PDF文件 采购") + public void stagingConvertPdf3(@RequestParam(required = false) String projId) { + collectionTask.stagingConvertPdf3(projId); + } + + @PostMapping("/rebuild-project-code") + @ApiOperation("重新生成项目编号") + @WebLog("重新生成项目编号") + public String stagingConvertPdf3(@RequestBody List projIds) { + return collectionManage.rebuildProjectCode(projIds); + } + + @PostMapping("/remove-project") + @ApiOperation("删除申报项目") + @WebLog("删除申报项目") + public String removeProject(@RequestBody List projectCodes){ + return collectionManage.removeProject(projectCodes); + } + + @GetMapping("/syn-province") + @ApiOperation("同步省级单位") + @WebLog("同步省级单位") + public String synProvince() throws UnknownHostException { + synProvinceOrgTask.doTask(); + return "同步成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java new file mode 100644 index 0000000..04fd41c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java @@ -0,0 +1,447 @@ +package com.hz.pm.api.gov.convert; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.model.dto.*; +import com.hz.pm.api.gov.model.req.*; +import com.hz.pm.api.gov.model.vo.*; +import com.hz.pm.api.gov.utils.ProjectCollectionUtil; +import org.apache.commons.lang3.StringUtils; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectConvert + * @Description + * @Date 2023/8/25 11:53 + * @Author PoffyZhang + */ +public class ProjectConvert { + + /** + * 6个 转换方法 + * @param saveDTO + * @return + */ + public static ProjectPushReq convert(GovBizProjectSaveDTO saveDTO) { + ProjectPushReq req = new ProjectPushReq(); + req.setBaseinfo(convertBase(saveDTO.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); + req.setApply(convertApply(saveDTO.getApply())); + req.setApprove(convertApprove(saveDTO.getApprove())); + req.setCimplement(convertCimplement(saveDTO.getCimplement())); + req.setMimplement(convertMimplement(saveDTO.getMimplement())); + req.setProcures(convertProcures(saveDTO.getProcures())); + return req; + } + + public static ProjectPushReq convert(GovBizProjectDetailVO vo) { + ProjectPushReq req = new ProjectPushReq(); + req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); + req.setApply(convertApplyVo(vo.getApply())); + req.setApprove(convertApproveVo(vo.getApprove())); + req.setCimplement(convertCimplementVo(vo.getCimplement())); + req.setMimplement(convertMimplementVo(vo.getMimplement())); + req.setProcures(convertProcuresVo(vo.getProcures())); + return req; + } + + public static ProjectPushReq convertWithConvertPdf(GovBizProjectDetailVO vo) { + ProjectPushReq req = new ProjectPushReq(); + req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); + req.setApply(convertApplyVoWithConvertPdf(vo.getApply())); + req.setApprove(convertApproveVoWithConvertPdf(vo.getApprove())); + req.setCimplement(convertCimplementVoWithConvertPdf(vo.getCimplement())); + req.setMimplement(convertMimplementVoWithConvertPdf(vo.getMimplement())); + req.setProcures(convertProcuresVoWithConvertPdf(vo.getProcures())); + return req; + } + + public static ProjectPushReq convertWithConvertPdf(GovOperationProjectDetailVO vo) { + ProjectPushReq req = new ProjectPushReq(); + req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); + req.setApply(convertApplyVoWithConvertPdf(vo.getApply())); + req.setApprove(convertApproveVoWithConvertPdf(vo.getApprove())); + req.setCimplement(convertCimplementVoWithConvertPdf(vo.getCimplement())); + req.setMimplement(convertMimplementVoWithConvertPdf(vo.getMimplement())); + req.setProcures(convertProcuresVoWithConvertPdf(vo.getProcures())); + return req; + } + + private static List convertProcures(List procures) { + if(CollUtil.isEmpty(procures)){ + return Collections.emptyList(); + } + + List req = procures.stream() + .map(p -> { + ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); + if(Objects.nonNull(p.getId())){ + r.setTongID(p.getId().intValue()); + } + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); + return r; + }) + .collect(Collectors.toList()); + return req; + } + + private static List convertProcuresVo(List procures) { + if(CollUtil.isEmpty(procures)){ + return Collections.emptyList(); + } + + List req = procures.stream() + .map(p -> { + ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); + if(Objects.nonNull(p.getId())){ + r.setTongID(p.getId().intValue()); + } + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); + return r; + }) + .collect(Collectors.toList()); + return req; + } + + private static List convertProcuresVoWithConvertPdf(List procures) { + if(CollUtil.isEmpty(procures)){ + return Collections.emptyList(); + } + + List req = procures.stream() + .map(p -> { + ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); + r.setBiddingFile(StringUtils.isNotBlank(p.getBiddingFilePdf()) ? p.getBiddingFilePdf() : + null); + r.setPurchaseFile(StringUtils.isNotBlank(p.getPurchaseFilePdf()) ? p.getPurchaseFilePdf() : + null); + r.setPurchaseContract(StringUtils.isNotBlank(p.getPurchaseContractPdf()) ? p.getPurchaseContractPdf() : + null); + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); + return r; + }) + .collect(Collectors.toList()); + return req; + } + + private static ProjectMimplementReq convertMimplement(GovBizProjectMimplementDTO mimplement) { + ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); + return req; + } + + private static ProjectMimplementReq convertMimplementVo(GovBizProjectMimplementVO mimplement) { + ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); + return req; + } + + private static ProjectMimplementReq convertMimplementVoWithConvertPdf(GovBizProjectMimplementVO mimplement) { + ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); + if(Objects.isNull(req)){ + return req; + } + req.setBaseUserConsFile(StringUtils.isNotBlank(mimplement.getBaseUserConsFilePdf()) ? mimplement.getBaseUserConsFilePdf() : + mimplement.getBaseUserConsFile()); + req.setBaseChanFile(StringUtils.isNotBlank(mimplement.getBaseChanFilePdf()) ? mimplement.getBaseChanFilePdf() : + mimplement.getBaseChanFile()); + req.setBasePasswAssessFile(StringUtils.isNotBlank(mimplement.getBasePasswAssessFilePdf()) ? mimplement.getBasePasswAssessFilePdf() : + mimplement.getBasePasswAssessFile()); + req.setBaseInforLevelFile(StringUtils.isNotBlank(mimplement.getBaseInforLevelFilePdf()) ? mimplement.getBaseInforLevelFilePdf() : + mimplement.getBaseInforLevelFile()); + req.setBaseEngineerPostpoFile(StringUtils.isNotBlank(mimplement.getBaseEngineerPostpoFilePdf()) ? mimplement.getBaseEngineerPostpoFilePdf() : + mimplement.getBaseEngineerPostpoFile()); + req.setBaseEstaSummFile(StringUtils.isNotBlank(mimplement.getBaseEstaSummFilePdf()) ? mimplement.getBaseEstaSummFilePdf() : + mimplement.getBaseEstaSummFile()); + req.setBaseFinalExpertOpinionFile(StringUtils.isNotBlank(mimplement.getBaseFinalExpertOpinionFilePdf()) ? mimplement.getBaseFinalExpertOpinionFilePdf() : + mimplement.getBaseFinalExpertOpinionFile()); + req.setBaseThirdAcceptFile(StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFilePdf()) ? mimplement.getBaseThirdAcceptFilePdf() : + mimplement.getBaseThirdAcceptFile()); + req.setBaseOperatMaintenSummFile(StringUtils.isNotBlank(mimplement.getBaseOperatMaintenSummFilePdf()) ? mimplement.getBaseOperatMaintenSummFilePdf() : + mimplement.getBaseOperatMaintenSummFile()); + req.setBaseEngineerAlterFile(StringUtils.isNotBlank(mimplement.getBaseEngineerAlterFilePdf()) ? mimplement.getBaseEngineerAlterFilePdf() : + mimplement.getBaseEngineerAlterFile()); + return req; + } + + public static ProjectCimplementReq convertCimplement(GovBizProjectCimplementDTO cimplement) { + ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); + return req; + } + + public static ProjectCimplementReq convertCimplementVo(GovBizProjectCimplementVO cimplement) { + ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); + return req; + } + + public static ProjectCimplementReq convertCimplementVoWithConvertPdf(GovBizProjectCimplementVO cimplement) { + ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); + if(Objects.isNull(req)){ + return req; + } + req.setBaseChangeFormFile(StringUtils.isNotBlank(cimplement.getBaseChangeFormFilePdf()) ? cimplement.getBaseChangeFormFilePdf() : + cimplement.getBaseChangeFormFile()); + req.setBaseUserConsFile(StringUtils.isNotBlank(cimplement.getBaseUserConsFilePdf()) ? cimplement.getBaseUserConsFilePdf() : + cimplement.getBaseUserConsFile()); + req.setBaseCheckFile(StringUtils.isNotBlank(cimplement.getBaseCheckFilePdf()) ? cimplement.getBaseCheckFilePdf() : + cimplement.getBaseCheckFile()); + req.setBaseChanFile(StringUtils.isNotBlank(cimplement.getBaseChanFilePdf()) ? cimplement.getBaseChanFilePdf() : + cimplement.getBaseChanFile()); + req.setBaseSummReportFile(StringUtils.isNotBlank(cimplement.getBaseSummReportFilePdf()) ? cimplement.getBaseSummReportFilePdf() : + cimplement.getBaseSummReportFile()); + req.setBasePasswAssessFile(StringUtils.isNotBlank(cimplement.getBasePasswAssessFilePdf()) ? cimplement.getBasePasswAssessFilePdf() : + cimplement.getBasePasswAssessFile()); + req.setBaseInforLevelFile(StringUtils.isNotBlank(cimplement.getBaseInforLevelFilePdf()) ? cimplement.getBaseInforLevelFilePdf() : + cimplement.getBaseInforLevelFile()); + req.setBaseEngineerPostpoFile(StringUtils.isNotBlank(cimplement.getBaseEngineerPostpoFilePdf()) ? cimplement.getBaseEngineerPostpoFilePdf() : + cimplement.getBaseEngineerPostpoFile()); + req.setBaseEstaSummFile(StringUtils.isNotBlank(cimplement.getBaseEstaSummFilePdf()) ? cimplement.getBaseEstaSummFilePdf() : + cimplement.getBaseEstaSummFile()); + req.setBaseFinanlAuditFile(StringUtils.isNotBlank(cimplement.getBaseFinanlAuditFilePdf()) ? cimplement.getBaseFinanlAuditFilePdf() : + cimplement.getBaseFinanlAuditFile()); + req.setBaseFinalExpertOpinionFile(StringUtils.isNotBlank(cimplement.getBaseFinalExpertOpinionFilePdf()) ? cimplement.getBaseFinalExpertOpinionFilePdf() : + cimplement.getBaseFinalExpertOpinionFile()); + req.setBaseThirdAcceptFile(StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFilePdf()) ? cimplement.getBaseThirdAcceptFilePdf() : + cimplement.getBaseThirdAcceptFile()); + req.setBaseInitialOpinionFile(StringUtils.isNotBlank(cimplement.getBaseInitialOpinionFilePdf()) ? cimplement.getBaseInitialOpinionFilePdf() : + cimplement.getBaseInitialOpinionFile()); + req.setBaseIrsTestRunFile(StringUtils.isNotBlank(cimplement.getBaseIrsTestRunFilePdf()) ? cimplement.getBaseIrsTestRunFilePdf() : + cimplement.getBaseIrsTestRunFile()); + return req; + } + + public static ProjectApproveReq convertApprove(GovBizProjectApproveDTO approve) { + ProjectApproveReq req = new ProjectApproveReq(); + if(Objects.isNull(approve)){ + return req; + } + req.setBaseProjId(approve.getBaseProjId()); + req.setBaseProjName(approve.getBaseProjName()); + req.setOp(approve.getOp()); + req.setApprovalFile(approve.getApprovalFile()); + req.setBaseReviewCommentsFile(approve.getBaseReviewCommentsFile()); + req.setPreliminaryDesignFile(approve.getPreliminaryDesignFile()); + req.setAreaCode(approve.getAreaCode()); + req.setBaseDevelopCode(approve.getBaseDevelopCode()); + req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); + req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); + req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); + req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); + req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); + req.setBaseReviewResults(approve.getBaseReviewResults()); + req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); + req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); + req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); + return req; + } + + public static ProjectApproveReq convertApproveVo(GovBizProjectApproveVO approve) { + ProjectApproveReq req = new ProjectApproveReq(); + if(Objects.isNull(approve)){ + return req; + } + req.setBaseProjId(approve.getBaseProjId()); + req.setBaseProjName(approve.getBaseProjName()); + req.setOp(approve.getOp()); + req.setApprovalFile(approve.getApprovalFile()); + req.setBaseReviewCommentsFile(approve.getBaseReviewCommentsFile()); + req.setPreliminaryDesignFile(approve.getPreliminaryDesignFile()); + req.setAreaCode(approve.getAreaCode()); + req.setBaseDevelopCode(approve.getBaseDevelopCode()); + req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); + req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); + req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); + req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); + req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); + req.setBaseReviewResults(approve.getBaseReviewResults()); + req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); + req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); + req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); + return req; + } + + public static ProjectApproveReq convertApproveVoWithConvertPdf(GovBizProjectApproveVO approve) { + ProjectApproveReq req = new ProjectApproveReq(); + if(Objects.isNull(approve)){ + return req; + } + req.setBaseProjId(approve.getBaseProjId()); + req.setBaseProjName(approve.getBaseProjName()); + req.setOp(approve.getOp()); + req.setApprovalFile(StringUtils.isNotBlank(approve.getApprovalFilePdf()) ? approve.getApprovalFilePdf() : + null); + req.setBaseReviewCommentsFile(StringUtils.isNotBlank(approve.getBaseReviewCommentsFilePdf()) ? approve.getBaseReviewCommentsFilePdf(): + null); + req.setPreliminaryDesignFile(StringUtils.isNotBlank(approve.getPreliminaryDesignFilePdf()) ? approve.getPreliminaryDesignFilePdf() : + null); + req.setAreaCode(approve.getAreaCode()); + req.setBaseDevelopCode(approve.getBaseDevelopCode()); + req.setBaseProjReplyAmount(Objects.nonNull(approve.getBaseProjReplyAmount()) ? String.valueOf(approve.getBaseProjReplyAmount()) : null); + req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); + req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); + req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); + req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); + req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); + req.setBaseReviewResults(approve.getBaseReviewResults()); + req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); + req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); + req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); + return req; + } + + public static ProjectApplyReq convertApply(GovBizProjectApplyDTO apply) { + ProjectApplyReq req = new ProjectApplyReq(); + if(Objects.isNull(apply)){ + return req; + } + req.setOp(apply.getOp()); + req.setBaseProjId(apply.getBaseProjId()); + req.setBaseProjName(apply.getBaseProjName()); + req.setAreaCode(apply.getAreaCode()); + req.setBaseAccountAppName(apply.getBaseAccountAppName()); + req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); + req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); + req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); + req.setBaseBrainName(apply.getBaseBrainName()); + req.setBaseDevelopCode(apply.getBaseDevelopCode()); + req.setBaseLowestLevel(apply.getBaseLowestLevel()); + req.setBaseHistorProjId(apply.getBaseHistorProjId()); + req.setBaseHistorProjName(apply.getBaseHistorProjName()); + req.setBaseOperatMaintenFile(apply.getBaseOperatMaintenFile()); + req.setBaseProjApplyFile(apply.getBaseProjApplyFile()); + req.setBaseProjBasisFile(apply.getBaseProjBasisFile()); + req.setBaseProjOtherFile(apply.getBaseProjOtherFile()); + req.setBaseResearchReportFile(apply.getBaseResearchReportFile()); + req.setBaseProjConsClass(apply.getBaseProjConsClass()); + req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); + req.setBaseProjIntro(apply.getBaseProjIntro()); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); + req.setBaseProjSetYear(apply.getBaseProjSetYear()); + req.setBaseProjSys(apply.getBaseProjSys()); + req.setBaseProjSysCode(apply.getBaseProjSysCode()); + req.setBaseProjDeclAmount(String.valueOf(apply.getBaseProjDeclAmount())); + req.setBaseProjTotalAmount(String.valueOf(apply.getBaseProjTotalAmount())); + req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); + req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); + req.setBaseProjRemark(apply.getBaseProjRemark()); + req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); + return req; + } + + public static ProjectApplyReq convertApplyVo(GovBizProjectApplyVO apply) { + ProjectApplyReq req = new ProjectApplyReq(); + if(Objects.isNull(apply)){ + return req; + } + req.setOp(apply.getOp()); + req.setBaseProjId(apply.getBaseProjId()); + req.setBaseProjName(apply.getBaseProjName()); + req.setAreaCode(apply.getAreaCode()); + req.setBaseAccountAppName(apply.getBaseAccountAppName()); + req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); + req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); + req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); + req.setBaseBrainName(apply.getBaseBrainName()); + req.setBaseDevelopCode(apply.getBaseDevelopCode()); + req.setBaseLowestLevel(apply.getBaseLowestLevel()); + req.setBaseHistorProjId(apply.getBaseHistorProjId()); + req.setBaseHistorProjName(apply.getBaseHistorProjName()); + req.setBaseOperatMaintenFile(apply.getBaseOperatMaintenFile()); + req.setBaseProjApplyFile(apply.getBaseProjApplyFile()); + req.setBaseProjBasisFile(apply.getBaseProjBasisFile()); + req.setBaseProjOtherFile(apply.getBaseProjOtherFile()); + req.setBaseResearchReportFile(apply.getBaseResearchReportFile()); + req.setBaseProjConsClass(apply.getBaseProjConsClass()); + req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); + req.setBaseProjIntro(apply.getBaseProjIntro()); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); + req.setBaseProjSetYear(apply.getBaseProjSetYear()); + req.setBaseProjSys(apply.getBaseProjSys()); + req.setBaseProjSysCode(apply.getBaseProjSysCode()); + req.setBaseProjDeclAmount(String.valueOf(apply.getBaseProjDeclAmount())); + req.setBaseProjTotalAmount(String.valueOf(apply.getBaseProjTotalAmount())); + req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); + req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); + req.setBaseProjRemark(apply.getBaseProjRemark()); + req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); + return req; + } + + public static ProjectApplyReq convertApplyVoWithConvertPdf(GovBizProjectApplyVO apply) { + ProjectApplyReq req = new ProjectApplyReq(); + if(Objects.isNull(apply)){ + return req; + } + req.setOp(apply.getOp()); + req.setBaseProjId(apply.getBaseProjId()); + req.setBaseProjName(apply.getBaseProjName()); + req.setAreaCode(apply.getAreaCode()); + req.setBaseAccountAppName(apply.getBaseAccountAppName()); + req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); + req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); +// req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); + req.setBaseBrainName(apply.getBaseBrainName()); + req.setBaseDevelopCode(apply.getBaseDevelopCode()); + req.setBaseLowestLevel(apply.getBaseLowestLevel()); + if(Objects.nonNull(apply.getMissing()) && apply.getMissing()){ + req.setBaseHistorProjId(BizProjectContant.ProjectCollection.MISSING_HIS_PROJ_ID); + req.setBaseHistorProjName(BizProjectContant.ProjectCollection.MISSING_HIS_PROJ_NAME); + }else{ + req.setBaseHistorProjId(apply.getBaseHistorProjId()); + req.setBaseHistorProjName(apply.getBaseHistorProjName()); + } + req.setBaseOperatMaintenFile(StringUtils.isNotBlank(apply.getBaseOperatMaintenFilePdf()) ? apply.getBaseOperatMaintenFilePdf() : + apply.getBaseOperatMaintenFile()); + req.setBaseProjApplyFile(StringUtils.isNotBlank(apply.getBaseProjApplyFilePdf()) ? apply.getBaseProjApplyFilePdf() : + apply.getBaseProjApplyFile()); + req.setBaseProjBasisFile(StringUtils.isNotBlank(apply.getBaseProjBasisFilePdf()) ? apply.getBaseProjBasisFilePdf() : + apply.getBaseProjBasisFile()); + req.setBaseProjOtherFile(StringUtils.isNotBlank(apply.getBaseProjOtherFilePdf()) ? apply.getBaseProjOtherFilePdf() : + apply.getBaseProjOtherFile()); + req.setBaseResearchReportFile(StringUtils.isNotBlank(apply.getBaseResearchReportFilePdf()) ? apply.getBaseResearchReportFilePdf() : + apply.getBaseResearchReportFile()); + req.setBaseProjConsClass(apply.getBaseProjConsClass()); + req.setBaseProjDuration((StringUtils.isNotBlank(apply.getBaseProjDuration()) ? apply.getBaseProjDuration() : "0") + + BizProjectContant.ProjectCollection.MONTH); + req.setBaseProjIntro(apply.getBaseProjIntro()); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); + req.setBaseProjSetYear(apply.getBaseProjSetYear()); + req.setBaseProjSys(apply.getBaseProjSys()); + req.setBaseProjSysCode(apply.getBaseProjSysCode()); + req.setBaseProjDeclAmount(Objects.nonNull(apply.getBaseProjDeclAmount()) ? String.valueOf(apply.getBaseProjDeclAmount()) : null); + req.setBaseProjTotalAmount(Objects.nonNull(apply.getBaseProjTotalAmount()) ? String.valueOf(apply.getBaseProjTotalAmount()) : null); + req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); + req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); + req.setBaseProjRemark(apply.getBaseProjRemark()); + req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); + return req; + } + + public static ProjectBaseInfoReq convertBase(GovBizProjectBaseinfoDTO baseinfo,String isEffective) { + ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); + req.setIsEffective(isEffective); + return req; + } + + public static ProjectBaseInfoReq convertBaseVo(GovBizProjectBaseinfoVO baseinfo,String isEffective) { + ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); + req.setIsEffective(isEffective); + return req; + } + + public static ProjectBaseInfoReq convertBaseVo(GovOperationProjectBaseinfoVO baseinfo,String isEffective) { + ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); + req.setIsEffective(isEffective); + return req; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/BelongOrg.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/BelongOrg.java new file mode 100644 index 0000000..d74594b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/BelongOrg.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.gov.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; + +/** + *

+ * + *

+ * + * @author liuxinxin + * @since 2023-04-18 + */ +@Data +@TableName("belong_org") +@ApiModel(value = "BelongOrg对象") +public class BelongOrg implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("组织code") + private String orgCode; + + @ApiModelProperty("组织名称") + private String orgName; + + @ApiModelProperty("所属组织code") + private String belongCode; + + @ApiModelProperty("所属组织名称") + private String belongName; + + @ApiModelProperty("组织类型") + private String orgType; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/GovBusinessStrip.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/GovBusinessStrip.java new file mode 100644 index 0000000..35d5308 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/GovBusinessStrip.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.gov.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author liuxinxin + * @since 2023-04-13 + */ +@TableName("gov_business_strip") +@ApiModel(value = "GovBusinessStrip对象", description = "") +public class GovBusinessStrip implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private String businessStripCode; + + private String businessStripName; + + private String parentCode; + + private String parentName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public String getBusinessStripCode() { + return businessStripCode; + } + + public void setBusinessStripCode(String businessStripCode) { + this.businessStripCode = businessStripCode; + } + public String getBusinessStripName() { + return businessStripName; + } + + public void setBusinessStripName(String businessStripName) { + this.businessStripName = businessStripName; + } + public String getParentCode() { + return parentCode; + } + + public void setParentCode(String parentCode) { + this.parentCode = parentCode; + } + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + @Override + public String toString() { + return "GovBusinessStrip{" + + "id=" + id + + ", businessStripCode=" + businessStripCode + + ", businessStripName=" + businessStripName + + ", parentCode=" + parentCode + + ", parentName=" + parentName + + "}"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/BelongTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/BelongTypeEnum.java new file mode 100644 index 0000000..9a21d3a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/BelongTypeEnum.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.gov.enumeration; + +/** + * @author liuxinxin + * @date 2023/4/18 下午2:48 + */ + +public enum BelongTypeEnum { + + /** + * 组织 + */ + ORGANIZATION, + + /** + * 条线 + */ + GOV_BUSINESS_STRIP + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectClassifiedEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectClassifiedEnum.java new file mode 100644 index 0000000..29e16da --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectClassifiedEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.gov.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * GovProjectClassifiedEnum + * + * @return + * @author ZPF + * @since 2023/10/24 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum GovProjectClassifiedEnum { + /** + * 是否涉密 + */ + NOT_CLASSIFIED("01", "非涉密"), + CLASSIFIED("02", "涉密"),; + + private String code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (GovProjectClassifiedEnum t : GovProjectClassifiedEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static GovProjectClassifiedEnum match(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (GovProjectClassifiedEnum t : GovProjectClassifiedEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectStatusEnum.java new file mode 100644 index 0000000..b5f5f13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/enumeration/GovProjectStatusEnum.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.gov.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * GovProjectStatusEnum + * + * @return + * @author ZPF + * @since 2023/10/24 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum GovProjectStatusEnum { + /** + * 项目归集 状态 + */ + APPROVAL("01", "评审中"), + PENDING("02", "待立项"), + REJECTED("03","已驳回"), + APPROVED("04","已立项"), + PURCHASED("05","已采购"), + HAS_PRE_INS("06","已初验"), + HAS_FINAL_INS("07","已终验"), + TERMINATED("00","已终止"); + + private String code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static GovProjectStatusEnum match(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/helper/GovBusinessStripHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/helper/GovBusinessStripHelper.java new file mode 100644 index 0000000..7098b64 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/helper/GovBusinessStripHelper.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.gov.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.hz.pm.api.gov.entity.BelongOrg; +import com.hz.pm.api.gov.service.IBelongOrgService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/4/21 下午2:07 + */ + +@Component +@RequiredArgsConstructor +public class GovBusinessStripHelper { + + private final IBelongOrgService iBelongOrgService; + + public List assemblerBusinessStripInfoList(List businessStripCodeList) { + List businessStripInfoList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(businessStripCodeList)) { + Map codeNameMap = iBelongOrgService.list(Wrappers + .lambdaQuery(BelongOrg.class).in(BelongOrg::getOrgCode, businessStripCodeList)) + .stream().collect(Collectors.toMap(BelongOrg::getOrgCode, BelongOrg::getOrgName)); + + businessStripCodeList.forEach(r -> { + ExpertGovBusinessStrip businessStripInfo = new ExpertGovBusinessStrip(); + businessStripInfo.setBusinessStripCode(r); + businessStripInfo.setBusinessStripName(codeNameMap.get(r)); + businessStripInfoList.add(businessStripInfo); + }); + } + return businessStripInfoList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/BelongOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/BelongOrgManage.java new file mode 100644 index 0000000..b3cf403 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/BelongOrgManage.java @@ -0,0 +1,219 @@ +package com.hz.pm.api.gov.manage; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertGovBusinessStripService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.gov.entity.BelongOrg; +import com.hz.pm.api.gov.enumeration.BelongTypeEnum; +import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; +import com.hz.pm.api.gov.service.IBelongOrgService; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/4/18 下午2:27 + */ + +@Component +@RequiredArgsConstructor +public class BelongOrgManage { + + private final IBelongOrgService iBelongOrgService; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final IDingOrganizationService dingOrganizationService; + private final IExpertGovBusinessStripService expertGovBusinessStripService; + + + public void generateBusinessStripOrg() { + // 条线Set + Set businessStripSet = new HashSet<>(); + + // 组织 Set + Set orgSet = new HashSet<>(); + + try { + //创建工作簿对象 + XSSFWorkbook xssfWorkbook = new XSSFWorkbook(Files.newInputStream(Paths.get("/Users/liuxinxin/Desktop/gov_business_strip_inport.xlsx"))); + //获取工作簿下sheet的个数 + int sheetNum = xssfWorkbook.getNumberOfSheets(); + System.out.println("该excel文件中总共有:" + sheetNum + "个sheet"); + //遍历工作簿中的所有数据 + for (int i = 0; i < sheetNum; i++) { + //读取第i个工作表 + System.out.println("读取第" + (i + 1) + "个sheet"); + XSSFSheet sheet = xssfWorkbook.getSheetAt(i); + //获取最后一行的num,即总行数。此处从0开始 + int maxRow = sheet.getLastRowNum(); + + // 条线code + // 条线名称 + String businessStripOrgCode = sheet.getRow(1).getCell(0) + ""; + String businessStripOrgName = sheet.getRow(1).getCell(1) + ""; + String uniqKey = businessStripOrgCode + "####" + businessStripOrgName; + businessStripSet.add(uniqKey); + + for (int row = 1; row <= maxRow; row++) { + //获取最后单元格num,即总单元格数 ***注意:此处从1开始计数*** + + String cell2 = getCellStr(sheet, row, 2); + String cell3 = getCellStr(sheet, row, 3); + if (StringUtils.isNotBlank(cell2) && StringUtils.isNotBlank(cell3)) { + String orgUniqKey = uniqKey + "&&&" + cell2 + "####" + cell3; + orgSet.add(orgUniqKey); + } + + String cell4 = getCellStr(sheet, row, 4); + String cell5 = getCellStr(sheet, row, 5); + + if (StringUtils.isNotBlank(cell4) && StringUtils.isNotBlank(cell5)) { + String orgUniqKey = uniqKey + "&&&" + cell4 + "####" + cell5; + orgSet.add(orgUniqKey); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } + List orgList = orgSet.stream().map(BelongOrgManage::buildBelongOrg).collect(Collectors.toList()); + List belongOrgList = businessStripSet.stream().map(BelongOrgManage::buildBusinessStrip).collect(Collectors.toList()); + + iBelongOrgService.saveBatch(orgList); + iBelongOrgService.saveBatch(belongOrgList); + } + + public static BelongOrg buildBusinessStrip(String businessStripStr) { + String[] split = businessStripStr.split("&&&"); + String busStrip = split[0]; + String[] split1 = busStrip.split("####"); + String belongOrgCode = split1[0]; + String belongOrgName = split1[1]; + + BelongOrg belongOrg = new BelongOrg(); + belongOrg.setOrgCode(belongOrgCode); + belongOrg.setOrgName(belongOrgName); + belongOrg.setBelongCode(belongOrgCode); + belongOrg.setBelongName(belongOrgName); + belongOrg.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name()); + return belongOrg; + } + + public static BelongOrg buildBelongOrg(String orgStr) { + String[] split = orgStr.split("&&&"); + String busStrip = split[0]; + String[] split1 = busStrip.split("####"); + String belongOrgCode = split1[0]; + String belongOrgName = split1[1]; + + String org = split[1]; + String[] split2 = org.split("####"); + String orgCode = split2[0]; + String orgName = split2[1]; + + BelongOrg belongOrg = new BelongOrg(); + belongOrg.setOrgCode(orgCode); + belongOrg.setOrgName(orgName); + belongOrg.setBelongCode(belongOrgCode); + belongOrg.setBelongName(belongOrgName); + belongOrg.setOrgType(BelongTypeEnum.ORGANIZATION.name()); + return belongOrg; + } + + public static String getCellStr(XSSFSheet sheet, int row, int col) { + if (Objects.isNull(sheet)) { + return null; + } + XSSFRow row1 = sheet.getRow(row); + if (Objects.isNull(row1)) { + return null; + } + XSSFCell cell = row1.getCell(col); + if (Objects.isNull(cell)) { + return null; + } + return cell + "".trim(); + } + + + public List getGovBusinessStripList(String businessStripName) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(BelongOrg.class) + .like(StrUtil.isNotBlank(businessStripName), BelongOrg::getBelongName, businessStripName) + .eq(BelongOrg::getOrgType, BelongTypeEnum.GOV_BUSINESS_STRIP.name()); + List belongOrgs = iBelongOrgService.list(query); + return belongOrgs.stream().map(r -> { + GovBusinessStripVO govBusinessStripVO = new GovBusinessStripVO(); + govBusinessStripVO.setBusinessStripCode(r.getOrgCode()); + govBusinessStripVO.setBusinessStripName(r.getOrgName()); + return govBusinessStripVO; + }).collect(Collectors.toList()); + } + + @Transactional(rollbackFor = Exception.class) + public void analysisExpertOrg() { + List expertUserFullInfoList = expertUserFullInfoService.list(); + for (ExpertUserFullInfo userFullInfo : expertUserFullInfoList) { + String company = userFullInfo.getCompany(); + + if (StringUtils.isNotBlank(company)) { + // 获取专家信息 + List dingOrganizationList = dingOrganizationService + .list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationName, company.trim())); + + if (CollectionUtils.isNotEmpty(dingOrganizationList)) { + // 获取专家组织code + DingOrganization dingOrganization = dingOrganizationList.get(0); + String organizationCode = dingOrganization.getOrganizationCode(); + + List belongOrgList = iBelongOrgService + .list(Wrappers.lambdaQuery(BelongOrg.class) + .eq(BelongOrg::getOrgCode, organizationCode.trim())); + if (CollectionUtils.isNotEmpty(belongOrgList)) { + // 获取专家条线code + Set belongOrgSet = new HashSet<>(); + List saveList = new ArrayList<>(); + for (BelongOrg belongOrg : belongOrgList) { + if (belongOrgSet.add(belongOrg.getBelongCode())) { + saveList.add(belongOrg); + } + } + expertGovBusinessStripService.remove(Wrappers.lambdaQuery(ExpertGovBusinessStrip.class) + .eq(ExpertGovBusinessStrip::getExpertUserId, userFullInfo.getUserId())); + + List expertBusinessStripSaveRecordList = saveList.stream().map(r -> { + ExpertGovBusinessStrip expertBusinessStrip = new ExpertGovBusinessStrip(); + expertBusinessStrip.setExpertUserId(userFullInfo.getUserId()); + expertBusinessStrip.setBusinessStripCode(r.getBelongCode()); + expertBusinessStrip.setBusinessStripName(r.getBelongName()); + return expertBusinessStrip; + }).collect(Collectors.toList()); + expertGovBusinessStripService.saveBatch(expertBusinessStripSaveRecordList); + } + } + } + + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java new file mode 100644 index 0000000..dc0f1cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -0,0 +1,2044 @@ +package com.hz.pm.api.gov.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +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.google.common.collect.Lists; +import com.google.common.collect.Maps; +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.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.convert.ProjectConvert; +import com.hz.pm.api.gov.model.dto.*; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.model.req.ProjectBaseInfoReq; +import com.hz.pm.api.gov.model.req.ProjectPushReq; +import com.hz.pm.api.gov.model.vo.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.entity.*; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.service.*; +import com.hz.pm.api.provincial.manage.ProvincialManage; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; +import com.hz.pm.api.safety.service.IPersonSafetyInfoService; +import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.hz.pm.api.wps.manage.WpsConvertManage; +import com.wflow.bean.entity.WflowCcTasks; +import com.wflow.service.WflowCcTasksService; +import io.swagger.annotations.ApiModelProperty; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.IOUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RuntimeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; + +import java.io.*; +import java.lang.reflect.Field; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author zpf + * @date 2023/8/21 下午2:27 + */ + +@Component +@RequiredArgsConstructor +@Slf4j +public class GovProjectCollectionManage { + + private final IGovProjectDictionaryService dictionaryService; + + private final IGovBizProjectApplyService projectApplyService; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; + + private final IGovBizProjectApproveService approveService; + + private final IGovBizProjectCimplementService cimplementService; + + private final IGovBizProjectMimplementService mimplementService; + + private final IGovBizProjectProcureService procureService; + + private final GenerateProjectCodeUtil generateProjectCodeUtil; + + private final IGovBizProjectDraftService draftService; + + private final IGovOperationProjectDraftService operationProjectDraftService; + + private final RestTemplate restTemplate; + + private final WpsConvertManage wpsConvertManage; + + private final ThreadPoolTaskScheduler threadPoolTaskScheduler; + + private final FileService fileService; + + @Value("${project.push-url}") + private String pushUrl; + + @Value("${project.no-effective-url}") + private String noEffectiveUrl; + + @Value("${project.delete-all-url}") + private String deleteAllUrl; + + @Value("${spring.profiles.active}") + private String active; + + private final RegionCacheHelper regionCacheHelper; + + private final IProjectService projectService; + private final IProjectApplicationService applicationService; + + private final IProjectInstService projectInstService; + + private final RuntimeService runtimeService; + + private final HistoryService historyService; + + private final WflowCcTasksService ccTasksService; + + private final IOperationService operationService; + + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; + + private final IProjectStagingService stagingService; + + private final INdProjectStatusChangeService statusChangeService; + + private final IPurchaseService purchaseService; + + private final IProjectTagService projectTagService; + + private final ISupplierSafetyQualificationService supplierSafetyQualificationService; + private final IPreInsAcceptancePersonService preInsAcceptancePersonService; + private final IPersonSafetyInfoService personService; + + public List dictionary(String type) { + + List dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class) + .eq(StringUtils.isNotBlank(type), GovProjectDictionary::getType, type) + .eq(GovProjectDictionary::getDeleted,Boolean.FALSE)); + + if(CollUtil.isEmpty(dictionaries)){ + return Collections.emptyList(); + } + + return dictionaries.stream().map(d -> BeanUtil.copyProperties(d,GovProjectDictionaryVO.class)) + .collect(Collectors.toList()); + } + + /** + * 分页查 项目归集 + * @param req + * @return + */ + public PageVo list(ProjectListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectBaseinfo::getBaseProjType,req.getProjectType()) + .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovBizProjectBaseinfo::getBaseProjId,req.getProjectCodes()) + .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), + GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), + ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) + .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), + GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), + ProjectTypeNewEnum.XU_OPERA.getCode())) + .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) + .orderByDesc(GovBizProjectBaseinfo::getBizTime); +// permissions(wrapper); + baseinfoService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List projIds = page.getRecords().stream() + .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) + .map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); + + Map applyMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projIds)){ + List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,projIds) + .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); + applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); + } + + Map finalApplyMap = applyMap; + List res = page.getRecords().stream().map(p -> { + GovBizProjectListVO vo = new GovBizProjectListVO(); + vo.setBaseAreaCode(p.getBaseAreaCode()); + vo.setBaseAreaName(p.getBaseAreaName()); + vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); + vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); + vo.setBaseProjId(p.getBaseProjId()); + vo.setBaseProjName(p.getBaseProjName()); + if(finalApplyMap.containsKey(p.getBaseProjId())){ + GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); + vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); + vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); + vo.setBaseProjSetYear(apply.getBaseProjSetYear()); + } + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 运维项目归集列表 + * @param req + * @return + */ + public PageVo operationList(ProjectListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectBaseinfo::getBaseProjType,req.getProjectType()) + .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovOperationProjectBaseinfo::getBaseProjId,req.getProjectCodes()) + .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) + .orderByDesc(GovOperationProjectBaseinfo::getBizTime); + operationProjectBaseinfoService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List projIds = page.getRecords().stream() + .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) + .map(GovOperationProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); + + Map applyMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projIds)){ + List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,projIds) + .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); + applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); + } + + Map finalApplyMap = applyMap; + List res = page.getRecords().stream().map(p -> { + GovBizProjectListVO vo = new GovBizProjectListVO(); + vo.setBaseAreaCode(p.getBaseAreaCode()); + vo.setBaseAreaName(p.getBaseAreaName()); + vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); + vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); + vo.setBaseProjId(p.getBaseProjId()); + vo.setBaseProjName(p.getBaseProjName()); + if(finalApplyMap.containsKey(p.getBaseProjId())){ + GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); + vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); + vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); + vo.setBaseProjSetYear(apply.getBaseProjSetYear()); + } + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 草稿箱列表 + * @param req + * @return + */ + public PageVo draftList(ProjectListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectDraft.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectDraft::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectDraft::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectDraft::getTongTime,req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectDraft::getBaseProjType,req.getProjectType()) + .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), + GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), + ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) + .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), + GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), + ProjectTypeNewEnum.XU_OPERA.getCode())) + .eq(GovBizProjectDraft::getDeleted,Boolean.FALSE) + .eq(GovBizProjectDraft::getCreateId,user.getUserId()) + .orderByDesc(GovBizProjectDraft::getBizTime); + draftService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + GovBizProjectListVO vo = new GovBizProjectListVO(); + vo.setBaseAreaCode(p.getBaseAreaCode()); + vo.setBaseAreaName(p.getBaseAreaName()); + vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); + vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); + vo.setBaseProjId(p.getBaseProjId()); + vo.setBaseProjName(p.getBaseProjName()); + vo.setBaseProjDeclAmount(p.getBaseProjDeclAmount()); + vo.setBaseProjTotalAmount(p.getBaseProjTotalAmount()); + vo.setBaseProjSetYear(p.getBaseProjSetYear()); + vo.setDraftId(p.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + public PageVo operationDraftList(ProjectListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectDraft.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectDraft::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectDraft::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectDraft::getTongTime,req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectDraft::getBaseProjType,req.getProjectType()) + .eq(GovOperationProjectDraft::getDeleted,Boolean.FALSE) + .eq(GovOperationProjectDraft::getCreateId,user.getUserId()) + .orderByDesc(GovOperationProjectDraft::getBizTime); + operationProjectDraftService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + GovBizProjectListVO vo = new GovBizProjectListVO(); + vo.setBaseAreaCode(p.getBaseAreaCode()); + vo.setBaseAreaName(p.getBaseAreaName()); + vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); + vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); + vo.setBaseProjId(p.getBaseProjId()); + vo.setBaseProjName(p.getBaseProjName()); + vo.setBaseProjDeclAmount(p.getBaseProjDeclAmount()); + vo.setBaseProjTotalAmount(p.getBaseProjTotalAmount()); + vo.setBaseProjSetYear(p.getBaseProjSetYear()); + vo.setDraftId(p.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 数据权限 + * @param wrapper + */ + private void permissions(LambdaQueryWrapper wrapper) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + //超管和区域管理员 + if(user.getSuperAdmin() || user.getRegionAdmin()){ + log.info("超管和区管 可以看所有"); + return; + } + + wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); + } + + public Long count(ProjectListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getAreaCode,req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode()) + .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) + .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) + .orderByDesc(GovBizProjectBaseinfo::getBizTime); + return baseinfoService.count(wrapper); + } + + public Long operationCount(ProjectListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getAreaCode,req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getAreaCode,req.getRegionCode()) + .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) + .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) + .orderByDesc(GovOperationProjectBaseinfo::getBizTime); + return operationProjectBaseinfoService.count(wrapper); + } + + /** + * 项目归集详情 + * @param projId + * @return + */ + public GovBizProjectDetailVO detail(String projId) { + GovBizProjectDetailVO res = new GovBizProjectDetailVO(); + //1.先查 基本信息 + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projId) + .orderByDesc(GovBizProjectBaseinfo::getBizTime) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(baseinfo)){ + return res; + } + res.setBaseProjId(baseinfo.getBaseProjId()); + res.setBaseProjName(baseinfo.getBaseProjName()); + res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoVO.class)); + + //2.再查 申报信息 + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projId) + .orderByDesc(GovBizProjectApply::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(apply)){ + res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); + } + + //3.再查 审批信息 + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, projId) + .orderByDesc(GovBizProjectApprove::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); + } + + //4 对应查询 实施项目还是运维项目 + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, projId) + .orderByDesc(GovBizProjectCimplement::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); + } + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, projId) + .orderByDesc(GovBizProjectMimplement::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); + } + + //5.最后查询采购信息 + List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, projId) + .orderByDesc(GovBizProjectProcure::getBizTime)); + if(CollUtil.isNotEmpty(procures)){ + res.setProcures(procures.stream() + .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) + .collect(Collectors.toList())); + } + + return res; + } + + public GovOperationProjectDetailVO operationDetail(String projId) { + GovOperationProjectDetailVO res = new GovOperationProjectDetailVO(); + //1.先查 基本信息 + GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projId) + .orderByDesc(GovOperationProjectBaseinfo::getBizTime) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(baseinfo)){ + return res; + } + res.setBaseProjId(baseinfo.getBaseProjId()); + res.setBaseProjName(baseinfo.getBaseProjName()); + res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovOperationProjectBaseinfoVO.class)); + + //2.再查 申报信息 + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projId) + .orderByDesc(GovBizProjectApply::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(apply)){ + res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); + } + + //3.再查 审批信息 + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, projId) + .orderByDesc(GovBizProjectApprove::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); + } + + //4 对应查询 实施项目还是运维项目 + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, projId) + .orderByDesc(GovBizProjectCimplement::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); + } + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, projId) + .orderByDesc(GovBizProjectMimplement::getBizTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); + } + + //5.最后查询采购信息 + List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, projId) + .orderByDesc(GovBizProjectProcure::getBizTime)); + if(CollUtil.isNotEmpty(procures)){ + res.setProcures(procures.stream() + .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) + .collect(Collectors.toList())); + } + + return res; + } + + /** + * 草稿箱详情 + * @param draftId + * @return + */ + public GovBizProjectDetailVO draftDetail(Long draftId) { + GovBizProjectDetailVO res = new GovBizProjectDetailVO(); + //查询草稿表 + GovBizProjectDraft draft = draftService.getById(draftId); + + if(Objects.isNull(draft)){ + return null; + } + res.setDraftId(draftId); + + //1.基本信息 + res.setBaseProjId(draft.getBaseProjId()); + res.setBaseProjName(draft.getBaseProjName()); + res.setBaseinfo(BeanUtil.copyProperties(draft, GovBizProjectBaseinfoVO.class)); + + //2.申报信息 + res.setApply(BeanUtil.copyProperties(draft, GovBizProjectApplyVO.class)); + + //3.再查 审批信息 + res.setApprove(BeanUtil.copyProperties(draft, GovBizProjectApproveVO.class)); + + //4 对应查询 实施项目还是运维项目 + GovBizProjectCimplementVO cimplementVo = BeanUtil.copyProperties(draft, GovBizProjectCimplementVO.class); + cimplementVo.setBaseChanFile(draft.getBaseChanFileCimplement()); + cimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileCimplement()); + cimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileCimplement()); + cimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileCimplement()); + cimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileCimplement()); + cimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileCimplement()); + cimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileCimplement()); + cimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileCimplement()); + cimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationCimplement()); + cimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsCimplement()); + res.setCimplement(cimplementVo); + GovBizProjectMimplementVO mimplementVo = BeanUtil.copyProperties(draft, GovBizProjectMimplementVO.class); + mimplementVo.setBaseChanFile(draft.getBaseChanFileMimplement()); + mimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileMimplement()); + mimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileMimplement()); + mimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileMimplement()); + mimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileMimplement()); + mimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileMimplement()); + mimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileMimplement()); + mimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileMimplement()); + mimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationMimplement()); + mimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsMimplement()); + res.setMimplement(mimplementVo); + + //5.最后查询采购信息 + if(StringUtils.isNotBlank(draft.getProcure())){ + try{ + res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); + }catch (Exception e){ + log.error("草稿箱采购出错:" + e.getMessage()); + } + } + + return res; + } + + + public GovOperationProjectDetailVO operationDraftDetail(Long draftId) { + GovOperationProjectDetailVO res = new GovOperationProjectDetailVO(); + //查询草稿表 + GovOperationProjectDraft draft = operationProjectDraftService.getById(draftId); + + if(Objects.isNull(draft)){ + return null; + } + res.setDraftId(draftId); + + //1.基本信息 + res.setBaseProjId(draft.getBaseProjId()); + res.setBaseProjName(draft.getBaseProjName()); + res.setBaseinfo(BeanUtil.copyProperties(draft, GovOperationProjectBaseinfoVO.class)); + + //2.申报信息 + res.setApply(BeanUtil.copyProperties(draft, GovBizProjectApplyVO.class)); + + //3.再查 审批信息 + res.setApprove(BeanUtil.copyProperties(draft, GovBizProjectApproveVO.class)); + + //4 对应查询 实施项目还是运维项目 + GovBizProjectCimplementVO cimplementVo = BeanUtil.copyProperties(draft, GovBizProjectCimplementVO.class); + cimplementVo.setBaseChanFile(draft.getBaseChanFileCimplement()); + cimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileCimplement()); + cimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileCimplement()); + cimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileCimplement()); + cimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileCimplement()); + cimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileCimplement()); + cimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileCimplement()); + cimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileCimplement()); + cimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationCimplement()); + cimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsCimplement()); + res.setCimplement(cimplementVo); + GovBizProjectMimplementVO mimplementVo = BeanUtil.copyProperties(draft, GovBizProjectMimplementVO.class); + mimplementVo.setBaseChanFile(draft.getBaseChanFileMimplement()); + mimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileMimplement()); + mimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileMimplement()); + mimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileMimplement()); + mimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileMimplement()); + mimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileMimplement()); + mimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileMimplement()); + mimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileMimplement()); + mimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationMimplement()); + mimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsMimplement()); + res.setMimplement(mimplementVo); + + //5.最后查询采购信息 + if(StringUtils.isNotBlank(draft.getProcure())){ + try{ + res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); + }catch (Exception e){ + log.error("草稿箱采购出错:" + e.getMessage()); + } + } + + return res; + } + + /** + * 项目归集保存 + * @param saveDTO + * @return + */ + @Transactional + public String save(GovBizProjectSaveDTO saveDTO,UserInfoDetails user) { + if(Objects.isNull(user)){ + user = LoginUserUtil.loginUserDetail(); + } + + GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); + String baseProjId = saveDTO.getBaseProjId(); + String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; + String baseProjName = base.getBaseProjName(); + + //1.保存基本信息 + GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); + baseinfo.setBaseProjId(baseProjId); + baseinfo.setBaseProjName(baseProjName); + baseinfo.setBaseAreaCode(baseAreaCode); + baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + GovBizProjectBaseinfo oldBaseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + //项目名去重 + checkName(baseProjName,baseProjId); + GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfo.class); + saveBase.setBaseProjName(baseProjName); + saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + if(Objects.nonNull(oldBaseInfo)){ + saveBase.setId(oldBaseInfo.getId()); + saveBase.setBaseAreaCode(null); + }else{ + saveBase.setTongTime(LocalDateTime.now()); + saveBase.setBaseAreaCode(baseAreaCode); + saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); + } + saveBase.setAreaCode(RegionConst.RC_LS); + saveBase.setBizTime(LocalDateTime.now()); + saveBase.setUpdateBy(user.getUsername()); + saveBase.setUpdateOn(LocalDateTime.now()); + + //如果是新增的话 要生成 项目编号 + if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ + baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + saveBase.setBaseProjId(baseProjId); + } + + baseinfoService.saveOrUpdate(saveBase); + + // 2.保存 申报信息 + GovBizProjectApplyDTO apply = saveDTO.getApply(); + if(Objects.nonNull(apply)){ + apply.setBaseProjId(baseProjId); + apply.setBaseProjName(baseProjName); + GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); + saveApply.setBaseProjId(baseProjId); + if(Objects.nonNull(oldApply)){ + saveApply.setId(oldApply.getId()); + }else{ + saveApply.setTongTime(LocalDateTime.now()); + } + if(Objects.nonNull(saveApply.getBaseProjStartTime()) && + Objects.nonNull(saveApply.getBaseProjEndTime())){ + saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), + saveApply.getBaseProjEndTime())); + } + saveApply.setAreaCode(RegionConst.RC_LS); + saveApply.setBizTime(LocalDateTime.now()); + saveApply.setUpdateBy(user.getUsername()); + saveApply.setUpdateOn(LocalDateTime.now()); + if(projectApplyService.saveOrUpdate(saveApply)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); + } + } + + // 3.保存 审批信息 + GovBizProjectApproveDTO approve = saveDTO.getApprove(); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(baseProjId); + approve.setBaseProjName(baseProjName); + GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); + saveApprove.setBaseProjId(baseProjId); + if(Objects.nonNull(oldApprove)){ + saveApprove.setId(oldApprove.getId()); + }else{ + saveApprove.setTongTime(LocalDateTime.now()); + } + saveApprove.setBizTime(LocalDateTime.now()); + saveApprove.setAreaCode(RegionConst.RC_LS); + saveApprove.setUpdateBy(user.getUsername()); + saveApprove.setUpdateOn(LocalDateTime.now()); + if(approveService.saveOrUpdate(saveApprove)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); + } + } + + // 4.保存 建设项目 实施信息 + GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(baseProjId); + cimplement.setBaseProjName(baseProjName); + cimplement.setBaseBidCode(baseProjId); + cimplement.setBaseBidName(baseProjName); + GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); + saveCimplement.setBaseProjId(baseProjId); + saveCimplement.setBaseBidCode(baseProjId); + saveCimplement.setBaseBidName(baseProjName); + if(Objects.nonNull(oldCimplement)){ + saveCimplement.setId(oldCimplement.getId()); + }else{ + saveCimplement.setTongTime(LocalDateTime.now()); + } + saveCimplement.setAreaCode(RegionConst.RC_LS); + saveCimplement.setBizTime(LocalDateTime.now()); + saveCimplement.setUpdateBy(user.getUsername()); + saveCimplement.setUpdateOn(LocalDateTime.now()); + if(cimplementService.saveOrUpdate(saveCimplement)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); + } + } + + // 5.保存 运维项目 实施信息 + GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(baseProjId); + mimplement.setBaseProjName(baseProjName); + mimplement.setBaseBidCode(baseProjId); + mimplement.setBaseBidName(baseProjName); + GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); + saveMimplement.setBaseProjId(baseProjId); + saveMimplement.setBaseBidCode(baseProjId); + saveMimplement.setBaseBidName(baseProjName); + if(Objects.nonNull(oldMimplement)){ + saveMimplement.setId(oldMimplement.getId()); + }else{ + saveMimplement.setTongTime(LocalDateTime.now()); + } + if(Objects.nonNull(saveBase.getAreaCode())){ + saveMimplement.setAreaCode(saveBase.getAreaCode()); + } + saveMimplement.setAreaCode(RegionConst.RC_LS); + saveMimplement.setBizTime(LocalDateTime.now()); + saveMimplement.setUpdateBy(user.getUsername()); + saveMimplement.setUpdateOn(LocalDateTime.now()); + if(mimplementService.saveOrUpdate(saveMimplement)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); + } + } + + // 6.保存 采购信息 + List procures = saveDTO.getProcures(); + + if(Objects.nonNull(procures)){ + procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); + + String finalBaseProjId = baseProjId; + UserInfoDetails finalUser = user; + + Integer index = 1; + for(GovBizProjectProcureDTO procure : procures){ + procure.setBaseProjId(finalBaseProjId); + procure.setBaseProjName(baseProjName); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + saveProcure.setBaseProjId(finalBaseProjId); + saveProcure.setId(null); + saveProcure.setAreaCode(RegionConst.RC_LS); + saveProcure.setTongTime(LocalDateTime.now()); + saveProcure.setBizTime(LocalDateTime.now()); + saveProcure.setUpdateBy(finalUser.getUsername()); + saveProcure.setUpdateOn(LocalDateTime.now()); + if(procureService.save(saveProcure)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); + } + index++; + } + + } + + //7. 推送数据(改为定时推送了) +// pushProject(saveDTO); + //如果是草稿箱来的 就要删除 + if(Objects.nonNull(saveDTO.getDraftId())){ + draftService.removeById(saveDTO.getDraftId()); + } + + return BizConst.SAVE_SUCCESS; + } + + /** + * 运维项目保存 + * @param saveDTO + * @param user + * @return + */ + public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { + if(Objects.isNull(user)){ + user = LoginUserUtil.loginUserDetail(); + } + + GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); + String baseProjId = saveDTO.getBaseProjId(); + String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; + String baseProjName = base.getBaseProjName(); + + //1.保存基本信息 + GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); + baseinfo.setBaseProjId(baseProjId); + baseinfo.setBaseProjName(baseProjName); + baseinfo.setBaseAreaCode(baseAreaCode); + baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + //项目名去重 + checkNameOperation(baseProjName,baseProjId); + GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovOperationProjectBaseinfo.class); + saveBase.setBaseProjName(baseProjName); + saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + if(Objects.nonNull(oldBaseInfo)){ + saveBase.setId(oldBaseInfo.getId()); + saveBase.setBaseAreaCode(null); + }else{ + saveBase.setBaseAreaCode(baseAreaCode); + saveBase.setTongTime(LocalDateTime.now()); + saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); + } + saveBase.setAreaCode(RegionConst.RC_LS); + saveBase.setBizTime(LocalDateTime.now()); + saveBase.setUpdateBy(user.getUsername()); + saveBase.setUpdateOn(LocalDateTime.now()); + + //如果是新增的话 要生成 项目编号 + if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ + baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + saveBase.setBaseProjId(baseProjId); + } + + operationProjectBaseinfoService.saveOrUpdate(saveBase); + + // 2.保存 申报信息 + GovBizProjectApplyDTO apply = saveDTO.getApply(); + if(Objects.nonNull(apply)){ + apply.setBaseProjId(baseProjId); + apply.setBaseProjName(baseProjName); + GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); + saveApply.setBaseProjId(baseProjId); + if(Objects.nonNull(oldApply)){ + saveApply.setId(oldApply.getId()); + }else{ + saveApply.setTongTime(LocalDateTime.now()); + } + if(Objects.nonNull(saveApply.getBaseProjStartTime()) && + Objects.nonNull(saveApply.getBaseProjEndTime())){ + saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), + saveApply.getBaseProjEndTime())); + } + saveApply.setAreaCode(RegionConst.RC_LS); + saveApply.setBizTime(LocalDateTime.now()); + saveApply.setUpdateBy(user.getUsername()); + saveApply.setUpdateOn(LocalDateTime.now()); + if(projectApplyService.saveOrUpdate(saveApply)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); + } + } + + // 3.保存 审批信息 + GovBizProjectApproveDTO approve = saveDTO.getApprove(); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(baseProjId); + approve.setBaseProjName(baseProjName); + GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); + saveApprove.setBaseProjId(baseProjId); + if(Objects.nonNull(oldApprove)){ + saveApprove.setId(oldApprove.getId()); + }else{ + saveApprove.setTongTime(LocalDateTime.now()); + } + saveApprove.setBizTime(LocalDateTime.now()); + saveApprove.setAreaCode(RegionConst.RC_LS); + saveApprove.setUpdateBy(user.getUsername()); + saveApprove.setUpdateOn(LocalDateTime.now()); + if(approveService.saveOrUpdate(saveApprove)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); + } + } + + // 4.保存 建设项目 实施信息 + GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(baseProjId); + cimplement.setBaseProjName(baseProjName); + cimplement.setBaseBidCode(baseProjId); + cimplement.setBaseBidName(baseProjName); + GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); + saveCimplement.setBaseProjId(baseProjId); + saveCimplement.setBaseBidCode(baseProjId); + saveCimplement.setBaseBidName(baseProjName); + if(Objects.nonNull(oldCimplement)){ + saveCimplement.setId(oldCimplement.getId()); + }else{ + saveCimplement.setTongTime(LocalDateTime.now()); + } + saveCimplement.setAreaCode(RegionConst.RC_LS); + saveCimplement.setBizTime(LocalDateTime.now()); + saveCimplement.setUpdateBy(user.getUsername()); + saveCimplement.setUpdateOn(LocalDateTime.now()); + if(cimplementService.saveOrUpdate(saveCimplement)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); + } + } + + // 5.保存 运维项目 实施信息 + GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(baseProjId); + mimplement.setBaseProjName(baseProjName); + mimplement.setBaseBidCode(baseProjId); + mimplement.setBaseBidName(baseProjName); + GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); + saveMimplement.setBaseProjId(baseProjId); + saveMimplement.setBaseBidCode(baseProjId); + saveMimplement.setBaseBidName(baseProjName); + if(Objects.nonNull(oldMimplement)){ + saveMimplement.setId(oldMimplement.getId()); + }else{ + saveMimplement.setTongTime(LocalDateTime.now()); + } + if(Objects.nonNull(saveBase.getAreaCode())){ + saveMimplement.setAreaCode(saveBase.getAreaCode()); + } + saveMimplement.setAreaCode(RegionConst.RC_LS); + saveMimplement.setBizTime(LocalDateTime.now()); + saveMimplement.setUpdateBy(user.getUsername()); + saveMimplement.setUpdateOn(LocalDateTime.now()); + if(mimplementService.saveOrUpdate(saveMimplement)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); + } + } + + // 6.保存 采购信息 + List procures = saveDTO.getProcures(); + + if(Objects.nonNull(procures)){ + procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); + + String finalBaseProjId = baseProjId; + UserInfoDetails finalUser = user; + + Integer index = 1; + for(GovBizProjectProcureDTO procure : procures){ + procure.setBaseProjId(finalBaseProjId); + procure.setBaseProjName(baseProjName); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + saveProcure.setBaseProjId(finalBaseProjId); + saveProcure.setId(null); + saveProcure.setAreaCode(RegionConst.RC_LS); + saveProcure.setTongTime(LocalDateTime.now()); + saveProcure.setBizTime(LocalDateTime.now()); + saveProcure.setUpdateBy(finalUser.getUsername()); + saveProcure.setUpdateOn(LocalDateTime.now()); + if(procureService.save(saveProcure)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); + } + index++; + } + + } + + //7. 推送数据(改为定时推送了) +// pushProject(saveDTO); + //如果是草稿箱来的 就要删除 + if(Objects.nonNull(saveDTO.getDraftId())){ + operationProjectDraftService.removeById(saveDTO.getDraftId()); + } + + return BizConst.SAVE_SUCCESS; + } + + /** + * 计算2个时间的月份 + * @param baseProjStartTime + * @param baseProjEndTime + * @return + */ + public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { + String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Temporal temporal1 = LocalDate.parse(start); + Temporal temporal2 = LocalDate.parse(end); + // 方法返回为相差月份 + Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); + return ll.toString(); + } + + /** + * 暂存草稿箱 + * @param saveDTO + * @param user + * @return + */ + public String draft(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { + if(Objects.isNull(user)){ + user = LoginUserUtil.loginUserDetail(); + } + + GovBizProjectDraft draft = new GovBizProjectDraft(); + //草稿id + Long draftId = saveDTO.getDraftId(); + String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; + if(Objects.nonNull(draftId)){ + GovBizProjectDraft oldDraft = draftService.getById(draftId); + VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); + draft.setId(draftId); + }else{ + draft.setTongTime(LocalDateTime.now()); + draft.setBaseAreaCode(baseAreaCode); + draft.setCreateId(user.getUserId()); + draft.setTongTime(LocalDateTime.now()); + } + + //1.保存基本信息 + GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); + String baseProjId = base.getBaseProjId(); + String baseProjName = base.getBaseProjName(); + //要生成 草稿的项目编号 + if(StringUtils.isBlank(baseProjId)){ + baseProjId = BizProjectContant.ProjectCollection.DRAFT; + } + + // 2.保存 申报信息 + GovBizProjectApplyDTO apply = saveDTO.getApply(); + BeanUtil.copyProperties(apply, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + + // 3.保存 审批信息 + GovBizProjectApproveDTO approve = saveDTO.getApprove(); + BeanUtil.copyProperties(approve, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + + // 4.保存 建设项目 实施信息 + GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); + if(Objects.nonNull(cimplement)){ + BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseBidCode(baseProjId + "-1"); + draft.setBaseChanFileCimplement(cimplement.getBaseChanFile()); + draft.setBaseLogAggregationCimplement(cimplement.getBaseLogAggregation()); + draft.setBaseBusinessMetricsCimplement(cimplement.getBaseBusinessMetrics()); + draft.setBaseEstaSummFileCimplement(cimplement.getBaseEstaSummFile()); + draft.setBaseInforLevelFileCimplement(cimplement.getBaseInforLevelFile()); + draft.setBaseEngineerPostpoFileCimplement(cimplement.getBaseEngineerPostpoFile()); + draft.setBaseUserConsFileCimplement(cimplement.getBaseUserConsFile()); + draft.setBasePasswAssessFileCimplement(cimplement.getBasePasswAssessFile()); + draft.setBaseThirdAcceptFileCimplement(cimplement.getBaseThirdAcceptFile()); + draft.setBaseFinalExpertOpinionFileCimplement(cimplement.getBaseFinalExpertOpinionFile()); + } + + // 5.保存 运维项目 实施信息 + GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); + if(Objects.nonNull(mimplement)){ + BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); + draft.setBaseBusinessMetricsMimplement(mimplement.getBaseBusinessMetrics()); + draft.setBaseChanFileMimplement(mimplement.getBaseChanFile()); + draft.setBaseEstaSummFileMimplement(mimplement.getBaseEstaSummFile()); + draft.setBaseInforLevelFileMimplement(mimplement.getBaseInforLevelFile()); + draft.setBaseEngineerPostpoFileMimplement(mimplement.getBaseEngineerPostpoFile()); + draft.setBaseThirdAcceptFileMimplement(mimplement.getBaseThirdAcceptFile()); + draft.setBaseUserConsFileMimplement(mimplement.getBaseUserConsFile()); + draft.setBaseFinalExpertOpinionFileMimplement(mimplement.getBaseFinalExpertOpinionFile()); + draft.setBasePasswAssessFileMimplement(mimplement.getBasePasswAssessFile()); + } + + // 6.保存 采购信息 + List procures = saveDTO.getProcures(); + if(Objects.nonNull(procures)){ + draft.setProcure(JSON.toJSONString(procures)); + } + + //最后再保存 基本信息 + BeanUtil.copyProperties(base, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseProjId(baseProjId); + draft.setBaseProjName(baseProjName); + draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + draft.setAreaCode(RegionConst.RC_LS); + draft.setBizTime(LocalDateTime.now()); + draft.setUpdateBy(user.getUsername()); + draft.setUpdateOn(LocalDateTime.now()); + draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); + + draftService.saveOrUpdate(draft); + + return BizConst.SAVE_SUCCESS; + } + + public String operationDraft(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { + if(Objects.isNull(user)){ + user = LoginUserUtil.loginUserDetail(); + } + + GovOperationProjectDraft draft = new GovOperationProjectDraft(); + //草稿id + Long draftId = saveDTO.getDraftId(); + String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; + if(Objects.nonNull(draftId)){ + GovOperationProjectDraft oldDraft = operationProjectDraftService.getById(draftId); + VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); + draft.setId(draftId); + }else{ + draft.setTongTime(LocalDateTime.now()); + draft.setBaseAreaCode(baseAreaCode); + draft.setCreateId(user.getUserId()); + draft.setTongTime(LocalDateTime.now()); + } + + //1.保存基本信息 + GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); + String baseProjId = base.getBaseProjId(); + String baseProjName = base.getBaseProjName(); + //要生成 草稿的项目编号 + if(StringUtils.isBlank(baseProjId)){ + baseProjId = BizProjectContant.ProjectCollection.DRAFT; + } + + // 2.保存 申报信息 + GovBizProjectApplyDTO apply = saveDTO.getApply(); + BeanUtil.copyProperties(apply, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + + // 3.保存 审批信息 + GovBizProjectApproveDTO approve = saveDTO.getApprove(); + BeanUtil.copyProperties(approve, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + + // 4.保存 建设项目 实施信息 + GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); + if(Objects.nonNull(cimplement)){ + BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseBidCode(baseProjId + "-1"); + draft.setBaseChanFileCimplement(cimplement.getBaseChanFile()); + draft.setBaseLogAggregationCimplement(cimplement.getBaseLogAggregation()); + draft.setBaseBusinessMetricsCimplement(cimplement.getBaseBusinessMetrics()); + draft.setBaseEstaSummFileCimplement(cimplement.getBaseEstaSummFile()); + draft.setBaseInforLevelFileCimplement(cimplement.getBaseInforLevelFile()); + draft.setBaseEngineerPostpoFileCimplement(cimplement.getBaseEngineerPostpoFile()); + draft.setBaseUserConsFileCimplement(cimplement.getBaseUserConsFile()); + draft.setBasePasswAssessFileCimplement(cimplement.getBasePasswAssessFile()); + draft.setBaseThirdAcceptFileCimplement(cimplement.getBaseThirdAcceptFile()); + draft.setBaseFinalExpertOpinionFileCimplement(cimplement.getBaseFinalExpertOpinionFile()); + } + + // 5.保存 运维项目 实施信息 + GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); + if(Objects.nonNull(mimplement)){ + BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); + draft.setBaseBusinessMetricsMimplement(mimplement.getBaseBusinessMetrics()); + draft.setBaseChanFileMimplement(mimplement.getBaseChanFile()); + draft.setBaseEstaSummFileMimplement(mimplement.getBaseEstaSummFile()); + draft.setBaseInforLevelFileMimplement(mimplement.getBaseInforLevelFile()); + draft.setBaseEngineerPostpoFileMimplement(mimplement.getBaseEngineerPostpoFile()); + draft.setBaseThirdAcceptFileMimplement(mimplement.getBaseThirdAcceptFile()); + draft.setBaseUserConsFileMimplement(mimplement.getBaseUserConsFile()); + draft.setBaseFinalExpertOpinionFileMimplement(mimplement.getBaseFinalExpertOpinionFile()); + draft.setBasePasswAssessFileMimplement(mimplement.getBasePasswAssessFile()); + } + + // 6.保存 采购信息 + List procures = saveDTO.getProcures(); + if(Objects.nonNull(procures)){ + draft.setProcure(JSON.toJSONString(procures)); + } + + //最后再保存 基本信息 + BeanUtil.copyProperties(base, draft, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + draft.setBaseProjId(baseProjId); + draft.setBaseProjName(baseProjName); + draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + draft.setAreaCode(RegionConst.RC_LS); + draft.setBizTime(LocalDateTime.now()); + draft.setUpdateBy(user.getUsername()); + draft.setUpdateOn(LocalDateTime.now()); + draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); + + operationProjectDraftService.saveOrUpdate(draft); + + return BizConst.SAVE_SUCCESS; + } + + /** + * 删除项目归集 + * @param projId + * @return + */ + public String remove(String projId) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String username = user.getUsername(); + + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projId) + .last(BizConst.LIMIT_1)); + + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!"); + + //改正逻辑删除 + baseinfo.setDeleted(Boolean.TRUE); + baseinfo.setUpdateBy(username); + baseinfo.setUpdateOn(LocalDateTime.now()); + baseinfoService.updateById(baseinfo); + projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId,projId) + .set(GovBizProjectApply::getDeleted,Boolean.TRUE) + .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectApply::getUpdateBy,username)); + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,projId) + .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) + .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectApprove::getUpdateBy,username)); + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,projId) + .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) + .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectCimplement::getUpdateBy,username)); + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,projId) + .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) + .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectMimplement::getUpdateBy,username)); + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,projId) + .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) + .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectProcure::getUpdateBy,username)); + return BizConst.OP_SUCCESS; + } + public String operationRemove(String projId) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String username = user.getUsername(); + + GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projId) + .last(BizConst.LIMIT_1)); + + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("运维项目不存在!"); + + //改正逻辑删除 + baseinfo.setDeleted(Boolean.TRUE); + baseinfo.setUpdateBy(username); + baseinfo.setUpdateOn(LocalDateTime.now()); + operationProjectBaseinfoService.updateById(baseinfo); + + projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId,projId) + .set(GovBizProjectApply::getDeleted,Boolean.TRUE) + .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectApply::getUpdateBy,username)); + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,projId) + .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) + .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectApprove::getUpdateBy,username)); + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,projId) + .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) + .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectCimplement::getUpdateBy,username)); + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,projId) + .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) + .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectMimplement::getUpdateBy,username)); + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,projId) + .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) + .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) + .set(GovBizProjectProcure::getUpdateBy,username)); + return BizConst.OP_SUCCESS; + } + + /** + * 项目归集 草稿箱删除 + * @param draftId + * @return + */ + public String draftRemove(Long draftId) { + if(draftService.removeById(draftId)){ + return BizConst.OP_SUCCESS; + } + return BizConst.OP_FAIL; + } + + public String operationDraftRemove(Long draftId) { + if(operationProjectDraftService.removeById(draftId)){ + return BizConst.OP_SUCCESS; + } + return BizConst.OP_FAIL; + } + + private void checkName(String baseProjName, String baseProjId) { + VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName) + .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) + .ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) + .throwMessage("项目名重复"); + } + + private void checkNameOperation(String baseProjName, String baseProjId) { + VUtils.isTrue(operationProjectBaseinfoService.count(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjName,baseProjName) + .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) + .ne(GovOperationProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) + .throwMessage("项目名重复"); + } + + /** + * 推送项目 + * @param saveDTO + */ + public void pushProject(GovBizProjectSaveDTO saveDTO) { + String url = pushUrl; + ProjectPushReq req = ProjectConvert.convert(saveDTO); + try{ + log.info("推送消息体 {} ,{},{}",saveDTO.getBaseProjId(),url, JSON.toJSONString(req)); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(req, headers); + ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); + log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response); + }catch (Exception e){ + log.info("推送失败,{}",e.getMessage()); + } + } + public void pushProjectVo(GovBizProjectDetailVO vo) { + String url = pushUrl; + ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); + try{ + log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(req, headers); + ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); + log.info("推送结果 {} :{}",vo.getBaseProjId(),response); + }catch (Exception e){ + log.info("推送失败,{}",e.getMessage()); + } + } + + public void pushProjectVo(GovOperationProjectDetailVO vo) { + String url = pushUrl; + ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); + try{ + log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(req, headers); + ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); + log.info("推送结果 {} :{}",vo.getBaseProjId(),response); + }catch (Exception e){ + log.info("推送失败,{}",e.getMessage()); + } + } + + /** + * 把项目置为无效 + * @param baseinfo + */ + private void notEffectiveProject(GovBizProjectBaseinfoDTO baseinfo) { + String url = noEffectiveUrl; + ProjectBaseInfoReq req = ProjectConvert.convertBase(baseinfo,BizProjectContant.NOT_EFFECTIVE_CODE); + try{ + log.info("推送消息体 {},{},{}",baseinfo.getBaseProjId(),url, JSON.toJSONString(req)); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(req, headers); + ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); + log.info("推送结果 {} :{}",baseinfo.getBaseProjId(),response); + }catch (Exception e){ + log.info("推送失败,{}",e.getMessage()); + } + } + + public void deleteAll() { + String url = deleteAllUrl; + try { + log.info("推送删除数据url {}", url); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(null, headers); + ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); + log.info("推送删除结果 :{}", response); + } catch (Exception e) { + log.info("推送删除失败,{}", e.getMessage()); + } + } + + /** + * 上传项目归集申报的文件到OSS 前提还要先转为PDF + * @param apply + * @param oldApply + */ + private void uploadFileToProvincialOssApply(GovBizProjectApplyDTO apply, + GovBizProjectApply oldApply,GovBizProjectApply saveApply) { + if(checkFieldNotPdf(apply.getBaseProjBasisFile(),oldApply,"baseProjBasisFile")){ + StringJoiner sj = convertAndUpload(apply.getBaseProjBasisFile()); + saveApply.setBaseProjBasisFilePdf(sj.toString()); + } + if(checkFieldNotPdf(apply.getBaseProjApplyFile(),oldApply,"baseProjApplyFile")){ + StringJoiner sj = convertAndUpload(apply.getBaseProjApplyFile()); + saveApply.setBaseProjApplyFilePdf(sj.toString()); + } + if(checkFieldNotPdf(apply.getBaseOperatMaintenFile(),oldApply,"baseOperatMaintenFile")){ + StringJoiner sj = convertAndUpload(apply.getBaseOperatMaintenFile()); + saveApply.setBaseOperatMaintenFilePdf(sj.toString()); + } + if(checkFieldNotPdf(apply.getBaseResearchReportFile(),oldApply,"baseResearchReportFile")){ + StringJoiner sj = convertAndUpload(apply.getBaseResearchReportFile()); + saveApply.setBaseResearchReportFilePdf(sj.toString()); + } + if(checkFieldNotPdf(apply.getBaseProjOtherFile(),oldApply,"baseProjOtherFile")){ + StringJoiner sj = convertAndUpload(apply.getBaseProjOtherFile()); + saveApply.setBaseProjOtherFilePdf(sj.toString()); + } + projectApplyService.updateById(saveApply); + } + + private void uploadFileToProvincialOssApprove(GovBizProjectApproveDTO approve, GovBizProjectApprove oldApprove, GovBizProjectApprove saveApprove) { + if(checkFieldNotPdf(approve.getApprovalFile(),oldApprove,"approvalFile")){ + StringJoiner sj = convertAndUpload(approve.getApprovalFile()); + saveApprove.setApprovalFilePdf(sj.toString()); + } + if(checkFieldNotPdf(approve.getBaseReviewCommentsFile(),oldApprove,"baseReviewCommentsFile")){ + StringJoiner sj = convertAndUpload(approve.getBaseReviewCommentsFile()); + saveApprove.setBaseReviewCommentsFilePdf(sj.toString()); + } + if(checkFieldNotPdf(approve.getPreliminaryDesignFile(),oldApprove,"preliminaryDesignFile")){ + StringJoiner sj = convertAndUpload(approve.getPreliminaryDesignFile()); + saveApprove.setPreliminaryDesignFilePdf(sj.toString()); + } + approveService.updateById(saveApprove); + } + + private void uploadFileToProvincialOssCimplement(GovBizProjectCimplementDTO cimplement, + GovBizProjectCimplement oldCimplement, GovBizProjectCimplement saveCimplement) { + if(checkFieldNotPdf(cimplement.getBaseChanFile(),oldCimplement,"baseChanFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseChanFile()); + saveCimplement.setBaseChanFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseCheckFile(),oldCimplement,"baseCheckFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseCheckFile()); + saveCimplement.setBaseCheckFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseInforLevelFile(),oldCimplement,"baseInforLevelFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseInforLevelFile()); + saveCimplement.setBaseInforLevelFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseChangeFormFile(),oldCimplement,"baseChangeFormFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseChangeFormFile()); + saveCimplement.setBaseChangeFormFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseEstaSummFile(),oldCimplement,"baseEstaSummFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseEstaSummFile()); + saveCimplement.setBaseEstaSummFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); + saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseFinalExpertOpinionFile(),oldCimplement,"baseFinalExpertOpinionFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseFinalExpertOpinionFile()); + saveCimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseThirdAcceptFile(),oldCimplement,"baseThirdAcceptFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseThirdAcceptFile()); + saveCimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseUserConsFile(),oldCimplement,"baseUserConsFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseUserConsFile()); + saveCimplement.setBaseUserConsFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseFinanlAuditFile(),oldCimplement,"baseFinanlAuditFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseFinanlAuditFile()); + saveCimplement.setBaseFinanlAuditFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); + saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseInitialOpinionFile(),oldCimplement,"baseInitialOpinionFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseInitialOpinionFile()); + saveCimplement.setBaseInitialOpinionFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBasePasswAssessFile(),oldCimplement,"basePasswAssessFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBasePasswAssessFile()); + saveCimplement.setBasePasswAssessFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseSummReportFile(),oldCimplement,"baseSummReportFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseSummReportFile()); + saveCimplement.setBaseSummReportFilePdf(sj.toString()); + } + if(checkFieldNotPdf(cimplement.getBaseIrsTestRunFile(),oldCimplement,"baseIrsTestRunFile")){ + StringJoiner sj = convertAndUpload(cimplement.getBaseIrsTestRunFile()); + saveCimplement.setBaseIrsTestRunFilePdf(sj.toString()); + } + cimplementService.updateById(saveCimplement); + } + + private void uploadFileToProvincialOssMimplement(GovBizProjectMimplementDTO mimplement, GovBizProjectMimplement oldMimplement, GovBizProjectMimplement saveMimplement) { + if(checkFieldNotPdf(mimplement.getBaseChanFile(),oldMimplement,"baseChanFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseChanFile()); + saveMimplement.setBaseChanFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseInforLevelFile(),oldMimplement,"baseInforLevelFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseInforLevelFile()); + saveMimplement.setBaseInforLevelFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBasePasswAssessFile(),oldMimplement,"basePasswAssessFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBasePasswAssessFile()); + saveMimplement.setBasePasswAssessFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseThirdAcceptFile(),oldMimplement,"baseThirdAcceptFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseThirdAcceptFile()); + saveMimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseEstaSummFile(),oldMimplement,"baseEstaSummFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseEstaSummFile()); + saveMimplement.setBaseEstaSummFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseUserConsFile(),oldMimplement,"baseUserConsFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseUserConsFile()); + saveMimplement.setBaseUserConsFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseOperatMaintenSummFile(),oldMimplement,"baseOperatMaintenSummFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseOperatMaintenSummFile()); + saveMimplement.setBaseOperatMaintenSummFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseFinalExpertOpinionFile(),oldMimplement,"baseFinalExpertOpinionFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseFinalExpertOpinionFile()); + saveMimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseEngineerPostpoFile(),oldMimplement,"baseEngineerPostpoFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerPostpoFile()); + saveMimplement.setBaseEngineerPostpoFilePdf(sj.toString()); + } + if(checkFieldNotPdf(mimplement.getBaseEngineerAlterFile(),oldMimplement,"baseEngineerAlterFile")){ + StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerAlterFile()); + saveMimplement.setBaseEngineerAlterFilePdf(sj.toString()); + } + mimplementService.updateById(saveMimplement); + } + + /** + * 采购文件处理 + * @param procure + * @param o + * @param saveProcure + */ + private void uploadFileToProvincialOssProcure(GovBizProjectProcureDTO procure, Object o, GovBizProjectProcure saveProcure) { + if(checkFieldNotPdf(procure.getPurchaseFile(),o,"purchaseFile")){ + StringJoiner sj = convertAndUpload(procure.getPurchaseFile()); + saveProcure.setPurchaseFilePdf(sj.toString()); + } + if(checkFieldNotPdf(procure.getBiddingFile(),o,"biddingFile")){ + StringJoiner sj = convertAndUpload(procure.getBiddingFile()); + saveProcure.setBiddingFilePdf(sj.toString()); + } + if(checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract")){ + StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); + saveProcure.setPurchaseContractPdf(sj.toString()); + } + procureService.updateById(saveProcure); + } + + public StringJoiner convertAndUpload(String baseProjBasisFile) { + String[] baseProjBasisFileArr = baseProjBasisFile.split(";"); + StringJoiner sj = new StringJoiner(";"); + for(String bpb : baseProjBasisFileArr){ + try{ + JSONArray fileArray = JSON.parseArray(bpb); + fileArray.forEach(j -> { + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); + String suffix = jsonObject.getString("suffix"); + //如果已经是PDF 就不用转换了 + byte[] btyes = null; + String originalFileName = jsonObject.getString("originalFileName"); + if(StringUtils.isNotBlank(suffix) && suffix.equals("pdf")){ + com.ningdatech.file.entity.File file = fileService.getById(jsonObject.getLong("id")); + if(Objects.isNull(file)){ + throw new RuntimeException("转换PDF文件失败:" + originalFileName); + } + InputStream inputStream = fileService.getFileInputStream(file); + try { + btyes = IOUtils.toByteArray(inputStream); + } catch (IOException e) { + throw new RuntimeException("转换PDF文件失败:" + originalFileName,e); + } + }else{ + btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); + } + + if(!BizConst.DEV.equals(active)){ + originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); + } +// upload(btyes,"/temp",originalFileName); + String oss = ProvincialManage.uploadToOss(btyes, originalFileName); + sj.add(oss); + }); + }catch (Exception e){ + log.error("解析文件出错!" + e); + } + + } + return sj; + } + + private Boolean checkFieldNotPdf(String field, Object record, String fieldName){ + if(StringUtils.isBlank(field)){ + return Boolean.FALSE; + } + + //如果没有老值 + if(Objects.isNull(record)){ + return Boolean.TRUE; + } + + //和老值做个对比 不一样则true + Class clazz = record.getClass(); + String oldFiled = StringUtils.EMPTY; + try { + Field fieldDeclared = clazz.getDeclaredField(fieldName); + fieldDeclared.setAccessible(Boolean.TRUE); + oldFiled = Objects.nonNull(fieldDeclared.get(record)) ? String.valueOf(fieldDeclared.get(record)) : null; + } catch (NoSuchFieldException e) { + log.error("转换PDF文件出错" + e); + } catch (IllegalAccessException e) { + log.error("转换PDF文件出错" + e); + } + + if(StringUtils.isBlank(oldFiled)){ + return Boolean.TRUE; + } + + //如果一模一样 就不用上传了 + if(oldFiled.equals(field)){ + return Boolean.FALSE; + } + + return Boolean.TRUE; + } + + /** + * @param bytes byte数组 + * @param fileRoute 文件路径 + * @param fileName 文件名 + */ + public static void upload(byte[] bytes,String fileRoute,String fileName) { + try { + File directory=new File(fileRoute); + if (!directory.exists()){ + directory.mkdirs(); + } + File file = new File(directory, fileName); + BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); + bos.write(bytes); + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String rebuildProjectCode(List baseProjIds){ + if(CollUtil.isEmpty(baseProjIds)){ + throw new BizException("项目编号不能为空"); + } + Integer successNum = 0; + for(String baseProjId : baseProjIds){ + //两种情况 + //1.项目归集 + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(baseinfo)){ + rebuildGuiji(baseProjId); + successNum ++; + } + + //2.运维备案 + GovOperationProjectBaseinfo operation = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovOperationProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(operation)){ + rebuildOperation(baseProjId); + successNum ++; + } + } + return "运行成功 重新生成" + successNum + "个项目编号"; + } + + private void rebuildGuiji(String baseProjId) { + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(baseinfo)){ + System.out.println("项目不存在 直接下一个"); + return; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + projectApplyService.updateById(apply); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } + } + + private void rebuildOperation(String baseProjId) { + GovOperationProjectBaseinfo operationBase = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovOperationProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(operationBase)){ + System.out.println("运维备案项目不存在 直接下一个"); + return; + } + GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + + operationBase.setBaseProjId(newProjId); + operationProjectBaseinfoService.updateById(operationBase); + apply.setBaseProjId(newProjId); + projectApplyService.updateById(apply); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } + } + + public String removeProject(List projectCodes) { + if(CollUtil.isEmpty(projectCodes)){ + throw new BizException("项目编号不能为空!"); + } + + for(String projectCode : projectCodes){ + //项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + + List projectIds = projects.stream().map(Project::getId).collect(Collectors.toList()); + + //1.删除应用 + applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode,projectCode)); + + //2.删除相关流程 + List projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIds)); + for(ProjectInst projectInst : projectInsts){ + //实例 + try{ + runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); + }catch (Exception e){ + + } + try{ + historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); + }catch (Exception e){ + + } + //抄送 + ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) + .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); + } + projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); + + //3.删除实施表 + operationService.remove(Wrappers.lambdaQuery(Operation.class) + .eq(Operation::getProjectCode,projectCode)); + + //4.删除续建项目资金表 + renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); + + //5.暂存表 + stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) + .in(ProjectStaging::getProjectId,projectIds)); + + //6.状态变更表 + statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId,projectIds)); + + //7.采购表 + purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId,projectIds)); + + //8.标签 + projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) + .eq(ProjectTag::getProjectCode,projectCode)); + + //9.初验人员 + preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .in(PreInsAcceptancePerson::getProjectId,projectIds)); + + //10.供应商安全质量 + supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) + .eq(SupplierSafetyQualification::getProjectCode,projectCode)); + + //11.安全人员 + personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) + .eq(PersonSafetyInfo::getProjectCode,projectCode)); + + //12.最后删除项目 + projectService.remove(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + } + return "删除成功"; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/BelongOrgMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/BelongOrgMapper.java new file mode 100644 index 0000000..af52e76 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/BelongOrgMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.entity.BelongOrg; + +/** + *

+ * Mapper 接口 + *

+ * + * @author liuxinxin + * @since 2023-04-18 + */ +public interface BelongOrgMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApplyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApplyMapper.java new file mode 100644 index 0000000..05bf15e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApplyMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectApplyMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApproveMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApproveMapper.java new file mode 100644 index 0000000..0bfeb32 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectApproveMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectApprove; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectApproveMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectBaseinfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectBaseinfoMapper.java new file mode 100644 index 0000000..e15a555 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectBaseinfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectBaseinfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectCimplementMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectCimplementMapper.java new file mode 100644 index 0000000..1c61439 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectCimplementMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectCimplement; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectCimplementMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectDraftMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectDraftMapper.java new file mode 100644 index 0000000..d85d5a0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectDraftMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectDraft; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectDraftMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectMimplementMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectMimplementMapper.java new file mode 100644 index 0000000..085e140 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectMimplementMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectMimplement; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectMimplementMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectProcureMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectProcureMapper.java new file mode 100644 index 0000000..f051d06 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovBizProjectProcureMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectProcure; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovBizProjectProcureMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectBaseinfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectBaseinfoMapper.java new file mode 100644 index 0000000..10b1245 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectBaseinfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovOperationProjectBaseinfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectDraftMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectDraftMapper.java new file mode 100644 index 0000000..3880c22 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectDraftMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectDraft; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovOperationProjectDraftMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectTobePushMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectTobePushMapper.java new file mode 100644 index 0000000..f0a6b40 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovOperationProjectTobePushMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectTobePush; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovOperationProjectTobePushMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovProjectDictionaryMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovProjectDictionaryMapper.java new file mode 100644 index 0000000..12d1977 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/mapper/GovProjectDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.gov.model.entity.GovProjectDictionary; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovProjectDictionaryMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java new file mode 100644 index 0000000..e79975e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java @@ -0,0 +1,139 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目申报信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectApply对象", description = "项目申报表") +public class GovBizProjectApplyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("发改委项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("关联IRS应用名称") + private String baseProjSys; + + @ApiModelProperty("关联IRS应用编号") + private String baseProjSysCode; + + @ApiModelProperty("一本账重大应用名称") + private String baseAccountAppName; + + @ApiModelProperty("领域大脑 一本账名称") + private String baseBrainName; + + @ApiModelProperty("单位核心业务名称") + private String baseCoreBusiness; + + @ApiModelProperty("单位核心业务编号") + private String baseCoreBusinessCode; + + @ApiModelProperty("项目开始时间") + private LocalDateTime baseProjStartTime; + + @ApiModelProperty("项目结束时间") + private LocalDateTime baseProjEndTime; + + @ApiModelProperty("项目期限") + private String baseProjDuration; + + @ApiModelProperty("项目年度") + private String baseProjSetYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("项目总投资") + private BigDecimal baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private BigDecimal baseProjDeclAmount; + + @ApiModelProperty("建设层级") + private String baseProjConsClass; + + @ApiModelProperty("贯通层级") + private String baseLowestLevel; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + + @ApiModelProperty("项目概述") + private String baseProjIntro; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("项目申报书") + private String baseProjApplyFile; + + @ApiModelProperty("运维方案") + private String baseOperatMaintenFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("备注") + private String baseProjRemark; + + @ApiModelProperty("数据来源 区域code") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java new file mode 100644 index 0000000..9e7cea4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java @@ -0,0 +1,86 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目审核信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") +public class GovBizProjectApproveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("'发改项目代码'") + private String baseDevelopCode; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("评审结果") + private String baseReviewResults; + + @ApiModelProperty("评审意见") + private String baseReviewOpinion; + + @ApiModelProperty("评审意见附件") + private String baseReviewCommentsFile; + + @ApiModelProperty("建议总投资") + private BigDecimal baseExpertTotalMoney; + + @ApiModelProperty("'建议年度预算'") + private BigDecimal baseExpertYearMoney; + + @ApiModelProperty("立项批复文件") + private String approvalFile; + + @ApiModelProperty("建议批复总投资") + private BigDecimal baseInitialReviewTotalMoney; + + @ApiModelProperty("'建议批复年度预算'") + private BigDecimal baseProjReplyAmount; + + @ApiModelProperty("等保定级") + private String equalProtectionLevel; + + @ApiModelProperty("初步设计方案") + private String preliminaryDesignScheme; + + @ApiModelProperty("初步设计方案批复函") + private String preliminaryDesignFile; + + @ApiModelProperty("年度预算下达金额") + private BigDecimal releaseYearMoney; + + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java new file mode 100644 index 0000000..4af4932 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java @@ -0,0 +1,105 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") +public class GovBizProjectBaseinfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDeprtDing; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java new file mode 100644 index 0000000..5d3e06d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectCimplement对象", description = "项目实施信息表") +public class GovBizProjectCimplementDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("初验意见") + private String baseInitialOpinionFile; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("建设核查表") + private String baseCheckFile; + + @ApiModelProperty("财务审计报告") + private String baseFinanlAuditFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("IRS应用试运行报告") + private String baseIrsTestRunFile; + + @ApiModelProperty("项目总结报告") + private String baseSummReportFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更申请单") + private String baseChangeFormFile; + + @ApiModelProperty("生产批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java new file mode 100644 index 0000000..2232136 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java @@ -0,0 +1,90 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectMimplement对象", description = "运维项目实施信息表") +public class GovBizProjectMimplementDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("运维总结报告") + private String baseOperatMaintenSummFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更报告") + private String baseEngineerAlterFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java new file mode 100644 index 0000000..cae5e17 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java @@ -0,0 +1,94 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目采购信息 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") +public class GovBizProjectProcureDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("采购方式") + private String baseProjPurchaseWay; + + @ApiModelProperty("预算执行确认书编号") + private String basePurchaseCode; + + @ApiModelProperty("招标(采购)文件") + private String purchaseFile; + + @ApiModelProperty("采购代理机构") + private String basePurchasingAgencies; + + @ApiModelProperty("采购代理机构统一社会信用代码") + private String baseUnifiedCreditCode; + + @ApiModelProperty("中标(成交)时间") + private LocalDateTime baseWinningBidTime; + + @ApiModelProperty("中标(成交)金额") + private BigDecimal baseProjPurchaseAmount; + + @ApiModelProperty("中标(成交)通知书") + private String biddingFile; + + @ApiModelProperty("中标(成交)供应商名称") + private String baseConsDeprt; + + @ApiModelProperty("中标(成交)供应商统一社会信用代码") + private String baseConsDeprtUsci; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("项目款支付时间") + private LocalDateTime basePaymentTime; + + @ApiModelProperty("项目款支付金额") + private BigDecimal paymentProgress; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java new file mode 100644 index 0000000..4817c8c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.gov.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.util.List; + +/** + *

+ * 项目归集总VO + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectSaveDTO", description = "项目归集总详情DTO") +public class GovBizProjectSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("草稿id") + private Long draftId; + + @ApiModelProperty("项目基本信息") + private GovBizProjectBaseinfoDTO baseinfo; + + @ApiModelProperty("项目申报信息") + private GovBizProjectApplyDTO apply; + + @ApiModelProperty("项目审批信息") + private GovBizProjectApproveDTO approve; + + @ApiModelProperty("实施项目实施信息") + private GovBizProjectCimplementDTO cimplement; + + @ApiModelProperty("运维项目实施信息") + private GovBizProjectMimplementDTO mimplement; + + @ApiModelProperty("项目采购信息") + private List procures; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectBaseinfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectBaseinfoDTO.java new file mode 100644 index 0000000..7ac6349 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectBaseinfoDTO.java @@ -0,0 +1,109 @@ +package com.hz.pm.api.gov.model.dto; + +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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") +public class GovOperationProjectBaseinfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("是否推送 省局归集") + private Boolean push; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDeprtDing; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectSaveDTO.java new file mode 100644 index 0000000..98c584c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovOperationProjectSaveDTO.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.gov.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 项目归集总VO + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovOperationProjectSaveDTO", description = "运维项目总详情DTO") +public class GovOperationProjectSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("草稿id") + private Long draftId; + + @ApiModelProperty("项目基本信息") + private GovOperationProjectBaseinfoDTO baseinfo; + + @ApiModelProperty("项目申报信息") + private GovBizProjectApplyDTO apply; + + @ApiModelProperty("项目审批信息") + private GovBizProjectApproveDTO approve; + + @ApiModelProperty("实施项目实施信息") + private GovBizProjectCimplementDTO cimplement; + + @ApiModelProperty("运维项目实施信息") + private GovBizProjectMimplementDTO mimplement; + + @ApiModelProperty("项目采购信息") + private List procures; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApply.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApply.java new file mode 100644 index 0000000..8222248 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApply.java @@ -0,0 +1,170 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目申报信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("gov_biz_project_apply") +@ApiModel(value = "GovBizProjectApply对象", description = "项目申报信息表") +public class GovBizProjectApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("发改委项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("关联IRS应用名称") + private String baseProjSys; + + @ApiModelProperty("关联IRS应用编号") + private String baseProjSysCode; + + @ApiModelProperty("一本账重大应用名称") + private String baseAccountAppName; + + @ApiModelProperty("领域大脑 一本账名称") + private String baseBrainName; + + @ApiModelProperty("单位核心业务名称") + private String baseCoreBusiness; + + @ApiModelProperty("单位核心业务编号") + private String baseCoreBusinessCode; + + @ApiModelProperty("项目开始时间") + private LocalDateTime baseProjStartTime; + + @ApiModelProperty("项目结束时间") + private LocalDateTime baseProjEndTime; + + @ApiModelProperty("项目期限") + private String baseProjDuration; + + @ApiModelProperty("项目年度") + private String baseProjSetYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("项目总投资") + private BigDecimal baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private BigDecimal baseProjDeclAmount; + + @ApiModelProperty("建设层级") + private String baseProjConsClass; + + @ApiModelProperty("贯通层级") + private String baseLowestLevel; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + + @ApiModelProperty("项目概述") + private String baseProjIntro; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("项目申报书") + private String baseProjApplyFile; + + @ApiModelProperty("运维方案") + private String baseOperatMaintenFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("备注") + private String baseProjRemark; + + @ApiModelProperty("数据来源 区域code") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("立项依据材料PDF版") + private String baseProjBasisFilePdf; + + @ApiModelProperty("项目申报书PDF版") + private String baseProjApplyFilePdf; + + @ApiModelProperty("运维方案PDF版") + private String baseOperatMaintenFilePdf; + + @ApiModelProperty("可研报告PDF版") + private String baseResearchReportFilePdf; + + @ApiModelProperty("其它文件PDF版") + private String baseProjOtherFilePdf; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApprove.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApprove.java new file mode 100644 index 0000000..538641e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectApprove.java @@ -0,0 +1,111 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目审核信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("gov_biz_project_approve") +@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") +public class GovBizProjectApprove implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("评审结果") + private String baseReviewResults; + + @ApiModelProperty("评审意见") + private String baseReviewOpinion; + + @ApiModelProperty("评审意见附件") + private String baseReviewCommentsFile; + + @ApiModelProperty("建议总投资") + private BigDecimal baseExpertTotalMoney; + + @ApiModelProperty("建议年度预算") + private BigDecimal baseExpertYearMoney; + + @ApiModelProperty("立项批复文件") + private String approvalFile; + + @ApiModelProperty("建议批复总投资") + private BigDecimal baseInitialReviewTotalMoney; + + @ApiModelProperty("'建议批复年度预算'") + private BigDecimal baseProjReplyAmount; + + @ApiModelProperty("等保定级") + private String equalProtectionLevel; + + @ApiModelProperty("初步设计方案") + private String preliminaryDesignScheme; + + @ApiModelProperty("初步设计方案批复函") + private String preliminaryDesignFile; + + @ApiModelProperty("年度预算下达金额") + private BigDecimal releaseYearMoney; + + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("立项批复文件") + private String approvalFilePdf; + + @ApiModelProperty("评审意见附件PDF") + private String baseReviewCommentsFilePdf; + + @ApiModelProperty("初步设计方案批复函PDF") + private String preliminaryDesignFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java new file mode 100644 index 0000000..9acc9d0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java @@ -0,0 +1,122 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目基本信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("gov_biz_project_baseinfo") +@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目基本信息表") +public class GovBizProjectBaseinfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDeprtDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectCimplement.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectCimplement.java new file mode 100644 index 0000000..4c2d0cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectCimplement.java @@ -0,0 +1,160 @@ +package com.hz.pm.api.gov.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("gov_biz_project_cimplement") +@ApiModel(value = "GovBizProjectCimplement对象", description = "项目实施信息表") +public class GovBizProjectCimplement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("初验意见") + private String baseInitialOpinionFile; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("建设核查表") + private String baseCheckFile; + + @ApiModelProperty("财务审计报告") + private String baseFinanlAuditFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("IRS应用试运行报告") + private String baseIrsTestRunFile; + + @ApiModelProperty("项目总结报告") + private String baseSummReportFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更申请单") + private String baseChangeFormFile; + + @ApiModelProperty("生产批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("生产批复文件PDF") + private String baseChanFilePdf; + + @ApiModelProperty("初验意见PDF") + private String baseInitialOpinionFilePdf; + + @ApiModelProperty("信息安全等级保护测评报告PDF") + private String baseInforLevelFilePdf; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFilePdf; + + @ApiModelProperty("第三方验收测试报告PDF") + private String baseThirdAcceptFilePdf; + + @ApiModelProperty("建设核查表PDF") + private String baseCheckFilePdf; + + @ApiModelProperty("财务审计报告PDF") + private String baseFinanlAuditFilePdf; + + @ApiModelProperty("用户使用报告PDF") + private String baseUserConsFilePdf; + + @ApiModelProperty("监理总结报告PDF") + private String baseEstaSummFilePdf; + + @ApiModelProperty("IRS应用试运行报告PDF") + private String baseIrsTestRunFilePdf; + + @ApiModelProperty("项目总结报告PDF") + private String baseSummReportFilePdf; + + @ApiModelProperty("终审意见PDF") + private String baseFinalExpertOpinionFilePdf; + + @ApiModelProperty("项目延期申请表PDF") + private String baseEngineerPostpoFilePdf; + + @ApiModelProperty("变更申请单PDF") + private String baseChangeFormFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectDraft.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectDraft.java new file mode 100644 index 0000000..febdf96 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectDraft.java @@ -0,0 +1,145 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname GovBizProjectDraft + * @Description + * @Date 2023/9/5 11:05 + * @Author PoffyZhang + */ +@Data +@TableName("gov_biz_project_draft") +@ApiModel(value = "GovBizProjectDraft", description = "草稿") +public class GovBizProjectDraft implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + private String baseProjId; + private String baseProjName; + private String baseAreaName; + private String baseAreaCode; + private String baseProjIsConfidentiality; + private String baseProjType; + private String baseConstructionType; + private String baseProjSetProg; + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + private String baseProvManDeprt; + private String baseProvManDeprtDing; + private String baseManDeprt; + private String baseManDeprtDing; + private String baseManDepartUsci; + private String baseBuildDeprt; + private String baseBuildDeprtDing; + private String baseBuildDepartUsci; + private String baseProjPrincipal; + private String baseProjPrincipalCall; + private String baseProjContacts; + private String baseProjContactsCall; + private Boolean deleted; + + private String baseDevelopCode; + private String setProjCodeFinan; + private String baseHistorProjName; + private String baseHistorProjId; + private String baseHistorProjYear; + private String baseProjSys; + private String baseProjSysCode; + private String baseAccountAppName; + private String baseBrainName; + private String baseCoreBusiness; + private String baseCoreBusinessCode; + private LocalDateTime baseProjStartTime; + private LocalDateTime baseProjEndTime; + private LocalDateTime baseProjDuration; + private String baseProjSetYear; + private String baseProjAmountOri; + private String baseBasisAmountOri; + private BigDecimal baseProjTotalAmount; + private BigDecimal baseProjDeclAmount; + private String baseProjConsClass; + private String baseLowestLevel; + private String baseProjBasis; + private String baseBasisEstablish; + private String baseProjBasisFile; + private String baseProjIntro; + private String beseExpectedResults; + private String baseResearchReportFile; + private String baseProjApplyFile; + private String baseOperatMaintenFile; + private String baseProjOtherFile; + private String baseProjRemark; + + private String baseReviewResults; + private String baseReviewOpinion; + private String baseReviewCommentsFile; + private BigDecimal baseExpertTotalMoney; + private BigDecimal baseExpertYearMoney; + private String approvalFile; + private BigDecimal baseInitialReviewTotalMoney; + private BigDecimal baseProjReplyAmount; + private String equalProtectionLevel; + private String preliminaryDesignScheme; + private String preliminaryDesignFile; + private BigDecimal releaseYearMoney; + + private String baseBidCode; + private String baseBidName; + + private String baseInitialOpinionFile; + private String baseInforLevelFileCimplement; + private String basePasswAssessFileCimplement; + private String baseThirdAcceptFileCimplement; + private String baseCheckFile; + private String baseFinanlAuditFile; + private String baseUserConsFileCimplement; + private String baseEstaSummFileCimplement; + private String baseIrsTestRunFile; + private String baseSummReportFile; + private String baseLogAggregationCimplement; + private String baseBusinessMetricsCimplement; + private String baseFinalExpertOpinionFileCimplement; + private String baseEngineerPostpoFileCimplement; + private String baseChangeFormFile; + private String baseChanFileCimplement; + + private String baseInforLevelFileMimplement; + private String basePasswAssessFileMimplement; + private String baseThirdAcceptFileMimplement; + private String baseUserConsFileMimplement; + private String baseEstaSummFileMimplement; + private String baseOperatMaintenSummFile; + private String baseLogAggregationMimplement; + private String baseBusinessMetricsMimplement; + private String baseFinalExpertOpinionFileMimplement; + private String baseEngineerPostpoFileMimplement; + private String baseEngineerAlterFile; + private String baseChanFileMimplement; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; + + private String procure; + + private String areaCode; + private LocalDateTime bizTime; + private String op; + private LocalDateTime tongTime; + private LocalDateTime updateOn; + private String updateBy; + private Long createId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectMimplement.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectMimplement.java new file mode 100644 index 0000000..8bbbebf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectMimplement.java @@ -0,0 +1,136 @@ +package com.hz.pm.api.gov.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("gov_biz_project_mimplement") +@ApiModel(value = "GovBizProjectMimplement对象", description = "运维项目实施信息表") +public class GovBizProjectMimplement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("运维总结报告") + private String baseOperatMaintenSummFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更报告") + private String baseEngineerAlterFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("信息安全等级保护测评报告PDF") + private String baseInforLevelFilePdf; + + @ApiModelProperty("商业密码应用评估报告PDF") + private String basePasswAssessFilePdf; + + @ApiModelProperty("第三方验收测试报告PDF") + private String baseThirdAcceptFilePdf; + + @ApiModelProperty("用户使用报告PDF") + private String baseUserConsFilePdf; + + @ApiModelProperty("监理总结报告PDF") + private String baseEstaSummFilePdf; + + @ApiModelProperty("运维总结报告PDF") + private String baseOperatMaintenSummFilePdf; + + @ApiModelProperty("终审意见PDF") + private String baseFinalExpertOpinionFilePdf; + + @ApiModelProperty("项目延期申请表PDF") + private String baseEngineerPostpoFilePdf; + + @ApiModelProperty("变更报告PDF") + private String baseEngineerAlterFilePdf; + + @ApiModelProperty("变更批复文件PDF") + private String baseChanFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectProcure.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectProcure.java new file mode 100644 index 0000000..0fc7bb2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectProcure.java @@ -0,0 +1,116 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目采购信息 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("gov_biz_project_procure") +@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") +public class GovBizProjectProcure implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("采购方式") + private String baseProjPurchaseWay; + + @ApiModelProperty("预算执行确认书编号") + private String basePurchaseCode; + + @ApiModelProperty("招标(采购)文件") + private String purchaseFile; + + @ApiModelProperty("采购代理机构") + private String basePurchasingAgencies; + + @ApiModelProperty("采购代理机构统一社会信用代码") + private String baseUnifiedCreditCode; + + @ApiModelProperty("中标(成交)时间") + private LocalDateTime baseWinningBidTime; + + @ApiModelProperty("中标(成交)金额") + private BigDecimal baseProjPurchaseAmount; + + @ApiModelProperty("中标(成交)通知书") + private String biddingFile; + + @ApiModelProperty("中标(成交)供应商名称") + private String baseConsDeprt; + + @ApiModelProperty("中标(成交)供应商统一社会信用代码") + private String baseConsDeprtUsci; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("项目款支付时间") + private LocalDateTime basePaymentTime; + + @ApiModelProperty("项目款支付金额") + private BigDecimal paymentProgress; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("招标(采购)文件PDF") + private String purchaseFilePdf; + + @ApiModelProperty("采购合同PDF") + private String purchaseContractPdf; + + @ApiModelProperty("中标(成交)通知书PDF") + private String biddingFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectBaseinfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectBaseinfo.java new file mode 100644 index 0000000..c5f6f5c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectBaseinfo.java @@ -0,0 +1,124 @@ +package com.hz.pm.api.gov.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-10-07 + */ +@Data +@TableName("gov_operation_project_baseinfo") +@ApiModel(value = "GovOperationProjectBaseinfo对象", description = "运维项目基本信息表") +public class GovOperationProjectBaseinfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("是否推送 省局归集") + private Boolean push; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDeprtDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectDraft.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectDraft.java new file mode 100644 index 0000000..d2b0743 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectDraft.java @@ -0,0 +1,147 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname GovBizProjectDraft + * @Description + * @Date 2023/9/5 11:05 + * @Author PoffyZhang + */ +@Data +@TableName("gov_operation_project_draft") +@ApiModel(value = "GovOperationProjectDraft", description = "草稿") +public class GovOperationProjectDraft implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + private Boolean push; + private String baseProjId; + private String baseProjName; + private String baseAreaName; + private String baseAreaCode; + private String baseProjIsConfidentiality; + private String baseProjType; + private String baseConstructionType; + private String baseProjSetProg; + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + private String baseProvManDeprt; + private String baseProvManDeprtDing; + private String baseManDeprt; + private String baseManDeprtDing; + private String baseManDepartUsci; + private String baseBuildDeprt; + private String baseBuildDeprtDing; + private String baseBuildDepartUsci; + private String baseProjPrincipal; + private String baseProjPrincipalCall; + private String baseProjContacts; + private String baseProjContactsCall; + private Boolean deleted; + + private String baseDevelopCode; + private String setProjCodeFinan; + private String baseHistorProjName; + private String baseHistorProjId; + private String baseHistorProjYear; + private String baseProjSys; + private String baseProjSysCode; + private String baseAccountAppName; + private String baseBrainName; + private String baseCoreBusiness; + private String baseCoreBusinessCode; + private LocalDateTime baseProjStartTime; + private LocalDateTime baseProjEndTime; + private LocalDateTime baseProjDuration; + private String baseProjSetYear; + private String baseProjAmountOri; + private String baseBasisAmountOri; + private BigDecimal baseProjTotalAmount; + private BigDecimal baseProjDeclAmount; + private String baseProjConsClass; + private String baseLowestLevel; + private String baseProjBasis; + private String baseBasisEstablish; + private String baseProjBasisFile; + private String baseProjIntro; + private String beseExpectedResults; + private String baseResearchReportFile; + private String baseProjApplyFile; + private String baseOperatMaintenFile; + private String baseProjOtherFile; + private String baseProjRemark; + + private String baseReviewResults; + private String baseReviewOpinion; + private String baseReviewCommentsFile; + private BigDecimal baseExpertTotalMoney; + private BigDecimal baseExpertYearMoney; + private String approvalFile; + private BigDecimal baseInitialReviewTotalMoney; + private BigDecimal baseProjReplyAmount; + private String equalProtectionLevel; + private String preliminaryDesignScheme; + private String preliminaryDesignFile; + private BigDecimal releaseYearMoney; + + private String baseBidCode; + private String baseBidName; + + private String baseInitialOpinionFile; + private String baseInforLevelFileCimplement; + private String basePasswAssessFileCimplement; + private String baseThirdAcceptFileCimplement; + private String baseCheckFile; + private String baseFinanlAuditFile; + private String baseUserConsFileCimplement; + private String baseEstaSummFileCimplement; + private String baseIrsTestRunFile; + private String baseSummReportFile; + private String baseLogAggregationCimplement; + private String baseBusinessMetricsCimplement; + private String baseFinalExpertOpinionFileCimplement; + private String baseEngineerPostpoFileCimplement; + private String baseChangeFormFile; + private String baseChanFileCimplement; + + private String baseInforLevelFileMimplement; + private String basePasswAssessFileMimplement; + private String baseThirdAcceptFileMimplement; + private String baseUserConsFileMimplement; + private String baseEstaSummFileMimplement; + private String baseOperatMaintenSummFile; + private String baseLogAggregationMimplement; + private String baseBusinessMetricsMimplement; + private String baseFinalExpertOpinionFileMimplement; + private String baseEngineerPostpoFileMimplement; + private String baseEngineerAlterFile; + private String baseChanFileMimplement; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; + + private String procure; + + private String areaCode; + private LocalDateTime bizTime; + private String op; + private LocalDateTime tongTime; + private LocalDateTime updateOn; + private String updateBy; + private Long createId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectTobePush.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectTobePush.java new file mode 100644 index 0000000..56f2c6c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovOperationProjectTobePush.java @@ -0,0 +1,147 @@ +package com.hz.pm.api.gov.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname GovBizProjectDraft + * @Description + * @Date 2023/9/5 11:05 + * @Author PoffyZhang + */ +@Data +@TableName("gov_operation_project_tobe_push") +@ApiModel(value = "GovOperationProjectTobePush", description = "待推送申报项目和运维项目") +public class GovOperationProjectTobePush implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private String baseProjId; + private String baseProjName; + private String baseAreaName; + private String baseAreaCode; + private String baseProjIsConfidentiality; + private String baseProjType; + private String baseConstructionType; + private String baseProjSetProg; + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + private String baseProvManDeprt; + private String baseProvManDeprtDing; + private String baseManDeprt; + private String baseManDeprtDing; + private String baseManDepartUsci; + private String baseBuildDeprt; + private String baseBuildDeprtDing; + private String baseBuildDepartUsci; + private String baseProjPrincipal; + private String baseProjPrincipalCall; + private String baseProjContacts; + private String baseProjContactsCall; + private Boolean deleted; + + private String baseDevelopCode; + private String setProjCodeFinan; + private String baseHistorProjName; + private String baseHistorProjId; + private String baseHistorProjYear; + private String baseProjSys; + private String baseProjSysCode; + private String baseAccountAppName; + private String baseBrainName; + private String baseCoreBusiness; + private String baseCoreBusinessCode; + private LocalDateTime baseProjStartTime; + private LocalDateTime baseProjEndTime; + private LocalDateTime baseProjDuration; + private String baseProjSetYear; + private String baseProjAmountOri; + private String baseBasisAmountOri; + private BigDecimal baseProjTotalAmount; + private BigDecimal baseProjDeclAmount; + private String baseProjConsClass; + private String baseLowestLevel; + private String baseProjBasis; + private String baseBasisEstablish; + private String baseProjBasisFile; + private String baseProjIntro; + private String beseExpectedResults; + private String baseResearchReportFile; + private String baseProjApplyFile; + private String baseOperatMaintenFile; + private String baseProjOtherFile; + private String baseProjRemark; + + private String baseReviewResults; + private String baseReviewOpinion; + private String baseReviewCommentsFile; + private BigDecimal baseExpertTotalMoney; + private BigDecimal baseExpertYearMoney; + private String approvalFile; + private BigDecimal baseInitialReviewTotalMoney; + private BigDecimal baseProjReplyAmount; + private String equalProtectionLevel; + private String preliminaryDesignScheme; + private String preliminaryDesignFile; + private BigDecimal releaseYearMoney; + + private String baseBidCode; + private String baseBidName; + + private String baseInitialOpinionFile; + private String baseInforLevelFileCimplement; + private String basePasswAssessFileCimplement; + private String baseThirdAcceptFileCimplement; + private String baseCheckFile; + private String baseFinanlAuditFile; + private String baseUserConsFileCimplement; + private String baseEstaSummFileCimplement; + private String baseIrsTestRunFile; + private String baseSummReportFile; + private String baseLogAggregationCimplement; + private String baseBusinessMetricsCimplement; + private String baseFinalExpertOpinionFileCimplement; + private String baseEngineerPostpoFileCimplement; + private String baseChangeFormFile; + private String baseChanFileCimplement; + + private String baseInforLevelFileMimplement; + private String basePasswAssessFileMimplement; + private String baseThirdAcceptFileMimplement; + private String baseUserConsFileMimplement; + private String baseEstaSummFileMimplement; + private String baseOperatMaintenSummFile; + private String baseLogAggregationMimplement; + private String baseBusinessMetricsMimplement; + private String baseFinalExpertOpinionFileMimplement; + private String baseEngineerPostpoFileMimplement; + private String baseEngineerAlterFile; + private String baseChanFileMimplement; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; + + private String procure; + + private String areaCode; + private LocalDateTime bizTime; + private String op; + private LocalDateTime tongTime; + private LocalDateTime updateOn; + private String updateBy; + private Long createId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovProjectDictionary.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovProjectDictionary.java new file mode 100644 index 0000000..b738b85 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovProjectDictionary.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.gov.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("gov_project_dictionary") +@ApiModel(value = "GovProjectDictionary对象", description = "项目字典表") +public class GovProjectDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private String createBy; + private LocalDateTime createOn; + + @ApiModelProperty("类型") + private String type; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("展示值") + private String label; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("是否删除") + private Boolean deleted; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApplyReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApplyReq.java new file mode 100644 index 0000000..d695be3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApplyReq.java @@ -0,0 +1,142 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_apply") +@ApiModel(value = "SzlsDaBiz331100ProjectApply对象", description = "项目申报信息") +public class ProjectApplyReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("历年项目代码") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("关联IRS应用名称") + private String baseProjSys; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("一本账重大应用名称") + private String baseAccountAppName; + + @ApiModelProperty("“领域大脑”一本账名称") + private String baseBrainName; + + @ApiModelProperty("单位核心业务名称") + private String baseCoreBusiness; + + @ApiModelProperty("单位核心业务编码") + private String baseCoreBusinessCode; + + @ApiModelProperty("项目起始时间") + private String baseProjStartTime; + + @ApiModelProperty("项目终止时间") + private String baseProjEndTime; + + @ApiModelProperty("项目期限") + private String baseProjDuration; + + @ApiModelProperty("预算年度") + private String baseProjSetYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("项目总投资") + private String baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private String baseProjDeclAmount; + + @ApiModelProperty("建设层级") + private String baseProjConsClass; + + @ApiModelProperty("贯通层级") + private String baseLowestLevel; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + + @ApiModelProperty("项目概述") + private String baseProjIntro; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("可行性研究报告") + private String baseResearchReportFile; + + @ApiModelProperty("项目申报书") + private String baseProjApplyFile; + + @ApiModelProperty("运维方案") + private String baseOperatMaintenFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("备注") + private String baseProjRemark; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApproveReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApproveReq.java new file mode 100644 index 0000000..3a2f235 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectApproveReq.java @@ -0,0 +1,91 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_approve") +@ApiModel(value = "SzlsDaBiz331100ProjectApprove对象", description = "项目立项评审信息") +public class ProjectApproveReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("评审结果") + private String baseReviewResults; + + @ApiModelProperty("评审意见") + private String baseReviewOpinion; + + @ApiModelProperty("评审意见附件") + private String baseReviewCommentsFile; + + @ApiModelProperty("建议总投资") + private String baseExpertTotalMoney; + + @ApiModelProperty("建议年度预算") + private String baseExpertYearMoney; + + @ApiModelProperty("立项批复文件") + private String approvalFile; + + @ApiModelProperty("建议批复总投资") + private String baseInitialReviewTotalMoney; + + @ApiModelProperty("建议批复年度预算") + private String baseProjReplyAmount; + + @ApiModelProperty("等保定级") + private String equalProtectionLevel; + + @ApiModelProperty("初步设计方案") + private String preliminaryDesignScheme; + + @ApiModelProperty("初步设计方案批复函") + private String preliminaryDesignFile; + + @ApiModelProperty("年度预算下达金额") + private String releaseYearMoney; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectBaseInfoReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectBaseInfoReq.java new file mode 100644 index 0000000..2cf1762 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectBaseInfoReq.java @@ -0,0 +1,106 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_baseinfo") +@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") +public class ProjectBaseInfoReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("所属区划") + private String baseAreaName; + + @ApiModelProperty("所属区划编码") + private String baseAreaCode; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位浙政钉ID") + private String baseProvManDeprtDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位浙政钉ID") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位统一社会信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位(申报单位)") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位浙政钉ID") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位统一社会信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人手机号") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectCimplementReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectCimplementReq.java new file mode 100644 index 0000000..500054e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectCimplementReq.java @@ -0,0 +1,109 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_cimplement") +@ApiModel(value = "SzlsDaBiz331100ProjectCimplement对象", description = "建设项目实施信息") +public class ProjectCimplementReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("初验意见") + private String baseInitialOpinionFile; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("商业密码应用评估报告") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("建设核查表") + private String baseCheckFile; + + @ApiModelProperty("财务审计报告") + private String baseFinanlAuditFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("IRS应用试运行报告") + private String baseIrsTestRunFile; + + @ApiModelProperty("项目总结报告") + private String baseSummReportFile; + + @ApiModelProperty("是否完成日志数据归集") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终验意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更申请单") + private String baseChangeFormFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectMimplementReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectMimplementReq.java new file mode 100644 index 0000000..2214040 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectMimplementReq.java @@ -0,0 +1,97 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_mimplement") +@ApiModel(value = "SzlsDaBiz331100ProjectMimplement对象", description = "运维项目实施信息") +public class ProjectMimplementReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("商业密码应用评估报告") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("运维总结报告") + private String baseOperatMaintenSummFile; + + @ApiModelProperty("是否完成日志数据归集") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终验意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更报告") + private String baseEngineerAlterFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectProcureReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectProcureReq.java new file mode 100644 index 0000000..2cd55d2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectProcureReq.java @@ -0,0 +1,97 @@ +package com.hz.pm.api.gov.model.req; + +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 CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_procure") +@ApiModel(value = "SzlsDaBiz331100ProjectProcure对象", description = "项目采购信息") +public class ProjectProcureReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("采购方式") + private String baseProjPurchaseWay; + + @ApiModelProperty("预算执行确认书编号") + private String basePurchaseCode; + + @ApiModelProperty("招标(采购)文件") + private String purchaseFile; + + @ApiModelProperty("采购代理机构") + private String basePurchasingAgencies; + + @ApiModelProperty("采购代理机构统一社会信用代码") + private String baseUnifiedCreditCode; + + @ApiModelProperty("中标(成交)时间") + private String baseWinningBidTime; + + @ApiModelProperty("中标(成交)金额") + private String baseProjPurchaseAmount; + + @ApiModelProperty("中标(成交)通知书") + private String biddingFile; + + @ApiModelProperty("中标(成交)供应商名称") + private String baseConsDeprt; + + @ApiModelProperty("中标(成交)供应商统一社会信用代码") + private String baseConsDeprtUsci; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("项目款支付时间") + private String basePaymentTime; + + @ApiModelProperty("项目款支付金额") + private String paymentProgress; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectPushReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectPushReq.java new file mode 100644 index 0000000..6985f1c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/req/ProjectPushReq.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.gov.model.req; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Classname ProjectPushReq + * @Description + * @Date 2023/8/25 9:45 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ProjectPushReq", description = "项目保存") +public class ProjectPushReq { + + @NotNull(message = "项目基本信息不能为空") + private ProjectBaseInfoReq baseinfo; + + @NotNull(message = "项目申报信息不能为空") + private ProjectApplyReq apply; + + @NotNull(message = "项目审批信息不能为空") + private ProjectApproveReq approve; + + private ProjectCimplementReq cimplement; + + private ProjectMimplementReq mimplement; + + private List procures; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApplyVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApplyVO.java new file mode 100644 index 0000000..efe1fc0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApplyVO.java @@ -0,0 +1,165 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目申报信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectApply对象", description = "项目申报表") +public class GovBizProjectApplyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("发改委项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("关联IRS应用名称") + private String baseProjSys; + + @ApiModelProperty("关联IRS应用编号") + private String baseProjSysCode; + + @ApiModelProperty("一本账重大应用名称") + private String baseAccountAppName; + + @ApiModelProperty("领域大脑 一本账名称") + private String baseBrainName; + + @ApiModelProperty("单位核心业务名称") + private String baseCoreBusiness; + + @ApiModelProperty("单位核心业务编号") + private String baseCoreBusinessCode; + + @ApiModelProperty("项目开始时间") + private LocalDateTime baseProjStartTime; + + @ApiModelProperty("项目结束时间") + private LocalDateTime baseProjEndTime; + + @ApiModelProperty("项目期限") + private String baseProjDuration; + + @ApiModelProperty("项目年度") + private String baseProjSetYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("项目总投资") + private BigDecimal baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private BigDecimal baseProjDeclAmount; + + @ApiModelProperty("建设层级") + private String baseProjConsClass; + + @ApiModelProperty("贯通层级") + private String baseLowestLevel; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + + @ApiModelProperty("项目概述") + private String baseProjIntro; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("项目申报书") + private String baseProjApplyFile; + + @ApiModelProperty("运维方案") + private String baseOperatMaintenFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("备注") + private String baseProjRemark; + + @ApiModelProperty("数据来源 区域code") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("立项依据材料PDF版") + private String baseProjBasisFilePdf; + + @ApiModelProperty("项目申报书PDF版") + private String baseProjApplyFilePdf; + + @ApiModelProperty("运维方案PDF版") + private String baseOperatMaintenFilePdf; + + @ApiModelProperty("可研报告PDF版") + private String baseResearchReportFilePdf; + + @ApiModelProperty("其它文件PDF版") + private String baseProjOtherFilePdf; + + @ApiModelProperty("是否确实历史项目") + private Boolean missing; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApproveVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApproveVO.java new file mode 100644 index 0000000..a71a26a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectApproveVO.java @@ -0,0 +1,106 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目审核信息表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") +public class GovBizProjectApproveVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("'发改项目代码'") + private String baseDevelopCode; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("评审结果") + private String baseReviewResults; + + @ApiModelProperty("评审意见") + private String baseReviewOpinion; + + @ApiModelProperty("评审意见附件") + private String baseReviewCommentsFile; + + @ApiModelProperty("建议总投资") + private BigDecimal baseExpertTotalMoney; + + @ApiModelProperty("'建议年度预算'") + private BigDecimal baseExpertYearMoney; + + @ApiModelProperty("立项批复文件") + private String approvalFile; + + @ApiModelProperty("建议批复总投资") + private BigDecimal baseInitialReviewTotalMoney; + + @ApiModelProperty("'建议批复年度预算'") + private BigDecimal baseProjReplyAmount; + + @ApiModelProperty("等保定级") + private String equalProtectionLevel; + + @ApiModelProperty("初步设计方案") + private String preliminaryDesignScheme; + + @ApiModelProperty("初步设计方案批复函") + private String preliminaryDesignFile; + + @ApiModelProperty("年度预算下达金额") + private BigDecimal releaseYearMoney; + + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("立项批复文件") + private String approvalFilePdf; + + @ApiModelProperty("评审意见附件PDF") + private String baseReviewCommentsFilePdf; + + @ApiModelProperty("初步设计方案批复函PDF") + private String preliminaryDesignFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectBaseinfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectBaseinfoVO.java new file mode 100644 index 0000000..2273196 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectBaseinfoVO.java @@ -0,0 +1,116 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") +public class GovBizProjectBaseinfoVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDepartDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectCimplementVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectCimplementVO.java new file mode 100644 index 0000000..d314d00 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectCimplementVO.java @@ -0,0 +1,155 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectCimplement对象", description = "项目实施信息表") +public class GovBizProjectCimplementVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("初验意见") + private String baseInitialOpinionFile; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("建设核查表") + private String baseCheckFile; + + @ApiModelProperty("财务审计报告") + private String baseFinanlAuditFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("IRS应用试运行报告") + private String baseIrsTestRunFile; + + @ApiModelProperty("项目总结报告") + private String baseSummReportFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更申请单") + private String baseChangeFormFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("生产批复文件PDF") + private String baseChanFilePdf; + + @ApiModelProperty("初验意见PDF") + private String baseInitialOpinionFilePdf; + + @ApiModelProperty("信息安全等级保护测评报告PDF") + private String baseInforLevelFilePdf; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFilePdf; + + @ApiModelProperty("第三方验收测试报告PDF") + private String baseThirdAcceptFilePdf; + + @ApiModelProperty("建设核查表PDF") + private String baseCheckFilePdf; + + @ApiModelProperty("财务审计报告PDF") + private String baseFinanlAuditFilePdf; + + @ApiModelProperty("用户使用报告PDF") + private String baseUserConsFilePdf; + + @ApiModelProperty("监理总结报告PDF") + private String baseEstaSummFilePdf; + + @ApiModelProperty("IRS应用试运行报告PDF") + private String baseIrsTestRunFilePdf; + + @ApiModelProperty("项目总结报告PDF") + private String baseSummReportFilePdf; + + @ApiModelProperty("终审意见PDF") + private String baseFinalExpertOpinionFilePdf; + + @ApiModelProperty("项目延期申请表PDF") + private String baseEngineerPostpoFilePdf; + + @ApiModelProperty("变更申请单PDF") + private String baseChangeFormFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectDetailVO.java new file mode 100644 index 0000000..e3ca9dd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectDetailVO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 项目归集总VO + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectDetailVO", description = "项目归集总详情VO") +public class GovBizProjectDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("草稿id") + private Long draftId; + + @ApiModelProperty("项目基本信息") + private GovBizProjectBaseinfoVO baseinfo; + + @ApiModelProperty("项目申报信息") + private GovBizProjectApplyVO apply; + + @ApiModelProperty("项目审批信息") + private GovBizProjectApproveVO approve; + + @ApiModelProperty("实施项目实施信息") + private GovBizProjectCimplementVO cimplement; + + @ApiModelProperty("运维项目实施信息") + private GovBizProjectMimplementVO mimplement; + + @ApiModelProperty("项目采购信息") + private List procures; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectListVO.java new file mode 100644 index 0000000..d4a9d58 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectListVO.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 项目归集列表VO + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectListVO", description = "项目归集列表VO") +public class GovBizProjectListVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("项目年度") + private String baseProjSetYear; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("项目总投资") + private BigDecimal baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private BigDecimal baseProjDeclAmount; + + @ApiModelProperty("草稿编号") + private Long draftId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectMimplementVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectMimplementVO.java new file mode 100644 index 0000000..7cef4ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectMimplementVO.java @@ -0,0 +1,131 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectMimplement对象", description = "运维项目实施信息表") +public class GovBizProjectMimplementVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("'商业密码应用评估报告'") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("运维总结报告") + private String baseOperatMaintenSummFile; + + @ApiModelProperty("'是否完成日志数据归集'") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终审意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更报告") + private String baseEngineerAlterFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("信息安全等级保护测评报告PDF") + private String baseInforLevelFilePdf; + + @ApiModelProperty("商业密码应用评估报告PDF") + private String basePasswAssessFilePdf; + + @ApiModelProperty("第三方验收测试报告PDF") + private String baseThirdAcceptFilePdf; + + @ApiModelProperty("用户使用报告PDF") + private String baseUserConsFilePdf; + + @ApiModelProperty("监理总结报告PDF") + private String baseEstaSummFilePdf; + + @ApiModelProperty("运维总结报告PDF") + private String baseOperatMaintenSummFilePdf; + + @ApiModelProperty("终审意见PDF") + private String baseFinalExpertOpinionFilePdf; + + @ApiModelProperty("项目延期申请表PDF") + private String baseEngineerPostpoFilePdf; + + @ApiModelProperty("变更报告PDF") + private String baseEngineerAlterFilePdf; + + @ApiModelProperty("变更批复文件PDF") + private String baseChanFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectProcureVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectProcureVO.java new file mode 100644 index 0000000..a811dd2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBizProjectProcureVO.java @@ -0,0 +1,111 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目采购信息 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") +public class GovBizProjectProcureVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("标段编号") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("'财政项目代码'") + private String setProjCodeFinan; + + @ApiModelProperty("采购方式") + private String baseProjPurchaseWay; + + @ApiModelProperty("预算执行确认书编号") + private String basePurchaseCode; + + @ApiModelProperty("招标(采购)文件") + private String purchaseFile; + + @ApiModelProperty("采购代理机构") + private String basePurchasingAgencies; + + @ApiModelProperty("采购代理机构统一社会信用代码") + private String baseUnifiedCreditCode; + + @ApiModelProperty("中标(成交)时间") + private LocalDateTime baseWinningBidTime; + + @ApiModelProperty("中标(成交)金额") + private BigDecimal baseProjPurchaseAmount; + + @ApiModelProperty("中标(成交)通知书") + private String biddingFile; + + @ApiModelProperty("中标(成交)供应商名称") + private String baseConsDeprt; + + @ApiModelProperty("中标(成交)供应商统一社会信用代码") + private String baseConsDeprtUsci; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("项目款支付时间") + private LocalDateTime basePaymentTime; + + @ApiModelProperty("项目款支付金额") + private BigDecimal paymentProgress; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; + + @ApiModelProperty("招标(采购)文件PDF") + private String purchaseFilePdf; + + @ApiModelProperty("采购合同PDF") + private String purchaseContractPdf; + + @ApiModelProperty("中标(成交)通知书PDF") + private String biddingFilePdf; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBusinessStripVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBusinessStripVO.java new file mode 100644 index 0000000..66aa63f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovBusinessStripVO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author Liuxinxin + * @since 2023-03-08 + */ +@Data +@ApiModel(value = "条线VO") +public class GovBusinessStripVO { + + @ApiModelProperty("条线code") + private String businessStripCode; + + @ApiModelProperty("条线名称") + private String businessStripName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectBaseinfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectBaseinfoVO.java new file mode 100644 index 0000000..304ea67 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectBaseinfoVO.java @@ -0,0 +1,119 @@ +package com.hz.pm.api.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") +public class GovOperationProjectBaseinfoVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("是否推送 省局归集") + private Boolean push; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("基本项目区域code") + private String baseAreaCode; + + @ApiModelProperty("基本项目区域名") + private String baseAreaName; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位钉id") + private String baseProvManDepartDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位ding code") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位社会统一信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位Ding Code") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位社会统一信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人联系方式") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("生产时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("逻辑删除") + private Boolean deleted; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectDetailVO.java new file mode 100644 index 0000000..8274fc3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovOperationProjectDetailVO.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 运维项目总详情VO + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovOperationProjectDetailVO", description = "运维项目总详情VO") +public class GovOperationProjectDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + private String baseProjId; + + @ApiModelProperty("基本项目名称") + private String baseProjName; + + @ApiModelProperty("草稿id") + private Long draftId; + + @ApiModelProperty("项目基本信息") + private GovOperationProjectBaseinfoVO baseinfo; + + @ApiModelProperty("项目申报信息") + private GovBizProjectApplyVO apply; + + @ApiModelProperty("项目审批信息") + private GovBizProjectApproveVO approve; + + @ApiModelProperty("实施项目实施信息") + private GovBizProjectCimplementVO cimplement; + + @ApiModelProperty("运维项目实施信息") + private GovBizProjectMimplementVO mimplement; + + @ApiModelProperty("项目采购信息") + private List procures; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovProjectDictionaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovProjectDictionaryVO.java new file mode 100644 index 0000000..9d7e6eb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/vo/GovProjectDictionaryVO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.gov.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 = "GovProjectDictionaryVO", description = "项目字典表") +public class GovProjectDictionaryVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private String createBy; + private LocalDateTime createOn; + + @ApiModelProperty("类型") + private String type; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("展示值") + private String label; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IBelongOrgService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IBelongOrgService.java new file mode 100644 index 0000000..9bddf5a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IBelongOrgService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.entity.BelongOrg; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author liuxinxin + * @since 2023-04-18 + */ +public interface IBelongOrgService extends IService { + + List listNameByCodes(Collection stripCodes); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApplyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApplyService.java new file mode 100644 index 0000000..1321903 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApplyService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectApplyService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApproveService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApproveService.java new file mode 100644 index 0000000..1f65b91 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectApproveService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectApprove; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectApproveService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectBaseinfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectBaseinfoService.java new file mode 100644 index 0000000..3016313 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectBaseinfoService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectBaseinfoService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectCimplementService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectCimplementService.java new file mode 100644 index 0000000..0bde37e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectCimplementService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectCimplement; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectCimplementService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectDraftService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectDraftService.java new file mode 100644 index 0000000..748692e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectDraftService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectDraft; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectDraftService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectMimplementService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectMimplementService.java new file mode 100644 index 0000000..6ffcbd2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectMimplementService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectMimplement; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectMimplementService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectProcureService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectProcureService.java new file mode 100644 index 0000000..138d52d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovBizProjectProcureService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovBizProjectProcure; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovBizProjectProcureService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectBaseinfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectBaseinfoService.java new file mode 100644 index 0000000..1e7bb75 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectBaseinfoService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovOperationProjectBaseinfoService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectDraftService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectDraftService.java new file mode 100644 index 0000000..be60ae7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectDraftService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovOperationProjectDraft; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovOperationProjectDraftService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectTobePushService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectTobePushService.java new file mode 100644 index 0000000..e0b7deb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovOperationProjectTobePushService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovOperationProjectTobePush; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovOperationProjectTobePushService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovProjectDictionaryService.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovProjectDictionaryService.java new file mode 100644 index 0000000..786e196 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/IGovProjectDictionaryService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.model.entity.GovProjectDictionary; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovProjectDictionaryService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/BelongOrgServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/BelongOrgServiceImpl.java new file mode 100644 index 0000000..552ffd3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/BelongOrgServiceImpl.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.gov.entity.BelongOrg; +import com.hz.pm.api.gov.mapper.BelongOrgMapper; +import com.hz.pm.api.gov.service.IBelongOrgService; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author liuxinxin + * @since 2023-04-18 + */ +@Service +public class BelongOrgServiceImpl extends ServiceImpl implements IBelongOrgService { + + @Override + public List listNameByCodes(Collection stripCodes) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(BelongOrg.class) + .in(BelongOrg::getOrgCode, stripCodes); + return CollUtils.fieldList(list(query), BelongOrg::getOrgName); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApplyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApplyServiceImpl.java new file mode 100644 index 0000000..8ed18a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApplyServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectApplyMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; +import com.hz.pm.api.gov.service.IGovBizProjectApplyService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectApplyServiceImpl extends + ServiceImpl implements IGovBizProjectApplyService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApproveServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApproveServiceImpl.java new file mode 100644 index 0000000..ad76c18 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectApproveServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectApproveMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectApprove; +import com.hz.pm.api.gov.service.IGovBizProjectApproveService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectApproveServiceImpl extends + ServiceImpl implements IGovBizProjectApproveService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java new file mode 100644 index 0000000..c05baa0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectBaseinfoMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectBaseinfoServiceImpl extends + ServiceImpl implements IGovBizProjectBaseinfoService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectCimplementServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectCimplementServiceImpl.java new file mode 100644 index 0000000..9d20f17 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectCimplementServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectCimplementMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectCimplement; +import com.hz.pm.api.gov.service.IGovBizProjectCimplementService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectCimplementServiceImpl extends + ServiceImpl implements IGovBizProjectCimplementService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectDraftServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectDraftServiceImpl.java new file mode 100644 index 0000000..377d82d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectDraftServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectDraftMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectDraft; +import com.hz.pm.api.gov.service.IGovBizProjectDraftService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectDraftServiceImpl extends + ServiceImpl implements IGovBizProjectDraftService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectMimplementServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectMimplementServiceImpl.java new file mode 100644 index 0000000..e85e511 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectMimplementServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectMimplementMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectMimplement; +import com.hz.pm.api.gov.service.IGovBizProjectMimplementService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectMimplementServiceImpl extends + ServiceImpl implements IGovBizProjectMimplementService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectProcureServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectProcureServiceImpl.java new file mode 100644 index 0000000..2c7da53 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovBizProjectProcureServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovBizProjectProcureMapper; +import com.hz.pm.api.gov.model.entity.GovBizProjectProcure; +import com.hz.pm.api.gov.service.IGovBizProjectProcureService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovBizProjectProcureServiceImpl extends + ServiceImpl implements IGovBizProjectProcureService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java new file mode 100644 index 0000000..e6d1c48 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovOperationProjectBaseinfoMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovOperationProjectBaseinfoServiceImpl extends + ServiceImpl implements IGovOperationProjectBaseinfoService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectDraftServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectDraftServiceImpl.java new file mode 100644 index 0000000..e56459c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectDraftServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovOperationProjectDraftMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectDraft; +import com.hz.pm.api.gov.service.IGovOperationProjectDraftService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovOperationProjectDraftServiceImpl extends + ServiceImpl implements IGovOperationProjectDraftService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectTobePushServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectTobePushServiceImpl.java new file mode 100644 index 0000000..a1e1e08 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovOperationProjectTobePushServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovOperationProjectTobePushMapper; +import com.hz.pm.api.gov.model.entity.GovOperationProjectTobePush; +import com.hz.pm.api.gov.service.IGovOperationProjectTobePushService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-10-25 + */ +@Service +public class GovOperationProjectTobePushServiceImpl extends + ServiceImpl implements IGovOperationProjectTobePushService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovProjectDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovProjectDictionaryServiceImpl.java new file mode 100644 index 0000000..0dc955c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/service/impl/GovProjectDictionaryServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.gov.mapper.GovProjectDictionaryMapper; +import com.hz.pm.api.gov.model.entity.GovProjectDictionary; +import com.hz.pm.api.gov.service.IGovProjectDictionaryService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovProjectDictionaryServiceImpl extends + ServiceImpl implements IGovProjectDictionaryService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectCollectionUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectCollectionUtil.java new file mode 100644 index 0000000..d809876 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectCollectionUtil.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.gov.utils; + +import com.hz.pm.api.common.constant.CommonConst; +import org.apache.commons.lang3.StringUtils; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * @Classname ProjectCollectionUtil + * @Description + * @Date 2023/9/14 9:07 + * @Author PoffyZhang + */ +public class ProjectCollectionUtil { + + public static String convertLocalDateTime(LocalDateTime localDateTime){ + if(Objects.isNull(localDateTime)){ + return StringUtils.EMPTY; + } + return localDateTime.format(DateTimeFormatter.ofPattern(CommonConst.NORMAL_TIME_PATTERN)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java new file mode 100644 index 0000000..04c586a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java @@ -0,0 +1,377 @@ +package com.hz.pm.api.gov.utils; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.file.entity.File; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.gov.enumeration.GovProjectClassifiedEnum; +import com.hz.pm.api.gov.model.vo.*; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.PaymentPlanVO; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCollectionUtil + * @Description + * @Date 2023/9/14 9:07 + * @Author PoffyZhang + */ +@Slf4j +public class ProjectConvertUtil { + + /** + * 申报项目 转为 项目归集 + * @param project + * @return + */ + public static GovBizProjectDetailVO declaredToCollection(ProjectDetailVO project, FileService fileService){ + GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); + if(Objects.isNull(project)){ + return projectCollection; + } + String projectCode = project.getProjectCode(); + String projectName = project.getProjectName(); + projectCollection.setBaseProjId(projectCode); + projectCollection.setBaseProjName(projectName); + projectCollection.setBaseinfo(buildBaseinfo(project)); + projectCollection.setApply(buildApply(project)); + projectCollection.setApprove(buildApprove(project,fileService)); + String projectType = project.getProjectType(); + ProjectTypeNewEnum match = ProjectTypeNewEnum.match(projectType); + if(Objects.nonNull(match)){ + switch (match){ + case SJ_BUILD: + case FIRST_BUILD: + case SZ_BUILD: + projectCollection.setCimplement(buildCim(project)); + break; + case NEW_OPERA: + case XU_OPERA: + projectCollection.setMimplement(buildMim(project)); + break; + default: + break; + } + } + projectCollection.setProcures(buildProcure(project)); + return projectCollection; + } + + //转化基本信息 + private static GovBizProjectBaseinfoVO buildBaseinfo(ProjectDetailVO project) { + GovBizProjectBaseinfoVO baseinfo = new GovBizProjectBaseinfoVO(); + baseinfo.setBaseProjId(project.getProjectCode()); + baseinfo.setBaseProjName(project.getProjectName()); + baseinfo.setAreaCode(RegionConst.RC_LS); + baseinfo.setBaseAreaCode(project.getAreaCode() + RegionConst.NINE_CODE_LAST); + baseinfo.setBaseAreaName(project.getArea()); + baseinfo.setBaseBuildDeprt(project.getBuildOrgName()); + baseinfo.setBaseBuildDeprtDing(project.getBuildOrgCode()); + baseinfo.setBaseBuildDepartUsci(project.getOrgCreditCode()); + baseinfo.setBaseConstructionType(project.getBaseConstructionType()); + baseinfo.setBaseManDeprt(project.getSuperOrg()); + baseinfo.setBaseManDeprtDing(project.getSuperOrgCode()); + baseinfo.setBaseManDepartUsci(project.getSuperOrgCreditCode()); + baseinfo.setBaseProjContacts(project.getContactName()); + baseinfo.setBaseProjContactsCall(project.getContactPhone()); + baseinfo.setBaseProjIsConfidentiality(GovProjectClassifiedEnum.NOT_CLASSIFIED.getCode()); + baseinfo.setBaseProjPrincipal(project.getResponsibleMan()); + baseinfo.setBaseProjPrincipalCall(project.getResponsibleManMobile()); + baseinfo.setBaseProvManDeprt(project.getHigherSuperOrg()); + baseinfo.setBaseProvManDepartDing(project.getHigherSuperOrgCode()); + baseinfo.setBaseProvManDeprtType(project.getBaseProvManDeprtType()); + ProjectStatusEnum match = ProjectStatusEnum.match(project.getStatus()); + if(Objects.nonNull(match)){ + if(Objects.nonNull(match.getCollectionStatus())){ + baseinfo.setBaseProjSetProg(match.getCollectionStatus().getCode()); + } + } + baseinfo.setBaseProjType(project.getProjectType()); + baseinfo.setDeleted(Boolean.FALSE); + return baseinfo; + } + + //转化申报信息 + private static GovBizProjectApplyVO buildApply(ProjectDetailVO project) { + GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); +// apply.setBaseProjId(project.getProjectCode()); + apply.setBaseProjName(project.getProjectName()); + apply.setAreaCode(RegionConst.RC_LS); + apply.setBaseHistorProjId(project.getBaseHistorProjId()); + apply.setBaseBasisEstablish(project.getBaseBasisEstablish()); + List projectApplications = project.getProjectApplications(); + if(CollUtil.isNotEmpty(projectApplications)){ + String appName = projectApplications.stream().map(app -> { + if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { + return app.getRelatedExistsApplication(); + } + return app.getApplicationName(); + }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + String appCode = projectApplications.stream().map(app -> { + if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { + return app.getRelatedExistsApplicationCode(); + } + return app.getAppCode(); + }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + String accountName = projectApplications.stream() + .map(app -> StringUtils.isNotBlank(app.getAccountAppName()) ? app.getAccountAppName() : null) + .filter(Objects::nonNull) + .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + apply.setBaseAccountAppName(accountName); + apply.setBaseProjSys(appName); + apply.setBaseProjSysCode(appCode); + } + apply.setBaseBasisAmountOri(project.getBaseBasisAmountOri()); + String coreBusiness = project.getCoreBusiness(); + if(StringUtils.isNotBlank(coreBusiness)){ + try{ + JSONArray coreJson = JSON.parseArray(coreBusiness); + String matters = coreJson.stream().map(j -> { + JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); + return matterJson.getString("matterName"); + }).filter(Objects::nonNull) + .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + String matterCodes = coreJson.stream().map(j -> { + JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); + return matterJson.getString("oid"); + }).filter(Objects::nonNull) + .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + apply.setBaseCoreBusiness(matters); + apply.setBaseCoreBusinessCode(matterCodes); + }catch (Exception e){ + log.error("项目转化失败",e); + } + } + apply.setBaseDevelopCode(project.getDevelopCode()); + apply.setBaseLowestLevel(project.getLowestLevel()); + apply.setBaseHistorProjName(project.getBaseHistorProjName()); + apply.setBaseHistorProjYear(project.getBaseHistorProjYear()); + apply.setBaseProjApplyFile(project.getProjectApplicationForm()); + String beginTime = project.getBeginTime(); + String endTime = project.getEndTime(); + if(StringUtils.isNotBlank(beginTime)){ + apply.setBaseProjStartTime(BizUtils.convertLocalDateTime(beginTime)); + } + if(StringUtils.isNotBlank(endTime)){ + apply.setBaseProjEndTime(BizUtils.convertLocalDateTime(endTime)); + } + if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){ + try{ + String yearEnd = endTime.split(StrPool.DASH)[0]; + String yearStart = beginTime.split(StrPool.DASH)[0]; + String monthEnd = endTime.split(StrPool.DASH)[1]; + String monthStart = beginTime.split(StrPool.DASH)[1]; + Integer duration = Integer.parseInt(monthEnd) - Integer.parseInt(monthStart) + + (Integer.parseInt(yearEnd) - Integer.parseInt(yearStart)) * 12; + apply.setBaseProjDuration(String.valueOf(duration)); + }catch (Exception e){ + log.error("日期转换失败:",e); + } + } + apply.setBaseProjConsClass(project.getBuildLevel()); + apply.setBaseProjIntro(project.getProjectIntroduction()); + apply.setBaseProjBasis(project.getBaseProjBasis()); + apply.setBaseProjBasisFile(project.getBaseProjBasisFile()); + apply.setBaseProjDeclAmount(project.getAnnualPlanAmount()); + apply.setBaseProjTotalAmount(project.getDeclareAmount()); + apply.setBaseProjSetYear(Objects.nonNull(project.getProjectYear()) + ? String.valueOf(project.getProjectYear()) : null); + apply.setBaseProjRemark(project.getProjectRemarks()); + apply.setBaseProjOtherFile(project.getBaseProjOtherFile()); + apply.setBaseResearchReportFile(project.getBaseResearchReportFile()); + apply.setBeseExpectedResults(project.getBeseExpectedResults()); + apply.setSetProjCodeFinan(project.getFinancialCode()); + apply.setMissing(StringUtils.isNotBlank(project.getBaseHistorProjId()) ? Boolean.FALSE : Boolean.TRUE); + return apply; + } + + //转化审批信息 + private static GovBizProjectApproveVO buildApprove(ProjectDetailVO project,FileService fileService) { + GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); +// approve.setBaseProjId(project.getProjectCode()); + approve.setBaseProjName(project.getProjectName()); + File file = fileService.getById(project.getApprovedFile()); + if(Objects.nonNull(file)){ + approve.setApprovalFile(JSON.toJSONString(Lists.newArrayList(file))); + } + approve.setAreaCode(RegionConst.RC_LS); + approve.setDeleted(Boolean.FALSE); + approve.setBaseDevelopCode(project.getDevelopCode()); + approve.setBaseExpertTotalMoney(project.getProposeTotalInvest()); + approve.setBaseExpertYearMoney(project.getProposeAnnualBudget()); + approve.setBaseInitialReviewTotalMoney(project.getApprovalAmount()); + approve.setBaseProjReplyAmount(project.getApprovalBudget()); + approve.setBaseReviewCommentsFile(project.getProposeAttachFiles()); + List projectApplications = project.getProjectApplications(); + if(CollUtil.isNotEmpty(projectApplications)){ + Integer max = 0; + for(ProjectApplicationVO app : projectApplications){ + max = Math.max(app.getSecrecyGrade(),max); + } + if(max > 0){ + approve.setEqualProtectionLevel(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,max)); + } + } + approve.setPreliminaryDesignScheme(project.getPreliminaryPlanFile()); + approve.setPreliminaryDesignFile(project.getPreliminaryInspectionMaterials()); + approve.setBaseReviewOpinion(project.getProposeAttach()); + if(Objects.nonNull(project.getBaseReviewResults())){ + approve.setBaseReviewResults(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, + project.getBaseReviewResults())); + } + List purchases = project.getPurchases(); + if(CollUtil.isNotEmpty(purchases)){ + purchases.stream().map(PurchaseVO::getTransactionAmount) + .filter(Objects::nonNull).reduce(BigDecimal::add) + .ifPresent(j -> approve.setReleaseYearMoney(j)); + + } + return approve; + } + + //转化建设 实施 + private static GovBizProjectCimplementVO buildCim(ProjectDetailVO project) { + GovBizProjectCimplementVO cim = new GovBizProjectCimplementVO(); +// cim.setBaseProjId(project.getProjectCode()); + cim.setBaseProjName(project.getProjectName()); + cim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); + cim.setAreaCode(RegionConst.RC_LS); + cim.setDeleted(Boolean.FALSE); + cim.setBaseDevelopCode(project.getDevelopCode()); + //总结报告 + cim.setBaseSummReportFile(searchReportFile(project,5,2)); + //监理总结报告 + cim.setBaseEstaSummFile(searchReportFile(project,5,3)); + //建设核查表 + cim.setBaseCheckFile(searchReportFile(project,3,2)); + cim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); + cim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); + List projectApplications = project.getProjectApplications(); + if(CollUtil.isNotEmpty(projectApplications)){ + String appCode = projectApplications.stream().map(app -> { + if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { + return app.getRelatedExistsApplicationCode(); + } + return app.getAppCode(); + }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + cim.setBaseProjSysCode(appCode); + } + return cim; + } + + //转化运维实施 + private static GovBizProjectMimplementVO buildMim(ProjectDetailVO project) { + GovBizProjectMimplementVO mim = new GovBizProjectMimplementVO(); +// mim.setBaseProjId(project.getProjectCode()); + mim.setBaseProjName(project.getProjectName()); + mim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); + mim.setAreaCode(RegionConst.RC_LS); + mim.setDeleted(Boolean.FALSE); + mim.setBaseDevelopCode(project.getDevelopCode()); + //监理总结报告 + mim.setBaseEstaSummFile(searchReportFile(project,5,3)); + //建设核查表 +// mim.setBaseCheckFile(searchReportFile(project,3,2)); + mim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); +// mim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); + List projectApplications = project.getProjectApplications(); + if(CollUtil.isNotEmpty(projectApplications)){ + String appCode = projectApplications.stream().map(app -> { + if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { + return app.getRelatedExistsApplicationCode(); + } + return app.getAppCode(); + }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); + mim.setBaseProjSysCode(appCode); + } + return mim; + } + + //转化采购信息 + private static List buildProcure(ProjectDetailVO project) { + List purchases = project.getPurchases(); + ContractVO contract = project.getContract(); + final BigDecimal[] paymentTotal = {BigDecimal.ZERO}; + if(Objects.nonNull(contract)){ + List payments = contract.getPayments(); + payments.stream().map(PaymentPlanVO::getPaymentAmount) + .reduce(BigDecimal::add) + .ifPresent(b -> paymentTotal[0] = b); + } + if(CollUtil.isNotEmpty(purchases)){ + return purchases.stream().map(p -> { + GovBizProjectProcureVO purchase = new GovBizProjectProcureVO(); + purchase.setBaseProjName(project.getProjectName()); + purchase.setAreaCode(RegionConst.RC_LS); + purchase.setDeleted(Boolean.FALSE); + purchase.setBaseBidName(p.getBidName()); + purchase.setBasePurchasingAgencies(p.getAgency()); + purchase.setBaseUnifiedCreditCode(p.getPurchaseSocialCreditCode()); + purchase.setBaseConsDeprt(p.getSupplier()); + purchase.setBaseConsDeprtUsci(p.getSupplierSocialCreditCode()); + purchase.setBasePaymentTime(p.getTransactionTime()); + purchase.setBaseProjPurchaseAmount(p.getTransactionAmount()); + purchase.setBaseProjPurchaseWay(p.getPurchaseMethod()); + purchase.setBasePurchaseCode(p.getBudgetExecConfirmNo()); + purchase.setBaseWinningBidTime(p.getTransactionTime()); + purchase.setBiddingFile(p.getAcceptanceLetter()); + purchase.setPaymentProgress(paymentTotal[0]); + if(Objects.nonNull(contract)){ + purchase.setPurchaseContract(contract.getAttachment()); + } + purchase.setSetProjCodeFinan(project.getFinancialCode()); + purchase.setPurchaseFile(p.getBidDoc()); + return purchase; + }).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + /** + * 查询项目 初验终验的 报告 + * @param project + * @return + */ + private static String searchReportFile(ProjectDetailVO project,Integer firstIndex,Integer secondIndex) { + if(Objects.isNull(project)){ + return null; + } + if(StringUtils.isNotBlank(project.getFinalAcceptanceMaterials())){ + return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); + }else if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){ + return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); + } + return null; + } + + private static String searchReportFileInner(String fileStr,Integer firstIndex,Integer secondIndex) { + try{ + JSONArray jsonArray = JSON.parseArray(fileStr); + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jsonArray.get(firstIndex - 1))); + JSONArray data = jsonObject.getJSONArray("data"); + JSONObject wangong = JSON.parseObject(JSON.toJSONString(data.get(secondIndex - 1))); + JSONArray files = wangong.getJSONArray("files"); + return JSON.toJSONString(files); + }catch (Exception e){ + log.error("解析文件失败:",e); + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/config/IrsSealPlatformProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/config/IrsSealPlatformProperties.java new file mode 100644 index 0000000..c9fda13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/config/IrsSealPlatformProperties.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.irs.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2023/3/16 下午6:03 + */ + +@Component +@Data +public class IrsSealPlatformProperties { + public static String projectId; + + public static String projectSecret; + + public static String accessKey; + + public static String secretKey; + + public static String apiUrl; + + @Value("${irs.seal-platform.project-id}") + public void setProjectId(String projectId) { + IrsSealPlatformProperties.projectId = projectId; + } + + @Value("${irs.seal-platform.project-secret}") + public void setProjectSecret(String projectSecret) { + IrsSealPlatformProperties.projectSecret = projectSecret; + } + + @Value("${irs.seal-platform.access-key}") + public void setAccessKey(String accessKey) { + IrsSealPlatformProperties.accessKey = accessKey; + } + + @Value("${irs.seal-platform.secret-key}") + public void setSecretKey(String secretKey) { + IrsSealPlatformProperties.secretKey = secretKey; + } + + @Value("${irs.seal-platform.api-url}") + public void setApiUrl(String apiUrl) { + IrsSealPlatformProperties.apiUrl = apiUrl; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/ApplicationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/ApplicationController.java new file mode 100644 index 0000000..3b77374 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/ApplicationController.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.irs.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.irs.manage.AppIrsManage; +import com.hz.pm.api.irs.model.dto.ApiApplyDTO; +import com.hz.pm.api.irs.model.dto.PushProjectAppToIrsDTO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.security.NoSuchAlgorithmException; + +/** + * @Classname ApplicationController + * @Description + * @Date 2023/7/12 9:26 + * @Author PoffyZhang + */ +@RestController +@RequestMapping("/api/v1/irs/app") +@AllArgsConstructor +@Slf4j +@Valid +public class ApplicationController { + + private final AppIrsManage appIrsManage; + + @PostMapping("/push-project-app") + @WebLog("推送项目和应用关系") + public Boolean pushProjectApp(@Valid @RequestBody PushProjectAppToIrsDTO dto) throws Exception { + return appIrsManage.pushProjectApp(dto); + } + + @GetMapping("/sreach-app") + public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { + return appIrsManage.searchApp(apply); + } + + @GetMapping("/sreach-apps") + public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { + return appIrsManage.searchApps(apply); + } + + @GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}") + public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) { + return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java new file mode 100644 index 0000000..fa0d767 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.irs.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.irs.model.dto.ForwardDTO; +import com.hz.pm.api.projectdeclared.manage.IrsManage; +import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO; +import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO; +import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.io.UnsupportedEncodingException; +import java.net.UnknownHostException; +import java.security.NoSuchAlgorithmException; +import java.util.List; + +/** + * @Classname IrsController + * @Description irs 一些下拉框信息 + * @Date 2023/3/13 9:53 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/irs") +@Api(value = "irs", tags = "irs-信息查询") +@RequiredArgsConstructor +public class IrsController { + + private final IrsManage irsManage; + + private final SynProjectCoreBizTask projectCoreBizTask; + + @ApiOperation(value = "irs应用列表", notes = "irs应用列表") + @WebLog("irs应用列表") + @GetMapping("/application-list") + public List applicationList(@RequestParam(required = false) String areaCode) { + return irsManage.applicationList(areaCode); + } + + @ApiOperation(value = "试点任务列表", notes = "试点任务列表") + @WebLog("试点任务列表") + @GetMapping("/piot-tasks") + public List piotTasks() { + return irsManage.listPiotTasks(); + } + + @ApiOperation(value = "获取企业社会信用编码", notes = "获取企业社会信用编码") + @GetMapping("/get-credit-code") + public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { + return irsManage.getCreditCode(); + } + + @ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") + @GetMapping("/refresh-core-biz") + public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException { + if(StringUtils.isNotBlank(orgCode)){ + projectCoreBizTask.doTask(orgCode); + }else{ + projectCoreBizTask.doTask(); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java new file mode 100644 index 0000000..c6e6939 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.irs.controller; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO; +import com.hz.pm.api.irs.manage.IrsProjectManage; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 IrsController + * @Description irs 一些下拉框信息 + * @Date 2023/3/13 9:53 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/irs/project/") +@Api(value = "irs", tags = "irs-IRS项目信息") +@RequiredArgsConstructor +public class IrsProjectController { + + private final IrsProjectManage irsProjectManage; + + @ApiOperation(value = "IRS项目列表", notes = "IRS项目列表") + @GetMapping("/list") + public PageVo list(ProjectListReq projectListReq) { + return irsProjectManage.list(projectListReq); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/OrganizationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/OrganizationController.java new file mode 100644 index 0000000..a4e938e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/OrganizationController.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java new file mode 100644 index 0000000..94e3e5e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java @@ -0,0 +1,398 @@ +package com.hz.pm.api.irs.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.crypto.digest.MD5; +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.basic.function.VUtils; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.common.util.RefreshKeyUtil; +import com.hz.pm.api.irs.model.dto.ApiApplyDTO; +import com.hz.pm.api.irs.model.dto.ApiApplySearchResult; +import com.hz.pm.api.irs.model.dto.PushProjectAppToIrsDTO; +import com.hz.pm.api.irs.model.res.ApiResponse; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +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.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname AppIrsManage + * @Description + * @Date 2023/7/12 11:43 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class AppIrsManage { + + private final IProjectService projectService; + + private final IProjectApplicationService applicationService; + + private final StateMachineUtils stateMachineUtils; + + @Value("${irs.push-app.appKey}") + private String pushAppKey; + + @Value("${irs.push-app.appScret}") + private String pushAppScret; + + @Value("${irs.push-app.url}") + private String pushUrl; + + @Value("${irs.search-app.appKey}") + private String searchAppKey; + + @Value("${irs.search-app.appScret}") + private String searchAppScret; + + @Value("${irs.search-app.url}") + private String searchUrl; + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + @Value("${irs.push-project-detail.url}") + private String pushProjectUrl; + + @Value("${irs.push-project-detail.appKey}") + private String pushProjectAppKey; + + @Value("${irs.push-project-detail.appSecret}") + private String pushProjectAppSecret; + + //=============数字资源指标获取======================================================================================== + + @Value("${irs.digital-resource-indicators.app-key}") + private String driAppKey; + + @Value("${irs.digital-resource-indicators.app-secret}") + private String driAppSecret; + + @Value("${irs.digital-resource-indicators.interface-name}") + private String driInterfaceName; + + @Value("${irs.digital-resource-indicators.url}") + private String driUrl; + + /** + * 推送 项目和应用关系 + * + * @param dto + * @return + * @throws NoSuchAlgorithmException + */ + public Boolean pushProjectApp(PushProjectAppToIrsDTO dto) throws Exception { + String appCode = dto.getAppCode(); + Long appId = dto.getAppId(); + String projectCode = dto.getProjectCode(); + ProjectApplication app = applicationService.getById(appId); + VUtils.isTrue(Objects.isNull(app)).throwMessage("应用不存在!"); + VUtils.isTrue(CommonEnum.NO.getCode().equals(app.getIsFirst())).throwMessage("应用不是初次新建!"); + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + + ApiApplyDTO apiApply = new ApiApplyDTO(); + apiApply.setAppId(appCode); + JSONObject jsonObject = this.searchApp(apiApply); + ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class); + VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); + + long timestamp = System.currentTimeMillis(); + String areaCode = project.getAreaCode(); + String projectName = project.getProjectName(); + String requestSecret = refreshTokenService.refreshToken(pushAppKey, pushAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name()); + String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); + String capTime = String.valueOf(timestamp); + String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); + String url = pushUrl + "?requestTime=" + timestamp + + "&sign=" + sign + "&appKey=" + pushAppKey + "&capCode=" + capCode + "&capTime=" + capTime + + "&baseProjSys=" + apiApplySearchResult.getName() + "&areaCode=" + areaCode + "&baseProjName=" + projectName + + "&baseProjId=" + project.getProjectCode() + + "&isEffective=1&baseProjSysCode=" + appCode; + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, ApiResponse.class); + + log.info("推送 项目和应用结果 : {}", JSON.toJSONString(forEntity)); + + ApiResponse body = forEntity.getBody(); + + if (Objects.isNull(body) || Objects.isNull(body.getCode()) + || 0 != body.getCode()) { + return Boolean.FALSE; + } + + //保存关系 + app.setAppCode(appCode); + if (applicationService.updateById(app)) { + /** + * 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 + * 如果都已经注册 要调用状态机 进入下一个状态 + */ + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, project.getId())); + //筛选出 初次新建的app 但是没有appCode的 + apps = apps.stream().filter(a -> { + if (CommonEnum.YES.getCode().equals(a.getIsFirst()) && + StringUtils.isBlank(app.getAppCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }) + .collect(Collectors.toList()); + + //如果筛选出来的 为空的话 就调用状态机 + if (CollUtil.isEmpty(apps)) { + stateMachineUtils.pass(project); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + } + } + + return body.getSuccess(); + } + + /** + * 查询app + * + * @param apply + * @return + * @throws NoSuchAlgorithmException + */ + public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appCode = apply.getAppId(); + String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name()); + String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); + String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + searchAppKey + "&" + + "pageSize=10&pageNum=1&appCode=" + appCode + + "&areaCode=&deptCode=&name="; + log.info("url : {}", url); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) { + JSONObject body = JSON.parseObject(forEntity.getBody()); + if (Objects.isNull(body)) { + return null; + } + JSONObject datas = body.getJSONObject("datas"); + if (Objects.isNull(datas)) { + return null; + } + JSONObject data = datas.getJSONObject("data"); + if (Objects.isNull(data)) { + return null; + } + JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); + if (CollUtil.isEmpty(apiApplySearchResult)) { + return null; + } + return apiApplySearchResult.getJSONObject(0); + } + return null; + } + + public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = StringUtils.isNotBlank(apply.getAreaCode()) ? + convertAreaCode(apply.getAreaCode()) : null; + String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl, + HttpMethod.POST.name()); + String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); + String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + searchAppKey + "&pageSize=1000&" + + "pageNum=1&areaCode=" + areaCode + + "&deptCode=&name="; + log.info("查询应用目录:{}",url); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + log.info("查询应用目录 : {}", forEntity.getStatusCode()); + + if (Objects.nonNull(forEntity.getBody())) { + JSONObject body = JSON.parseObject(forEntity.getBody()); + if (Objects.isNull(body)) { + return null; + } + JSONObject datas = body.getJSONObject("datas"); + if (Objects.isNull(datas)) { + return null; + } + JSONObject data = datas.getJSONObject("data"); + if (Objects.isNull(data)) { + return null; + } + JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); + return apiApplySearchResult; + } + return null; + } + + /** + * 如果是市本级的 结尾改成01 还要转换开发区的code + * @param areaCode + * @return + */ + private String convertAreaCode(String areaCode) { + if(RegionConst.RC_LS.equals(areaCode) || RegionConst.LS_KF.equals(areaCode)){ + return RegionConst.RC_LS_SBJ_IRS; + } + return areaCode; + } + + public String testGuibing() throws Exception { + long timestamp = System.currentTimeMillis(); + String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String method = "POST"; + String interfaceName = "5crv7i4727abLCv0"; + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); + log.info("secret :{}", secret); + String sign = MD5.create().digestHex(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if (Objects.nonNull(factory)) { + restTemplate = new RestTemplate(factory); + } else { + restTemplate = new RestTemplate(); + } + String appId = "A330000100000202105005790"; + String capCode = CryptUtils.encryptHMAC(timestamp + appId, "bcb4fc0f517fc168ee543fcf4d231f3b"); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + + "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + + "&sign=" + sign + "&appKey=" + appKey + + "&capCode=" + capCode + "&capTime=" + timestamp + + "&appId=" + appId; + log.info("url :{}", url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + } + + /** + * 推送项目详情 + * + * @return + */ + public String pushProjectDetail(ProjectDTO projectDto) { + long timestamp = System.currentTimeMillis(); + String appSecret = pushProjectAppSecret; + String appKey = pushProjectAppKey; + String method = HttpMethod.POST.name(); + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); + log.info("secret :{}", secret); + String sign = MD5.create().digestHex(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if (Objects.nonNull(factory)) { + restTemplate = new RestTemplate(factory); + } else { + restTemplate = new RestTemplate(); + } + String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" + String baseProjSetYear = String.valueOf(projectDto.getProjectYear());//"2022" + String baseProjId = projectDto.getProjectCode();//"331123220130969000000" + String baseManDeprt = projectDto.getBuildOrgName();//"遂昌县大数据和金融发展中心" + String baseProjBasis = projectDto.getBaseProjBasis();//"2" + String baseLowestLevel = projectDto.getBaseLowestLevel();//"C" + String ProjPrincipalCall = projectDto.getResponsibleManMobile();//"13884366607" + //内容类别 + String baseConstructionType = projectDto.getBaseConstructionType();//"01" + String baseProjType = projectDto.getBaseProjType();//"1" + String baseProjContacts = projectDto.getContactName();//"毛以林" + String isEffective = "02"; // 有效 + String baseConsDeprtDing = projectDto.getBuildOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1"; + String baseProjSetProg = projectDto.getBaseProjSetProg();//"04" + String baseProjContactsCall = projectDto.getContactPhone();//"13857049999" + String baseProjName = projectDto.getProjectName();//"遂昌县大数据和金融发展中心天工系统" + String baseProjConsClass = projectDto.getBaseProjConsClass();//"C" + String areaCode = projectDto.getAreaCode();//"331123000" + String baseAreaName = projectDto.getArea();//"遂昌县"; + String baseManDeprtDing = projectDto.getSuperOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1"; + String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; + String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; + String capCode = null; + try { + capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); + } catch (Exception e) { + log.error(e.getMessage()); + } + + String url = pushProjectUrl + "?" + + "requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + + "&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + + "&baseManDeprt=" + baseManDeprt + "&baseProjBasis=" + baseProjBasis + + "&baseLowestLevel=" + baseLowestLevel + "&ProjPrincipalCall=" + ProjPrincipalCall + + "&baseConstructionType=" + baseConstructionType + "&baseProjType=" + baseProjType + + "&baseProjContacts=" + baseProjContacts + "&isEffective=" + isEffective + + "&baseConsDeprtDing=" + baseConsDeprtDing + "&baseProjSetProg=" + baseProjSetProg + + "&baseProjContactsCall=" + baseProjContactsCall + "&baseProjName=" + baseProjName + + "&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + + "&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + + "&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; + log.info("url :{}", url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + } + + public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) { + long timestamp = System.currentTimeMillis(); + String appSecret = driAppSecret; + String appKey = driAppKey; + String method = HttpMethod.POST.name(); + String interfaceName = driInterfaceName; + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); + log.info("secret : {}", secret); + String sign = MD5.create().digestHex(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if (Objects.nonNull(factory)) { + restTemplate = new RestTemplate(factory); + } else { + restTemplate = new RestTemplate(); + } + + String url = driUrl + "?" + + "requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize; + log.info("url :{}", url); + ResponseEntity forEntity = restTemplate.getForEntity(url, JSONObject.class); + log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString()); + return forEntity.getBody(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java new file mode 100644 index 0000000..769add0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -0,0 +1,85 @@ +package com.hz.pm.api.irs.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.model.PageVo; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname IrsProjectManage + * @Description + * @Date 2023/8/15 11:43 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class IrsProjectManage { + + private final IProjectService projectService; + + /** + * IRS档案 项目列表 + * @param req + * @return + */ + public PageVo list(ProjectListReq req) { + Page page = req.page(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .eq(StringUtils.isNotBlank(req.getAreaCode()),Project::getAreaCode,req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) + .eq(StringUtils.isNotBlank(req.getProjectType()),Project::getProjectType,req.getProjectType()) + .eq(Objects.nonNull(req.getStatus()),Project::getStatus,req.getStatus()) + .eq(Objects.nonNull(req.getStage()),Project::getStage,req.getStage()) + .ge(Objects.nonNull(req.getApproveAmountMin()),Project::getApprovalAmount,req.getApproveAmountMin()) + .le(Objects.nonNull(req.getApproveAmountMax()),Project::getApprovalAmount,req.getApproveAmountMax()) + .eq(Objects.nonNull(req.getProjectYear()),Project::getProjectYear,req.getProjectYear()) + .ge(Objects.nonNull(req.getCreateOnMin()),Project::getCreateOn,req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()),Project::getCreateOn,req.getCreateOnMax()) + .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) + .gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) + .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getIncludeApplication, CommonEnum.YES.getCode()) + .orderByDesc(Project::getUpdateOn); + buildPermission(wrapper,user); + projectService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List res = page.getRecords().stream().map(p -> { + ProjectLibListItemVO vo = BeanUtil.copyProperties(p,ProjectLibListItemVO.class); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + private void buildPermission(LambdaQueryWrapper wrapper, UserInfoDetails user) { + if(user.getSuperAdmin()){ + log.info("超管 都可看 项目档案列表"); + }else if(user.getRegionAdmin()){ + wrapper.eq(Project::getAreaCode,user.getRegionCode()); + }else{ + wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/ProjectIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/ProjectIrsManage.java new file mode 100644 index 0000000..93594cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/ProjectIrsManage.java @@ -0,0 +1,93 @@ +package com.hz.pm.api.irs.manage; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.common.util.RefreshKeyUtil; +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, + 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=" + (StringUtils.isNotBlank(orgCode)?orgCode:StringUtils.EMPTY) + + "&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("core biz :{}",body); + + JSONObject datas = body.getJSONObject("datas"); + if(Objects.nonNull(datas)){ + return datas; + } + return forEntity.getBody(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/mapper/ProjectCoreBizMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/mapper/ProjectCoreBizMapper.java new file mode 100644 index 0000000..26804b0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/mapper/ProjectCoreBizMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.irs.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-09-13 + */ +public interface ProjectCoreBizMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplyDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplyDTO.java new file mode 100644 index 0000000..b26a6dd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplyDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.irs.model.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApiApplyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private int id; + private String orgId; + private String userId; + private String isDeleted; + private String name; + private String appId; + private String type; + private String status; + private String sysStateTime; + private String deptName; + private String deptCode; + private String fiveAreas; + private String constructionLevel; + private String isUnifiedConstruction; + private String deployType; + private String principal; + private String employeeCode; + private String areaCode; + private String areaName; + private String createTime; + private String modifiedTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplySearchResult.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplySearchResult.java new file mode 100644 index 0000000..c277c86 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiApplySearchResult.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.irs.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ApiApplySearchResult implements Serializable { + + private static final long serialVersionUID = 1L; + + private int id; + private String orgId; + private String userId; + private String isDeleted; + private String name; + private String appId; + private String type; + private String status; + private String sysStateTime; + private String systemAreas; + private String deptName; + private String deptCode; + private String fiveAreas; + private String constructionLevel; + private String isUnifiedConstruction; + private String deployType; + private String principal; + private String employeeCode; + private String areaName; + private String createTime; + private String modifiedTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiDTO.java new file mode 100644 index 0000000..ce1f4c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiDTO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.irs.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.poi.ss.formula.functions.T; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname ApiDTO + * @Description + * @Date 2023/7/13 18:03 + * @Author PoffyZhang + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ApiDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String code; + private String msg; + private ApiSearchResult data; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiSearchResult.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiSearchResult.java new file mode 100644 index 0000000..0499d49 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ApiSearchResult.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.irs.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ApiSearchResult implements Serializable { + + private static final long serialVersionUID = 1L; + + private Boolean success; + private Integer code; + private String message; + private Integer totalCount; + private Integer pageSize; + private Integer pageNum; + private List apiApplySearchResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ForwardDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ForwardDTO.java new file mode 100644 index 0000000..d88e41c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/ForwardDTO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.irs.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Classname ForwardDTO + * @Description + * @Date 2023/7/13 18:03 + * @Author PoffyZhang + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ForwardDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String url; + private String secret; + private String appKey; + private String sign; + private Long requestTime; + private Map data; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/PushProjectAppToIrsDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/PushProjectAppToIrsDTO.java new file mode 100644 index 0000000..7528741 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/dto/PushProjectAppToIrsDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.irs.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Classname PushProjectAppToIrsDto + * @Description + * @Date 2023/7/12 11:39 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class PushProjectAppToIrsDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("我们系统的appId") + @NotNull(message = "appId 不能为空") + private Long appId; + + @ApiModelProperty("app code") + @NotBlank(message = "appCode 不能为空") + private String appCode; + + @ApiModelProperty("项目编码") + @NotBlank(message = "项目编码 不能为空") + private String projectCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/entity/ProjectCoreBiz.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/entity/ProjectCoreBiz.java new file mode 100644 index 0000000..1fcd3c4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/entity/ProjectCoreBiz.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.irs.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.time.LocalDateTime; + +/** + * @Classname ProjectCoreBiz + * @Description + * @Date 2023/9/13 15:33 + * @Author PoffyZhang + */ +@Data +@TableName("nd_project_core_biz") +@ApiModel(value = "项目核心业务对象") +public class ProjectCoreBiz { + @TableId(type = IdType.AUTO) + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("irs那边的ID") + private Long irsId; + + @ApiModelProperty("生成的业务编号") + private String matterCode; + + @ApiModelProperty("业务名") + private String matterName; + + @ApiModelProperty("企业名") + private String orgName; + + @ApiModelProperty("企业钉code") + private String orgCode; + + @ApiModelProperty("区域名") + private String areaName; + + @ApiModelProperty("状态") + private String userState; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/res/ApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/res/ApiResponse.java new file mode 100644 index 0000000..cd9222b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/model/res/ApiResponse.java @@ -0,0 +1,123 @@ +package com.hz.pm.api.irs.model.res; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiStatus; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * ApiResponse - 统一的接口返回值封装 + *

+ * + * @author WendyYang + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class ApiResponse implements Serializable { + private static final long serialVersionUID = 532384723325394156L; + + public static final int SUCCESS_CODE = 200; + + public static final String SUCCESS_MSG = "success"; + + public static final int ERROR_CODE = 500; + + public static final String ERROR_MSG = "Internal server error"; + + /** + * 状态码 + */ + private Integer code; + + /** + * 返回内容 + */ + private String message; + + /** + * 返回数据 + */ + private T data; + + + private Boolean success; + /** + * 全参构造函数 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + */ + private ApiResponse(Integer code, String message, T data,Boolean success) { + this.code = code; + this.message = message; + this.data = data; + this.success = success; + } + + /** + * 构造一个自定义的API返回 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse of(Integer code, String message, T data,Boolean success) { + return new ApiResponse(code, message, data,success); + } + + /** + * 构造一个成功且不带数据的API返回 + * + * @return ApiResponse + */ + public static ApiResponse ofSuccess() { + return ofSuccess(null); + } + + /** + * 构造一个成功且带数据的API返回 + * + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse ofSuccess(T data) { + return ofStatus(Status.OK, data,Boolean.TRUE); + } + + /** + * 构造一个成功且自定义消息的API返回 + * + * @param message 返回内容 + * @return ApiResponse + */ + public static ApiResponse ofMessage(String message) { + return of(Status.OK.getCode(), message, null,Boolean.TRUE); + } + + /** + * 构造一个有状态的API返回 + * + * @param status 状态 {@link Status} + * @return ApiResponse + */ + public static ApiResponse ofStatus(ApiStatus status) { + return ofStatus(status, null,Boolean.TRUE); + } + + /** + * 构造一个有状态且带数据的API返回 + * + * @param status 状态 {@link Status} + * @param data 返回数据 + * @return ApiResponse + */ + public static ApiResponse ofStatus(ApiStatus status, T data,Boolean success) { + return of(status.getCode(), status.getReasonPhrase(), data,success); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/IProjectCoreBizService.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/IProjectCoreBizService.java new file mode 100644 index 0000000..f7e153e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/IProjectCoreBizService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.irs.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.gov.entity.BelongOrg; +import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Zpf + * @since 2023-09-13 + */ +public interface IProjectCoreBizService extends IService { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/impl/ProjectCoreBizServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/impl/ProjectCoreBizServiceImpl.java new file mode 100644 index 0000000..8b7366a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/service/impl/ProjectCoreBizServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.irs.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.irs.mapper.ProjectCoreBizMapper; +import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; +import com.hz.pm.api.irs.service.IProjectCoreBizService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-09-13 + */ +@Service +public class ProjectCoreBizServiceImpl extends ServiceImpl + implements IProjectCoreBizService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/sign/IRSAPIRequest.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/sign/IRSAPIRequest.java new file mode 100644 index 0000000..cf22fca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/sign/IRSAPIRequest.java @@ -0,0 +1,329 @@ +package com.hz.pm.api.irs.sign; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.irs.config.IrsSealPlatformProperties; +import com.hz.pm.api.todocenter.model.dto.SignReqDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; +import java.io.*; +import java.net.URI; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.Key; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; +@Slf4j +public class IRSAPIRequest { + + /** + * pdf文件盖章 + * 接口地址:/V1/accounts/outerAccounts/create + * + * @return + */ + public static String createSignPdf(SignReqDTO req) { + String pdfEncode64 = req.getPdfEncode64(); + Float posX = req.getPosX(); + Float posY = req.getPosY(); + String sealSn = req.getSealSn(); + String fileName = req.getFileName(); + String posPage = req.getPosPage(); + Integer signType = req.getSignType(); + String resp; + try { + JSONObject ReqData = new JSONObject(); + ReqData.put("fileBase64", pdfEncode64); + ReqData.put("sealSn", sealSn); + ReqData.put("posX", posX); + ReqData.put("posY", posY); + ReqData.put("signType", signType); + ReqData.put("posPage", posPage); + ReqData.put("fileName", fileName); + resp = post(ReqData, "post"); + } catch (Exception e) { + throw new BizException("调用IRS盖章接口失败,印章编号为:" + sealSn + StrPool.SEMICOLON + e.getMessage()); + } + // return obj; + JSONObject jsonObject = JSON.parseObject(resp, JSONObject.class); + String data = jsonObject.getString("data"); + JSONObject object = JSON.parseObject(data, JSONObject.class); + // 获取盖好章的PDF文件内容Base64字符串 + return object.getString("signFileB64"); + } + + + public static String post(JSONObject data, String requestMethod) throws Exception { + + //计算irs请求头里面参数信息 + DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + String date = dateFormat.format(new Date()); + URL url = new URL(IrsSealPlatformProperties.apiUrl); + URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery(), null); + String canonicalQueryString = getCanonicalQueryString(uri.getQuery()); + String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + IrsSealPlatformProperties.accessKey + "\n" + date + "\n"; + Mac hasher = Mac.getInstance("HmacSHA256"); + hasher.init(new SecretKeySpec(IrsSealPlatformProperties.secretKey.getBytes(), "HmacSHA256")); + byte[] hash = hasher.doFinal(message.getBytes()); + DatatypeConverter.printHexBinary(hash); + String sign = DatatypeConverter.printBase64Binary(hash); + + // 计算电子印章组件signature值 + byte[] stream = data.toString().getBytes(StandardCharsets.UTF_8); + // 签名数据,根据签名算法,对请求数据进行签名 + String signature = sign(stream); + // 设置HTTP请求头 + HttpEntityEnclosingRequestBase req = new HttpPost(IrsSealPlatformProperties.apiUrl); + // project-id为用户的projectId + req.addHeader("appId", IrsSealPlatformProperties.projectId); + // signature为之前生成的签名 + req.addHeader("signature", signature); + req.addHeader("X-BG-HMAC-SIGNATURE", sign); + req.addHeader("X-BG-HMAC-ALGORITHM", "hmac-sha256"); + req.addHeader("X-BG-HMAC-ACCESS-KEY", IrsSealPlatformProperties.accessKey); + req.addHeader("X-BG-DATE-TIME", date); + req.addHeader("Content-Type", "application/json"); + + // 设置HTTP请求体 + HttpEntity entity = new ByteArrayEntity(stream, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), "UTF-8")); + req.setEntity(entity); + + // 执行请求 + // 自定义 RequestConfig 设置请求超时时间 + RequestConfig requestConfig = RequestConfig.custom() + // 连接超时时间,单位:毫秒 + .setConnectTimeout(5000) + // 连接请求超时时间,单位:毫秒 + .setConnectionRequestTimeout(5000) + // 数据读取超时时间,单位:毫秒 + .setSocketTimeout(5000) + .build(); + // 通过 HttpClientBuilder 的 custom() 方法创建自定义的 HttpClient + CloseableHttpClient customHttpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + HttpResponse res = customHttpClient.execute(req); + int statusCode = res.getStatusLine().getStatusCode(); + log.info(String.valueOf(statusCode)); + if (200 != statusCode) { + log.info(String.valueOf(statusCode)); + } + // 获取响应 + InputStream in = res.getEntity().getContent(); + + byte[] resp = readStream(in); + String strRes = new String(resp, StandardCharsets.UTF_8); + log.info(strRes); + customHttpClient.close(); + return strRes; + } + + private static String sign(byte[] stream) throws Exception { + // 获取消息验证码类的实例,算法选择"HmacSHA256" + Mac mac = Mac.getInstance("HmacSHA256"); + + // 获取安全密钥 + Key secKey = new SecretKeySpec(IrsSealPlatformProperties.projectSecret.getBytes(StandardCharsets.UTF_8), mac.getAlgorithm()); + + // 初始化 + mac.init(secKey); + + // 获得签名 + byte[] sign = mac.doFinal(stream); + + // 将byte[]格式的签名用binary编码转化为字符串返回 + return binaryEncode(sign); + + } + + private static String sign1(byte[] stream) throws Exception { + // 获取消息验证码类的实例,算法选择"HmacSHA256" + Mac mac = Mac.getInstance("HmacSHA256"); + + // 获取安全密钥 + Key secKey = new SecretKeySpec(IrsSealPlatformProperties.secretKey.getBytes(StandardCharsets.UTF_8), mac.getAlgorithm()); + + // 初始化 + mac.init(secKey); + + // 获得签名 + byte[] sign = mac.doFinal(stream); + + // 将byte[]格式的签名用binary编码转化为字符串返回 + return binaryEncode(sign); + + } + + public static String binaryEncode(byte[] data) { + final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + StringBuilder builder = new StringBuilder(); + + for (byte i : data) { + builder.append(hexDigits[i >>> 4 & 0xf]); + builder.append(hexDigits[i & 0xf]); + } + + return builder.toString(); + } + + public static byte[] readStream(InputStream in) throws IOException { + + ByteArrayOutputStream output = new ByteArrayOutputStream(); + + byte[] buffer = new byte[1024 * 10]; + try { + int n; + while ((n = in.read(buffer)) != -1) { + output.write(buffer, 0, n); + } + return output.toByteArray(); + } finally { + in.close(); + output.close(); + } + } + + /** + * Description: 将pdf文件转换为Base64编码 + *

+ * // * @param 要转的的pdf文件 + * + * @Author fuyuwei + * Create Date: 2015年8月3日 下午9:52:30 + */ + public static String PDFToBase64(File file) { + FileInputStream fin = null; + BufferedInputStream bin = null; + ByteArrayOutputStream baos; + BufferedOutputStream bout = null; + try { + fin = new FileInputStream(file); + bin = new BufferedInputStream(fin); + baos = new ByteArrayOutputStream(); + bout = new BufferedOutputStream(baos); + byte[] buffer = new byte[1024]; + int len = bin.read(buffer); + while (len != -1) { + bout.write(buffer, 0, len); + len = bin.read(buffer); + } + //刷新此输出流并强制写出所有缓冲的输出字节 + bout.flush(); + byte[] bytes = baos.toByteArray(); + return String.valueOf(Base64.getEncoder().encode(bytes)); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + fin.close(); + bin.close(); + bout.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * Description: 将base64编码内容转换为Pdf + *

+ * // * @param base64编码内容,文件的存储路径(含文件名) + * + * @Author fuyuwei + * Create Date: 2015年7月30日 上午9:40:23 + */ + public static void base64StringToPdf(String base64Content, String filePath) { + BASE64Decoder decoder = new BASE64Decoder(); + BufferedInputStream bis; + FileOutputStream fos; + BufferedOutputStream bos; + + try { + // base64编码内容转换为字节数组 + byte[] bytes = decoder.decodeBuffer(base64Content); + ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes); + bis = new BufferedInputStream(byteInputStream); + File file = new File(filePath); + File path = file.getParentFile(); + if (!path.exists()) { + path.mkdirs(); + } + fos = new FileOutputStream(file); + bos = new BufferedOutputStream(fos); + + byte[] buffer = new byte[1024]; + int length = bis.read(buffer); + while (length != -1) { + bos.write(buffer, 0, length); + length = bis.read(buffer); + } + bos.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + //closeStream(bis, fos, bos); + } + } + + + private static String getCanonicalQueryString(String query) { + if (query == null || query.trim().isEmpty()) { + return ""; + } + List> queryParamList = new ArrayList<>(); + String[] params = query.split("&"); + for (String param : params) { + int eqIndex = param.indexOf("="); + String key = param.substring(0, eqIndex); + String value = param.substring(eqIndex + 1); + Pair pair = Pair.of(key, value); + queryParamList.add(pair); + } + + List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); + List> encodeParamList = new ArrayList<>(); + sortedParamList.forEach(param -> { + try { + String key = URLEncoder.encode(param.getKey(), "utf-8"); + String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8").replaceAll("\\%2B", "%20").replaceAll("\\+", "%20").replaceAll("\\%21", "!").replaceAll("\\%27", "'").replaceAll("\\%28", "(").replaceAll("\\%29", ")").replaceAll("\\%7E", "~").replaceAll("\\%25", "%"); + encodeParamList.add(Pair.of(key, value)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("encoding error"); + } + }); + + StringBuilder queryParamString = new StringBuilder(); + for (Pair encodeParam : encodeParamList) { + queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); + queryParamString.append("&"); + } + return queryParamString.substring(0, queryParamString.length() - 1); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/utils/RefreshTokenUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/utils/RefreshTokenUtil.java new file mode 100644 index 0000000..a9c8690 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/utils/RefreshTokenUtil.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.irs.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + * @Classname RefreshTokenManage + * @Description + * @Date 2023/7/20 15:53 + * @Author PoffyZhang + */ +@Slf4j +public class RefreshTokenUtil { + + public static String refrshByAppScret() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appSecret = "e066f496194540afa829c66983d4710e"; + String appKey = "8fb070a1f1194b2ebffdc6f596bb8a96"; + String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + String url = "https://interface.ls.local/a/api/refreshTokenKey?appKey=" + appKey + + "&requestTime=" + timestamp + "&sign=" + sign; + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + String body = forEntity.getBody(); + log.info(body); + + JSONObject bodyJson = JSON.parseObject(body); + JSONObject datas = bodyJson.getJSONObject("datas"); + String requestSecret = datas.getString("requestSecret"); + log.info("requestSecret :{}",requestSecret); + return requestSecret; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/controller/ExpertLeaveController.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/controller/ExpertLeaveController.java new file mode 100644 index 0000000..b255c11 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/controller/ExpertLeaveController.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.leave.controller; + + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.leave.entity.po.LeaveCreateReq; +import com.hz.pm.api.leave.entity.po.LeaveListByCreatorReq; +import com.hz.pm.api.leave.entity.vo.LeaveDetailVO; +import com.hz.pm.api.leave.entity.vo.LeaveListItemVO; +import com.hz.pm.api.leave.manage.LeaveManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +@Api(tags = "请假管理控制器") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/leave/") +public class ExpertLeaveController { + + private final LeaveManage leaveManage; + + @ApiOperation("请假") + @PostMapping("/save") + @WebLog("请假") + public IdVo askForLeave(@Valid @RequestBody LeaveCreateReq po) { + return leaveManage.askForLeave(po); + } + + @ApiOperation("请假详情") + @GetMapping(value = {"/detail/{leaveId}", "/detail/{auditId}/byApply"}) + public LeaveDetailVO detail(@PathVariable(required = false) Long leaveId, + @PathVariable(required = false) Long auditId) { + if (ObjectUtils.allNull(leaveId, auditId)) { + throw BizException.wrap("请假ID或申请ID不能为空"); + } + return leaveManage.leaveDetail(leaveId, auditId); + } + + @ApiOperation("我的请假列表(发起人)") + @WebLog("我的请假列表(发起人)") + @GetMapping("/leaveListByCreator") + public PageVo leaveListByCreator(LeaveListByCreatorReq po) { + return leaveManage.leaveListByCreator(po); + } + + @ApiOperation("销假") + @WebLog("销假") + @GetMapping("/endLeave") + public void endLeave(Long leaveId) { + leaveManage.endLeave(leaveId); + } + + @ApiOperation("撤销") + @WebLog("撤销") + @GetMapping("/cancel") + public void cancelLeave(Long leaveId) { + leaveManage.cancel(leaveId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeave.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeave.java new file mode 100644 index 0000000..40910a8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeave.java @@ -0,0 +1,80 @@ +package com.hz.pm.api.leave.entity.domain; + +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 WendyYang + * @since 2022-08-11 + */ +@Data +@TableName("expert_leave") +@ApiModel(value = "ExpertLeave对象", description = "请假记录表") +public class ExpertLeave implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("请假类型") + private Integer type; + + @ApiModelProperty("请假说明") + private String remark; + + @ApiModelProperty("附件ID") + private String attachment; + + @ApiModelProperty("审核表ID") + private Long auditId; + + @ApiModelProperty("请假人ID") + private Long leaveUserId; + + @ApiModelProperty("创建人名称") + private String creator; + + @ApiModelProperty("创建人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long createBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("修改人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @ApiModelProperty("请假开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("请假结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("销假时间") + private LocalDateTime cancelTime; + + @ApiModelProperty("固定时段模式") + private String fixedType; + + private Long meetingId; + + private Integer status; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeaveDetail.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeaveDetail.java new file mode 100644 index 0000000..3d0da42 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/domain/ExpertLeaveDetail.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.leave.entity.domain; + +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 java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专家请假详情表(维度:天) + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +@Data +@NoArgsConstructor +@TableName("expert_leave_detail") +@ApiModel(value = "ExpertLeaveDetail对象", description = "专家请假详情表(维度:天)") +public class ExpertLeaveDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("专家请假ID") + private Long expertLeaveId; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + public ExpertLeaveDetail(Long expertLeaveId, LocalDateTime startTime, LocalDateTime endTime) { + this.expertLeaveId = expertLeaveId; + this.startTime = startTime; + this.endTime = endTime; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveStatusEnum.java new file mode 100644 index 0000000..948f6da --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveStatusEnum.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.leave.entity.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * LeaveStatus + *

+ * + * @author WendyYang + * @since 09:39 2022/8/12 + */ +@Getter +public enum LeaveStatusEnum { + + /** + * 请假状态 + */ + APPLYING(1, "审核中"), + PASSED(2, "审核通过"), + PASSED_END(3, "审核通过且销假"), + UN_PASSED(4, "审核不通过"), + CANCELED(5, "发起人撤销"); + private final Integer code; + private final String name; + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + LeaveStatusEnum(Integer code, String name) { + this.code = code; + this.name = name; + } + + public static LeaveStatusEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的请假状态")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveTypeEnum.java new file mode 100644 index 0000000..9ce50d9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/enumeration/LeaveTypeEnum.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.leave.entity.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * LeaveType-请假类型 + *

+ * + * @author WendyYang + * @since 10:23 2022/8/11 + */ +@Getter +public enum LeaveTypeEnum { + + TEMPORARY(3, "临时请假"), + LONG_TERM(1, "长期请假"), + FIXED_TERM(2, "固定时段请假"); + + private final Integer code; + private final String name; + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + LeaveTypeEnum(Integer code, String name) { + this.code = code; + this.name = name; + } + + public static LeaveTypeEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的请假类型")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java new file mode 100644 index 0000000..1c3eded --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.leave.entity.po; + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.leave.entity.enumeration.LeaveTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.ObjectUtils; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * LeaveCreatePo + *

+ * + * @author WendyYang + * @since 10:30 2022/8/11 + */ +@Data +@ApiModel("请假创建实体") +public class LeaveCreateReq { + + @ApiModelProperty("请假类型:1 长期请假、2 固定时段请假、3 临时请假") + @NotNull(message = "请假类型不能为空") + private Integer type; + + @ApiModelProperty("请假开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("请假结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("请假说明") + @NotBlank(message = "请假说明不能为空") + private String postscript; + + @ApiModelProperty("附件ID") + private List attachments; + + @ApiModelProperty("固定时段") + private List fixedType; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("专家ID:管理员替专家请假时传参") + private Long expertId; + + public void paramCheck(LeaveTypeEnum leaveTypeEnum) { + if (leaveTypeEnum.equals(LeaveTypeEnum.TEMPORARY)) { + if (this.getMeetingId() == null) { + throw new BizException("会议ID不能为空"); + } + } else { + if (ObjectUtils.anyNull(this.getStartTime(), this.getEndTime())) { + throw new BizException("开始时间或结束时间不能为空"); + } + if (!this.getStartTime().isBefore(this.getEndTime())) { + throw new BizException("无效的请假时间"); + } + if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM)) { + if (this.getFixedType() == null || this.getFixedType().isEmpty()) { + throw new BizException("固定时段不能为空"); + } + } + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveListByCreatorReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveListByCreatorReq.java new file mode 100644 index 0000000..e5b96be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveListByCreatorReq.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.leave.entity.po; + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.sms.constant.DatePattern; +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; + +/** + *

+ * LeaveListByCreatorPo + *

+ * + * @author WendyYang + * @since 19:32 2022/8/11 + */ +@Data +@ApiModel("我的请假列表参数实体") +@EqualsAndHashCode(callSuper = true) +public class LeaveListByCreatorReq extends PagePo { + + @ApiModelProperty("开始时间") + @DateTimeFormat(pattern = DatePattern.YMD_HMS) + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + @DateTimeFormat(pattern = DatePattern.YMD_HMS) + private LocalDateTime endTime; + + @ApiModelProperty("请假类型") + private Integer leaveType; + + @ApiModelProperty("审核状态") + private String auditStatus; + + @ApiModelProperty("专家ID") + private Long expertId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveDetailVO.java new file mode 100644 index 0000000..b28fc18 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveDetailVO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.leave.entity.vo; + +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import lombok.Builder; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * LeaveDetailVo + *

+ * + * @author WendyYang + * @since 11:48 2022/8/12 + */ +@Data +@Builder +public class LeaveDetailVO { + + private Long id; + + private String postscript; + + private LocalDateTime startTime; + + private LocalDateTime endTime; + + private LocalDateTime actualEndTime; + + private Integer status; + + private List attachments; + + private Integer type; + + private List fixedType; + + private LocalDateTime createOn; + + private String createBy; + + private Long auditId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveListItemVO.java new file mode 100644 index 0000000..82a763c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/vo/LeaveListItemVO.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.leave.entity.vo; + +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * LeaveListItemByCreatorVo + *

+ * + * @author WendyYang + * @since 20:53 2022/8/11 + */ +@Data +@ApiModel("我得请假列表实体(发起人)") +public class LeaveListItemVO { + + @ApiModelProperty("请假ID") + private Long leaveId; + + @ApiModelProperty("审核ID") + private Long auditId; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("实际结束时间") + private LocalDateTime actualEndTime; + + @ApiModelProperty("请假说明") + private String postscript; + + @ApiModelProperty("说明材料") + private List attachments; + + @ApiModelProperty("请假类型") + private Integer leaveType; + + @ApiModelProperty("相关会议") + private String meetingName; + + @ApiModelProperty("审核状态") + private String auditStatus; + + @ApiModelProperty("状态") + private Integer status; + + @ApiModelProperty("审核意见") + private String auditOption; + + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java new file mode 100644 index 0000000..45820a8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java @@ -0,0 +1,529 @@ +package com.hz.pm.api.leave.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.model.FileBasicInfo; +import com.hz.pm.api.common.model.entity.KeyValDTO; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.model.dto.ModifyApplyExtraInfoDTO; +import com.hz.pm.api.expert.service.IExpertMetaApplyService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.leave.entity.domain.ExpertLeave; +import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; +import com.hz.pm.api.leave.entity.enumeration.LeaveStatusEnum; +import com.hz.pm.api.leave.entity.enumeration.LeaveTypeEnum; +import com.hz.pm.api.leave.entity.po.LeaveCreateReq; +import com.hz.pm.api.leave.entity.po.LeaveListByCreatorReq; +import com.hz.pm.api.leave.entity.vo.LeaveDetailVO; +import com.hz.pm.api.leave.entity.vo.LeaveListItemVO; +import com.hz.pm.api.leave.service.IExpertLeaveDetailService; +import com.hz.pm.api.leave.service.IExpertLeaveService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.meeting.task.ExpertRandomInviteTask; +import com.hz.pm.api.sms.utils.DateUtil; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + + +/** + *

+ * LeaveManage + *

+ * + * @author WendyYang + * @since 10:38 2022/8/11 + */ +@Component +@AllArgsConstructor +public class LeaveManage { + + private final ExpertRandomInviteTask inviteTask; + private final IMeetingService meetingService; + private final IMeetingExpertService meetingExpertService; + private final IExpertLeaveService leaveService; + private final IExpertLeaveDetailService leaveDetailService; + private final IExpertMetaApplyService metaApplyService; + private final FileService fileService; + private final IExpertUserFullInfoService userFullInfoService; + private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; + + private static final int HOURS_BEFORE_MEETING = 2; + + public void cancelMeetingExpertByLeave(Long meetingExpertId, ExpertAttendStatusEnum status) { + MeetingExpert update = buildMeetingExpertUpdate(meetingExpertId, status); + meetingExpertService.updateById(update); + } + + private MeetingExpert buildMeetingExpertUpdate(Long meetingExpertId, ExpertAttendStatusEnum status) { + MeetingExpert expert = new MeetingExpert(); + expert.setId(meetingExpertId); + expert.setStatus(status.getCode()); + return expert; + } + + private List listMeetingExpert(Long expertId, List> leaveTimes) { + // 先查询专家参与的所有会议 + LambdaQueryWrapper meetingExpertQuery = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getExpertId, expertId) + .in(MeetingExpert::getStatus, Arrays.asList(ExpertAttendStatusEnum.NOTICING.getCode(), + ExpertAttendStatusEnum.AGREED.getCode())); + List meetingExperts = meetingExpertService.list(meetingExpertQuery); + if (meetingExperts.isEmpty()) { + return Collections.emptyList(); + } + // 只需要查询待确认的或者是同意参加的 + Map expertMap = meetingExperts.stream() + .collect(Collectors.groupingBy(MeetingExpert::getMeetingId, + Collectors.collectingAndThen(Collectors.toList(), w -> { + w.sort(Comparator.comparing(MeetingExpert::getUpdateOn).reversed()); + return w.get(0); + }))); + List meetingIds = CollUtils.fieldList(expertMap.values(), MeetingExpert::getMeetingId); + LocalDateTime startTime = leaveTimes.get(0).getKey(), endTime = leaveTimes.get(leaveTimes.size() - 1).getValue(); + LambdaQueryWrapper meetingQuery = Wrappers.lambdaQuery(Meeting.class) + .in(Meeting::getId, meetingIds) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) + .and(w -> w.between(Meeting::getStartTime, startTime, endTime) + .or(or -> or.between(Meeting::getEndTime, startTime, endTime))); + List meetingList = meetingService.list(meetingQuery); + List matchMeetingIds = meetingList.stream() + .filter(w -> leaveTimes.stream() + .anyMatch(tp -> DateUtil.intersect(w.getStartTime(), w.getEndTime(), tp.getKey(), tp.getValue()))) + .map(Meeting::getId).collect(Collectors.toList()); + if (matchMeetingIds.isEmpty()) { + return Collections.emptyList(); + } + return matchMeetingIds.stream().map(expertMap::get).collect(Collectors.toList()); + } + + @Transactional(rollbackFor = Exception.class) + public IdVo askForLeave(LeaveCreateReq po) { + Long leaveUserId, applyUserId = Objects.requireNonNull(LoginUserUtil.getUserId()); + leaveUserId = po.getExpertId() != null ? po.getExpertId() : applyUserId; + boolean leaveForSelf = leaveUserId.equals(applyUserId); + if (!leaveForSelf) { + Assert.isFalse(leaveService.existsToBeReviewed(leaveUserId), "该专家存在待审核请假申请,请及时审核"); + } + LeaveTypeEnum type = LeaveTypeEnum.getByCode(po.getType()); + // 校验参数是否合法 + po.paramCheck(type); + ExpertLeave leave = new ExpertLeave(); + if (po.getAttachments() != null) { + leave.setAttachment(CollUtils.joinByComma(po.getAttachments())); + } + leave.setType(po.getType()); + leave.setRemark(po.getPostscript()); + leave.setLeaveUserId(leaveUserId); + leave.setCreator(LoginUserUtil.getUsername()); + List> leaveDetailTimes = new ArrayList<>(); + if (type.equals(LeaveTypeEnum.FIXED_TERM) || type.equals(LeaveTypeEnum.LONG_TERM)) { + leaveProcessByDateRange(po, leaveUserId, leave, leaveDetailTimes); + } else if (LeaveTypeEnum.TEMPORARY.equals(type)) { + leaveProcessByTemporary(po, leaveUserId, leave, leaveDetailTimes); + } + if (type != LeaveTypeEnum.TEMPORARY) { + ExpertMetaApply apply = getExpertMetaApply(po, leaveUserId, applyUserId); + leave.setAuditId(apply.getId()); + if (!leaveForSelf) { + leave.setStatus(LeaveStatusEnum.PASSED.getCode()); + } + } + leave.setStartTime(po.getStartTime()); + leave.setEndTime(po.getEndTime()); + leave.setCancelTime(po.getEndTime()); + leaveService.save(leave); + List detailList = CollUtils.convert(leaveDetailTimes, w -> new ExpertLeaveDetail(leave.getId(), w.getKey(), w.getValue())); + leaveDetailService.saveBatch(detailList); + return IdVo.of(leave.getId()); + } + + private void leaveProcessByTemporary(LeaveCreateReq po, Long leaveUserId, ExpertLeave leave, List> leaveDetailTimes) { + // 临时请假 + Meeting meeting = meetingService.getById(po.getMeetingId()); + if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("该会议已取消"); + } + po.setStartTime(meeting.getStartTime()); + po.setEndTime(meeting.getEndTime()); + if (LocalDateTime.now().plusHours(HOURS_BEFORE_MEETING).isAfter(po.getStartTime())) { + throw BizException.wrap("会议开始前" + HOURS_BEFORE_MEETING + "小时,不能在线请假,请电话该会议的联系人。"); + } + MeetingExpert expert = meetingExpertService.getByMeetingIdAndExpertId(po.getMeetingId(), leaveUserId); + if (!ExpertAttendStatusEnum.AGREED.eq(expert.getStatus())) { + // 非确认参加状态无法临时请假 + throw BizException.wrap("未同意参加该会议,无法临时请假"); + } + LocalDateTime tempStart = po.getStartTime(); + while (!tempStart.isAfter(po.getEndTime())) { + LocalDateTime tempEnd = tempStart.toLocalDate().atTime(DateUtil.LOCAL_TIME_3D); + leaveDetailTimes.add(KeyValDTO.of(tempStart, DateUtil.min(tempEnd, po.getEndTime()))); + tempStart = tempStart.plusDays(1).toLocalDate().atStartOfDay(); + } + LeaveManage proxy = (LeaveManage) AopContext.currentProxy(); + proxy.cancelMeetingExpertByLeave(expert.getId(), ExpertAttendStatusEnum.ON_LEAVE); + if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { + inviteTask.notifyInviteTask(meeting.getId(), Boolean.FALSE); + } + if (meeting.getConfirmedRoster()) { + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getConfirmedRoster, Boolean.FALSE) + .eq(Meeting::getId, meeting.getId()); + meetingService.update(mUpdate); + } + meetingCallOrMsgHelper.sendExpertLeaveMsg(expert, meeting); + // 临时请假无需审核 + leave.setAuditId(0L); + leave.setStatus(LeaveStatusEnum.PASSED.getCode()); + } + + private void leaveProcessByDateRange(LeaveCreateReq req, Long leaveUserId, ExpertLeave leave, List> leaveDetailTimes) { + boolean fixedTerm = CollUtil.isNotEmpty(req.getFixedType()); + if (fixedTerm) { + // 固定时段请假 + leave.setFixedType(CollUtils.joinByComma(req.getFixedType())); + } + LocalDateTime tempStart = req.getStartTime(); + while (!tempStart.isAfter(req.getEndTime())) { + boolean add = true; + if (fixedTerm) { + int weekday = tempStart.getDayOfWeek().getValue(); + add = req.getFixedType().contains(weekday); + } + if (add) { + LocalDateTime tempEnd = tempStart.toLocalDate().atTime(DateUtil.LOCAL_TIME_3D); + leaveDetailTimes.add(KeyValDTO.of(tempStart, DateUtil.min(tempEnd, req.getEndTime()))); + } + tempStart = tempStart.plusDays(1).toLocalDate().atStartOfDay(); + } + if (leaveDetailTimes.isEmpty()) { + throw BizException.wrap("请假时间无效"); + } + if (leaveDetailService.existsLeaveByUserIdAndTime(leaveUserId, leaveDetailTimes)) { + throw BizException.wrap("该请假时段内已存在请假"); + } + List meetingExperts = listMeetingExpert(leaveUserId, leaveDetailTimes); + if (!meetingExperts.isEmpty()) { + if (meetingExperts.stream().anyMatch(w -> ExpertAttendStatusEnum.AGREED.eq(w.getStatus()))) { + throw BizException.wrap("有待参加会议,请先处理完会议,再发起请假"); + } + List expertsUpdate = meetingExperts.stream() + .map(w -> buildMeetingExpertUpdate(w.getExpertId(), ExpertAttendStatusEnum.ON_LEAVE)) + .collect(Collectors.toList()); + meetingExpertService.updateBatchById(expertsUpdate); + } + leave.setStatus(LeaveStatusEnum.APPLYING.getCode()); + } + + private ExpertMetaApply getExpertMetaApply(LeaveCreateReq po, Long leaveUserId, Long applyUserId) { + // 非临时请假需要审批 + LocalDateTime now = LocalDateTime.now(); + ExpertMetaApply apply = new ExpertMetaApply(); + apply.setCreateOn(now); + apply.setUpdateOn(now); + apply.setApplyType(ExpertApplyTypeEnum.LONG_TERM_LEAVE.getKey()); + if (applyUserId.equals(leaveUserId)) { + apply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); + } else { + // 专家管理员发起请假自动通过 + apply.setReviewTime(now); + apply.setApprover(LoginUserUtil.getUsername()); + apply.setApproverUserId(applyUserId); + apply.setApplyStatus(ExpertApplyStatusEnum.PASSED.getKey()); + } + apply.setUserId(leaveUserId); + apply.setApplicantId(applyUserId); + ExpertUserFullInfo userInfo = userFullInfoService.getByUserId(apply.getUserId()); + apply.setRegionCode(userInfo.getRegionCode()); + apply.setRegionLevel(userInfo.getRegionLevel()); + ModifyApplyExtraInfoDTO extraInfo = new ModifyApplyExtraInfoDTO(); + extraInfo.setFactSheet(po.getPostscript()); + if (po.getAttachments() != null) { + List infoList = CollUtils.convert(po.getAttachments(), w -> { + FileBasicInfo info = new FileBasicInfo(); + info.setFileId(w); + return info; + }); + extraInfo.setEvidenceList(infoList); + } + apply.setExtraMaterial(JSONUtil.toJsonStr(extraInfo)); + metaApplyService.save(apply); + return apply; + } + + public PageVo leaveListByCreator(LeaveListByCreatorReq po) { + if (po.getExpertId() == null) { + po.setExpertId(LoginUserUtil.getUserId()); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) + .orderByDesc(ExpertLeave::getCreateOn); + if (po.getLeaveType() != null && po.getLeaveType().equals(LeaveTypeEnum.TEMPORARY.getCode())) { + // 临时请假 + if (po.getAuditStatus() != null && !po.getAuditStatus().equals(ExpertApplyStatusEnum.PASSED.getKey())) { + return PageVo.empty(); + } + query.eq(ExpertLeave::getAuditId, 0L); + query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); + } else { + if (StrUtils.isNotBlank(po.getAuditStatus())) { + LambdaQueryWrapper queryApply = Wrappers.lambdaQuery(ExpertMetaApply.class) + .select(ExpertMetaApply::getId) + .eq(ExpertMetaApply::getUserId, po.getExpertId()) + .eq(ExpertMetaApply::getApplyStatus, po.getAuditStatus()); + List applyList = metaApplyService.list(queryApply); + List auditIds = CollUtils.fieldList(applyList, ExpertMetaApply::getId); + if (po.getAuditStatus().equals(ExpertApplyStatusEnum.PASSED.getKey())) { + query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); + auditIds.add(0L); + } + if (auditIds.isEmpty()) { + return PageVo.empty(); + } + query.in(ExpertLeave::getAuditId, auditIds); + } else { + query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); + } + query.eq(po.getLeaveType() != null, ExpertLeave::getType, po.getLeaveType()); + } + if (po.getStartTime() != null && po.getEndTime() != null) { + query.and(wrapper -> wrapper.between(ExpertLeave::getStartTime, po.getStartTime(), po.getEndTime()) + .or(or -> or.between(ExpertLeave::getEndTime, po.getStartTime(), po.getEndTime()))); + } + Page page = leaveService.page(po.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List meetingIds = new ArrayList<>(), auditIds = new ArrayList<>(), fileIds = new ArrayList<>(); + page.getRecords().forEach(w -> { + if (w.getMeetingId() != 0) { + meetingIds.add(w.getMeetingId()); + } + if (w.getAuditId() != 0) { + auditIds.add(w.getAuditId()); + } + if (!w.getAttachment().isEmpty()) { + List tempFileIds = BizUtils.splitToLong(w.getAttachment()); + fileIds.addAll(tempFileIds); + } + }); + Map meetingMap = new HashMap<>(16); + if (!meetingIds.isEmpty()) { + meetingMap.putAll(CollUtils.listToMap(meetingService.listByIds(meetingIds), Meeting::getId)); + } + Map applyMap = new HashMap<>(16); + if (!auditIds.isEmpty()) { + applyMap.putAll(CollUtils.listToMap(metaApplyService.listByIds(auditIds), ExpertMetaApply::getId)); + } + Map fileMap = new HashMap<>(fileIds.size()); + if (!fileIds.isEmpty()) { + fileMap.putAll(CollUtils.listToMap(fileService.getByIds(fileIds), AttachFileVo::getFileId)); + } + List dataList = CollUtils.convert(page.getRecords(), w -> { + LeaveListItemVO item = new LeaveListItemVO(); + item.setLeaveType(w.getType()); + item.setPostscript(w.getRemark()); + item.setAuditId(w.getAuditId()); + item.setLeaveId(w.getId()); + item.setStartTime(w.getStartTime()); + item.setEndTime(w.getEndTime()); + ExpertMetaApply apply = applyMap.get(w.getAuditId()); + item.setAuditOption(apply != null ? apply.getAuditOpinion() : StrUtil.EMPTY); + item.setStatus(w.getStatus()); + item.setAuditStatus(apply != null ? apply.getApplyStatus() : ExpertApplyStatusEnum.PASSED.getKey()); + item.setActualEndTime(w.getCancelTime()); + Meeting meeting = meetingMap.get(w.getMeetingId()); + item.setMeetingName(meeting != null ? meeting.getName() : StrUtil.EMPTY); + item.setAttachments(new ArrayList<>()); + if (!w.getAttachment().isEmpty()) { + Arrays.stream(w.getAttachment().split(",")).forEach(fileId -> item.getAttachments().add(fileMap.get(Long.parseLong(fileId)))); + } + return item; + }); + return PageVo.of(dataList, page.getTotal()); + } + + public void endLeave(Long leaveId) { + ExpertLeave leave = leaveService.getById(leaveId); + if (LeaveTypeEnum.TEMPORARY.eq(leave.getType())) { + throw BizException.wrap("临时请假不支持销假"); + } + LeaveStatusEnum status = LeaveStatusEnum.getByCode(leave.getStatus()); + if (!status.equals(LeaveStatusEnum.PASSED) || LocalDateTime.now().isAfter(leave.getEndTime())) { + throw BizException.wrap("该请假不支持销假"); + } + LocalDateTime actualEndTime = LocalDateTime.now(); + LambdaUpdateWrapper updater = Wrappers.lambdaUpdate(ExpertLeave.class) + .set(ExpertLeave::getCancelTime, actualEndTime) + .set(ExpertLeave::getUpdateOn, actualEndTime) + .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) + .set(ExpertLeave::getStatus, LeaveStatusEnum.PASSED_END.getCode()) + .eq(ExpertLeave::getId, leave.getId()); + leaveService.update(updater); + LambdaQueryWrapper deleter = Wrappers.lambdaQuery(ExpertLeaveDetail.class) + .ge(ExpertLeaveDetail::getStartTime, actualEndTime.toLocalDate()) + .eq(ExpertLeaveDetail::getExpertLeaveId, leaveId); + leaveDetailService.remove(deleter); + } + + public void cancel(Long leaveId) { + ExpertLeave leave = leaveService.getById(leaveId); + if (LeaveTypeEnum.TEMPORARY.eq(leave.getType())) { + throw BizException.wrap("临时请假不支持撤销"); + } + if (LeaveStatusEnum.APPLYING.eq(leave.getStatus())) { + throw BizException.wrap("该请假不支持撤销"); + } + LocalDateTime actualEndTime = LocalDateTime.now(); + // 修改请假状态 + LambdaUpdateWrapper updater = Wrappers.lambdaUpdate(ExpertLeave.class) + .set(ExpertLeave::getUpdateOn, actualEndTime) + .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) + .set(ExpertLeave::getStatus, LeaveStatusEnum.CANCELED.getCode()) + .eq(ExpertLeave::getId, leave.getId()); + leaveService.update(updater); + // 删除请假详情 + LambdaQueryWrapper deleter = Wrappers.lambdaQuery(ExpertLeaveDetail.class) + .eq(ExpertLeaveDetail::getExpertLeaveId, leaveId); + leaveDetailService.remove(deleter); + // 修改审核表 + LambdaUpdateWrapper updaterApply = Wrappers.lambdaUpdate(ExpertMetaApply.class) + .set(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) + .set(ExpertMetaApply::getUpdateOn, LocalDateTime.now()) + .set(ExpertMetaApply::getAuditOpinion, "发起人撤销") + .eq(ExpertMetaApply::getId, leave.getAuditId()); + metaApplyService.update(updaterApply); + } + + public LeaveDetailVO leaveDetail(Long leaveId, Long auditId) { + ExpertLeave leave; + if (leaveId != null) { + leave = leaveService.getById(leaveId); + } else { + leave = leaveService.getByAuditId(auditId); + } + LeaveDetailVO detail = LeaveDetailVO.builder() + .createOn(leave.getCreateOn()) + .createBy(leave.getCreator()) + .postscript(leave.getRemark()) + .id(leave.getId()) + .status(leave.getStatus()) + .startTime(leave.getStartTime()) + .endTime(leave.getEndTime()) + .attachments(new ArrayList<>()) + .type(leave.getType()) + .actualEndTime(leave.getCancelTime()) + .auditId(leave.getAuditId()) + .build(); + if (LeaveTypeEnum.FIXED_TERM.eq(leave.getType())) { + detail.setFixedType(BizUtils.splitToNum(leave.getFixedType(), Integer.class)); + } + if (StrUtils.isNotBlank(leave.getAttachment())) { + List fileIds = BizUtils.splitToLong(leave.getAttachment()); + List files = fileService.getByIds(fileIds); + detail.getAttachments().addAll(files); + } + return detail; + } + + public List listLeaveUserIdByTime(LocalDateTime start, LocalDateTime end) { + LambdaQueryWrapper leaveDetailQuery = Wrappers.lambdaQuery(ExpertLeaveDetail.class) + .select(ExpertLeaveDetail::getExpertLeaveId) + .and(wrapper -> wrapper.between(ExpertLeaveDetail::getStartTime, start, end) + .or(wrapper1 -> wrapper1.between(ExpertLeaveDetail::getEndTime, start, end))); + List detailList = leaveDetailService.list(leaveDetailQuery); + if (detailList.isEmpty()) { + return new ArrayList<>(); + } + List leaveIdList = CollUtils.fieldList(detailList, ExpertLeaveDetail::getExpertLeaveId); + LambdaQueryWrapper leaveQuery = Wrappers.lambdaQuery(ExpertLeave.class) + .select(ExpertLeave::getCreateBy) + .in(ExpertLeave::getId, leaveIdList) + .in(ExpertLeave::getStatus, + LeaveStatusEnum.APPLYING.getCode(), + LeaveStatusEnum.PASSED.getCode(), + LeaveStatusEnum.PASSED_END.getCode()); + List leaveList = leaveService.list(leaveQuery); + return CollUtils.fieldList(leaveList, ExpertLeave::getCreateBy); + } + + @Transactional(rollbackFor = Exception.class) + public void leaveAuditCallback(boolean status, Long applyId) { + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(ExpertLeave.class) + .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) + .set(ExpertLeave::getUpdateOn, LocalDateTime.now()) + .eq(ExpertLeave::getAuditId, applyId); + ExpertLeave leave = leaveService.getByAuditId(applyId); + ExpertUserFullInfo leaveUser = userFullInfoService.getByUserId(leave.getLeaveUserId()); + if (status) { + update.set(ExpertLeave::getStatus, LeaveStatusEnum.PASSED.getCode()); + } else { + ExpertMetaApply metaApply = metaApplyService.getById(applyId); + update.set(ExpertLeave::getStatus, LeaveStatusEnum.UN_PASSED.getCode()); + LambdaQueryWrapper delete = Wrappers.lambdaQuery(ExpertLeaveDetail.class) + .eq(ExpertLeaveDetail::getExpertLeaveId, leave.getId()); + leaveDetailService.remove(delete); + } + leaveService.update(update); + } + + public Map> listLeaveIdByDate(LocalDate startDate, LocalDate endDate, Long expertId) { + List leaveDetails = leaveDetailService.listByDateAndLeaveUserId(startDate, endDate, expertId); + return leaveDetails.stream().collect(Collectors.groupingBy(w -> w.getStartTime().toLocalDate(), + Collectors.mapping(ExpertLeaveDetail::getExpertLeaveId, Collectors.toSet()))); + } + + public PageVo listLeaveApplyingAndCouldBeStop(PagePo po) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) + .eq(ExpertLeave::getLeaveUserId, LoginUserUtil.getUserId()) + .and(wrapper -> wrapper.eq(ExpertLeave::getStatus, LeaveStatusEnum.APPLYING.getCode()) + .or(wrapper1 -> wrapper1.eq(ExpertLeave::getStatus, LeaveStatusEnum.PASSED.getCode()) + .gt(ExpertLeave::getCancelTime, LocalDateTime.now()))); + Page page = leaveService.page(new Page<>(po.getPageNumber(), po.getPageSize()), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List result = CollUtils.convert(page.getRecords(), w -> { + LeaveListItemVO item = new LeaveListItemVO(); + item.setStartTime(w.getStartTime()); + item.setEndTime(w.getEndTime()); + item.setStatus(w.getStatus()); + item.setLeaveType(w.getType()); + item.setLeaveId(w.getId()); + return item; + }); + return PageVo.of(result, page.getTotal()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.java new file mode 100644 index 0000000..cf2fff3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.leave.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.common.model.entity.KeyValDTO; +import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 专家请假详情表(维度:天) Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +public interface ExpertLeaveDetailMapper extends BaseMapper { + + /** + * 查询时间段之内的请假信息(请假状态:已通过、销假) + * + * @param leaveUserId 请假人ID + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return 请假详情 + * @author WendyYang + **/ + List selectLeaveIdByDateAndExpertId(@Param("leaveUserId") Long leaveUserId, + @Param("startDate") LocalDate startDate, + @Param("endDate") LocalDate endDate); + + /** + * 查询用户在指定时间之内是否有请假 + * + * @param leaveUserId 用户ID + * @param times 时间集合 + * @return 请假天数 + * @author WendyYang + **/ + Integer existsLeaveByLeaveUserIdAndTime(@Param("leaveUserId") Long leaveUserId, + @Param("times") List> times); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.xml new file mode 100644 index 0000000..d4aad18 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveDetailMapper.xml @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.java new file mode 100644 index 0000000..f56c4dc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.leave.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.leave.entity.domain.ExpertLeave; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +public interface ExpertLeaveMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.xml new file mode 100644 index 0000000..3fc2188 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/mapper/ExpertLeaveMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveDetailService.java new file mode 100644 index 0000000..16d1792 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveDetailService.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.leave.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.common.model.entity.KeyValDTO; +import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 专家请假详情表(维度:天) 服务类 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +public interface IExpertLeaveDetailService extends IService { + + List listByDateAndLeaveUserId(LocalDate startDate, LocalDate endDate, Long leaveUserId); + + boolean existsLeaveByUserIdAndTime(Long userId, List> times); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveService.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveService.java new file mode 100644 index 0000000..a4dacb1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/IExpertLeaveService.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.leave.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.leave.entity.domain.ExpertLeave; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +public interface IExpertLeaveService extends IService { + + ExpertLeave getByAuditId(Long auditId); + + /** + * 是否存在待审核请假记录 + * + * @param expertId 专家ID + * @return boolean + */ + boolean existsToBeReviewed(Long expertId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveDetailServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveDetailServiceImpl.java new file mode 100644 index 0000000..ef32368 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveDetailServiceImpl.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.leave.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.common.model.entity.KeyValDTO; +import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; +import com.hz.pm.api.leave.mapper.ExpertLeaveDetailMapper; +import com.hz.pm.api.leave.service.IExpertLeaveDetailService; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 专家请假详情表(维度:天) 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +@Service +public class ExpertLeaveDetailServiceImpl extends ServiceImpl implements IExpertLeaveDetailService { + + @Override + public List listByDateAndLeaveUserId(LocalDate startDate, LocalDate endDate, Long leaveUserId) { + return baseMapper.selectLeaveIdByDateAndExpertId(leaveUserId, startDate, endDate.plusDays(1)); + } + + @Override + public boolean existsLeaveByUserIdAndTime(Long userId, List> times) { + return baseMapper.existsLeaveByLeaveUserIdAndTime(userId, times) != null; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveServiceImpl.java new file mode 100644 index 0000000..37021e3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/service/impl/ExpertLeaveServiceImpl.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.leave.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.leave.entity.domain.ExpertLeave; +import com.hz.pm.api.leave.entity.enumeration.LeaveStatusEnum; +import com.hz.pm.api.leave.mapper.ExpertLeaveMapper; +import com.hz.pm.api.leave.service.IExpertLeaveService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-08-11 + */ +@Service +public class ExpertLeaveServiceImpl extends ServiceImpl implements IExpertLeaveService { + + @Override + public ExpertLeave getByAuditId(Long auditId) { + if (auditId == 0) { + return null; + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) + .eq(ExpertLeave::getAuditId, auditId); + return getOne(query); + } + + @Override + public boolean existsToBeReviewed(Long expertId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) + .eq(ExpertLeave::getLeaveUserId, expertId) + .eq(ExpertLeave::getStatus, LeaveStatusEnum.APPLYING.getCode()); + return baseMapper.exists(query); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/ExpertInviteBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/ExpertInviteBuilder.java new file mode 100644 index 0000000..8a77036 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/ExpertInviteBuilder.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.meeting.builder; + +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; + +/** + *

+ * ExpertInviteBuilder + *

+ * + * @author WendyYang + * @since 21:30 2022/11/21 + */ +public class ExpertInviteBuilder { + + private ExpertInviteBuilder() { + } + + public static MeetingExpert getExpertByRandom(Long meetingId, ExpertUserFullInfo user, Long ruleId) { + return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.RANDOM); + } + + private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteTypeEnum type) { + MeetingExpert expert = new MeetingExpert(); + expert.setMeetingId(meetingId); + expert.setMobile(user.getPhoneNo()); + expert.setExpertId(user.getUserId()); + expert.setExpertName(user.getExpertName()); + expert.setRuleId(ruleId); + expert.setInviteType(type.getCode()); + return expert; + } + + public static MeetingExpert getExpertByAppoint(Long meetingId, ExpertUserFullInfo user, Long ruleId) { + return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.APPOINT); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java new file mode 100644 index 0000000..bf384e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java @@ -0,0 +1,129 @@ +//package com.hz.pm.api.meeting.builder; +// +// +//import com.hz.pm.api.meeting.entity.domain.Meeting; +//import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +//import com.hz.pm.api.sms.utils.DateUtil; +// +//import java.time.format.DateTimeFormatter; +//import java.util.ArrayList; +//import java.util.List; +// +///** +// *

+// * YxtSmsContextBuilder +// *

+// * +// * @author WendyYang +// * @since 14:19 2022/11/17 +// */ +//public class YxtSmsContextBuilder { +// +// private YxtSmsContextBuilder() { +// } +// +// public static List smsToExpertByCancelMeeting(Meeting meeting, List experts, String meetingType) { +// String holdCompany = meeting.getHoldCompanyBracket(); +// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); +// List contexts = new ArrayList<>(); +// for (MeetingExpert me : experts) { +// SendSmsContext context = new SendSmsContext(); +// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.MEETING_CANCEL, +// me.getExpertName(), meeting.getCancelRemark(), meetingTime, meetingType, meeting.getContact())); +// context.setReceiveNumber(me.getMobile()); +// contexts.add(context); +// } +// return contexts; +// } +// +// public static List smsToExpertBySendNotice(Meeting meeting, List experts, String meetingType) { +// String holdCompany = meeting.getHoldCompanyBracket(); +// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); +// List contexts = new ArrayList<>(); +// for (MeetingExpert me : experts) { +// SendSmsContext context = new SendSmsContext(); +// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.SEND_MEETING_NOTICE, +// me.getExpertName(), me.getUpdateOn().format(DateUtil.DTF_YMD_HM), +// meetingType, meetingTime, meeting.getRegionDetail(), meeting.getContact())); +// context.setReceiveNumber(me.getMobile()); +// contexts.add(context); +// } +// return contexts; +// } +// +// public static SendSmsContext smsToExpertByReplace(Meeting meeting, MeetingExpert expert, String meetingType) { +// SendSmsContext context = new SendSmsContext(); +// String holdCompany = meeting.getHoldCompanyBracket(); +// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.EXPERT_REPLACED, +// expert.getExpertName(), +// meeting.getStartTime().format(DateUtil.DTF_YMD_HM), +// meetingType, +// meeting.getContact() +// )); +// context.setReceiveNumber(expert.getMobile()); +// return context; +// } +// +// public static List smsToExpertByMeetingChange(Meeting old, Meeting curr, List experts, String meetingType) { +// List contexts = new ArrayList<>(); +// String holdCompany = curr.getHoldCompanyBracket(); +// String sTimeOld = old.getStartTime().format(DateUtil.DTF_YMD_HM); +// String sTimeNew = curr.getStartTime().format(DateUtil.DTF_YMD_HM); +// for (MeetingExpert me : experts) { +// SendSmsContext context = new SendSmsContext(); +// String content = String.format(YxtSmsTemplateConst.MEETING_INGO_CHANGE, me.getExpertName(), +// sTimeOld, meetingType, sTimeNew, curr.getRegionDetail(), curr.getContact()); +// context.setContent(holdCompany + content); +// context.setReceiveNumber(me.getMobile()); +// contexts.add(context); +// } +// return contexts; +// } +// +// public static SendSmsContext smsToInvitorByExpertLeave(UserBasicInfo invitor, String meetingName, String expertName) { +// SendSmsContext context = new SendSmsContext(); +// context.setReceiveNumber(invitor.getPhoneNo()); +// context.setContent(String.format(YxtSmsTemplateConst.TEMP_LEAVE_APPLY, invitor.getNickName(), +// meetingName, expertName, WebProperties.webUrl)); +// return context; +// } +// +// public static SendSmsContext smsToExpertByLeavePassed(ExpertLeave leave, String leaveUser, String mobile) { +// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_PASSED, leaveUser, +// leave.getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS)), +// leave.getEndTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS))); +// SendSmsContext context = new SendSmsContext(); +// context.setContent(smsContent); +// context.setReceiveNumber(mobile); +// return context; +// } +// +// public static SendSmsContext smsToExpertBtLeaveReject(String leaveUser, String mobile, String opinion) { +// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_REFUSED, leaveUser, opinion); +// SendSmsContext context = new SendSmsContext(); +// context.setContent(smsContent); +// context.setReceiveNumber(mobile); +// return context; +// } +// +// public static SendSmsContext smsByRandomInviteStop(String inviterName, String meetingName, String mobile) { +// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_INVITE_STOP, +// inviterName, meetingName, WebProperties.webUrl +// ); +// SendSmsContext context = new SendSmsContext(); +// context.setContent(smsContent); +// context.setReceiveNumber(mobile); +// return context; +// } +// +// +// public static SendSmsContext meetingInviteCompleteNotice(Meeting meeting) { +// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_EXTRACTION_COMPLETED, +// meeting.getConnecter(), meeting.getName(), WebProperties.webUrl +// ); +// SendSmsContext context = new SendSmsContext(); +// context.setContent(smsContent); +// context.setReceiveNumber(meeting.getContact()); +// return context; +// } +//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/constant/MeetingMsgTemplateConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/constant/MeetingMsgTemplateConst.java new file mode 100644 index 0000000..2ba28b6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/constant/MeetingMsgTemplateConst.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.meeting.constant; + +/** + *

+ * MeetingMsgConst + *

+ * + * @author WendyYang + * @since 2023/4/20 + **/ +public interface MeetingMsgTemplateConst { + + /** + * 已结束:自动抽取结束,结束时给会议发起人发送浙政钉工作通知、短信:“注意,xxx会议自动抽取已结束,请及时确认是否召开会议”。 + */ + String INVITE_END = "注意,%s会议自动抽取已结束,请及时确认是否召开会议"; + + /** + * 确认名单:尊敬的【姓名】专家您好,您于【确认时间】接受了信息化项目评审会议邀请,会议时间:【会议时间】,会议地点:【会议地点】。请准时参加评审会议。如有疑问请联系【联系人】(【联系方式】)。 + */ + String CONFIRMED_ROSTER = "尊敬的%s专家您好,您于%s接受了信息化项目评审会议邀请,会议时间:%s,会议地点:%s。请准时参加评审会议。如有疑问请联系%s(%s)。"; + + /** + * 会议取消:尊敬的{name}专家,因会议取消说明,原定于开会时间的会议类型会议已取消。给您带来不便,敬请谅解。如有疑问请咨询会议联系人「会议联系人联系方式」。 + */ + String MEETING_CANCEL = "尊敬的%s专家,原定于%s的%s会议已取消。给您带来不便,敬请谅解。如有疑问请咨询会议联系人「%s」。"; + + String EXPERT_LEAVE_RANDOM = "请注意,%s会议有专家请假,将重新抽取以替换该专家。"; + + String EXPERT_LEAVE_APPOINT = "请注意,%s会议的%s专家请假,请及时登录系统替换该专家。"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/ExpertDashboardController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/ExpertDashboardController.java new file mode 100644 index 0000000..b032ba9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/ExpertDashboardController.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.meeting.controller; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.meeting.entity.req.MeetingCalenderReq; +import com.hz.pm.api.meeting.entity.vo.*; +import com.hz.pm.api.meeting.manage.DashboardManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * DashboardController + *

+ * + * @author WendyYang + * @since 22:19 2022/8/24 + */ +@Api(tags = "工作台相关接口") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/dashboard") +public class ExpertDashboardController { + + private final DashboardManage dashboardManage; + + @ApiOperation("会议日历") + @GetMapping("/meetingCalender") + @WebLog(value = "会议日历") + public List meetingCalender(@Valid MeetingCalenderReq po) { + return dashboardManage.meetingCalender(po); + } + + @ApiOperation("待办:专家评价列表") + @GetMapping("/todo/expertEvaluation") + public PageVo expertEvaluationToDo(PagePo po) { + return dashboardManage.expertEvaluationToDo(po); + } + + @ApiOperation("待办:专家待替换列表") + @GetMapping("/todo/expertReplace") + public PageVo expertReplaceToDo(PagePo po) { + return dashboardManage.expertReplaceTodoList(po); + } + + @ApiOperation("待办:专家待确认列表") + @GetMapping("/todo/expertConfirm") + public PageVo expertConfirmToDo(PagePo po) { + return dashboardManage.expertConfirmToDo(po); + } + + @ApiOperation("会议数量统计") + @GetMapping("/meetingCountSummary") + @WebLog(value = "会议数量统计") + public MeetingCountSummaryVO meetingCountSummary() { + return dashboardManage.meetingCountSummary(); + } + + @ApiOperation("专家工作台:会议数量统计") + @GetMapping("/meetingCountByExpert") + @WebLog(value = "专家工作台:会议数量统计") + public MeetingCountByExpertVO meetingCountByExpert() { + return dashboardManage.meetingCountByExpert(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingController.java new file mode 100644 index 0000000..e21bffa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingController.java @@ -0,0 +1,199 @@ +package com.hz.pm.api.meeting.controller; + + +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.meeting.entity.dto.ReviewProjectDTO; +import com.hz.pm.api.meeting.entity.req.*; +import com.hz.pm.api.meeting.entity.vo.*; +import com.hz.pm.api.meeting.manage.MeetingManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 会议 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Validated +@RestController +@AllArgsConstructor +@Api(tags = "会议管理") +@RequestMapping("/api/v1/meeting") +public class MeetingController { + + private final MeetingManage meetingManage; + + @PostMapping("/create") + @ApiOperation(value = "新建会议") + @WebLog(value = "新建会议") + public IdVo meetingCreate(@Valid @RequestBody MeetingCreateReq req) { + return meetingManage.meetingCreateAndInviteExpert(req); + } + + @PostMapping("/continueInvite") + @ApiOperation(value = "续抽专家") + @WebLog(value = "续抽专家") + public void continueInvite(@Valid @RequestBody MeetingIdReq req) { + meetingManage.continueInvite(req.getMeetingId()); + } + + @PostMapping("/convertToAppoint") + @ApiOperation(value = "转为指定抽取") + @WebLog(value = "转为指定抽取") + public void convertToAppoint(@Valid @RequestBody MeetingIdReq req) { + meetingManage.convertToAppoint(req.getMeetingId()); + } + + @PostMapping("/expertInviteByCreate") + @ApiOperation(value = "新建会议-专家抽取", hidden = true) + @WebLog(value = "新建会议-专家抽取") + public void expertInviteByCreate(@Valid @RequestBody ExpertInviteReq po) { + meetingManage.expertInviteByCreate(po); + } + + @ApiOperation("专家抽取数量校验") + @PostMapping("/expertCountOnChange") + public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteReq po) { + return meetingManage.expertCountOnChange(po); + } + + @ApiOperation("管理员会议列表") + @GetMapping("/manager/meetingList") + public PageVo meetingListByManager(MeetingListReq req) { + return meetingManage.meetingListForManager(req); + } + + @ApiOperation("专家会议列表") + @GetMapping("/expert/meetingList") + public PageVo meetingListByExpert(MeetingListReq po) { + return meetingManage.meetingListForExpert(po); + } + + @ApiOperation("专家请假会议列表") + @GetMapping("/expert/meetingListForLeave") + public PageVo meetingListForLeave(MeetingLeaveListReq req) { + return meetingManage.meetingListForLeave(req); + } + + @ApiOperation("项目详情-基本信息") + @GetMapping("/basicInfo/{meetingId}") + @WebLog(value = "项目详情-基本信息",response = true,project = true) + public MeetingDetailBasicVO meetingBasic(@PathVariable Long meetingId) { + return meetingManage.getMeetingDetail(meetingId); + } + + @ApiOperation("抽取情况") + @GetMapping("/inviteExpertList/{meetingId}") + @WebLog(value = "邀请情况详请") + public ExpertInviteDetailVO inviteExpertList(@PathVariable Long meetingId) { + return meetingManage.inviteExpertList(meetingId); + } + + @ApiOperation("会议基础信息修改") + @PostMapping("/basicInfo/modify") + @WebLog(value = "会议基础信息修改") + public void meetingBasicInfoModify(@Valid @RequestBody MeetingBasicInfoModifyReq po) { + meetingManage.meetingBasicInfoModify(po); + } + + @ApiOperation("会议详情-抽取规则") + @GetMapping("/inviteRuleDetail/{meetingId}") + @WebLog(value = "会议详情-抽取规则") + public InviteRuleDetailVO inviteRuleDetail(@PathVariable Long meetingId) { + return meetingManage.inviteRuleDetail(meetingId); + } + + @ApiOperation("停止抽取") + @GetMapping("/stopInvite/{meetingId}") + @WebLog(value = "停止抽取") + public void stopInvite(@PathVariable Long meetingId) { + meetingManage.stopRandomInvite(meetingId); + } + + @ApiOperation("取消会议") + @PostMapping("/cancel") + @WebLog(value = "取消会议") + public void cancelMeeting(@Valid @RequestBody MeetingCancelReq po) { + meetingManage.cancelMeeting(po); + } + + @ApiOperation("邀请函信息") + @GetMapping("/expertInviteDetail") + @WebLog(value = "邀请函信息") + public ExpertInvitationDetailVO expertInvitationDetail(@RequestParam(required = false) Long expertId, + @RequestParam Long meetingId) { + return meetingManage.expertInvitationDetail(meetingId, expertId); + } + + @ApiOperation("补充专家(指定抽取)") + @PostMapping("/expert/batchAppoint") + @WebLog(value = "批量补充专家") + public void batchAppointExperts(@Valid @RequestBody BatchAppointExpertsReq po) { + meetingManage.batchAppointExperts(po); + } + + @ApiOperation("确认参加") + @PostMapping("/expert/confirm") + @WebLog(value = "确认参加") + public void confirmAttendByManager(@RequestBody ExpertConfirmReq req) { + meetingManage.confirmAttendByManager(req); + } + + @ApiOperation("专家移除") + @PostMapping("/expertRemove") + @WebLog(value = "专家移除") + public void expertRemove(@Valid @RequestBody ExpertRemoveReq req) { + meetingManage.expertRemove(req); + } + + @ApiOperation("释放专家") + @PostMapping("/expert/release") + @WebLog(value = "释放专家") + public void releaseExperts(@RequestBody MeetingCancelReq req) { + meetingManage.releaseExperts(req); + } + + @ApiOperation("设置专家组长") + @PostMapping("setUpHeadman") + @WebLog(value = "设置专家组长") + public void setUpHeadman(@RequestBody ExpertConfirmReq req) { + meetingManage.setUpHeadman(req); + } + + @ApiOperation("重发短信 | 确认名单") + @PostMapping("/confirmedRoster") + @WebLog(value = "重发短信") + public void resendSms(@RequestBody ConfirmedRosterReq req) { + meetingManage.confirmedRoster(req); + } + + @GetMapping("/listReviewProject") + @ApiOperation("评审会议列表") + public PageVo listReviewProject(ReviewProjectListReq req) { + return meetingManage.pageReviewProject(req); + } + + @GetMapping("/option/project") + @ApiOperation("项目列表(创建会议添加项目)") + public PageVo projectList(MeetingOptionProjectReq req) { + return meetingManage.optionProject(req); + } + + @GetMapping("/{meetingId}/projects") + @ApiOperation("会议关联项目列表") + public List projectsByMeetingId(@PathVariable Long meetingId) { + return meetingManage.projectsByMeetingId(meetingId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java new file mode 100644 index 0000000..e5fc724 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.controller; + + +import com.hz.pm.api.meeting.entity.req.MeetingExpertJudgeReq; +import com.hz.pm.api.meeting.entity.req.MeetingExpertJudgeReq.Basic; +import com.hz.pm.api.meeting.manage.MeetingExpertJudgeManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2023-07-31 + */ +@Api(tags = "履职评价管理") +@AllArgsConstructor +@RestController +@RequestMapping("/api/v1/meeting/expert-judge") +public class MeetingExpertJudgeController { + + private final MeetingExpertJudgeManage expertJudgeManage; + + @ApiOperation("保存履职评价") + @PostMapping("/submit") + public void saveExpertJudge(@Validated(Basic.class) @RequestBody MeetingExpertJudgeReq req) { + expertJudgeManage.saveExpertJudge(req); + } + + @ApiOperation("查看履职评价") + @GetMapping("/detail/{meetingExpertId}") + public MeetingExpertJudgeReq expertJudgeDetail(@PathVariable Long meetingExpertId) { + return expertJudgeManage.expertJudgeDetail(meetingExpertId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExportController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExportController.java new file mode 100644 index 0000000..ccbe9f0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExportController.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.meeting.controller; + +import com.hz.pm.api.meeting.manage.ExpertExportManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; + +/** + *

+ * MeetingExportController + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Api(tags = "会议信息导出") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/meeting/export") +public class MeetingExportController { + + + private final ExpertExportManage expertExportManage; + + + @GetMapping("/expertFeeTable/{meetingId}") + @ApiOperation("专家费用单导出") + public void exportFeeForExpert(@PathVariable Long meetingId, HttpServletResponse response) { + expertExportManage.exportFeeForExpert(meetingId, response); + } + + @GetMapping("/expertReviewTable/{meetingId}") + @ApiOperation("专家评审单导出") + public void exportExpertReviewTable(@PathVariable Long meetingId, HttpServletResponse response) { + expertExportManage.expertReviewTable(meetingId, response); + } + + @GetMapping("/laborFeeAuditTable/{meetingId}") + @ApiOperation("劳务费发放单导出") + public void exportLaborFeeAuditTable(@PathVariable Long meetingId, HttpServletResponse response) { + expertExportManage.laborFeeAuditTable(meetingId, response); + } + + @GetMapping("/expertInviteTable/{meetingId}") + @ApiOperation("专家抽取表导出") + public void exportExpertInviteTable(@PathVariable Long meetingId, HttpServletResponse response) { + expertExportManage.expertInviteTable(meetingId, response); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java new file mode 100644 index 0000000..1a19608 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.entity.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + *

+ * SystemProperties + *

+ * + * @author WendyYang + * @since 14:39 2022/9/15 + */ +@Data +@Component +public class WebProperties { + + public static String expertRegistrationUrl; + + public static String webUrl; + + public static String provincialUrl; + + @Value("${expert-registration.url:/expertEnroll}") + private void setExpertRegistrationUrl(String url) { + expertRegistrationUrl = url; + } + + @Value("${web.url:}") + private void setWebUrl(String url) { + webUrl = url; + } + + /** + * 省局项目管理调用跳转地址 + */ + @Value("${web.provincial:}") + private void setProvincial(String provincial) { + provincialUrl = provincial; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteAvoidRule.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteAvoidRule.java new file mode 100644 index 0000000..c47ddd1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteAvoidRule.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.meeting.entity.domain; + +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; + +/** + *

+ * ExpertInviteAvoidRule + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Data +@TableName("meeting_expert_invite_avoid_rule") +@ApiModel(value = "ExpertInviteAvoidRule对象") +public class ExpertInviteAvoidRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("事务ID") + private Long meetingId; + + @ApiModelProperty("回避专家ID") + private String avoidExpertIds; + + @ApiModelProperty("回避单位ID") + private String avoidUnitIds; + + @ApiModelProperty("回避条线ID") + private String avoidOrgIds; + + @ApiModelProperty("回避类型") + private Integer avoidType; + + @ApiModelProperty("每周参与次数") + private Integer weekInviteCount; + + @ApiModelProperty("创建人ID") + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @ApiModelProperty("修改人ID") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteIgnoreTime.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteIgnoreTime.java new file mode 100644 index 0000000..4fe4d43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteIgnoreTime.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.meeting.entity.domain; + +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; +import java.time.LocalTime; + +/** + *

+ * 专家抽取免打扰时间设置 + *

+ * + * @author WendyYang + * @since 2022-11-21 + */ +@Data +@TableName("expert_invite_ignore_time") +@ApiModel(value = "ExpertInviteIgnoreTime对象", description = "专家抽取免打扰时间设置") +public class ExpertInviteIgnoreTime implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("是否启用") + private Boolean enable; + + @ApiModelProperty("开始时间") + private LocalTime startTime; + + @ApiModelProperty("截止时间") + private LocalTime endTime; + + @ApiModelProperty("创建人ID") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改人ID") + private Long updateBy; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteRule.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteRule.java new file mode 100644 index 0000000..6404e62 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/ExpertInviteRule.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.meeting.entity.domain; + +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; + +/** + *

+ * ExpertInviteRule + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Data +@TableName("meeting_expert_invite_rule") +@ApiModel(value = "ExpertInviteRule对象") +public class ExpertInviteRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private Long meetingId; + + @ApiModelProperty("抽取规则") + private String inviteRule; + + @ApiModelProperty("创建人ID") + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @ApiModelProperty("修改人ID") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("抽取类型:1 自定义规则、2 指定邀请") + private Integer inviteType; + + @ApiModelProperty("抽取数量") + private Integer inviteCount; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java new file mode 100644 index 0000000..672a346 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.meeting.entity.domain; + +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 WendyYang + * @since 2022-07-26 + */ +@Data +@TableName("meeting") +@ApiModel(value = "Meeting对象", description = "会议") +public class Meeting implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("事务名称") + private String name; + + @ApiModelProperty("事务类型") + private String type; + + @ApiModelProperty("评审耗时:1 半天、2 一天") + private Integer meetingUsageTime; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("评委出席时间") + private LocalDateTime judgesAttendanceTime; + + @ApiModelProperty("地区编码") + private String regionCode; + + @ApiModelProperty("地区层级") + private Integer regionLevel; + + @ApiModelProperty("联系人") + private String connecter; + + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("创建人") + private String creator; + + @ApiModelProperty("会议地址") + private String meetingAddress; + + private Integer status; + + @ApiModelProperty("抽取状态") + private Boolean inviteStatus; + + @ApiModelProperty("是否确认名单") + private Boolean confirmedRoster; + + @ApiModelProperty("举办单位") + private String holdOrg; + + @ApiModelProperty("举办单位ID") + private String holdOrgCode; + + @ApiModelProperty("是否为内部项目") + private Boolean isInnerProject; + + @ApiModelProperty("抽取类型") + private Integer inviteType; + + @ApiModelProperty("创建人ID") + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("修改人ID") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java new file mode 100644 index 0000000..93d72f6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpert.java @@ -0,0 +1,76 @@ +package com.hz.pm.api.meeting.entity.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 事务专家表 + *

+ * + * @author WendyYang + * @since 2022-07-27 + */ +@Data +@Builder +@TableName("meeting_expert") +@ApiModel(value = "MeetingExpert对象", description = "事务专家表") +public class MeetingExpert implements Serializable { + + @Tolerate + public MeetingExpert() { + } + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("事务ID") + private Long meetingId; + + @ApiModelProperty("专家ID") + private Long expertId; + + @ApiModelProperty("邀请规则ID") + private Long ruleId; + + private String mobile; + + private String expertName; + + @ApiModelProperty("当前状态") + private Integer status; + + @ApiModelProperty("是否是专家组长") + private Boolean isHeadman; + + @ApiModelProperty("邀请类型") + private Integer inviteType; + + @ApiModelProperty("是否已确认名单") + private Boolean confirmedRoster; + + private String submitKey; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertEvaluation.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertEvaluation.java new file mode 100644 index 0000000..ac0f2e6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertEvaluation.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.meeting.entity.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.hz.pm.api.sys.model.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 专家评价表 + *

+ * + * @author WendyYang + * @since 2022-07-25 + */ +@Data +@TableName("meeting_expert_evaluation") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "MeetingExpertEvaluation对象", description = "专家评价表") +public class MeetingExpertEvaluation extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("专家事务关联ID") + private Long expertMeetingId; + + @ApiModelProperty("事务ID") + private Long meetingId; + + @ApiModelProperty("专家ID") + private Long expertId; + + @TableField(value = "is_attended") + @ApiModelProperty("是否参加") + private Boolean attended; + + @TableField(value = "is_in_time") + @ApiModelProperty("是否准时参加") + private Boolean inTime; + + @TableField(value = "is_violated") + @ApiModelProperty("是否违规") + private Boolean violated; + + @ApiModelProperty("参与程度") + private Integer initiative; + + @ApiModelProperty("建设性建议") + private String advice; + + @ApiModelProperty("评审结果情况") + private String evaluateResult; + + @ApiModelProperty("违规情况") + private String violation; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java new file mode 100644 index 0000000..224c2b6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.meeting.entity.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 会议专家履职评价表 + *

+ * + * @author WendyYang + * @since 2023-07-31 + */ +@Data +@TableName("meeting_expert_judge") +@ApiModel(value = "MeetingExpertJudge对象") +public class MeetingExpertJudge implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("会议ID") + private Long meetingId; + + private Long expertId; + + @ApiModelProperty("会议专家ID") + private Long meetingExpertId; + + @ApiModelProperty("评分(1~10)") + private Integer score; + + @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") + private Integer attended; + + @ApiModelProperty("参与程度:1 积极、2 消极") + private Integer performance; + + @ApiModelProperty("是否提出建议:true 是、false 否") + private Boolean advised; + + @ApiModelProperty("是否早退:true 早退、false 未早退") + private Boolean leaveEarly; + + @ApiModelProperty("是否违规:true 是、false 否") + private Boolean brokeRule; + + @ApiModelProperty("违规内容") + private String brokeRuleContent; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java new file mode 100644 index 0000000..4b57021 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.meeting.entity.domain; + +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; + +/** + *

+ * 会议评审内部项目表 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +@Data +@TableName("meeting_inner_project") +@ApiModel(value = "MeetingInnerProject对象", description = "会议评审内部项目表") +public class MeetingInnerProject implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java new file mode 100644 index 0000000..81848b6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.meeting.entity.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 会议评审外部项目 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +@Data +@TableName("meeting_outer_project") +@ApiModel(value = "MeetingOuterProject对象", description = "会议评审外部项目") +public class MeetingOuterProject implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AbstractInviteRule.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AbstractInviteRule.java new file mode 100644 index 0000000..f09631b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AbstractInviteRule.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * AbstractExpertExtractRule + *

+ * + * @author WendyYang + * @since 10:10 2022/7/26 + */ +@Data +@ApiModel("抽取规则") +public abstract class AbstractInviteRule { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("专家抽取数量") + @NotNull(message = "专家抽取数量不能为空", groups = {RuleSave.class}) + private Integer count; + + @ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取") + @NotNull(message = "抽取类型不能为空", groups = {RuleSave.class, CountCheck.class}) + private Integer inviteType; + + public interface RuleSave { + } + + public interface CountCheck { + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AppointInviteRuleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AppointInviteRuleDTO.java new file mode 100644 index 0000000..b772dfd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AppointInviteRuleDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + *

+ * AppointExtractRuleDto + *

+ * + * @author WendyYang + * @since 10:19 2022/7/26 + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel("指定抽取规则") +public class AppointInviteRuleDTO extends AbstractInviteRule { + + @NotEmpty(message = "邀请说明不能为空", groups = {RuleSave.class}) + @ApiModelProperty("邀请说明") + private String inviteDesc; + + @NotEmpty(message = "专家ID不能为空", groups = {RuleSave.class, CountCheck.class}) + @ApiModelProperty("专家ID") + private List expertIdList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AvoidRuleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AvoidRuleDTO.java new file mode 100644 index 0000000..7c2ce56 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/AvoidRuleDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 专家邀请回避规则 + *

+ * + * @author WendyYang + * @since 10:22 2022/7/26 + */ +@Data +@ApiModel("回避信息") +public class AvoidRuleDTO { + + + @ApiModelProperty("回避类型:1 回避同单位、2 回避同条线、3 不回避") + private Integer avoidType; + + @ApiModelProperty("回避单位") + private List avoidUnitIdList; + + @ApiModelProperty("回避条线") + private List avoidOrgIdList; + + @ApiModelProperty("每周邀请次数") + private Integer weekInviteCount; + + @ApiModelProperty("回避专家") + private List expertIds; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java new file mode 100644 index 0000000..9f300de --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +/** + *

+ * CountConfirmByMeetingIdDto + *

+ * + * @author WendyYang + * @since 14:21 2022/8/8 + */ +@Data +@Builder +@AllArgsConstructor +public class CountConfirmByMeetingIdDTO { + + @Tolerate + public CountConfirmByMeetingIdDTO() { + } + + private Long meetingId; + + private Integer total; + + private Integer confirmed; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertChooseDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertChooseDTO.java new file mode 100644 index 0000000..2ef4e8f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertChooseDTO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.dto; + +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertChooseDto + *

+ * + * @author WendyYang + * @since 00:44 2022/7/27 + */ +@Data +@AllArgsConstructor +public class ExpertChooseDTO { + + private List experts; + + private Integer total; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertDictChooseDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertDictChooseDTO.java new file mode 100644 index 0000000..ee01865 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertDictChooseDTO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertDictChooseDTO + *

+ * + * @author WendyYang + * @since 15:49 2022/8/9 + */ +@Data +public class ExpertDictChooseDTO { + + @ApiModelProperty("专家字典类型") + private String expertDict; + + @ApiModelProperty("字典编码") + private List dictCodes; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertFeeExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertFeeExportDTO.java new file mode 100644 index 0000000..2779e75 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertFeeExportDTO.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertFeeExportDTO + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Data +public class ExpertFeeExportDTO { + + private String projectName; + + private String meetingAddress; + + private String meetingTime; + + private List experts; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInfoDTO.java new file mode 100644 index 0000000..2d005df --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInfoDTO.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * ExpertInfoDTO + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Data +public class ExpertInfoDTO { + + private Integer no; + + private String name; + + private String bank; + + private String bankNo; + + private String mobile; + + private String sex; + + private String company; + + private String job; + + private BigDecimal fee; + + private String idcard; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInviteTableDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInviteTableDTO.java new file mode 100644 index 0000000..c7bd253 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertInviteTableDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertInviteTableDTO + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Data +public class ExpertInviteTableDTO { + + private List experts; + + private String projectCode; + + private String projectName; + + private String meetingCreateBy; + + private String meetingUsageTime; + + private String meetingAddress; + + private String meetingTime; + + private String buildOrg; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertReviewTableDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertReviewTableDTO.java new file mode 100644 index 0000000..2fe263d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertReviewTableDTO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * ExpertReviewTableDTO + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Data +public class ExpertReviewTableDTO implements Serializable { + + private static final long serialVersionUID = 3383159744182234397L; + + private String projectName; + + private String meetingTime; + + private String meetingAddress; + + private String holdOrg; + + private String reviewResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertTagChooseDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertTagChooseDTO.java new file mode 100644 index 0000000..c85094d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertTagChooseDTO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertTagChooseDTO + *

+ * + * @author WendyYang + * @since 19:45 2022/7/26 + */ +@Data +public class ExpertTagChooseDTO { + + @ApiModelProperty("专家标签") + private String expertTag; + + @ApiModelProperty("标签编码") + private List tagCodes; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/InviteCacheDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/InviteCacheDTO.java new file mode 100644 index 0000000..f24c9ab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/InviteCacheDTO.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * MeetingInviteDTO + *

+ * + * @author WendyYang + * @since 19:21 2023/3/7 + */ +@Data +public final class InviteCacheDTO { + + private Long meetingId; + + /** + * 拒绝的专家是否可以再次邀请 + */ + private Boolean reInvite; + + /** + * 任务触发时间 + */ + private LocalDateTime taskStartTime; + + public static InviteCacheDTO of(Long meetingId, Boolean reInvite, LocalDateTime startTime) { + InviteCacheDTO bo = new InviteCacheDTO(); + bo.setMeetingId(meetingId); + bo.setReInvite(reInvite); + bo.setTaskStartTime(startTime); + return bo; + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/LaborFeeAuditTableDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/LaborFeeAuditTableDTO.java new file mode 100644 index 0000000..1724009 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/LaborFeeAuditTableDTO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.util.List; + +/** + *

+ * LaborFeeAuditTableDTO + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Data +public class LaborFeeAuditTableDTO { + + private String projectName; + + private String meetingTime; + + private Integer expertCount; + + private List experts; + + private String meetingUsageTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingAndAttendStatusDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingAndAttendStatusDTO.java new file mode 100644 index 0000000..019d47f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingAndAttendStatusDTO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +/** + *

+ * MeetingAndAttendStatusDto + *

+ * + * @author WendyYang + * @since 22:48 2022/8/22 + */ +@Data +public class MeetingAndAttendStatusDTO { + + private Long meetingId; + + private Long meetingExpertId; + + private Long expertId; + + private Integer status; + + private Boolean attended; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java new file mode 100644 index 0000000..c485ac7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.meeting.entity.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * MeetingBasicDto + *

+ * + * @author WendyYang + * @since 09:35 2022/7/26 + */ +@Data +@ApiModel("会议基本信息") +public class MeetingBasicDTO { + + @NotNull(message = "是否是系统内部项目不能为空") + @ApiModelProperty("是否是系统内部项目") + private Boolean isInnerProject; + + @NotEmpty(message = "事务名称不能为空") + @ApiModelProperty("事务名称") + private String name; + + @NotEmpty(message = "事务类型不能为空") + @ApiModelProperty("事务类型") + private String type; + + @NotNull(message = "开始时间不能为空") + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @NotNull(message = "结束时间不能为空") + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @NotNull(message = "评审耗时不能为空") + @ApiModelProperty("评审耗时:1 半天、2 一天") + private Integer meetingUsageTime; + + @NotNull(message = "评委出席时间不能为空") + @ApiModelProperty("评委出席时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime judgesAttendanceTime; + + @NotEmpty(message = "评审地点不能为空") + @ApiModelProperty("评审地点") + private String meetingAddress; + + @NotEmpty(message = "联系人不能为空") + @ApiModelProperty("联系人") + private String connecter; + + @NotEmpty(message = "联系方式不能为空") + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("内部项目ID") + private List innerProjects; + + @ApiModelProperty("外部项目") + private List projects; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java new file mode 100644 index 0000000..9f40839 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * MeetingEvalProjectDTO + *

+ * + * @author WendyYang + * @since 17:18 2023/2/28 + */ +@Data +public class MeetingReviewProjectDTO { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("评审结果") + private String reviewResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MergeExpertIdDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MergeExpertIdDTO.java new file mode 100644 index 0000000..bef8f80 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MergeExpertIdDTO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.util.List; + +/** + *

+ * MergeExpertIdDTO + *

+ * + * @author WendyYang + * @since 2023/4/14 + **/ +@Data +public class MergeExpertIdDTO { + + private List expertIdsIn; + + private List expertIdsNotIn; + + private Boolean skip; + + public static MergeExpertIdDTO noExpert() { + MergeExpertIdDTO condition = new MergeExpertIdDTO(); + condition.setSkip(Boolean.TRUE); + return condition; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ProjectIdCodeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ProjectIdCodeDTO.java new file mode 100644 index 0000000..2903924 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ProjectIdCodeDTO.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.meeting.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * ProjectIdCodeDTO + *

+ * + * @author WendyYang + * @since 2023/4/28 + **/ +@Data +public class ProjectIdCodeDTO { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编码") + private String projectCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/RandomInviteRuleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/RandomInviteRuleDTO.java new file mode 100644 index 0000000..e1d6b5f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/RandomInviteRuleDTO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.entity.dto; + +import com.hz.pm.api.common.model.ReqRegionDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * RandomExtractRuleDto + *

+ * + * @author WendyYang + * @since 10:18 2022/7/26 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("随机抽取规则") +public class RandomInviteRuleDTO extends AbstractInviteRule { + + @ApiModelProperty("专家字典信息") + private List expertDicts; + + @ApiModelProperty("履职意向地编码") + private String intentionRegionCode; + + @ApiModelProperty("履职意向地层级") + private Integer intentionRegionLevel; + + private List expertRegionList; + + @ApiModelProperty("专家标签") + private List expertTags; + + @ApiModelProperty("专家最长响应时间") + @NotNull(message = "专家最长响应时间不能为空", groups = {RuleSave.class}) + private Integer waitForCallbackMinutes; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java new file mode 100644 index 0000000..eb2bad3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.meeting.entity.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hz.pm.api.sms.constant.DatePattern; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * ReviewProjectDTO + *

+ * + * @author WendyYang + * @since 10:27 2023/3/8 + */ +@Data +public class ReviewProjectDTO { + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("评审时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime reviewTime; + + @ApiModelProperty("评审结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endReviewTime; + + @ApiModelProperty("评审类型") + private Integer reviewType; + + @ApiModelProperty("联系人") + private String connecter; + + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("是否是专家组长") + private Boolean isHeadman; + + @ApiModelProperty("是否已评价:0 未自评、1 已自评、2 已终评") + private Integer reviewed; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/YxtCallBackDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/YxtCallBackDTO.java new file mode 100644 index 0000000..03ffd5c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/YxtCallBackDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2023 json.cn + */ +package com.hz.pm.api.meeting.entity.dto; + +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 电话结果回调内容 + *

+ * + * @author WendyYang + * @since 2023/4/17 + **/ +@Data +public class YxtCallBackDTO { + + private Integer duration; + + private String pressKey; + + private String receiveNumber; + + private LocalDateTime dialEndTime; + + private Integer resultCode; + + private Integer retryNumber; + + private String failCode; + + private LocalDateTime dialBeginTime; + + private String sendNumber; + + private String failReason; + + private String transactionId; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/AvoidTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/AvoidTypeEnum.java new file mode 100644 index 0000000..df2bf6d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/AvoidTypeEnum.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import com.ningdatech.basic.exception.BizException; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * AvoidTypeEnum + *

+ * + * @author WendyYang + * @since 2023/8/17 + **/ +@Getter +@AllArgsConstructor +public enum AvoidTypeEnum { + + CURR_UNIT(1, "同单位"), + CURR_STRIP(2, "同条线"), + NONE(3, "不回避"); + + private final Integer code; + private final String remark; + + public static AvoidTypeEnum getByCode(int code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> BizException.wrap("回避类型无效")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertAttendStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertAttendStatusEnum.java new file mode 100644 index 0000000..bf3c240 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertAttendStatusEnum.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * ExpertAttendStatus + *

+ * + * @author WendyYang + * @since 09:23 2022/8/9 + */ +@Getter +@AllArgsConstructor +public enum ExpertAttendStatusEnum { + + NOTICING("通知中", 0), + UNANSWERED("未应答", 1), + AGREED("同意参加", 3), + REFUSED("拒绝参加", 4), + ON_LEAVE("已请假", 5), + RELEASED("已释放", 7); + + private final String value; + private final Integer code; + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + public static ExpertAttendStatusEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.eq(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的邀请状态")); + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertInviteTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertInviteTypeEnum.java new file mode 100644 index 0000000..392707d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertInviteTypeEnum.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * ExpertExtractRuleType + *

+ * + * @author WendyYang + * @since 10:11 2022/7/26 + */ +@Getter +public enum ExpertInviteTypeEnum { + + /** + * 专家抽取类型 + */ + RANDOM(1, "随机邀请"), + APPOINT(2, "指定邀请"); + + private final Integer code; + private final String name; + + ExpertInviteTypeEnum(Integer code, String name) { + this.code = code; + this.name = name; + } + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + public static ExpertInviteTypeEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的邀请类型")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertJudgeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertJudgeEnum.java new file mode 100644 index 0000000..a9cdd09 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/ExpertJudgeEnum.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * ExpertJudgeEnum + *

+ * + * @author WendyYang + * @since 2023/8/3 + **/ +public class ExpertJudgeEnum { + + private ExpertJudgeEnum() { + } + + @Getter + @AllArgsConstructor + public enum AttendStatus { + ON_TIME(1, "准时"), + BE_LATE(2, "迟到"), + ABSENT(3, "缺席"); + + private final Integer code; + private final String value; + + public boolean eq(Integer code) { + return this.code.equals(code); + } + } + + @Getter + @AllArgsConstructor + public enum Performance { + + POSITIVE(1, "积极"), + NEGATIVE(2, "消极"); + + private final Integer code; + private final String value; + + public boolean eq(Integer code) { + return this.code.equals(code); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingAttendStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingAttendStatusEnum.java new file mode 100644 index 0000000..4548d71 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingAttendStatusEnum.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * 专家参会状态 + *

+ * + * @author WendyYang + * @since 20:30 2023/3/2 + */ +@Getter +@AllArgsConstructor +public enum MeetingAttendStatusEnum { + + TO_ATTEND("待参加", 1), + ATTENDED("已参加", 2), + ON_LEAVE("已请假", 3), + UN_ATTEND("缺席", 4); + + private final String value; + private final Integer code; + + public static MeetingAttendStatusEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("专家参会状态编码无效")); + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingDateTermTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingDateTermTypeEnum.java new file mode 100644 index 0000000..37fe345 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingDateTermTypeEnum.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * MeetingDateTermType + *

+ * + * @author WendyYang + * @since 09:54 2022/8/15 + */ +@Getter +@AllArgsConstructor +public enum MeetingDateTermTypeEnum { + + /** + * 会议日期类型 + */ + ONE_DAY(1, "一天"), + MORE_THAN_ONE(2, "两天及以上"); + + private final Integer code; + private final String value; + + public static MeetingDateTermTypeEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的会议日期类型编码")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java new file mode 100644 index 0000000..6ca2433 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * MeetingReviewTypeEnum + *

+ * + * @author WendyYang + * @since 16:32 2023/3/15 + */ +@Getter +@AllArgsConstructor +public enum MeetingReviewTypeEnum { + + /** + * 会议评审类型 + */ + PRELIMINARY_SCHEME_REVIEW("初步方案评审", "1"), + + CONSTRUCTION_SCHEME_REVIEW("建设方案评审", "2"), + + ACCEPTANCE_SCHEME_REVIEW("验收方案评审", "3"), + + DEPT_JOIN_REVIEW("部门联审", "4"), + + FAIRNESS_REVIEW( "公平性审查","5"); + + private final String value; + private final String code; + + public boolean eq(String code) { + return this.getCode().equals(code); + } + + public static MeetingReviewTypeEnum getByCode(String code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的会议评审类型编码")); + } + + public static String getValue(String code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .map(MeetingReviewTypeEnum::getValue) + .findFirst() + .orElse("未知"); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusByDashboard.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusByDashboard.java new file mode 100644 index 0000000..ff18571 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusByDashboard.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +/** + *

+ * MeetingStatusByDashboard + *

+ * + * @author WendyYang + * @since 14:02 2022/8/30 + */ +public enum MeetingStatusByDashboard { + + /** + * 已完成 + */ + COMPLETED, + /** + * 已取消 + */ + CANCELED, + /** + * 待召开 + */ + TO_BE_HELD, + /** + * 已召开 + */ + HELD + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusEnum.java new file mode 100644 index 0000000..6363f04 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingStatusEnum.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.meeting.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * MeetingStatus + *

+ * + * @author WendyYang + * @since 11:14 2022/8/8 + */ +@Getter +@AllArgsConstructor +public enum MeetingStatusEnum { + + /** + * 会议状态 + */ + NORMAL("正常", 1), + CANCELED("已取消", 3); + + private final String value; + private final Integer code; + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + + public static MeetingStatusEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.getCode().equals(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("会议状态编码无效")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/BatchAppointExpertsReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/BatchAppointExpertsReq.java new file mode 100644 index 0000000..214a7d6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/BatchAppointExpertsReq.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * BatchAppointExpertsPo + *

+ * + * @author WendyYang + * @since 15:49 2022/8/26 + */ +@Data +@ApiModel("补充专家参数实体") +public class BatchAppointExpertsReq { + + @NotEmpty(message = "专家ID不能为空") + @ApiModelProperty("专家ID") + private List expertIdList; + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ConfirmedRosterReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ConfirmedRosterReq.java new file mode 100644 index 0000000..11c3dc2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ConfirmedRosterReq.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 会议确认名单实体 + *

+ * + * @author WendyYang + * @since 10:43 2022/8/26 + */ +@Data +@ApiModel("会议确认名单实体") +public class ConfirmedRosterReq { + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty + private Boolean reconfirmed; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertConfirmReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertConfirmReq.java new file mode 100644 index 0000000..b88425f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertConfirmReq.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 确认参加参数类 + *

+ * + * @author WendyYang + * @since 08:59 2022/8/10 + */ +@Data +@ApiModel("确认参加") +public class ExpertConfirmReq { + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + + @NotNull(message = "专家会议ID不能为空") + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + + @ApiModelProperty("是否确认参加会议") + private Boolean agreed; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertEvaluationReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertEvaluationReq.java new file mode 100644 index 0000000..1421c2a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertEvaluationReq.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * ExpertEvaluationPo + *

+ * + * @author WendyYang + * @since 15:30 2022/7/25 + */ +@Data +@ApiModel("专家评价实体") +public class ExpertEvaluationReq { + + @ApiModelProperty("专家事务关联ID") + @NotNull(message = "专家事务关联ID不能为空") + private Long expertMeetingId; + + @ApiModelProperty("是否参加") + @NotNull(message = "是否参加不能为空") + private Boolean attended; + + @ApiModelProperty("是否准时参加") + private Boolean inTime; + + @ApiModelProperty("是否违规") + @NotNull(message = "是否违规不能为空") + private Boolean violated; + + @ApiModelProperty("违规情况") + private String violation; + + @ApiModelProperty("参与程度:1 很积极...5 很消极") + @NotNull(message = "参与程度不能为空") + private Integer initiative; + + @ApiModelProperty("建设性的建议") + private String advice; + + @ApiModelProperty("评审结果") + private String evaluateResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java new file mode 100644 index 0000000..98eb477 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalTime; + +/** + *

+ * 专家抽取免打扰时间设置 + *

+ * + * @author WendyYang + * @since 2022-11-21 + */ +@Data +@ApiModel("专家抽取免打扰时间设置") +public class ExpertInviteIgnoreTimeModifyReq { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("是否启用:true 是、false 否") + private Boolean enable; + + @ApiModelProperty("开始时间(格式:HH:mm)") + @JSONField(format = "HH:mm") + private LocalTime startTime; + + @ApiModelProperty("截止时间(格式:HH:mm)") + @JSONField(format = "HH:mm") + private LocalTime endTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteReq.java new file mode 100644 index 0000000..ce3ca26 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertInviteReq.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.hz.pm.api.meeting.entity.dto.AppointInviteRuleDTO; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * MeetingCreatePo + *

+ * + * @author WendyYang + * @since 10:32 2022/7/26 + */ +@Data +@ApiModel("专家抽取新家实体") +public class ExpertInviteReq { + + @ApiModelProperty("会议ID") + private Long meetingId; + + @NotNull(message = "抽取类型不能为空") + @ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取") + private Integer inviteType; + + @Valid + @NotNull(message = "回避信息不能为空") + @ApiModelProperty("回避信息") + private AvoidRuleDTO avoidRule; + + @Valid + @ApiModelProperty("随机抽取规则") + private List randomRules; + + @Valid + @ApiModelProperty("指定抽取规则") + private AppointInviteRuleDTO appointRule; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertRemoveReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertRemoveReq.java new file mode 100644 index 0000000..2c130ae --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertRemoveReq.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * ExpertRemovePo + *

+ * + * @author WendyYang + * @since 08:59 2022/8/10 + */ +@Data +@ApiModel("专家移除实体") +public class ExpertRemoveReq { + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + + @NotNull(message = "专家会议ID不能为空") + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertReplaceReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertReplaceReq.java new file mode 100644 index 0000000..ea1ed6b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ExpertReplaceReq.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * ExpertRemovePo + *

+ * + * @author WendyYang + * @since 08:59 2022/8/10 + */ +@Data +@ApiModel("专家替换实体") +public class ExpertReplaceReq { + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("专家ID") + private Long expertId; + + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingBasicInfoModifyReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingBasicInfoModifyReq.java new file mode 100644 index 0000000..b2ce551 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingBasicInfoModifyReq.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * MeetingBasicInfoModifyPo + *

+ * + * @author WendyYang + * @since 11:15 2022/8/17 + */ +@Data +public class MeetingBasicInfoModifyReq { + + @ApiModelProperty("会议ID") + @NotNull(message = "会议ID不能为空") + private Long id; + + @NotEmpty(message = "会议名称不能为空") + @ApiModelProperty("会议名称") + private String name; + + @NotEmpty(message = "会议类型不能为空") + @ApiModelProperty("会议类型") + private String type; + + @NotNull(message = "开始时间不能为空") + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @NotNull(message = "结束时间不能为空") + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @NotEmpty(message = "地区编码不能为空") + @ApiModelProperty("地区编码") + private String regionCode; + + @NotNull(message = "地区编码层级不能为空") + @ApiModelProperty("地区编码层级") + private Integer regionLevel; + + @NotEmpty(message = "地址详情不能为空") + @ApiModelProperty("地址详情") + private String regionDetail; + + @NotEmpty(message = "联系人不能为空") + @ApiModelProperty("联系人") + private String connecter; + + @NotEmpty(message = "联系方式不能为空") + @ApiModelProperty("联系方式") + private String contact; + + @NotEmpty(message = "会议说明不能为空") + @ApiModelProperty("会议说明") + private String description; + + @ApiModelProperty("附件ID") + private List attachmentIds; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("创建人") + private String author; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCalenderReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCalenderReq.java new file mode 100644 index 0000000..41d56e5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCalenderReq.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.entity.req; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.time.LocalDate; + +/** + *

+ * MeetingCalenderPo + *

+ * + * @author WendyYang + * @since 22:38 2022/8/24 + */ +@Data +public class MeetingCalenderReq { + + @NotNull(message = "开始日期不能为空") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; + + @NotNull(message = "结束日期不能为空") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCancelReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCancelReq.java new file mode 100644 index 0000000..6833df8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCancelReq.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * MeetingCancelPo + *

+ * + * @author WendyYang + * @since 10:43 2022/8/26 + */ +@Data +@ApiModel("会议取消实体") +public class MeetingCancelReq { + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCreateReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCreateReq.java new file mode 100644 index 0000000..5d499e1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingCreateReq.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.hz.pm.api.meeting.entity.dto.MeetingBasicDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +/** + *

+ * MeetingCreateReq + *

+ * + * @author WendyYang + * @since 14:33 2023/2/28 + */ +@Data +public class MeetingCreateReq { + + @Valid + @NotNull(message = "会议基本信息不能为空") + @ApiModelProperty("会议基本信息") + private MeetingBasicDTO meetingBasicInfo; + + @Valid + @NotNull(message = "会议邀请规则不能为空") + @ApiModelProperty("会议邀请规则") + private ExpertInviteReq expertInviteRule; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertIdReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertIdReq.java new file mode 100644 index 0000000..d6b3032 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertIdReq.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MeetingExpertIdReq + *

+ * + * @author WendyYang + * @since 14:11 2023/3/3 + */ +@Data +public class MeetingExpertIdReq { + + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertJudgeReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertJudgeReq.java new file mode 100644 index 0000000..405d955 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingExpertJudgeReq.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +import com.hz.pm.api.meeting.entity.enumeration.ExpertJudgeEnum; +import org.hibernate.validator.constraints.Range; + +/** + *

+ * MeetingExpertJudgeReq + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Data +public class MeetingExpertJudgeReq { + + private Long id; + + @NotNull(message = "会议ID不能为空", groups = Basic.class) + private Long meetingId; + + @NotNull(message = "会议专家ID不能为空", groups = Basic.class) + private Long meetingExpertId; + + @ApiModelProperty("评分(1~10)") + @NotNull(message = "评分不能为空", groups = Basic.class) + @Range(min = 1, max = 10, message = "评分范围为:1~10") + private Integer score; + + /** + * @see ExpertJudgeEnum.AttendStatus + */ + @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") + @NotNull(message = "是否参加不能为空", groups = Basic.class) + private Integer attended; + + /** + * @see ExpertJudgeEnum.Performance + */ + @ApiModelProperty("参与程度:1 积极、2 消极") + @NotNull(message = "参与度不能为空", groups = Attend.class) + private Integer performance; + + @ApiModelProperty("是否提出建议:true 是、false 否") + @NotNull(message = "是否提出建议不能为空", groups = Attend.class) + private Boolean advised; + + @ApiModelProperty("是否早退:true 早退、false 未早退") + @NotNull(message = "是否早退不能为空", groups = Attend.class) + private Boolean leaveEarly; + + @ApiModelProperty("是否违规:true 是、false 否") + @NotNull(message = "是否违规不能为空", groups = Attend.class) + private Boolean brokeRule; + + @ApiModelProperty("违规内容") + private String brokeRuleContent; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createOn; + + //================================================================================================================== + + public interface Attend { + } + + public interface Basic { + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingIdReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingIdReq.java new file mode 100644 index 0000000..581390a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingIdReq.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MeetingIdReq + *

+ * + * @author WendyYang + * @since 17:10 2023/3/7 + */ +@Data +public class MeetingIdReq { + + @ApiModelProperty("会议ID") + private Long meetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingLeaveListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingLeaveListReq.java new file mode 100644 index 0000000..a1a9f60 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingLeaveListReq.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.ningdatech.basic.model.PagePo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MeetingListForLeaveReq + *

+ * + * @author WendyYang + * @since 17:03 2023/4/3 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MeetingLeaveListReq extends PagePo { + + private Long expertId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListByExpertReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListByExpertReq.java new file mode 100644 index 0000000..72aa0f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListByExpertReq.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.ningdatech.basic.model.PagePo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MeetingListByExpertPo + *

+ * + * @author WendyYang + * @since 17:02 2022/8/23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MeetingListByExpertReq extends PagePo { + + private Long expertId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListReq.java new file mode 100644 index 0000000..ba5e795 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingListReq.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.meeting.entity.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; + +/** + *

+ * MeetingListByManagerPo + *

+ * + * @author WendyYang + * @since 11:07 2022/8/8 + */ +@Data +@ApiModel("专家抽取员事务列表请求参数") +@EqualsAndHashCode(callSuper = true) +public class MeetingListReq extends PagePo { + + @ApiModelProperty("会议名称") + private String name; + + @ApiModelProperty("会议开始时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("会议结束时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("事务状态") + private Integer status; + + @ApiModelProperty("会议类型") + private String meetingType; + + @ApiModelProperty("专家ID") + private Long expertId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("区域层级") + private Integer regionLevel; + + @ApiModelProperty("参会名单是否确认") + private Boolean confirmedRoster; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java new file mode 100644 index 0000000..37ce98a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.ningdatech.basic.model.PagePo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MeetingOptionProjectReq + *

+ * + * @author WendyYang + * @since 11:50 2023/3/16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MeetingOptionProjectReq extends PagePo { + + private String meetingType; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultReq.java new file mode 100644 index 0000000..b355ee3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultReq.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * MeetingResultPo + *

+ * + * @author WendyYang + * @since 21:20 2022/8/8 + */ +@Data +@ApiModel("会议结果上传实体") +public class MeetingResultReq { + + @NotNull(message = "事务ID不能为空") + @ApiModelProperty("事务ID") + private Long meetingId; + + @NotBlank(message = "会议结果说明不能为空") + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("附件ID") + private List attachments; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ReviewProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ReviewProjectListReq.java new file mode 100644 index 0000000..aed0d91 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/ReviewProjectListReq.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.meeting.entity.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * ReviewProjectListReq + *

+ * + * @author WendyYang + * @since 10:54 2023/3/8 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class ReviewProjectListReq extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("建设单位") + private String buildOrgName; + + private Long userId; + + @ApiModelProperty("是否已评审") + private Boolean reviewed; + + private LocalDateTime reviewTimeMin; + + private LocalDateTime reviewTimeMax; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java new file mode 100644 index 0000000..411b696 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 指定邀请规则 + *

+ * + * @author WendyYang + * @since 11:26 2023/3/1 + */ +@Data +@ApiModel("指定邀请规则") +public class AppointRuleVO { + + @ApiModelProperty("邀请说明") + private String inviteDesc; + + @ApiModelProperty("指定邀请专家") + private List experts; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java new file mode 100644 index 0000000..5a86e35 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 回避信息 + *

+ * + * @author WendyYang + * @since 11:25 2023/3/1 + */ +@Data +@ApiModel("回避信息") +public class AvoidInfoVO { + + @ApiModelProperty("回避类型:1 回避同单位、2 回避同条线、3 不回避") + private Integer avoidType; + + @ApiModelProperty("回避单位") + private List avoidUnitIds; + + @ApiModelProperty("回避单位名称") + private List avoidUnits; + + @ApiModelProperty("回避条线") + private List avoidOrgIds; + + @ApiModelProperty("回避条线名称") + private List avoidOrgs; + + @ApiModelProperty("每周邀请次数") + private Integer weekInviteCount; + + @ApiModelProperty("回避专家") + private List experts; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertAttendSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertAttendSummaryVO.java new file mode 100644 index 0000000..50c2e65 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertAttendSummaryVO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * ExpertAttendSummaryVo + *

+ * + * @author WendyYang + * @since 11:18 2022/8/28 + */ +@Data +public class ExpertAttendSummaryVO { + + private transient Long expertId; + + @ApiModelProperty("专家姓名") + private String expertName; + + @ApiModelProperty("专家出席次数") + private Integer attendCount; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertBasicInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertBasicInfoVO.java new file mode 100644 index 0000000..e061fd1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertBasicInfoVO.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.hz.pm.api.sys.model.dto.RegionDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.util.List; + +/** + *

+ * ExpertBasicInfoVo + *

+ * + * @author WendyYang + * @since 15:58 2022/8/8 + */ +@Data +@Builder +public class ExpertBasicInfoVO { + + @Tolerate + public ExpertBasicInfoVO() { + } + + @ApiModelProperty("专家ID") + private Long expertId; + + @ApiModelProperty("专家姓名") + private String name; + + @ApiModelProperty("专家层级") + private List regions; + + @ApiModelProperty("职称级别") + private String jobLevel; + + @ApiModelProperty("单位属性") + private String companyType; + + @ApiModelProperty("工作单位") + private String company; + + @ApiModelProperty("联系方式") + private String contact; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertCountOnChangeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertCountOnChangeVO.java new file mode 100644 index 0000000..058bc44 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertCountOnChangeVO.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * ExpertCountOnChangeVo + *

+ * + * @author WendyYang + * @since 10:02 2022/8/8 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("专家抽取数量校验实体") +public class ExpertCountOnChangeVO { + + @ApiModelProperty("每个随机规则对应的可抽取数量") + private List countList; + + @ApiModelProperty("参数是否通过校验:true 是、false 否") + private Boolean status; + + @ApiModelProperty("错误提醒") + private String message; + + public void addCountList(Integer count) { + this.countList.add(count); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationListVO.java new file mode 100644 index 0000000..ec6a2e3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationListVO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * ExpertEvaluationListVo + *

+ * + * @author WendyYang + * @since 16:03 2022/8/8 + */ +@Data +@ApiModel("专家评价列表") +public class ExpertEvaluationListVO { + + @ApiModelProperty("专家评价ID") + private Long evaluationId; + + @ApiModelProperty("专家信息") + private ExpertBasicInfoVO expert; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java new file mode 100644 index 0000000..73cde2c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * ExpertEvaluationToDoListItemVo + *

+ * + * @author WendyYang + * @since 13:58 2022/8/29 + */ +@Data +@ApiModel("专家评价待办列表") +@EqualsAndHashCode(callSuper = true) +public class ExpertEvaluationToDoListItemVO extends ExpertBasicInfoVO { + + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("会议开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("会议结束时间") + private LocalDateTime endTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInvitationDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInvitationDetailVO.java new file mode 100644 index 0000000..a169fba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInvitationDetailVO.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * ExpertInvitationDetailVo + *

+ * + * @author WendyYang + * @since 13:51 2022/8/27 + */ +@Data +@Builder +public class ExpertInvitationDetailVO { + + @Tolerate + public ExpertInvitationDetailVO() { + } + + @ApiModelProperty("专家确认时间") + private LocalDateTime inviteTime; + + @ApiModelProperty("会议举办单位") + private String holdOrg; + + @ApiModelProperty("会议开始时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("会议结束时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("举办地址详情") + private String regionDetail; + + private List regions; + + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("联系人") + private String connecter; + + @ApiModelProperty("专家名称") + private String expertName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteDetailVO.java new file mode 100644 index 0000000..2c1c8cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteDetailVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * ExpertInviteDetailVO + *

+ * + * @author WendyYang + * @since 08:58 2022/8/9 + */ +@Data +@ApiModel("专家邀请情况实体") +public class ExpertInviteDetailVO { + + @ApiModelProperty("是否已停止邀请") + private Boolean invitedStopped; + + @ApiModelProperty("是否已确认名单") + private Boolean confirmedRoster; + + @ApiModelProperty("邀请名单") + private List inviteExpertList; + + @ApiModelProperty("抽取情况") + private List inviteStatistics; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java new file mode 100644 index 0000000..8847db8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.time.LocalTime; + +/** + *

+ * 专家抽取免打扰时间设置 + *

+ * + * @author WendyYang + * @since 2022-11-21 + */ +@Data +@ApiModel("专家抽取免打扰时间设置") +public class ExpertInviteIgnoreTimeListVO { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("是否启用:true 是、false 否") + private Boolean enable; + + @ApiModelProperty("开始时间") + @JSONField(format = "HH:mm") + private LocalTime startTime; + + @ApiModelProperty("截止时间") + @JSONField(format = "HH:mm") + private LocalTime endTime; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertListItemFoEvaluationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertListItemFoEvaluationVO.java new file mode 100644 index 0000000..0436934 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertListItemFoEvaluationVO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MeetingExpertListItemFoEvaluationVo + *

+ * + * @author WendyYang + * @since 10:06 2022/8/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("专家评价专家列表视图实体") +public class ExpertListItemFoEvaluationVO extends ExpertBasicInfoVO { + + @ApiModelProperty("是否已评价:true 已评价、false 未评价") + private boolean evaluated; + + @ApiModelProperty("评价ID") + private Long evaluationId; + + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertReplaceTodoListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertReplaceTodoListItemVO.java new file mode 100644 index 0000000..470c3b8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertReplaceTodoListItemVO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * ExpertReplaceTodoListItemVo + *

+ * + * @author WendyYang + * @since 16:46 2022/8/29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class ExpertReplaceTodoListItemVO extends ExpertBasicInfoVO { + + @ApiModelProperty("会议ID") + private Long meetingId; + + private Long expertMeetingId; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("邀请结果") + private Integer status; + + @ApiModelProperty("邀请方式") + private String inviteType; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java new file mode 100644 index 0000000..6b2e064 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteExpertListItemVO.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * RandomInviteListItemVO + *

+ * + * @author WendyYang + * @since 16:48 2023/3/3 + */ +@Data +@ApiModel("邀请名单实体") +@EqualsAndHashCode(callSuper = true) +public class InviteExpertListItemVO extends ExpertBasicInfoVO { + + @ApiModelProperty("邀请规则ID") + private Long ruleId; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("手机号") + private String mobile; + + @ApiModelProperty("是否是专家组长") + private Boolean isHeadman; + + @ApiModelProperty("专家会议ID") + private Long expertMeetingId; + + @ApiModelProperty("电话通知状态") + private String noticeStatus; + + @ApiModelProperty("邀请状态") + private Integer status; + + @ApiModelProperty("抽取类型") + private Integer inviteType; + + @ApiModelProperty("通知时间") + private LocalDateTime noticeTime; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteRuleDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteRuleDetailVO.java new file mode 100644 index 0000000..77bcdae --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteRuleDetailVO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * InviteRuleDetailVo + *

+ * + * @author WendyYang + * @since 14:58 2022/8/17 + */ +@Data +public class InviteRuleDetailVO { + + @ApiModelProperty("随机邀请规则") + private List randomRules; + + @ApiModelProperty("指定抽取规则") + private AppointRuleVO appointRule; + + @ApiModelProperty("回避信息") + private AvoidInfoVO avoidInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteStatisticsByRuleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteStatisticsByRuleVO.java new file mode 100644 index 0000000..27efae8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/InviteStatisticsByRuleVO.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * InviteStatisticsVO + *

+ * + * @author WendyYang + * @since 18:07 2023/3/4 + */ +@Data +public class InviteStatisticsByRuleVO { + + @ApiModelProperty("抽取规则ID") + private Long ruleId; + + @ApiModelProperty("抽取人数") + private Integer inviteCnt; + + @ApiModelProperty("同意人数") + private Integer agreeCnt; + + @ApiModelProperty("实抽人数") + private Integer noticedCnt; + + public static InviteStatisticsByRuleVO init(Long ruleId) { + InviteStatisticsByRuleVO statistics = new InviteStatisticsByRuleVO(); + statistics.setRuleId(ruleId); + statistics.setNoticedCnt(0); + statistics.setInviteCnt(0); + statistics.setAgreeCnt(0); + return statistics; + } + + public void incrInviteCnt() { + this.inviteCnt++; + } + + public void incrAgreeCnt() { + this.agreeCnt++; + } + + public void incrNoticedCnt() { + this.noticedCnt++; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java new file mode 100644 index 0000000..62752e5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; + +/** + *

+ * MeetingByManagerVo + *

+ * + * @author WendyYang + * @since 11:43 2022/8/8 + */ +@Data +@Builder +@ApiModel("会议实体(管理员列表)") +public class MeetingByManagerVO { + + @Tolerate + public MeetingByManagerVO() { + } + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("会议专家ID") + private Long meetingExpertId; + + @ApiModelProperty("会议开始时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("会议结束时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("会议状态") + private Integer status; + + @ApiModelProperty("抽取类型") + private Integer inviteType; + + @ApiModelProperty("抽取状态") + private Boolean inviteStatus; + + @ApiModelProperty("名单确认状态") + private Boolean confirmedRoster; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("会议类型编码") + private String meetingType; + + @ApiModelProperty("会议类型名称") + private String meetingTypeName; + + @ApiModelProperty("专家状态") + private Integer expertStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("联系人") + private String connecter; + + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("是否评价") + private Boolean hasJudge; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCalenderItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCalenderItemVO.java new file mode 100644 index 0000000..ba262c9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCalenderItemVO.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.util.Collection; +import java.util.List; + +/** + *

+ * MeetingCalenderItemVo + *

+ * + * @author WendyYang + * @since 22:57 2022/8/24 + */ +@Data +@ApiModel("会议日历视图实体") +public class MeetingCalenderItemVO { + + @ApiModelProperty("当前日期") + private LocalDate today; + + @ApiModelProperty("是否请假") + private Boolean hasLeave; + + @ApiModelProperty("请假ID") + private Collection leaveIds; + + @ApiModelProperty("是否有会议") + private Boolean hasMeeting; + + @ApiModelProperty("会议信息") + private List meetings; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingConfirmToDoListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingConfirmToDoListItemVO.java new file mode 100644 index 0000000..2aaf424 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingConfirmToDoListItemVO.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.hz.pm.api.sys.model.dto.RegionDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * MeetingConfirmToDoListItem + *

+ * + * @author WendyYang + * @since 15:20 2022/8/29 + */ +@Data +public class MeetingConfirmToDoListItemVO { + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("会议开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("会议结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("会议类型") + private String type; + + @ApiModelProperty("举办地址详情") + private String regionDetail; + + @ApiModelProperty("举办地址") + private List regions; + + @ApiModelProperty("状态") + private Integer status; + + @ApiModelProperty("邀请总人数") + private Integer totalExpert; + + @ApiModelProperty("确认总人数") + private Integer confirmedExpert; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountByExpertVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountByExpertVO.java new file mode 100644 index 0000000..2cd81f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountByExpertVO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + *

+ * MeetingCountByExpertVo + *

+ * + * @author WendyYang + * @since 10:23 2022/10/19 + */ +@Data +@AllArgsConstructor +@ApiModel("专家工作台:会议数量统计视图") +public class MeetingCountByExpertVO { + + @ApiModelProperty("待参加数量") + private Integer toBeAttended; + + @ApiModelProperty("已参加数量") + private Integer attended; + + @ApiModelProperty("请假数量") + private Integer leaved; + + public static MeetingCountByExpertVO init() { + return new MeetingCountByExpertVO(0, 0, 0); + } + + public void incrToBeAttended() { + this.toBeAttended += 1; + } + + public void incrAttended() { + this.attended += 1; + } + + public void incrLeaved() { + this.leaved += 1; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountSummaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountSummaryVO.java new file mode 100644 index 0000000..cc7b51e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingCountSummaryVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * MeetingCountSummaryVo + *

+ * + * @author WendyYang + * @since 09:43 2022/8/30 + */ +@Data +@Builder +@ApiModel("会议数量统计视图实体") +public class MeetingCountSummaryVO { + + @ApiModelProperty("已完成") + private Integer completed; + + @ApiModelProperty("已取消") + private Integer canceled; + + @ApiModelProperty("待召开") + private Integer toBeHeld; + + @ApiModelProperty("已召开") + private Integer held; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java new file mode 100644 index 0000000..a6c7578 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java @@ -0,0 +1,101 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.hz.pm.api.meeting.entity.dto.MeetingReviewProjectDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * MeetingDetailBasicVo + *

+ * + * @author WendyYang + * @since 15:16 2022/8/8 + */ +@Data +@Builder +@ApiModel("会议详情基本信息") +public class MeetingDetailBasicVO { + + @Tolerate + public MeetingDetailBasicVO() { + } + + private Long meetingId; + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("会议类型名称") + private String typeName; + + private String regionCode; + + @ApiModelProperty("会议类型代码") + private String meetingType; + + @ApiModelProperty("开始时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("评委到场时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime judgesAttendanceTime; + + @ApiModelProperty("会议耗时") + private Integer meetingUsageTime; + + @ApiModelProperty("联系人") + private String connecter; + + @ApiModelProperty("创建人") + private String creator; + + @ApiModelProperty("评审地点") + private String meetingAddress; + + @ApiModelProperty("联系方式") + private String contact; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("会议状态") + private Integer status; + + @ApiModelProperty("取消说明") + private String cancelRemark; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("抽取单位") + private String holdOrg; + + @ApiModelProperty("抽取信息") + private InviteRuleDetailVO inviteRule; + + @ApiModelProperty("评审项目信息") + private List projects; + + @ApiModelProperty("是否已停止邀请") + private Boolean invitedStopped; + + @ApiModelProperty("是否已确认名单") + private Boolean confirmedRoster; + + @ApiModelProperty("邀请类型") + private Integer inviteType; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingResultVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingResultVO.java new file mode 100644 index 0000000..bbf4062 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingResultVO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * MeetingResultVo + *

+ * + * @author WendyYang + * @since 21:28 2022/8/8 + */ +@Data +public class MeetingResultVO { + + @ApiModelProperty("事务ID") + private Long meetingId; + + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("附件信息") + private List attachments; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java new file mode 100644 index 0000000..b374a0c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * MeetingReviewProjectVO + *

+ * + * @author WendyYang + * @since 13:57 2023/3/20 + */ +@Data +@Builder +public class MeetingReviewProjectVO { + + @Tolerate + public MeetingReviewProjectVO() { + } + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("申报年度") + private Integer projectYear; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("评审结果") + private String reviewResult; + + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/RandomInviteRuleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/RandomInviteRuleVO.java new file mode 100644 index 0000000..859e576 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/RandomInviteRuleVO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.meeting.entity.vo; + +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + *

+ * RandomInviteRuleVo + *

+ * + * @author WendyYang + * @since 09:55 2022/8/26 + */ +@Data +@ApiModel("随机抽取规则视图实体") +@EqualsAndHashCode(callSuper = true) +public class RandomInviteRuleVO extends RandomInviteRuleDTO { + + @ApiModelProperty("履职意向地(回显使用)") + private List intentionRegions; + + @ApiModelProperty("专家层级意向地(回显使用)") + private List expertRegions; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertInviteHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertInviteHelper.java new file mode 100644 index 0000000..b810275 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertInviteHelper.java @@ -0,0 +1,110 @@ +package com.hz.pm.api.meeting.helper; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.AbstractInviteRule; +import com.hz.pm.api.meeting.entity.dto.AppointInviteRuleDTO; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.*; + +/** + *

+ * ExpertInviteHelper + *

+ * + * @author WendyYang + * @since 16:35 2022/11/21 + */ +@Slf4j +@Component +@AllArgsConstructor +public class ExpertInviteHelper { + + private final IMeetingService meetingService; + private final IMeetingExpertService meetingExpertService; + private final IExpertUserFullInfoService expertUserFullInfoService; + + /** + * 获取时间段内被抽中的专家(通知中、确认参加) + * + * @param start 开始时间 + * @param end 结束时间 + * @return java.util.List + * @author WendyYang + **/ + public List listInvitedExpertByTime(LocalDateTime start, LocalDateTime end) { + LambdaQueryWrapper meetingQuery = Wrappers.lambdaQuery(Meeting.class) + .select(Meeting::getId) + .eq(Meeting::getStatus, MeetingStatusEnum.NORMAL.getCode()) + .and(wrapper -> wrapper.between(Meeting::getStartTime, start, end) + .or(wrapper1 -> wrapper1.between(Meeting::getEndTime, start, end))); + List meetings = meetingService.list(meetingQuery); + if (meetings.isEmpty()) { + return Collections.emptyList(); + } + List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); + LambdaQueryWrapper meetingExpertQuery = Wrappers.lambdaQuery(MeetingExpert.class) + .select(MeetingExpert::getExpertId) + .in(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode(), ExpertAttendStatusEnum.NOTICING.getCode()) + .in(MeetingExpert::getMeetingId, meetingIds); + List meetingExperts = meetingExpertService.list(meetingExpertQuery); + return CollUtils.fieldList(meetingExperts, MeetingExpert::getExpertId); + } + + public Set listExpertLeaveOrInvited(LocalDateTime start, LocalDateTime end) { + return new HashSet<>(listInvitedExpertByTime(start, end)); + } + + public Set getAvoidExpert(List appoints, AvoidRuleDTO avoid, LocalDateTime start, LocalDateTime end) { + Set expertIds = new HashSet<>(); + Optional.ofNullable(appoints).ifPresent(expertIds::addAll); + Optional.ofNullable(avoid) + .flatMap(w -> Optional.ofNullable(w.getExpertIds())) + .ifPresent(expertIds::addAll); + // 过滤掉请假专家 + expertIds.addAll(listInvitedExpertByTime(start, end)); + return expertIds; + } + + public Map checkAppointExpert(AppointInviteRuleDTO appointRule) { + if (appointRule == null) { + return Collections.emptyMap(); + } + List expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIdList()); + return CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); + } + + /** + * 构建邀请规则 + * + * @param rule 邀请规则 + * @param meetingId 会议ID + * @return {@link ExpertInviteRule} + * @author WendyYang + **/ + public static ExpertInviteRule getExpertInviteRule(AbstractInviteRule rule, Long meetingId) { + ExpertInviteRule result = new ExpertInviteRule(); + result.setInviteRule(JSONObject.toJSONString(rule)); + result.setInviteCount(rule.getCount()); + result.setInviteType(rule.getInviteType()); + result.setMeetingId(meetingId); + return result; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java new file mode 100644 index 0000000..c35406a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java @@ -0,0 +1,193 @@ +package com.hz.pm.api.meeting.helper; + +import cn.hutool.core.util.RandomUtil; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.RandomUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 专家抽取算法 + *

+ * + * @author WendyYang + * @since 2023/4/14 + **/ +public class ExpertRandomInviteAlgorithm { + + private ExpertRandomInviteAlgorithm() { + + } + + private static boolean expertMatchNone(List experts, ExpertUserFullInfo userInfo) { + return experts.stream().noneMatch(w -> w.getExpertId().equals(userInfo.getUserId())); + } + + /** + * 每个单位只抽取一人 + * + * @param expertGroupByUnit 需要抽取的人 + * @param expertsByRecentMeeting 最近会议抽取到的专家 + * @param count 抽取数量 + * @return 抽取到的专家信息 + * @author WendyYang + **/ + public static List inviteGroupByUnit(Map> expertGroupByUnit, + List> expertsByRecentMeeting, + Integer count) { + if (MapUtils.isEmpty(expertGroupByUnit)) { + return Collections.emptyList(); + } + if (expertsByRecentMeeting.isEmpty()) { + return expertGroupByUnit.values().stream() + .map(RandomUtil::randomEle) + .limit(count).collect(Collectors.toList()); + } else { + List result = new ArrayList<>(); + List keySet = new ArrayList<>(expertGroupByUnit.keySet()); + for (int i = 0; i < count; i++) { + String company = keySet.get(RandomUtils.nextInt(0, keySet.size())); + List expertsByCompany = expertGroupByUnit.get(company); + for (int j = 0; j < expertsByRecentMeeting.size(); j++) { + List experts = expertsByRecentMeeting.get(j); + List notInvitedUsers = expertsByCompany.stream() + .filter(w -> expertMatchNone(experts, w)) + .collect(Collectors.toList()); + if (!notInvitedUsers.isEmpty()) { + result.add(RandomUtil.randomEle(notInvitedUsers)); + break; + } else if (j == (expertsByRecentMeeting.size() - 1)) { + result.add(RandomUtil.randomEle(expertsByCompany)); + } + } + if (result.size() < count) { + keySet.remove(company); + if (keySet.isEmpty()) { + break; + } + } + } + return result; + } + } + + public static List inviteGroupByStrip(Map> expertStripGroup, + List userFullInfoList, + List> expertsByRecentMeeting, + Integer count) { + if (MapUtils.isEmpty(expertStripGroup)) { + return Collections.emptyList(); + } + Map userMap = CollUtils.listToMap(userFullInfoList, ExpertUserFullInfo::getUserId); + if (expertsByRecentMeeting.isEmpty()) { + return expertStripGroup.values().stream() + .map(w -> { + ExpertUserFullInfo euf; + while (true) { + ExpertGovBusinessStrip ele = RandomUtil.randomEle(w); + euf = userMap.remove(ele.getExpertUserId()); + if (euf != null || w.isEmpty() || userMap.isEmpty()) { + break; + } + w.remove(ele); + } + return euf; + }).filter(Objects::nonNull) + .limit(count) + .collect(Collectors.toList()); + } else { + List lockedUsers = new ArrayList<>(); + List strips = new ArrayList<>(expertStripGroup.keySet()); + for (int i = 0; i < count; i++) { + String strip = strips.get(RandomUtils.nextInt(0, strips.size())); + List expertsByStrip = expertStripGroup.get(strip); + for (int j = 0; j < expertsByRecentMeeting.size(); j++) { + List experts = expertsByRecentMeeting.get(j); + List notInvitedUsers = expertsByStrip.stream() + .map(w -> userMap.get(w.getExpertUserId())) + .filter(w -> w != null && expertMatchNone(experts, w)) + .collect(Collectors.toList()); + if (!notInvitedUsers.isEmpty()) { + ExpertUserFullInfo usf = RandomUtil.randomEle(notInvitedUsers); + // 防止一个专家多条线 + userMap.remove(usf.getUserId()); + lockedUsers.add(usf); + break; + } else if (j == (expertsByRecentMeeting.size() - 1)) { + ExpertUserFullInfo euf; + ExpertGovBusinessStrip egs = RandomUtil.randomEle(expertsByStrip); + while (true) { + euf = userMap.remove(egs.getExpertUserId()); + if (euf != null || expertsByStrip.isEmpty() || userMap.isEmpty()) { + break; + } + expertsByStrip.remove(egs); + } + if (euf != null) { + lockedUsers.add(euf); + } + } + if (userMap.isEmpty()) { + return lockedUsers; + } + } + if (lockedUsers.size() < count) { + strips.remove(strip); + if (strips.isEmpty()) { + break; + } + } + } + return lockedUsers; + } + } + + /** + * 随机抽取专家 + * + * @param userFullInfos 可抽取的所有专家 + * @param expertsByRecentMeeting 最近会议抽取到的专家 + * @param count 抽取数量 + * @return 抽取到的专家信息 + * @author WendyYang + **/ + public static List inviteWithoutCompany(List userFullInfos, + List> expertsByRecentMeeting, + Integer count) { + List result; + if (expertsByRecentMeeting.isEmpty()) { + result = RandomUtil.randomEleList(userFullInfos, count); + } else { + result = new ArrayList<>(); + for (List experts : expertsByRecentMeeting) { + List notInvitedUsers = userFullInfos.stream() + .filter(w -> expertMatchNone(experts, w)) + .collect(Collectors.toList()); + if (!notInvitedUsers.isEmpty()) { + result.addAll(notInvitedUsers); + if (result.size() >= count) { + return result.subList(0, count); + } + userFullInfos.removeAll(notInvitedUsers); + } + } + if (userFullInfos.isEmpty()) { + return result; + } + int restCnt = Math.min(count - result.size(), userFullInfos.size()); + if (userFullInfos.size() > restCnt) { + result.addAll(RandomUtil.randomEleList(userFullInfos, restCnt)); + } else { + result.addAll(userFullInfos); + } + } + return result; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java new file mode 100644 index 0000000..d0b374d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java @@ -0,0 +1,216 @@ +package com.hz.pm.api.meeting.helper; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.meeting.constant.MeetingMsgTemplateConst; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingReviewTypeEnum; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sms.constant.VoiceSmsTemplateConst; +import com.hz.pm.api.sms.utils.DateUtil; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.hz.pm.api.sys.model.entity.Notify; +import com.hz.pm.api.sys.service.INotifyService; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; +import com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * MeetingMsgHelper + *

+ * + * @author WendyYang + * @since 2023/4/20 + **/ +@Component +@AllArgsConstructor +public class MeetingCallOrMsgHelper { + + private final IUserInfoService userInfoService; + private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + private final INdWorkNoticeStagingService workNoticeStagingService; + private final IDingEmployeeInfoService dingEmployeeInfoService; + private final IDingOrganizationService dingOrganizationService; + private final INotifyService notifyService; + + private static String officialTime(LocalDateTime time) { + return time.format(DateUtil.DTF_YMD_HM); + } + + private Notify getNotify(Long userId, String msg, MsgTypeEnum type, Map extraPara) { + Notify notify = new Notify(); + notify.setUserId(userId); + notify.setContent(msg); + notify.setType(type.name()); + notify.setReaded(Boolean.FALSE); + notify.setCreateTime(LocalDateTime.now()); + String extraJson = JSON.toJSONString(extraPara); + notify.setExtraInfo(extraJson); + return notify; + } + + private WorkNoticeInfo getSendWorkNoticeInfo(Long accountId) { + WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); + workNoticeInfo.setAccountId(accountId); + // 根据浙政钉用户ID获取部门code + DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getAccountId, accountId) + .eq(DingEmployeeInfo::getMainJob, String.valueOf(Boolean.TRUE)) + .last("limit 1")); + String organizationCode = employeeInfo.getOrganizationCode(); + workNoticeInfo.setOrganizationCode(organizationCode); + // 根据部门code获取部门名称 + DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, organizationCode)); + String organizationName = dingOrganization.getOrganizationName(); + workNoticeInfo.setOrganizationName(organizationName); + // 构建唯一的消息ID + String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE + + organizationName + accountId + StrUtil.UNDERLINE + System.currentTimeMillis(); + workNoticeInfo.setBizMsgId(bizMsgId); + String receiverUserId = String.valueOf(accountId); + workNoticeInfo.setReceiverUserId(receiverUserId); + return workNoticeInfo; + } + + @Transactional(rollbackFor = Exception.class) + public void sendInviteStopMsg(Long userId, Long meetingId, String meetingName) { + UserInfo info = userInfoService.getById(userId); + String msgContent = String.format(MeetingMsgTemplateConst.INVITE_END, meetingName); + // 音信通消息 + SendSmsContext yxtContent = new SendSmsContext(); + yxtContent.setContent(msgContent); + yxtContent.setReceiveNumber(info.getMobile()); + yxtCallOrSmsHelper.sendSms(yxtContent); + // 发送工作通知 + if (info.getAccountId() != null) { + WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); + swn.setMsg(msgContent); + workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); + Map map = new HashMap<>(2); + map.put("meetingId", meetingId); + Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); + notifyService.save(notify); + } + } + + @Transactional(rollbackFor = Exception.class) + public void sendConfirmedRosterMsg(List experts, Meeting meeting) { + List userIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + List userInfos = userInfoService.listByIds(userIds); + Map userMap = CollUtils.listToMap(userInfos, UserInfo::getId); + String sTime = officialTime(meeting.getStartTime()); + String eTime = officialTime(meeting.getEndTime()); + String meetingTime = sTime + "至" + eTime; + List yxtContents = new ArrayList<>(); + List notifies = new ArrayList<>(); + List workingNotices = new ArrayList<>(); + experts.forEach(w -> { + String msgContent = String.format(MeetingMsgTemplateConst.CONFIRMED_ROSTER, + w.getExpertName(), officialTime(w.getCreateOn()), meetingTime, meeting.getMeetingAddress(), + meeting.getConnecter(), meeting.getContact()); + // 音信通消息 + SendSmsContext yxtContent = new SendSmsContext(); + yxtContent.setContent(msgContent); + yxtContent.setReceiveNumber(w.getMobile()); + yxtContents.add(yxtContent); + UserInfo info = userMap.get(w.getExpertId()); + // 发送工作通知 + if (info.getAccountId() != null) { + WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); + swn.setMsg(msgContent); + workingNotices.add(swn); + Map map = new HashMap<>(2); + map.put("meetingId", meeting.getId()); + Notify notify = getNotify(info.getId(), msgContent, MsgTypeEnum.EXPERT_REVIEW, map); + notifies.add(notify); + } + }); + notifyService.saveBatch(notifies); + yxtCallOrSmsHelper.sendSms(yxtContents); + workNoticeStagingService.addByWorkNotice(workingNotices, MsgTypeEnum.EXPERT_REVIEW); + } + + + public void sendCancelMeetingMsg(List experts, Meeting meeting) { + String startTime = officialTime(meeting.getStartTime()); + String meetingType = MeetingReviewTypeEnum.getValue(meeting.getType()); + List contexts = experts.stream().map(w -> { + String content = String.format(MeetingMsgTemplateConst.MEETING_CANCEL, + w.getExpertName(), startTime, meetingType, meeting.getContact()); + SendSmsContext context = new SendSmsContext(); + context.setReceiveNumber(w.getMobile()); + context.setContent(content); + return context; + }).collect(Collectors.toList()); + yxtCallOrSmsHelper.sendSms(contexts); + } + + /** + * 提交专家通知音信通任务 + * + * @param meeting 会议信息 + * @param experts 待通知专家 + * @author WendyYang + **/ + public void callExpertByMeeting(Meeting meeting, List experts) { + String voiceContent = String.format(VoiceSmsTemplateConst.OFFLINE_TEMPLATE, + meeting.getHoldOrg(), meeting.getName(), officialTime(meeting.getStartTime()), + meeting.getMeetingAddress()); + List callContexts = CollUtils.convert(experts, w -> { + SubmitTaskCallContext context = new SubmitTaskCallContext(); + context.setContent(voiceContent); + context.setReceiveNumber(w.getMobile()); + return context; + }); + String submitKey = yxtCallOrSmsHelper.submitCallTask(callContexts); + experts.forEach(w -> w.setSubmitKey(submitKey)); + } + + public void sendExpertLeaveMsg(MeetingExpert expert, Meeting meeting) { + Long userId = meeting.getCreateBy(); + String msgContent; + if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { + msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_RANDOM, meeting.getName()); + } else { + msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_APPOINT, meeting.getName(), expert.getExpertName()); + } + UserInfo info = userInfoService.getById(userId); + SendSmsContext yxtContent = new SendSmsContext(); + yxtContent.setContent(msgContent); + yxtContent.setReceiveNumber(info.getMobile()); + yxtCallOrSmsHelper.sendSms(yxtContent); + // 发送工作通知 + if (info.getAccountId() != null) { + WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); + swn.setMsg(msgContent); + workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); + Map map = new HashMap<>(2); + map.put("meetingId", meeting.getId()); + Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); + notifyService.save(notify); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java new file mode 100644 index 0000000..b4574ba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.meeting.helper; + +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.entity.ViewRegionDTO; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + *

+ * MeetingDataScopeHelper + *

+ * + * @author WendyYang + * @since 2023/4/27 + **/ +@Component +@AllArgsConstructor +public class MeetingDataScopeHelper { + + private final RegionCacheHelper regionCacheHelper; + + private static RoleEnum getRolePriorityMax() { + List roleList = LoginUserUtil.loginUserDetail().getUserRoleList(); + List roleCodeList = CollUtils.fieldList(roleList, Role::getCode); + if (roleCodeList.contains(RoleEnum.SUPER_ADMIN.name())) { + return RoleEnum.SUPER_ADMIN; + } + if (roleCodeList.contains(RoleEnum.REGION_MANAGER.name())) { + return RoleEnum.REGION_MANAGER; + } + return RoleEnum.EXPERT_ADMIN; + } + + public ViewRegionDTO meetingListViewRegions() { + RoleEnum role = getRolePriorityMax(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + Integer regionLevel = user.getRegionLevel(); + Collection regions; + switch (role) { + case SUPER_ADMIN: + regions = null; + break; + case REGION_MANAGER: + regions = regionCacheHelper.listChildRegionCodeList(regionCode, regionLevel); + break; + case EXPERT_ADMIN: + regions = Collections.singletonList(regionCode); + break; + default: + regions = Collections.emptyList(); + break; + } + return new ViewRegionDTO(regions, regionLevel); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java new file mode 100644 index 0000000..6037bac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java @@ -0,0 +1,251 @@ +package com.hz.pm.api.meeting.helper; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.model.dto.ExpertDictionaryDTO; +import com.hz.pm.api.expert.model.dto.ExpertFullInfoAllDTO; +import com.hz.pm.api.expert.model.dto.ExpertUserFullInfoDTO; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteAvoidRule; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; +import com.hz.pm.api.meeting.entity.dto.MeetingBasicDTO; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingReviewTypeEnum; +import com.hz.pm.api.meeting.entity.req.MeetingListReq; +import com.hz.pm.api.meeting.entity.vo.ExpertBasicInfoVO; +import com.hz.pm.api.meeting.entity.vo.MeetingByManagerVO; +import com.hz.pm.api.meeting.service.IExpertInviteAvoidRuleService; +import com.hz.pm.api.meeting.service.IExpertInviteRuleService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.AllArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.*; + +/** + *

+ * MeetingManageHelper + *

+ * + * @author WendyYang + * @since 17:23 2022/8/23 + */ +@Component +@AllArgsConstructor +public class MeetingManageHelper { + + private final DictionaryCache dictionaryCache; + private final ExpertInfoService expertInfoService; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final IMeetingExpertService meetingExpertService; + private final IExpertInviteRuleService inviteRuleService; + private final IExpertInviteAvoidRuleService inviteAvoidRuleService; + private final RegionCacheHelper regionCacheHelper; + + public void checkReviewProject(MeetingBasicDTO meetingBasic) { + if (meetingBasic.getIsInnerProject()) { + Assert.notEmpty(meetingBasic.getInnerProjects(), "评审项目不能为空"); + } else { + Assert.notEmpty(meetingBasic.getProjects(), "评审项目不能为空"); + } + } + + /** + * 校验会议是否还可继续抽取 + */ + public boolean checkCouldBeInvitedContinue(Long meetingId) { + Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); + List experts = meetingExpertService.listExpertLastByMeetingId(meetingId); + if (experts.isEmpty()) { + return Boolean.TRUE; + } + Map> expertMap = CollUtils.group(experts, MeetingExpert::getRuleId); + for (Map.Entry entry : ruleMap.entrySet()) { + List tmpExperts = expertMap.get(entry.getKey()); + if (CollUtil.isEmpty(tmpExperts)) { + return Boolean.TRUE; + } + int count = 0; + for (MeetingExpert w : tmpExperts) { + boolean status = ExpertAttendStatusEnum.AGREED.eq(w.getStatus()) || + ExpertAttendStatusEnum.NOTICING.eq(w.getStatus()); + if (status) { + count++; + } + } + if (count < entry.getValue().getCount()) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + public MeetingByManagerVO buildByMeeting(Meeting meeting) { + return MeetingByManagerVO.builder() + .meetingId(meeting.getId()) + .meetingType(meeting.getType()) + .meetingTypeName(MeetingReviewTypeEnum.getValue(meeting.getType())) + .meetingName(meeting.getName()) + .startTime(meeting.getStartTime()) + .endTime(meeting.getEndTime()) + .inviteType(meeting.getInviteType()) + .confirmedRoster(meeting.getConfirmedRoster()) + .inviteStatus(meeting.getInviteStatus()) + .status(meeting.getStatus()) + .createOn(meeting.getCreateOn()) + .connecter(meeting.getConnecter()) + .contact(meeting.getContact()) + .build(); + } + + public void buildMeetingQuery(LambdaQueryWrapper query, MeetingListReq req) { + if (StrUtils.isNotBlank(req.getRegionCode())) { + List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); + List regionCodes = CollUtils.fieldList(regions, RegionDTO::getRegionCode); + query.in(Meeting::getRegionCode, regionCodes).ge(Meeting::getRegionLevel, req.getRegionLevel()); + } + if (StrUtil.isNotBlank(req.getName())) { + query.like(Meeting::getName, req.getName()); + } + if (StrUtil.isNotBlank(req.getMeetingType())) { + query.eq(Meeting::getType, req.getMeetingType()); + } + if (req.getStartTime() != null) { + query.ge(Meeting::getStartTime, req.getStartTime()); + } + if (req.getEndTime() != null) { + query.le(Meeting::getEndTime, req.getEndTime()); + } + if (req.getConfirmedRoster() != null) { + query.eq(Meeting::getConfirmedRoster, req.getConfirmedRoster()); + } + if (StrUtils.isNotBlank(req.getProjectName())) { + String projectName = "%" + req.getProjectName() + "%"; + query.and(q1 -> q1.exists("select 1 from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id" + + " where mip.meeting_id = meeting.id and np.project_name like {0}", projectName) + .or(q2 -> q2.exists("select 1 from meeting_outer_project mop where mop.meeting_id = meeting.id" + + " and mop.project_name like {0}", projectName))); + } + } + + /** + * 构建用户基本信息 + * + * @param userIds 用户ID + * @return java.util.Map + * @author WendyYang + **/ + public Map getExpertBasicInfo(List userIds) { + List expertInfos = expertInfoService.listExpertUserFullInfoAll(userIds); + return CollUtils.listToMap(expertInfos, ExpertFullInfoAllDTO::getUserId, w -> { + ExpertBasicInfoVO basicInfoVo = new ExpertBasicInfoVO(); + ExpertUserFullInfoDTO userInfo = w.getExpertUserInfoDTO(); + basicInfoVo.setName(userInfo.getName()); + basicInfoVo.setExpertId(w.getUserId()); + basicInfoVo.setContact(userInfo.getPhoneNo()); + basicInfoVo.setCompany(userInfo.getCompany()); + Optional first = w.getExpertDictionaryList().stream() + .filter(dict -> dict.getExpertInfoField().equals(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())) + .findFirst(); + if (first.isPresent()) { + DictionaryDTO dictInfo = dictionaryCache.getByCode(first.get().getDictionaryCode()); + basicInfoVo.setJobLevel(dictInfo.getName()); + } else { + basicInfoVo.setJobLevel(""); + } + basicInfoVo.setCompanyType(""); + return basicInfoVo; + }); + } + + public AvoidRuleDTO getAvoidInfoDto(Long meetingId) { + ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); + AvoidRuleDTO result = new AvoidRuleDTO(); + result.setAvoidOrgIdList(StrUtil.split(avoidRule.getAvoidOrgIds(), ",")); + result.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); + result.setAvoidUnitIdList(StrUtil.split(avoidRule.getAvoidUnitIds(), ",")); + result.setWeekInviteCount(result.getWeekInviteCount()); + return result; + } + + public void saveAvoidInfo(Long meetingId, List expertIds) { + ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); + avoidRule.setAvoidExpertIds(CollUtils.joinByComma(expertIds)); + inviteAvoidRuleService.saveOrUpdate(avoidRule); + } + + /** + * 校验是否能够进行指定邀请 + * + * @param meetingId 会议ID + * @param expertIds 专家ID + * @param inviteType 邀请类型 + * @return 符合邀请规则的专家 + * @author WendyYang + **/ + public List appointExpertCheck(Long meetingId, Integer inviteType, List expertIds) { + List experts = expertUserFullInfoService.listByUserId(expertIds); + AvoidRuleDTO avoidRule; + if (ExpertInviteTypeEnum.RANDOM.eq(inviteType)) { + avoidRule = getAvoidInfoDto(meetingId); + } else { + avoidRule = null; + } + experts.forEach(expert -> { + if (avoidRule != null) { + if (avoidRule.getAvoidUnitIdList().contains(expert.getCompany())) { + throw BizException.wrap("请移除已回避单位的专家"); + } + if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds()) && avoidRule.getExpertIds().contains(expert.getUserId())) { + throw BizException.wrap("请移除已回避的专家"); + } + } + // 校验专家状态 + ExpertAccountStatusEnum accountStatus = ExpertAccountStatusEnum.of(expert.getExpertAccountStatus()); + if (!accountStatus.equals(ExpertAccountStatusEnum.AVAILABLE)) { + throw BizException.wrap("专家%s不可被抽取", expert.getExpertName()); + } + }); + Map expertMap = CollUtils.listToMap(experts, ExpertUserFullInfo::getUserId); + List meetingExperts = meetingExpertService.listByMeetingId(meetingId); + if (!meetingExperts.isEmpty()) { + Comparator comparator = Comparator.comparing(MeetingExpert::getUpdateOn).reversed(); + Collection values = BizUtils.groupFirst(meetingExperts, MeetingExpert::getExpertId, comparator); + values.forEach(w -> { + ExpertUserFullInfo expertInfo = expertMap.get(w.getExpertId()); + if (expertInfo != null) { + String expertName = expertInfo.getExpertName(); + switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) { + case AGREED: + throw BizException.wrap("专家 %s 已同意参加", expertName); + case NOTICING: + throw BizException.wrap("专家 %s 正在通知中", expertName); + default: + break; + } + } + }); + } + return experts; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java new file mode 100644 index 0000000..8d84122 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.meeting.helper; + +import com.ningdatech.yxt.client.YxtClient; +import com.ningdatech.yxt.constants.YxtSmsSignEnum; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; +import com.ningdatech.yxt.model.cmd.SubmitTaskCallResponse; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; + +import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; +import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.of; + +/** + *

+ * YxtCallOrSmsHelper + *

+ * + * @author WendyYang + * @since 23:59 2022/8/31 + */ +@Component +@AllArgsConstructor +public class YxtCallOrSmsHelper { + + private final YxtClient yxtClient; + + public String submitCallTask(List callContexts) { + SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts)); + return callResponse.getSubmitKey(); + } + + public void sendSms(List smsList) { + yxtClient.submitSmsTask(new SendSmsCmd() {{ + setContextList(smsList); + setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + }}); + } + + public void sendSms(SendSmsContext sms) { + sendSms(Collections.singletonList(sms)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java new file mode 100644 index 0000000..e001ea3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java @@ -0,0 +1,235 @@ +package com.hz.pm.api.meeting.manage; + +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.CountConfirmByMeetingIdDTO; +import com.hz.pm.api.meeting.entity.dto.MeetingAndAttendStatusDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusByDashboard; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.entity.req.MeetingCalenderReq; +import com.hz.pm.api.meeting.entity.req.MeetingListReq; +import com.hz.pm.api.meeting.entity.vo.*; +import com.hz.pm.api.meeting.helper.MeetingManageHelper; +import com.hz.pm.api.meeting.service.IMeetingExpertEvaluationService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * DashboardManage + *

+ * + * @author WendyYang + * @since 23:04 2022/8/24 + */ +@Component +@AllArgsConstructor +public class DashboardManage { + + private final MeetingManage meetingManage; + private final IMeetingService meetingService; + private final IMeetingExpertService meetingExpertService; + private final MeetingManageHelper meetingManageHelper; + private final IMeetingExpertEvaluationService meetingExpertEvaluationService; + private final DictionaryCache dictionaryCache; + + public static final int MEETING_CALENDER_MONTHS = 2; + + public List meetingCalender(MeetingCalenderReq po) { + if (po.getStartDate().plusMonths(MEETING_CALENDER_MONTHS).isBefore(po.getEndDate())) { + throw new BizException("最多可查询两个月数据"); + } + MeetingListReq meetingListPo = new MeetingListReq(); + meetingListPo.setPageSize(500); + meetingListPo.setStartTime(po.getStartDate().atStartOfDay()); + meetingListPo.setEndTime(po.getEndDate().atTime(LocalTime.MAX)); + PageVo meetingPage = meetingManage.meetingListForExpert(meetingListPo); + Map> meetingByDate = meetingPage.getRecords().stream().map(w -> { + List> pairs = new ArrayList<>(); + LocalDateTime tempTime = w.getStartTime(); + while (tempTime.isBefore(w.getEndTime())) { + pairs.add(Pair.of(tempTime.toLocalDate(), w)); + tempTime = tempTime.plusDays(1); + } + return pairs; + }).flatMap(Collection::stream) + .collect(Collectors.groupingBy(Pair::getLeft, + Collectors.collectingAndThen(Collectors.mapping(Pair::getRight, Collectors.toList()), + w -> { + w.sort(Comparator.comparing(MeetingByManagerVO::getStartTime)); + return w; + }))); + LocalDate tempDate = po.getStartDate(); + List result = new ArrayList<>(); + while (!tempDate.isAfter(po.getEndDate())) { + MeetingCalenderItemVO item = new MeetingCalenderItemVO(); + List meetings = meetingByDate.get(tempDate); + item.setHasMeeting(meetings != null); + if (item.getHasMeeting()) { + item.setMeetings(meetings); + } + item.setToday(tempDate); + result.add(item); + tempDate = tempDate.plusDays(1); + } + return result; + } + + public PageVo expertEvaluationToDo(PagePo po) { + PageVo result = PageVo.of(new ArrayList<>(), 0L); + // 查询所有未完成的项目 + LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) + .select(Meeting::getId) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) + .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()); + List meetings = meetingService.list(query); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); + Page page = meetingExpertEvaluationService.pageExpertEvaluationTodo(meetingIds, po); + if (page.getTotal() > 0) { + List expertIds = new ArrayList<>(); + List meetingIdsByPage = new ArrayList<>(); + page.getRecords().forEach(w -> { + meetingIdsByPage.add(w.getMeetingId()); + expertIds.add(w.getExpertId()); + }); + Map meetingMap = CollUtils.listToMap(meetingService.listByIds(meetingIdsByPage), Meeting::getId); + Map basicInfoVoMap = meetingManageHelper.getExpertBasicInfo(expertIds); + page.getRecords().forEach(w -> { + ExpertBasicInfoVO expertInfo = basicInfoVoMap.get(w.getExpertId()); + Meeting meeting = meetingMap.get(w.getMeetingId()); + ExpertEvaluationToDoListItemVO item = BeanUtil.copyProperties(expertInfo, ExpertEvaluationToDoListItemVO.class); + item.setMeetingName(meeting.getName()); + item.setMeetingId(w.getMeetingId()); + item.setExpertMeetingId(w.getId()); + item.setStartTime(meeting.getStartTime()); + item.setEndTime(meeting.getEndTime()); + result.getRecords().add(item); + }); + result.setTotal(page.getTotal()); + } + return result; + } + + public PageVo expertConfirmToDo(PagePo po) { + // 查询所有未完成的项目 + LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) + .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()) + .orderByDesc(Meeting::getStartTime); + List meetings = meetingService.list(query); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); + Map confirmedMap = meetingExpertService.countConfirmedByMeetingIds(meetingIds); + confirmedMap.entrySet().removeIf(w -> { + CountConfirmByMeetingIdDTO confirm = w.getValue(); + return confirm.getConfirmed().equals(confirm.getTotal()); + }); + if (confirmedMap.size() == 0) { + return PageVo.empty(); + } + meetings.removeIf(w -> !confirmedMap.containsKey(w.getId())); + List dataList = meetings.stream() + .skip((long) (po.getPageNumber() - 1) * po.getPageSize()) + .limit(po.getPageSize()).map(w -> { + MeetingConfirmToDoListItemVO item = new MeetingConfirmToDoListItemVO(); + CountConfirmByMeetingIdDTO confirm = confirmedMap.get(w.getId()); + if (confirm == null) { + item.setTotalExpert(0); + item.setConfirmedExpert(0); + } else { + item.setTotalExpert(confirm.getTotal()); + item.setConfirmedExpert(confirm.getConfirmed()); + } + item.setMeetingId(w.getId()); + item.setEndTime(w.getEndTime()); + item.setStartTime(w.getStartTime()); + item.setStatus(w.getStatus()); + item.setType(dictionaryCache.getByCode(w.getType()).getName()); + item.setMeetingName(w.getName()); + return item; + }).collect(Collectors.toList()); + return PageVo.of(dataList, meetings.size()); + } + + public PageVo expertReplaceTodoList(PagePo po) { + // 查询所有未完成的项目 + LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) + .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()) + .orderByDesc(Meeting::getStartTime); + List meetings = meetingService.list(query); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); + Page page = meetingExpertService.pageExpertByStatusAndMeetingIds(po.page(), meetingIds, null); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + Map meetingMap = CollUtils.listToMap(meetings, Meeting::getId); + List expertIds = CollUtils.fieldList(page.getRecords(), MeetingExpert::getExpertId); + Map basicInfoVoMap = meetingManageHelper.getExpertBasicInfo(expertIds); + List dataList = page.getRecords().stream().map(w -> { + ExpertBasicInfoVO basicInfoVo = basicInfoVoMap.get(w.getExpertId()); + ExpertReplaceTodoListItemVO item = BeanUtil.copyProperties(basicInfoVo, ExpertReplaceTodoListItemVO.class); + item.setMeetingId(w.getMeetingId()); + item.setExpertMeetingId(w.getId()); + Meeting meeting = meetingMap.get(w.getMeetingId()); + item.setMeetingName(meeting.getName()); + item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName()); + item.setStatus(w.getStatus()); + item.setStartTime(meeting.getStartTime()); + item.setEndTime(meeting.getEndTime()); + return item; + }).collect(Collectors.toList()); + return PageVo.of(dataList, page.getTotal()); + } + + public MeetingCountSummaryVO meetingCountSummary() { + Map meetingCountSummary = meetingService.meetingCountSummary(LoginUserUtil.getUserId()); + return MeetingCountSummaryVO.builder() + .canceled(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.CANCELED, 0)) + .completed(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.COMPLETED, 0)) + .toBeHeld(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.TO_BE_HELD, 0)) + .held(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.HELD, 0)) + .build(); + } + + public MeetingCountByExpertVO meetingCountByExpert() { + List attendStatusList = meetingExpertService.listByExpertIdAndStatus(LoginUserUtil.getUserId(), null, null); + MeetingCountByExpertVO result = MeetingCountByExpertVO.init(); + attendStatusList.forEach(w -> { + if (w.getAttended() != null && w.getAttended()) { + result.incrAttended(); + } else { + result.incrToBeAttended(); + } + }); + return result; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java new file mode 100644 index 0000000..e067492 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java @@ -0,0 +1,292 @@ +package com.hz.pm.api.meeting.manage; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.lang.UUID; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.model.FreemarkerBatchExportDTO; +import com.hz.pm.api.common.util.FreemarkerWordUtil; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.manage.ExpertReviewManage; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; +import com.hz.pm.api.meeting.entity.domain.MeetingOuterProject; +import com.hz.pm.api.meeting.entity.dto.*; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; +import com.hz.pm.api.meeting.service.IMeetingOuterProjectService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sms.utils.DateUtil; +import freemarker.template.TemplateException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +/** + *

+ * ExpertExportManage + *

+ * + * @author WendyYang + * @since 2023/7/24 + **/ +@Slf4j +@Component +@RequiredArgsConstructor +public class ExpertExportManage { + + private final IMeetingService meetingService; + private final IMeetingExpertService meetingExpertService; + private final IMeetingInnerProjectService meetingInnerProjectService; + private final IMeetingOuterProjectService meetingOuterProjectService; + private final IExpertUserFullInfoService expertUserInfoService; + private final IProjectService projectService; + private final ExpertReviewManage expertReviewManage; + + //================================================================================================================== + + private static final String EXPERT_REVIEW = "meeting/专家评审单.ftl"; + + private static final String EXPERT_FEE = "meeting/专家费.ftl"; + + private static final String LABOR_FEE = "meeting/劳务费发放.ftl"; + + private static final String EXPERT_INVITE = "meeting/专家抽取表.ftl"; + + //================================================================================================================== + static Function meetingUsageTime = (type) -> { + if (1 == type) { + return "半天"; + } + if (2 == type) { + return "一天"; + } + return StrUtil.EMPTY; + }; + + static Supplier wordName = () -> UUID.randomUUID().toString(true) + ".doc"; + + private List listExpertsByAgreeOrLeave(Long meetingId) { + Page page = Page.of(1, 20); + meetingExpertService.pageExpertByStatusAndMeetingId(page, meetingId, null, null); + if (page.getTotal() == 0) { + return Collections.emptyList(); + } + page.getRecords().removeIf(w -> !(ExpertAttendStatusEnum.AGREED.eq(w.getStatus()) || ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus()))); + return page.getRecords(); + } + + //================================================================================================================== + + public void exportFeeForExpert(Long meetingId, HttpServletResponse response) { + try { + Meeting meeting = meetingService.getById(meetingId); + ExpertFeeExportDTO data = new ExpertFeeExportDTO(); + data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); + data.setMeetingAddress(meeting.getMeetingAddress()); + List projectNames = new ArrayList<>(); + if (meeting.getIsInnerProject()) { + List inners = meetingInnerProjectService.listByMeetingId(meetingId); + List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); + List projects = projectService.listByIds(projectIds); + projects.forEach(w -> projectNames.add(w.getProjectName())); + } else { + List inners = meetingOuterProjectService.listByMeetingId(meetingId); + inners.forEach(w -> projectNames.add(w.getProjectName())); + } + data.setProjectName(StrUtil.join("、", projectNames)); + data.setExperts(new ArrayList<>()); + // 设置专家信息 + List experts = meetingExpertService.listAgreedExperts(meetingId); + List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + List expertInfos = expertUserInfoService.listByUserId(expertIds); + Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); + AtomicInteger integer = new AtomicInteger(0); + experts.forEach(w -> { + ExpertInfoDTO expert = new ExpertInfoDTO(); + expert.setNo(integer.incrementAndGet()); + expert.setFee(BigDecimal.valueOf(500)); + expert.setName(w.getExpertName()); + expert.setMobile(w.getMobile()); + ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); + if (expertUser != null) { + expert.setIdcard(expertUser.getIdCard()); + expert.setBankNo(expertUser.getBankNo()); + expert.setBank(expertUser.getBank()); + expert.setCompany(expertUser.getCompany()); + expert.setSex(expertUser.getGender()); + } + data.getExperts().add(expert); + }); + FreemarkerWordUtil.export(wordName.get(), data, response, EXPERT_FEE); + } catch (TemplateException | IOException e) { + log.error("专家费用单导出异常:{}", meetingId, e); + throw BizException.wrap("专家费用单导出失败"); + } + } + + public void expertReviewTable(Long meetingId, HttpServletResponse response) { + try { + Meeting meeting = meetingService.getById(meetingId); + String startTime = DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy年M月d日"); + List fbeList; + if (meeting.getIsInnerProject()) { + List inners = meetingInnerProjectService.listByMeetingId(meetingId); + Map reviewResultMap = expertReviewManage.buildExpertReviewToStr(meetingId); + List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); + List projects = projectService.listByIds(projectIds); + fbeList = projects.stream().map(w -> { + FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO(); + ExpertReviewTableDTO currData = new ExpertReviewTableDTO(); + currData.setHoldOrg(meeting.getHoldOrg()); + currData.setMeetingTime(startTime); + currData.setMeetingAddress(meeting.getMeetingAddress()); + currData.setProjectName(w.getProjectName()); + currData.setReviewResult(reviewResultMap.get(w.getId())); + fbe.setData(currData); + fbe.setTemplate(EXPERT_REVIEW); + fbe.setFileName(w.getProjectName() + ".doc"); + return fbe; + }).collect(Collectors.toList()); + } else { + List inners = meetingOuterProjectService.listByMeetingId(meetingId); + fbeList = inners.stream().map(w -> { + FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO(); + ExpertReviewTableDTO currData = new ExpertReviewTableDTO(); + currData.setHoldOrg(meeting.getHoldOrg()); + currData.setMeetingTime(startTime); + currData.setMeetingAddress(meeting.getMeetingAddress()); + currData.setProjectName(w.getProjectName()); + fbe.setData(currData); + fbe.setTemplate(EXPERT_REVIEW); + fbe.setFileName(w.getProjectName() + ".doc"); + return fbe; + }).collect(Collectors.toList()); + } + String exportFileName = meeting.getName() + "专家评审表.zip"; + FreemarkerWordUtil.exportBatch(response, fbeList, exportFileName); + } catch (TemplateException | IOException e) { + log.error("专家评审单导出异常:{}", meetingId, e); + throw BizException.wrap("专家评审单导出失败"); + } + } + + public void laborFeeAuditTable(Long meetingId, HttpServletResponse response) { + try { + Meeting meeting = meetingService.getById(meetingId); + LaborFeeAuditTableDTO data = new LaborFeeAuditTableDTO(); + data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); + data.setMeetingUsageTime(meetingUsageTime.apply(meeting.getMeetingUsageTime())); + List projectNames = new ArrayList<>(); + if (meeting.getIsInnerProject()) { + List inners = meetingInnerProjectService.listByMeetingId(meetingId); + List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); + List projects = projectService.listByIds(projectIds); + projects.forEach(w -> projectNames.add(w.getProjectName())); + } else { + List inners = meetingOuterProjectService.listByMeetingId(meetingId); + inners.forEach(w -> projectNames.add(w.getProjectName())); + } + data.setProjectName(StrUtil.join("、", projectNames)); + data.setExperts(new ArrayList<>()); + // 设置专家信息 + List experts = listExpertsByAgreeOrLeave(meetingId); + List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + List expertInfos = expertUserInfoService.listByUserId(expertIds); + Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); + experts.forEach(w -> { + ExpertInfoDTO expert = new ExpertInfoDTO(); + if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) { + expert.setName(w.getExpertName() + "(请假)"); + } else { + expert.setName(w.getExpertName()); + } + ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); + if (expertUser != null) { + expert.setCompany(expertUser.getCompany()); + expert.setJob(expertUser.getAdministrativeDuties()); + } else { + expert.setCompany(StrUtil.EMPTY); + expert.setJob(StrUtil.EMPTY); + } + data.getExperts().add(expert); + }); + data.setExpertCount(experts.size()); + FreemarkerWordUtil.export(wordName.get(), data, response, LABOR_FEE); + } catch (TemplateException | IOException e) { + log.error("劳务费发放审批单导出异常:{}", meetingId, e); + throw BizException.wrap("劳务费发放审批单导出失败"); + } + } + + public void expertInviteTable(Long meetingId, HttpServletResponse response) { + try { + Meeting meeting = meetingService.getById(meetingId); + ExpertInviteTableDTO data = new ExpertInviteTableDTO(); + data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); + data.setMeetingUsageTime(meetingUsageTime.apply(meeting.getMeetingUsageTime())); + data.setMeetingCreateBy(meeting.getCreator()); + data.setMeetingAddress(meeting.getMeetingAddress()); + if (meeting.getIsInnerProject()) { + List inners = meetingInnerProjectService.listByMeetingId(meetingId); + Assert.isTrue(inners.size() == 1, "专家抽取表导出失败"); + Project project = projectService.getById(inners.get(0).getProjectId()); + data.setProjectCode(project.getProjectCode()); + data.setProjectName(project.getProjectName()); + data.setBuildOrg(project.getBuildOrgName()); + } else { + List inners = meetingOuterProjectService.listByMeetingId(meetingId); + Assert.isTrue(inners.size() == 1, "专家抽取表导出失败"); + data.setProjectName(inners.get(0).getProjectName()); + data.setProjectCode(StrUtil.EMPTY); + data.setBuildOrg(StrUtil.EMPTY); + } + data.setExperts(new ArrayList<>()); + // 设置专家信息 + List experts = listExpertsByAgreeOrLeave(meetingId); + List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + List expertInfos = expertUserInfoService.listByUserId(expertIds); + Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); + AtomicInteger integer = new AtomicInteger(0); + experts.forEach(w -> { + ExpertInfoDTO expert = new ExpertInfoDTO(); + expert.setNo(integer.incrementAndGet()); + if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) { + expert.setName(w.getExpertName() + "(请假)"); + } else { + expert.setName(w.getExpertName()); + } + expert.setMobile(w.getMobile()); + ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); + if (expertUser != null) { + expert.setCompany(expertUser.getCompany()); + } + data.getExperts().add(expert); + }); + FreemarkerWordUtil.export(wordName.get(), data, response, EXPERT_INVITE); + } catch (Exception e) { + log.error("专家抽取表导出异常:{}", meetingId, e); + throw BizException.wrap("专家抽取表导出失败"); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java new file mode 100644 index 0000000..e8fe346 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java @@ -0,0 +1,586 @@ +package com.hz.pm.api.meeting.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.entity.ExpertAvoidCompany; +import com.hz.pm.api.expert.entity.ExpertGovBusinessStrip; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertAvoidCompanyService; +import com.hz.pm.api.expert.service.IExpertGovBusinessStripService; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meeting.builder.ExpertInviteBuilder; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.*; +import com.hz.pm.api.meeting.entity.enumeration.AvoidTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.helper.ExpertInviteHelper; +import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; +import com.hz.pm.api.meeting.service.IExpertInviteRuleService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.meta.service.IExpertTagService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Predicate; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import static com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum.*; +import static com.hz.pm.api.meeting.helper.ExpertInviteHelper.getExpertInviteRule; +import static com.hz.pm.api.meeting.helper.ExpertRandomInviteAlgorithm.*; + +/** + *

+ * 专家邀请管理 + *

+ * + * @author WendyYang + * @since 18:05 2022/8/8 + */ +@Component +@RequiredArgsConstructor +public class ExpertInviteManage { + + private final IExpertDictionaryService expertDictionaryService; + private final TagCache tagCache; + private final IExpertTagService expertTagService; + private final IExpertIntentionWorkRegionService workRegionService; + private final IExpertInviteRuleService inviteRuleService; + private final IMeetingExpertService meetingExpertService; + private final ExpertInviteHelper expertInviteHelper; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final IMeetingService meetingService; + private final IExpertAvoidCompanyService expertAvoidCompanyService; + private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; + private final IExpertGovBusinessStripService expertGovBusinessStripService; + + @Value("#{randomInviteProperties.recentMeetingCount}") + private Integer recentMeetingCount; + + @Value("#{randomInviteProperties.recentDays}") + private Integer recentDays; + + private static final Predicate> COLL_EMPTY = (coll) -> coll != null && coll.isEmpty(); + + private LambdaQueryWrapper buildBaseExpertQuery() { + return Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .select(ExpertUserFullInfo::getUserId, + ExpertUserFullInfo::getId, + ExpertUserFullInfo::getCompany, + ExpertUserFullInfo::getExpertName, + ExpertUserFullInfo::getCompanyUniqCode, + ExpertUserFullInfo::getPhoneNo) + .eq(ExpertUserFullInfo::getExpertAccountStatus, ExpertAccountStatusEnum.AVAILABLE.getKey()); + } + + private void buildAvoidCompanyAndBusinessStrip(LambdaQueryWrapper query, List units, List strips) { + if (CollUtil.isNotEmpty(units)) { + String unitStr = BizUtils.inSqlJoin(units); + query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" + + " and company_uniq_code in " + unitStr); + } + if (CollUtil.isNotEmpty(strips)) { + String orgStr = BizUtils.inSqlJoin(strips); + query.notExists("select 1 from expert_gov_business_strip egbs where egbs.expert_user_id = nd_expert_user_full_info.user_id" + + " and business_strip_code in " + orgStr); + } + } + + /** + * 获取一周内被抽中并同意参会的专家ID + * + * @param agreeCnt 一周内被抽中并同意参会次数 + * @param sTime 会议开始时间 + * @param days 天数 + * @return java.util.List + * @author WendyYang + **/ + private List listAgreedUserIdByRecentMeetings(int agreeCnt, int days, LocalDateTime sTime) { + if (agreeCnt == 0 || days == 0) { + return Collections.emptyList(); + } + LocalDateTime beginLimit = sTime.minusDays(days); + return meetingExpertService.listAgreeExpertIdByRecentDaysAndAgreeCount(agreeCnt, beginLimit, sTime); + } + + /** + * 增加专家层级限制 + * + * @param query 查询 + * @param rule 随机邀请规则 + */ + private static void addRegionLimit(LambdaQueryWrapper query, RandomInviteRuleDTO rule) { + if (CollUtil.isNotEmpty(rule.getExpertRegionList())) { + String inSqlParam = rule.getExpertRegionList().stream() + .map(w -> "('" + w.getRegionCode() + "'," + w.getRegionLevel() + ")") + .collect(Collectors.joining(",", "(", ")")); + query.apply("(region_code, region_level) in " + inSqlParam); + } + } + + /** + * 获取满足履职意向地的专家ID + * null -> 表示无需过滤 + * + * @param rule 抽取规则 + * @return java.util.List + * @author WendyYang + **/ + private List expertIdsByRegion(RandomInviteRuleDTO rule) { + if (rule.getIntentionRegionCode() == null || rule.getIntentionRegionLevel() == null) { + return null; + } + return workRegionService.userIdsMatchIntentionRegion(rule.getIntentionRegionCode(), rule.getIntentionRegionLevel()); + } + + + /** + * 如果抽取回避单位和专家回避单位一致,同样需要回避该专家 + * + * @param unitCodeList / + * @return / + */ + private List avoidCompanyExpertIds(List unitCodeList) { + if (CollUtil.isEmpty(unitCodeList)) { + return new ArrayList<>(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .select(ExpertAvoidCompany::getUserId) + .in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList); + List expertAvoidCompanyList = expertAvoidCompanyService.list(query); + return CollUtils.fieldList(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); + } + + private MergeExpertIdDTO mergeExpertIdsByCondition(RandomInviteRuleDTO rule, AvoidRuleDTO avoidInfo) { + // 处理履职意向地 + List expertIdsByIntentionRegion = expertIdsByRegion(rule); + if (COLL_EMPTY.evaluate(expertIdsByIntentionRegion)) { + return MergeExpertIdDTO.noExpert(); + } + // 处理专家标签 + List expertIdsByTag = expertIdsByTag(rule); + if (COLL_EMPTY.evaluate(expertIdsByTag)) { + return MergeExpertIdDTO.noExpert(); + } + // 处理专家字典 + List expertIdsByDict = expertIdsByDict(rule); + if (COLL_EMPTY.evaluate(expertIdsByDict)) { + return MergeExpertIdDTO.noExpert(); + } + // 处理专家回避单位 与 抽取回避单位是否相同 + List avoidExpertIdsByUnit = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList()); + + MergeExpertIdDTO merge = new MergeExpertIdDTO(); + // 聚合用户ID + List expertIdsIn = new ArrayList<>(); + if (ObjectUtils.anyNotNull(expertIdsByDict, expertIdsByTag, expertIdsByIntentionRegion)) { + Optional.ofNullable(expertIdsByDict).ifPresent(expertIdsIn::addAll); + Optional.ofNullable(expertIdsByTag).ifPresent(item -> { + if (expertIdsIn.isEmpty()) { + expertIdsIn.addAll(expertIdsByTag); + } else { + expertIdsIn.removeIf(w -> !expertIdsByTag.contains(w)); + } + }); + Optional.ofNullable(expertIdsByIntentionRegion).ifPresent(item -> { + if (expertIdsIn.isEmpty()) { + expertIdsIn.addAll(expertIdsByIntentionRegion); + } else { + expertIdsIn.removeIf(w -> !expertIdsByIntentionRegion.contains(w)); + } + }); + if (expertIdsIn.isEmpty()) { + return MergeExpertIdDTO.noExpert(); + } + merge.setExpertIdsIn(expertIdsIn); + } + if (CollUtil.isNotEmpty(avoidExpertIdsByUnit)) { + if (expertIdsIn.isEmpty()) { + merge.setExpertIdsNotIn(avoidExpertIdsByUnit); + } else { + expertIdsIn.removeIf(avoidExpertIdsByUnit::contains); + if (expertIdsIn.isEmpty()) { + return MergeExpertIdDTO.noExpert(); + } + } + } + merge.setSkip(Boolean.FALSE); + return merge; + } + + /** + * 根据专家标签获取满足的专家ID + * + * @param rule 抽取规则 + * @return java.util.List + * @author WendyYang + **/ + private List expertIdsByTag(RandomInviteRuleDTO rule) { + if (CollectionUtils.isEmpty(rule.getExpertTags())) { + return null; + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertTag.class) + .select(ExpertTag::getUserId, ExpertTag::getExpertInfoField); + rule.getExpertTags().forEach(tag -> { + List codes = tag.getTagCodes().stream() + .map(tagCache::listChildrenCodes) + .flatMap(Collection::stream) + .collect(Collectors.toList()); + query.or(wrapper -> wrapper.eq(ExpertTag::getExpertInfoField, tag.getExpertTag()) + .in(ExpertTag::getTagCode, codes)); + }); + List expertTagList = expertTagService.list(query); + return expertTagList.stream() + .collect(Collectors.groupingBy(ExpertTag::getUserId, Collectors.collectingAndThen(Collectors.toList(), + tags -> CollUtils.fieldList(tags, ExpertTag::getExpertInfoField).size()))) + .entrySet().stream().filter(w -> w.getValue() == rule.getExpertTags().size()) + .map(Map.Entry::getKey).collect(Collectors.toList()); + } + + /** + * 根据专家字典获取满足的专家ID + * null -> 表示无需过虑 + * 空集合 -> 未查到 + * + * @param rule 抽取规则 + * @return java.util.List + * @author WendyYang + **/ + private List expertIdsByDict(RandomInviteRuleDTO rule) { + if (CollectionUtils.isEmpty(rule.getExpertDicts())) { + return null; + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) + .select(ExpertDictionary::getUserId, ExpertDictionary::getExpertInfoField); + for (ExpertDictChooseDTO dict : rule.getExpertDicts()) { + query.or(wrapper -> wrapper.eq(ExpertDictionary::getExpertInfoField, dict.getExpertDict()) + .in(ExpertDictionary::getDictionaryCode, dict.getDictCodes())); + } + List expertDictionaryList = expertDictionaryService.list(query); + return expertDictionaryList.stream() + .collect(Collectors.groupingBy(ExpertDictionary::getUserId, + Collectors.collectingAndThen(Collectors.toList(), + dicts -> CollUtils.fieldList(dicts, ExpertDictionary::getExpertInfoField).size()))) + .entrySet().stream().filter(w -> w.getValue() == rule.getExpertDicts().size()) + .map(Map.Entry::getKey).collect(Collectors.toList()); + } + + + /** + * 专家抽取(随机) + * + * @param avoidRule 回避信息 + * @param randomRule 抽取规则 + * @param invitedExpertIds 指定抽取专家ID + * @param meetingCreateOn 会议创建时间 + * @return 满足抽取条件的专家 + * @author WendyYang + **/ + public ExpertChooseDTO expertInviteByRandomRule(AvoidRuleDTO avoidRule, + RandomInviteRuleDTO randomRule, + List invitedExpertIds, + LocalDateTime sTime, + LocalDateTime eTime, + LocalDateTime meetingCreateOn) { + ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); + MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); + if (merge.getSkip()) { + return result; + } + boolean avoidExpert = CollUtil.isNotEmpty(avoidRule.getExpertIds()); + boolean avoidCompany = CollUtil.isNotEmpty(avoidRule.getAvoidUnitIdList()); + Set avoidCompanyUniqCodes = new HashSet<>(); + if (avoidCompany) { + avoidCompanyUniqCodes.addAll(avoidRule.getAvoidUnitIdList()); + } + if (CollUtil.isNotEmpty(invitedExpertIds)) { + List tmpCompanyUniqCodes = expertUserFullInfoService.listCompanyUniqCodeByUserIds(invitedExpertIds); + avoidCompanyUniqCodes.addAll(tmpCompanyUniqCodes); + } + // 回避信息 + LambdaQueryWrapper query = buildBaseExpertQuery(); + query.notIn(!avoidCompanyUniqCodes.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, avoidCompanyUniqCodes); + // 处理回避单位与回避条线 + buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); + Set expertIdsIn = new HashSet<>(); + Set expertIdsNotIn = new HashSet<>(); + if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { + expertIdsIn.addAll(merge.getExpertIdsIn()); + } else if (CollUtil.isNotEmpty(merge.getExpertIdsNotIn())) { + expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); + } + // 处理回避专家次数 + if (avoidRule.getWeekInviteCount() != null) { + Integer weekInviteCount = avoidRule.getWeekInviteCount(); + List tmpExpertIdsNotIn = listAgreedUserIdByRecentMeetings(weekInviteCount, recentDays, meetingCreateOn); + expertIdsNotIn.addAll(tmpExpertIdsNotIn); + } + // 处理专家层级 + addRegionLimit(query, randomRule); + if (!expertIdsIn.isEmpty()) { + if (avoidExpert) { + expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); + if (expertIdsIn.isEmpty()) { + // 字典、标签、履职意向地 筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的 + return result; + } + } + if (CollUtil.isNotEmpty(invitedExpertIds)) { + expertIdsIn.removeIf(invitedExpertIds::contains); + if (expertIdsIn.isEmpty()) { + return result; + } + } + // 过滤掉已参加会议的专家 + List expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(sTime, eTime); + expertIdsIn.removeIf(expertIdsLockByMeeting::contains); + if (expertIdsIn.isEmpty()) { + return result; + } + } else if (avoidExpert || CollUtil.isNotEmpty(invitedExpertIds)) { + Set tmpExpert = expertInviteHelper.getAvoidExpert(invitedExpertIds, avoidRule, sTime, eTime); + expertIdsNotIn.addAll(tmpExpert); + } else { + Set tmpNotInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime); + expertIdsNotIn.addAll(tmpNotInUserIds); + } + if (!expertIdsIn.isEmpty()) { + query.in(ExpertUserFullInfo::getUserId, expertIdsIn); + } else if (!expertIdsNotIn.isEmpty()) { + query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); + } + List userInfoList = expertUserFullInfoService.list(query); + if (userInfoList.isEmpty()) { + return result; + } + AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType()); + switch (avoidType) { + case NONE: + result.setExperts(inviteWithoutCompany(userInfoList, expertsByRecentMeeting(), randomRule.getCount())); + result.setTotal(userInfoList.size()); + break; + case CURR_UNIT: + Map> unitGroup = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode); + result.setExperts(inviteGroupByUnit(unitGroup, expertsByRecentMeeting(), randomRule.getCount())); + result.setTotal(unitGroup.size()); + break; + case CURR_STRIP: + List userIds = CollUtils.fieldList(userInfoList, ExpertUserFullInfo::getUserId); + List expertStrips = expertGovBusinessStripService.listByUserIds(userIds); + if (!expertStrips.isEmpty()) { + Map> stripGroup = CollUtils.group(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode); + result.setExperts(inviteGroupByStrip(stripGroup, userInfoList, expertsByRecentMeeting(), randomRule.getCount())); + result.setTotal(stripGroup.size()); + } else { + result.setTotal(0); + } + break; + } + return result; + } + + /** + * 专家替换、补充 + * + * @param avoidRule 回避信息 + * @param randomRule 随机抽取 + * @param invitedExperts 已抽取人员 + * @param count 抽取数量 + * @param msTime 会议开始时间 + * @param meTime 会议结束时间 + * @param reInvite 邀请已拒绝 + * @return {@link ExpertChooseDTO} + * @author WendyYang + **/ + public ExpertChooseDTO expertReplaceByRandomRule(AvoidRuleDTO avoidRule, + RandomInviteRuleDTO randomRule, + Collection invitedExperts, + Integer count, + LocalDateTime msTime, + LocalDateTime meTime, + LocalDateTime tsTime, + boolean reInvite) { + ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); + // 合并标签、字典 + MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); + if (merge.getSkip()) { + return result; + } + Set expertIdsIn = new HashSet<>(); + Set expertIdsNotIn = new HashSet<>(); + if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { + expertIdsIn.addAll(merge.getExpertIdsIn()); + } else if (CollUtil.isNotEmpty(merge.getExpertIdsNotIn())) { + expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); + } + LambdaQueryWrapper query = buildBaseExpertQuery(); + // 设置回避单位 + Set notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList()); + // 处理回避单位与回避条线 + buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); + // 处理回避专家次数 + if (avoidRule.getWeekInviteCount() != null) { + Integer weekInviteCount = avoidRule.getWeekInviteCount(); + List tmpExpertIdsNotIn = listAgreedUserIdByRecentMeetings(weekInviteCount, recentDays, msTime); + expertIdsNotIn.addAll(tmpExpertIdsNotIn); + } + // 处理专家层级 + addRegionLimit(query, randomRule); + + if (expertIdsIn.size() > 0) { + if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) { + expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); + if (expertIdsIn.isEmpty()) { + // 字典、标签、履职意向地筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的 + return result; + } + } + List lockExpertIds = expertInviteHelper.listInvitedExpertByTime(msTime, meTime); + expertIdsIn.removeIf(lockExpertIds::contains); + if (expertIdsIn.isEmpty()) { + return result; + } + } else if (CollUtil.isNotEmpty(avoidRule.getExpertIds())) { + Set notInExpertIds = expertInviteHelper.getAvoidExpert(avoidRule.getExpertIds(), null, msTime, meTime); + expertIdsNotIn.addAll(notInExpertIds); + } else { + Set notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(msTime, meTime); + expertIdsNotIn.addAll(notInUserIds); + } + Map> expertGroupByStatus = invitedExperts.stream() + .collect(Collectors.groupingBy(w -> ExpertAttendStatusEnum.getByCode(w.getStatus()))); + // 回避同单位其他专家 + List agreeOrNoticing = new ArrayList<>(); + BizUtils.notEmpty(expertGroupByStatus.get(AGREED), agreeOrNoticing::addAll); + BizUtils.notEmpty(expertGroupByStatus.get(NOTICING), agreeOrNoticing::addAll); + List agreeOrNoticingExpertIds = CollUtils.fieldList(agreeOrNoticing, MeetingExpert::getExpertId); + if (agreeOrNoticingExpertIds.size() > 0) { + expertIdsNotIn.addAll(agreeOrNoticingExpertIds); + List agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds); + List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); + notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); + } + // 已请假的专家不再抽取 + List expertsOnLeave = expertGroupByStatus.get(ON_LEAVE); + if (CollUtil.isNotEmpty(expertsOnLeave)) { + expertIdsNotIn.addAll(CollUtils.fieldList(expertsOnLeave, MeetingExpert::getExpertId)); + } + // 处理已拒绝专家与重复抽取 + BizUtils.notEmpty(expertGroupByStatus.get(REFUSED), refuseExperts -> { + List tmpExpertIdsNotIn; + if (reInvite) { + tmpExpertIdsNotIn = refuseExperts.stream() + .filter(w -> w.getCreateOn().isAfter(tsTime)) + .map(MeetingExpert::getExpertId) + .collect(Collectors.toList()); + } else { + tmpExpertIdsNotIn = CollUtils.fieldList(refuseExperts, MeetingExpert::getExpertId); + } + expertIdsNotIn.addAll(tmpExpertIdsNotIn); + }); + + boolean hasExpertIdIn = !expertIdsIn.isEmpty(); + boolean hasExpertIdNotIn = !expertIdsNotIn.isEmpty(); + if (hasExpertIdIn && hasExpertIdNotIn) { + expertIdsIn.removeAll(expertIdsNotIn); + if (expertIdsIn.isEmpty()) { + return result; + } + query.in(ExpertUserFullInfo::getUserId, expertIdsIn); + } else if (hasExpertIdIn) { + query.in(ExpertUserFullInfo::getUserId, expertIdsIn); + } else if (hasExpertIdNotIn) { + query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); + } + query.notIn(notInCompanyUniqCodeList.size() > 0, ExpertUserFullInfo::getCompanyUniqCode, notInCompanyUniqCodeList); + List userFullInfos = expertUserFullInfoService.list(query); + if (userFullInfos.size() == 0) { + return result; + } + Map> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode); + result.setTotal(userGroupByUnit.size()); + result.setExperts(inviteGroupByUnit(userGroupByUnit, expertsByRecentMeeting(), count)); + return result; + } + + private List> expertsByRecentMeeting() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) + .select(Meeting::getId) + .eq(Meeting::getInviteStatus, Boolean.TRUE) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) + .orderByDesc(Meeting::getCreateOn) + .last("limit " + recentMeetingCount); + List meetingIds = CollUtils.fieldList(meetingService.list(query), Meeting::getId); + if (meetingIds.isEmpty()) { + return Collections.emptyList(); + } + Map> groupByMeetingId = meetingExpertService.listByMeetingIds(meetingIds) + .stream().collect(Collectors.groupingBy(MeetingExpert::getMeetingId)); + return groupByMeetingId.entrySet().stream() + .sorted(Map.Entry.comparingByKey(Comparator.reverseOrder())) + .map(Map.Entry::getValue) + .collect(Collectors.toList()); + } + + /** + * 专家抽取(会议创建时抽取) + * + * @param randomRules 随机抽取规则 + * @param avoidRule 回避信息 + * @param meeting 会议信息 + * @author WendyYang + **/ + public void expertInviteByMeetingCreate(Meeting meeting, + List randomRules, + AvoidRuleDTO avoidRule) { + List expertInserts = new ArrayList<>(); + // 处理随机抽取规则 + if (CollUtil.isNotEmpty(randomRules)) { + List randoms = new ArrayList<>(); + List expertsByRandom = new ArrayList<>(); + List chooseExpertIds = new ArrayList<>(); + LocalDateTime sTime = meeting.getStartTime(); + LocalDateTime eTime = meeting.getEndTime(); + LocalDateTime createOn = meeting.getCreateOn(); + randomRules.forEach(rule -> { + ExpertChooseDTO tmpExperts = expertInviteByRandomRule(avoidRule, rule, chooseExpertIds, sTime, eTime, createOn); + if (tmpExperts.getTotal() < rule.getCount()) { + throw BizException.wrap("可抽取专家数量不足"); + } + expertsByRandom.add(tmpExperts); + chooseExpertIds.addAll(CollUtils.fieldList(tmpExperts.getExperts(), ExpertUserFullInfo::getUserId)); + randoms.add(getExpertInviteRule(rule, meeting.getId())); + }); + inviteRuleService.saveBatch(randoms); + for (int i = 0; i < expertsByRandom.size(); i++) { + Long ruleId = randoms.get(i).getId(); + expertsByRandom.get(i).getExperts().forEach(w -> { + MeetingExpert expert = ExpertInviteBuilder.getExpertByRandom(meeting.getId(), w, ruleId); + expert.setStatus(NOTICING.getCode()); + expertInserts.add(expert); + }); + } + meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertInserts); + } + meetingExpertService.saveBatch(expertInserts); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertJudgeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertJudgeManage.java new file mode 100644 index 0000000..b92bfb8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertJudgeManage.java @@ -0,0 +1,94 @@ +package com.hz.pm.api.meeting.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.ValidUtil; +import com.ningdatech.cache.lock.DistributedLock; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertJudgeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.entity.req.MeetingExpertJudgeReq; +import com.hz.pm.api.meeting.entity.req.MeetingExpertJudgeReq.Attend; +import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + *

+ * MeetingExpertJudgeManage + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Component +@AllArgsConstructor +public class MeetingExpertJudgeManage { + + private final IMeetingExpertJudgeService expertJudgeService; + private final IMeetingExpertService meetingExpertService; + private final IMeetingService meetingService; + private final DistributedLock distributedLock; + + private MeetingExpertJudge getMeetingExpertJudge(Long meetingExpertId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) + .eq(MeetingExpertJudge::getMeetingExpertId, meetingExpertId); + return expertJudgeService.getOne(query); + } + + public void saveExpertJudge(MeetingExpertJudgeReq req) { + String key = "lock_expert_judge:" + req.getMeetingExpertId(); + if (!distributedLock.lock(key, 3)) { + throw BizException.wrap("履职评价失败,请重试"); + } + try { + if (!ExpertJudgeEnum.AttendStatus.ABSENT.eq(req.getAttended())) { + Map validMap = ValidUtil.valid(req, Attend.class); + if (!validMap.isEmpty()) { + String errMsg = CollUtils.joinByComma(validMap.values()); + throw BizException.wrap(errMsg); + } + } + // 会议状态校验 + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (meeting == null || MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议不存在或已取消"); + } + // 专家抽取状态校验 + MeetingExpert expert = meetingExpertService.getById(req.getMeetingExpertId()); + if (expert == null || (ExpertAttendStatusEnum.AGREED.eq(expert.getStatus()) + && ExpertAttendStatusEnum.ON_LEAVE.eq(expert.getStatus()))) { + throw BizException.wrap("未被抽中专家无法进行履职评价"); + } + // 智能履职评价一次 + MeetingExpertJudge judge = getMeetingExpertJudge(req.getMeetingExpertId()); + if (judge != null) { + throw BizException.wrap("履职评价已提交"); + } + MeetingExpertJudge entity = BeanUtil.copyProperties(req, MeetingExpertJudge.class); + entity.setExpertId(expert.getExpertId()); + expertJudgeService.save(entity); + } finally { + distributedLock.releaseLock(key); + } + } + + public MeetingExpertJudgeReq expertJudgeDetail(Long meetingExpertId) { + MeetingExpertJudge judge = getMeetingExpertJudge(meetingExpertId); + if (judge == null) { + throw BizException.wrap("履职评价未提交"); + } + return BeanUtil.copyProperties(judge, MeetingExpertJudgeReq.class); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertManage.java new file mode 100644 index 0000000..c18c104 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingExpertManage.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meeting.manage; + +import com.hz.pm.api.meeting.helper.MeetingManageHelper; +import com.hz.pm.api.meeting.service.IMeetingExpertEvaluationService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * MeetingExpertManage + *

+ * + * @author WendyYang + * @since 10:04 2022/8/24 + */ +@Component +@AllArgsConstructor +public class MeetingExpertManage { + + private final IMeetingExpertService meetingExpertService; + private final IMeetingExpertEvaluationService meetingExpertEvaluationService; + private final MeetingManageHelper meetingManageHelper; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java new file mode 100644 index 0000000..fce95b3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -0,0 +1,937 @@ +package com.hz.pm.api.meeting.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.basic.util.ValidUtil; +import com.ningdatech.cache.lock.DistributedLock; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.entity.ViewRegionDTO; +import com.hz.pm.api.expert.constant.ReviewResultEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.hz.pm.api.expert.service.IExpertReviewService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.gov.service.IBelongOrgService; +import com.hz.pm.api.meeting.builder.ExpertInviteBuilder; +import com.hz.pm.api.meeting.entity.domain.*; +import com.hz.pm.api.meeting.entity.dto.*; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingReviewTypeEnum; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; +import com.hz.pm.api.meeting.entity.req.*; +import com.hz.pm.api.meeting.entity.vo.*; +import com.hz.pm.api.meeting.helper.ExpertInviteHelper; +import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; +import com.hz.pm.api.meeting.helper.MeetingDataScopeHelper; +import com.hz.pm.api.meeting.helper.MeetingManageHelper; +import com.hz.pm.api.meeting.service.*; +import com.hz.pm.api.meeting.task.ExpertRandomInviteTask; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +import static com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum.*; +import static com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum.APPOINT; +import static com.hz.pm.api.meeting.helper.ExpertInviteHelper.getExpertInviteRule; + +/** + *

+ * MeetingManage + *

+ * + * @author WendyYang + * @since 13:35 2022/7/26 + */ +@Component +@RequiredArgsConstructor +public class MeetingManage { + + private final RegionCacheHelper regionCache; + private final IMeetingService meetingService; + private final IExpertInviteAvoidRuleService inviteAvoidRuleService; + private final IExpertInviteRuleService inviteRuleService; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final TagCache tagCache; + private final DictionaryCache dictionaryCache; + private final IMeetingExpertService meetingExpertService; + private final ExpertInviteManage expertInviteManage; + private final ExpertRandomInviteTask expertRandomInviteTask; + private final MeetingManageHelper meetingManageHelper; + private final DistributedLock distributedLock; + private final IProjectService projectService; + private final IMeetingInnerProjectService meetingInnerProjectService; + private final IMeetingOuterProjectService meetingOuterProjectService; + private final IBelongOrgService belongOrgService; + private final IDingOrganizationService dingOrganizationService; + private final IExpertReviewService expertReviewService; + private final ExpertInviteHelper expertInviteHelper; + private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; + private final MeetingDataScopeHelper meetingDataScopeHelper; + private final IMeetingExpertJudgeService expertJudgeService; + private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; + + private static final String MEETING_CREATE_KEY = "MEETING_CREATE:"; + + private String getDictName(String dictType) { + return Optional.ofNullable(dictionaryCache.getByCode(dictType)) + .flatMap(w -> Optional.of(w.getName())) + .orElse(StrPool.EMPTY); + } + + /** + * 锁定时间10 * 60秒 + */ + public static final int RETRY_TIMES = 3; + + @Transactional(rollbackFor = Exception.class) + public IdVo meetingCreateAndInviteExpert(MeetingCreateReq req) { + MeetingBasicDTO meetingBasic = req.getMeetingBasicInfo(); + meetingManageHelper.checkReviewProject(meetingBasic); + String md5ByParam = SecureUtil.md5(meetingBasic.toString()); + String key = MEETING_CREATE_KEY + md5ByParam; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("会议正在创建中"); + } + try { + ExpertInviteReq inviteRule = req.getExpertInviteRule(); + // 保存会议基本信息 + Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class); + meeting.setStatus(MeetingStatusEnum.NORMAL.getCode()); + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + meeting.setHoldOrg(userDetail.getOrganizationName()); + meeting.setHoldOrgCode(userDetail.getOrganizationCode()); + meeting.setRegionCode(userDetail.getRegionCode()); + meeting.setRegionLevel(userDetail.getRegionLevel()); + meeting.setCreator(userDetail.getUsername()); + meeting.setInviteStatus(Boolean.FALSE); + meeting.setConfirmedRoster(Boolean.FALSE); + meeting.setInviteType(inviteRule.getInviteType()); + meetingService.save(meeting); + if (meetingBasic.getIsInnerProject()) { + List projects = meetingBasic.getInnerProjects().stream().map(w -> { + MeetingInnerProject project = BeanUtil.copyProperties(w, MeetingInnerProject.class); + project.setMeetingId(meeting.getId()); + return project; + }).collect(Collectors.toList()); + meetingInnerProjectService.saveBatch(projects); + } else { + List projects = meetingBasic.getProjects().stream().map(w -> { + MeetingOuterProject project = BeanUtil.copyProperties(w, MeetingOuterProject.class); + project.setMeetingId(meeting.getId()); + return project; + }).collect(Collectors.toList()); + meetingOuterProjectService.saveBatch(projects); + } + // 抽取专家 + req.getExpertInviteRule().setMeetingId(meeting.getId()); + expertInviteByCreate(inviteRule); + return IdVo.of(meeting.getId()); + } finally { + distributedLock.releaseLock(key); + } + } + + @Transactional(rollbackFor = Exception.class) + public void continueInvite(Long meetingId) { + String key = "CONTINUE_INVITE:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("已进行续抽,请勿重复点击"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (!meeting.getInviteStatus()) { + throw BizException.wrap("该会议正在抽取专家,暂无法续抽"); + } + if (meeting.getStartTime().isBefore(LocalDateTime.now())) { + throw BizException.wrap("会议已开始,不允许续抽"); + } + if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { + throw BizException.wrap("续抽失败,请刷新后重试"); + } + boolean invitedContinue = meetingManageHelper.checkCouldBeInvitedContinue(meetingId); + if (!invitedContinue) { + throw BizException.wrap("抽取人员数量已满足抽取规则"); + } + expertRandomInviteTask.notifyInviteTask(meetingId); + } finally { + distributedLock.releaseLock(key); + } + } + + @Transactional(rollbackFor = Exception.class) + public void convertToAppoint(Long meetingId) { + String key = "CONVERT_TO_APPOINT:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("已进行转换,请勿重复点击"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { + throw BizException.wrap("转换失败,请刷新后重试"); + } + expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); + LambdaUpdateWrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getInviteType, APPOINT.getCode()) + .eq(Meeting::getId, meetingId); + meetingService.update(meetingUpdate); + saveAppointRuleByConvertFromRandomRule(meetingId); + } finally { + distributedLock.releaseLock(key); + } + } + + private void saveAppointRuleByConvertFromRandomRule(Long meetingId) { + AppointInviteRuleDTO rule = new AppointInviteRuleDTO(); + rule.setInviteDesc("转为指定抽取"); + rule.setExpertIdList(Collections.emptyList()); + rule.setInviteType(APPOINT.getCode()); + rule.setCount(0); + ExpertInviteRule inviteRule = new ExpertInviteRule(); + inviteRule.setMeetingId(meetingId); + inviteRule.setInviteType(rule.getInviteType()); + inviteRule.setInviteCount(0); + inviteRule.setInviteRule(JSONUtil.toJsonStr(rule)); + inviteRuleService.save(inviteRule); + } + + @Transactional(rollbackFor = Exception.class) + public void expertInviteByCreate(ExpertInviteReq req) { + String key = INVITED_RULE_CREATE + req.getMeetingId(); + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("不可重复进行专家抽取"); + } + try { + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (ExpertInviteTypeEnum.RANDOM.eq(req.getInviteType())) { + List randomRules = req.getRandomRules(); + Assert.notEmpty(randomRules, "随机抽取规则不能为空"); + AvoidRuleDTO avoidInfo = req.getAvoidRule(); + Assert.notNull(avoidInfo, "回避信息不能为空"); + // 随机抽取的话则需进行抽取数量校验 + LocalDateTime now = LocalDateTime.now(); + expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); + expertRandomInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now); + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getInviteStatus, false) + .eq(Meeting::getId, meeting.getId()); + meetingService.update(mUpdate); + // 回避规则 + ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule(); + avoidRule.setMeetingId(meeting.getId()); + // 未传值时设置为0 表示不限制周参与次数 + avoidRule.setWeekInviteCount(ObjectUtil.defaultIfNull(avoidInfo.getWeekInviteCount(), 0)); + avoidRule.setAvoidOrgIds(CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList())); + avoidRule.setAvoidUnitIds(CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList())); + avoidRule.setAvoidExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds())); + avoidRule.setAvoidType(avoidInfo.getAvoidType()); + inviteAvoidRuleService.save(avoidRule); + } else { + // 指定邀请 + AppointInviteRuleDTO appointRule = req.getAppointRule(); + Assert.notNull(appointRule, "指定邀请规则不能为空"); + Map usersMap = expertInviteHelper.checkAppointExpert(appointRule); + // 处理指定抽取规则 + ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId()); + inviteRuleService.save(appoint); + Long ruleId = appoint.getId(); + List experts = appointRule.getExpertIdList().stream().map(w -> { + ExpertUserFullInfo info = usersMap.get(w); + MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId); + expert.setStatus(NOTICING.getCode()); + return expert; + }).collect(Collectors.toList()); + meetingExpertService.saveBatch(experts); + } + } finally { + distributedLock.releaseLock(key); + } + } + + /** + * 抽取数量校验 + * + * @param req 抽取参数 + * @return {@link ExpertCountOnChangeVO} + * @author WendyYang + **/ + public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteReq req) { + // 未传递指定邀请专家直接忽略 + expertInviteHelper.checkAppointExpert(req.getAppointRule()); + Meeting meeting = meetingService.getById(req.getMeetingId()); + ExpertCountOnChangeVO resultCount = new ExpertCountOnChangeVO(); + resultCount.setStatus(true); + resultCount.setCountList(new ArrayList<>()); + // 参数校验 + String errMsg = ValidUtil.validFast(req, AbstractInviteRule.CountCheck.class); + if (errMsg != null) { + resultCount.setStatus(false); + resultCount.setMessage(errMsg); + return resultCount; + } + List expertIdsChoose = new ArrayList<>(); + for (int i = 0; i < req.getRandomRules().size(); i++) { + RandomInviteRuleDTO randomRule = req.getRandomRules().get(i); + ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(), + randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime(), meeting.getCreateOn()); + if (i < req.getRandomRules().size() - 1 && chooseExpert.getTotal() > 0) { + List tempUserIds = CollUtils.fieldList(chooseExpert.getExperts(), ExpertUserFullInfo::getUserId); + expertIdsChoose.addAll(tempUserIds); + } + resultCount.addCountList(chooseExpert.getTotal()); + } + return resultCount; + } + + /** + * 专家会议列表 + * + * @param req 查询参数 + * @return 会议列表 + * @author WendyYang + **/ + public PageVo meetingListForExpert(MeetingListReq req) { + Long expertId = req.getExpertId() != null ? req.getExpertId() : LoginUserUtil.getUserId(); + List meetings = meetingExpertService.listByExpertIdAndStatus(expertId, null, null); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + Map mapByMeetingId = new HashMap<>(16); + List meetingExpertIds = new ArrayList<>(); + meetings.forEach(w -> { + mapByMeetingId.put(w.getMeetingId(), w); + meetingExpertIds.add(w.getMeetingExpertId()); + }); + LambdaQueryWrapper query = new LambdaQueryWrapper() + .orderByDesc(Meeting::getCreateOn) + .in(Meeting::getId, mapByMeetingId.keySet()) + .eq(Meeting::getConfirmedRoster, Boolean.TRUE) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()); + if (req.getExpertId() == null) { + meetingManageHelper.buildMeetingQuery(query, req); + } + Page page = meetingService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List existsMeIds = expertJudgeService.listExistsMeetingExpertIds(meetingExpertIds); + PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); + page.getRecords().forEach(meeting -> { + MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); + MeetingAndAttendStatusDTO info = mapByMeetingId.get(meeting.getId()); + item.setMeetingExpertId(info.getMeetingExpertId()); + item.setExpertStatus(info.getStatus()); + item.setHasJudge(existsMeIds.contains(info.getMeetingExpertId())); + result.getRecords().add(item); + }); + return result; + } + + public PageVo meetingListForLeave(MeetingLeaveListReq req) { + Long expertId = ObjectUtil.defaultIfNull(req.getExpertId(), LoginUserUtil.getUserId()); + LambdaQueryWrapper meQuery = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getExpertId, expertId) + .in(MeetingExpert::getStatus, AGREED.getCode(), ON_LEAVE.getCode()); + List meetings = meetingExpertService.list(meQuery); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + Map meetingMap = new HashMap<>(16); + meetings.forEach(w -> meetingMap.put(w.getMeetingId(), w)); + LambdaQueryWrapper query = new LambdaQueryWrapper() + .orderByAsc(Meeting::getStartTime) + .in(Meeting::getId, meetingMap.keySet()) + .eq(Meeting::getConfirmedRoster, Boolean.TRUE) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()); + Page page = meetingService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); + page.getRecords().forEach(meeting -> { + MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); + MeetingExpert info = meetingMap.get(meeting.getId()); + item.setExpertStatus(info.getStatus()); + result.getRecords().add(item); + }); + return result; + } + + + /** + * 管理员会议列表 + * + * @param req 查询参数 + * @return 会议列表 + * @author WendyYang + */ + public PageVo meetingListForManager(MeetingListReq req) { + ViewRegionDTO viewRegions = meetingDataScopeHelper.meetingListViewRegions(); + Collection regions; + if ((regions = viewRegions.getRegions()) != null && regions.isEmpty()) { + return PageVo.empty(); + } + LambdaQueryWrapper query = new LambdaQueryWrapper() + .orderByDesc(Meeting::getCreateOn); + // 补充逻辑 如果拥有超级管理员权限可以看到所有事务 + if (regions != null) { + query.in(Meeting::getRegionCode, regions); + query.ge(Meeting::getRegionLevel, viewRegions.getRegionLevel()); + } + query.eq(req.getStatus() != null, Meeting::getStatus, req.getStatus()); + meetingManageHelper.buildMeetingQuery(query, req); + Page page = meetingService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); + page.getRecords().forEach(meeting -> { + MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); + result.getRecords().add(item); + }); + return result; + } + + public MeetingDetailBasicVO getMeetingDetail(Long meetingId) { + Meeting meeting = meetingService.getById(meetingId); + Assert.notNull(meeting, "会议不存在"); + MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() + .meetingId(meeting.getId()) + .regionCode(meeting.getRegionCode()) + .meetingName(meeting.getName()) + .meetingType(meeting.getType()) + .meetingAddress(meeting.getMeetingAddress()) + .typeName(getDictName(meeting.getType())) + .startTime(meeting.getStartTime()) + .endTime(meeting.getEndTime()) + .judgesAttendanceTime(meeting.getJudgesAttendanceTime()) + .meetingUsageTime(meeting.getMeetingUsageTime()) + .contact(meeting.getContact()) + .connecter(meeting.getConnecter()) + .status(meeting.getStatus()) + .holdOrg(meeting.getHoldOrg()) + .createOn(meeting.getCreateOn()) + .creator(meeting.getCreator()) + .createBy(meeting.getCreator()) + .inviteType(meeting.getInviteType()) + .confirmedRoster(meeting.getConfirmedRoster()) + .invitedStopped(meeting.getInviteStatus()) + .build(); + if (meeting.getIsInnerProject()) { + List innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); + List projects = projectService.listByIds(CollUtils.fieldList(innerProjects, MeetingInnerProject::getProjectId)); + Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); + List convert = CollUtils.convert(projects, w -> { + MeetingReviewProjectDTO mrp = new MeetingReviewProjectDTO(); + mrp.setProjectId(w.getId()); + mrp.setBuildOrg(w.getBuildOrgName()); + mrp.setProjectName(w.getProjectName()); + mrp.setProjectType(w.getProjectType().toString()); + mrp.setProjectYear(w.getProjectYear()); + mrp.setDeclareAmount(w.getDeclareAmount()); + mrp.setProjectCode(w.getProjectCode()); + ExpertReview review = reviewMap.get(w.getId()); + if (review != null) { + mrp.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); + } + return mrp; + }); + detail.setProjects(convert); + } else { + List outerProjects = meetingOuterProjectService.listByMeetingId(meetingId); + detail.setProjects(BeanUtil.copyToList(outerProjects, MeetingReviewProjectDTO.class)); + } + detail.setInviteRule(inviteRuleDetail(meetingId)); + return detail; + } + + public ExpertInviteDetailVO inviteExpertList(Long meetingId) { + Meeting meeting = meetingService.getById(meetingId); + if (meeting == null) { + throw BizException.wrap("该会议信息不存在"); + } + ExpertInviteDetailVO result = new ExpertInviteDetailVO(); + result.setInvitedStopped(meeting.getInviteStatus()); + result.setConfirmedRoster(meeting.getConfirmedRoster()); + List experts = meetingExpertService.listByMeetingId(meetingId); + if (experts.isEmpty()) { + return result; + } + List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); + Map expertMap = meetingManageHelper.getExpertBasicInfo(expertIds); + BiFunction, InviteExpertListItemVO> mapping = (me, ruleMap) -> { + ExpertBasicInfoVO expert = expertMap.get(me.getExpertId()); + InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class); + item.setExpertMeetingId(me.getId()); + item.setMeetingId(me.getMeetingId()); + item.setStatus(me.getStatus()); + item.setMobile(me.getMobile()); + item.setNoticeTime(me.getCreateOn()); + item.setRuleId(me.getRuleId()); + item.setIsHeadman(me.getIsHeadman()); + ExpertInviteRule rule = ruleMap.get(me.getRuleId()); + item.setInviteType(rule == null ? APPOINT.getCode() : rule.getInviteType()); + if (NOTICING.eq(me.getStatus())) { + item.setNoticeStatus("通知中"); + } else { + item.setNoticeStatus("已通知"); + } + return item; + }; + List inviteRules = inviteRuleService.listByMeetingId(meetingId); + Map ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId); + boolean isRandom = ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType()); + if (isRandom) { + result.setInviteStatistics(new ArrayList<>()); + Map> groupByRule = CollUtils.group(experts, MeetingExpert::getRuleId); + ruleMap.forEach((k, v) -> { + InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(k); + statistics.setInviteCnt(v.getInviteCount()); + List expertList = groupByRule.get(k); + if (expertList != null) { + expertList.forEach((expert) -> { + if (AGREED.eq(expert.getStatus())) { + statistics.incrAgreeCnt(); + } + statistics.incrNoticedCnt(); + }); + } + result.getInviteStatistics().add(statistics); + }); + } + List converts = CollUtils.convert(experts, me -> mapping.apply(me, ruleMap)); + result.setInviteExpertList(converts); + // 确定参加列表 + return result; + } + + /** + * 会议基本信息修改 + * + * @param po 修改参数 + **/ + public void meetingBasicInfoModify(MeetingBasicInfoModifyReq po) { + Meeting meeting = new Meeting(); + BeanUtil.copyProperties(po, meeting); + LocalDateTime now = LocalDateTime.now(); + Meeting old = meetingService.getById(po.getId()); + List meList = meetingExpertService.listAgreedExperts(Collections.singletonList(po.getId())); + if (!meList.isEmpty() && old.getStartTime().isAfter(now)) { + // TODO + /*String meetingType = dictionaryCache.getByCode(old.getType()).getName(); + List contexts = YxtSmsContextBuilder.smsToExpertByMeetingChange(old, meeting, meList, meetingType); + yxtCallOrSmsHelper.sendSms(contexts);*/ + } + meetingService.updateById(meeting); + } + + /** + * 抽取规则详情 + * + * @param meetingId 会议ID + * @return {@link InviteRuleDetailVO} + * @author WendyYang + **/ + public InviteRuleDetailVO inviteRuleDetail(Long meetingId) { + InviteRuleDetailVO result = new InviteRuleDetailVO(); + List inviteRules = inviteRuleService.listByMeetingId(meetingId); + result.setRandomRules(new ArrayList<>()); + Map> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType())); + List randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM); + if (CollUtil.isNotEmpty(randoms)) { + randoms.forEach(random -> { + RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class); + randomRule.setId(random.getId()); + if (randomRule.getExpertTags() != null) { + randomRule.getExpertTags().forEach(w -> { + List tagNames = CollUtils.convert(w.getTagCodes(), tagCode -> tagCache.getByTagCode(tagCode).getTagName()); + w.setTagCodes(tagNames); + }); + } + if (randomRule.getExpertDicts() != null) { + randomRule.getExpertDicts().forEach(w -> { + List dictNames = CollUtils.convert(w.getDictCodes(), dictCode -> dictionaryCache.getByCode(dictCode).getName()); + w.setDictCodes(dictNames); + }); + } + if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) { + List intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel()); + randomRule.setIntentionRegions(intentionRegions); + } + if (CollUtil.isNotEmpty(randomRule.getExpertRegionList())) { + List regions = CollUtils.convert(randomRule.getExpertRegionList(), + w -> regionCache.getByCodeAndLevel(w.getRegionCode(), w.getRegionLevel())); + randomRule.setExpertRegions(regions); + } + result.getRandomRules().add(randomRule); + }); + AvoidRuleDTO avoidInfo = inviteAvoidRuleService.getAvoidInfo(meetingId); + AvoidInfoVO vo = new AvoidInfoVO(); + vo.setAvoidType(avoidInfo.getAvoidType()); + vo.setWeekInviteCount(avoidInfo.getWeekInviteCount()); + vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList()); + vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList()); + if (CollUtil.isNotEmpty(vo.getAvoidOrgIds())) { + vo.setAvoidOrgs(belongOrgService.listNameByCodes(avoidInfo.getAvoidOrgIdList())); + } + if (CollUtil.isNotEmpty(vo.getAvoidUnitIds())) { + vo.setAvoidUnits(dingOrganizationService.listNameByCodes(avoidInfo.getAvoidUnitIdList())); + } + if (CollUtil.isNotEmpty(avoidInfo.getExpertIds())) { + vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values())); + } + result.setAvoidInfo(vo); + } else { + List appoints = groupByType.get(APPOINT); + ExpertInviteRule appoint = appoints.get(0); + AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); + appointRule.setId(appoint.getId()); + AppointRuleVO vo = new AppointRuleVO(); + vo.setInviteDesc(appointRule.getInviteDesc()); + vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values())); + result.setAppointRule(vo); + } + return result; + } + + public void batchAppointExperts(BatchAppointExpertsReq req) { + Long meetingId = req.getMeetingId(); + String key = "BATCH_APPOINT_EXPERT:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("补充专家中,请勿重复点击"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (!APPOINT.eq(meeting.getInviteType())) { + throw BizException.wrap("该会议不能指定邀请专家"); + } + if (meeting.getConfirmedRoster()) { + throw BizException.wrap("补充专家失败,已确认过专家名单"); + } + if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { + throw BizException.wrap("补充专家失败"); + } + AppointInviteRuleDTO rule = inviteRuleService.appointRuleByMeetingId(meetingId); + List userInfos = meetingManageHelper.appointExpertCheck(meetingId, meeting.getInviteType(), req.getExpertIdList()); + List expertList = CollUtils.convert(userInfos, w -> { + MeetingExpert me = ExpertInviteBuilder.getExpertByAppoint(meetingId, w, rule.getId()); + me.setStatus(NOTICING.getCode()); + return me; + }); + meetingExpertService.saveBatch(expertList); + } finally { + distributedLock.releaseLock(key); + } + } + + public void stopRandomInvite(Long meetingId) { + expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); + } + + @Transactional(rollbackFor = Exception.class) + public void cancelMeeting(MeetingCancelReq req) { + Long meetingId = req.getMeetingId(); + String key = "CANCEL_MEETING:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("正在取消会议,请刷新后重试"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议已取消"); + } + if (meeting.getStartTime().isBefore(LocalDateTime.now())) { + throw BizException.wrap("会议已开始,暂时无法取消"); + } + LambdaUpdateWrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) + .eq(Meeting::getId, meetingId); + meetingService.update(meetingUpdate); + expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); + // 发送通知给专家 + List experts = meetingExpertService.listAgreedExperts(meetingId); + if (!experts.isEmpty()) { + meetingCallOrMsgHelper.sendCancelMeetingMsg(experts, meeting); + } + } finally { + distributedLock.releaseLock(key); + } + } + + public ExpertInvitationDetailVO expertInvitationDetail(Long meetingId, Long expertId) { + Long userId = expertId == null ? LoginUserUtil.getUserId() : expertId; + MeetingExpert me = meetingExpertService.getByMeetingIdAndExpertId(meetingId, userId); + if (me == null) { + throw BizException.wrap("未被邀请参加此会议"); + } + if (AGREED.eq(me.getStatus())) { + throw BizException.wrap("未确认参加此会议"); + } + ExpertUserFullInfo userInfo = expertUserFullInfoService.getByUserId(userId); + Meeting meeting = meetingService.getById(meetingId); + return ExpertInvitationDetailVO.builder() + .expertName(userInfo.getExpertName()) + .holdOrg(meeting.getHoldOrg()) + .meetingName(meeting.getName()) + .startTime(meeting.getStartTime()) + .endTime(meeting.getEndTime()) + .inviteTime(me.getCreateOn()) + .connecter(meeting.getConnecter()) + .contact(meeting.getContact()) + .build(); + } + + public void confirmAttendByManager(ExpertConfirmReq req) { + String key = "CONFIRM_ATTEND:" + req.getExpertMeetingId(); + String msgPrefix = req.getAgreed() ? "确认参加" : "拒绝参加"; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("%s失败,请重试!", msgPrefix); + } + try { + MeetingExpert me = meetingExpertService.getById(req.getExpertMeetingId()); + if (!NOTICING.eq(me.getStatus())) { + throw BizException.wrap("%s失败,请重试!", msgPrefix); + } + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) + .set(MeetingExpert::getStatus, (req.getAgreed() ? AGREED : REFUSED).getCode()) + .eq(MeetingExpert::getId, req.getExpertMeetingId()); + meetingExpertService.update(update); + } finally { + distributedLock.releaseLock(key); + } + } + + @Transactional(rollbackFor = Exception.class) + public void expertRemove(ExpertRemoveReq req) { + String key = "EXPERT_REMOVE:" + req.getExpertMeetingId(); + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("删除专家失败,请重试!"); + } + try { + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议已取消!"); + } + if (LocalDateTime.now().isAfter(meeting.getStartTime())) { + throw BizException.wrap("会议已开始,不允许移除专家!"); + } + MeetingExpert expert = meetingExpertService.getById(req.getExpertMeetingId()); + if (!APPOINT.eq(expert.getInviteType())) { + throw BizException.wrap("随机抽取的专家不允许移除!"); + } + if (!NOTICING.eq(expert.getStatus())) { + throw BizException.wrap("已确认过的专家不允许移除!"); + } + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getConfirmedRoster, false) + .eq(Meeting::getId, req.getMeetingId()); + meetingService.update(mUpdate); + meetingExpertService.removeById(req.getExpertMeetingId()); + } finally { + distributedLock.releaseLock(key); + } + } + + public void releaseExperts(MeetingCancelReq req) { + String key = "EXPERT_RELEASE:" + req.getMeetingId(); + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("释放专家失败,请重试!"); + } + try { + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议已取消"); + } + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) + .set(MeetingExpert::getStatus, RELEASED.getCode()) + .eq(MeetingExpert::getMeetingId, req.getMeetingId()); + meetingExpertService.update(update); + } finally { + distributedLock.releaseLock(key); + } + } + + @Transactional(rollbackFor = Exception.class) + public void setUpHeadman(ExpertConfirmReq req) { + String key = "SETUP_HEADMAN:" + req.getMeetingId(); + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("设置专家组长失败,请重试!"); + } + try { + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议已取消"); + } + LambdaUpdateWrapper cancel = Wrappers.lambdaUpdate(MeetingExpert.class) + .set(MeetingExpert::getIsHeadman, Boolean.FALSE) + .eq(MeetingExpert::getIsHeadman, Boolean.TRUE) + .eq(MeetingExpert::getMeetingId, req.getMeetingId()); + meetingExpertService.update(cancel); + MeetingExpert headman = meetingExpertService.getById(req.getExpertMeetingId()); + if (!AGREED.eq(headman.getStatus())) { + ExpertAttendStatusEnum status = getByCode(headman.getStatus()); + throw BizException.wrap("该专家处于:%s状态,不能被设置为专家组长!", status.getValue()); + } + LambdaUpdateWrapper setup = Wrappers.lambdaUpdate(MeetingExpert.class) + .set(MeetingExpert::getIsHeadman, Boolean.TRUE) + .eq(MeetingExpert::getId, req.getExpertMeetingId()); + meetingExpertService.update(setup); + } finally { + distributedLock.releaseLock(key); + } + } + + public void confirmedRoster(ConfirmedRosterReq req) { + Long meetingId = req.getMeetingId(); + String key = "MEETING_RESEND_SMS:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("请刷新后重试!"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { + throw BizException.wrap("请刷新后重试!"); + } + if (!meeting.getConfirmedRoster()) { + // 首次确认的 + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class); + update.set(Meeting::getConfirmedRoster, Boolean.TRUE); + update.eq(Meeting::getId, meetingId); + meetingService.update(update); + } + List experts = meetingExpertService.listAgreedExperts(meetingId); + List expertNoticing = experts.stream() + .filter(w -> meeting.getConfirmedRoster() || !w.getConfirmedRoster()) + .collect(Collectors.toList()); + if (expertNoticing.isEmpty()) { + return; + } + List currConfirmedMeIds = CollUtils.fieldList(expertNoticing, MeetingExpert::getId); + LambdaUpdateWrapper meUpdate = Wrappers.lambdaUpdate(MeetingExpert.class) + .in(MeetingExpert::getId, currConfirmedMeIds) + .set(MeetingExpert::getConfirmedRoster, Boolean.TRUE); + meetingExpertService.update(meUpdate); + meetingCallOrMsgHelper.sendConfirmedRosterMsg(expertNoticing, meeting); + } finally { + distributedLock.releaseLock(key); + } + } + + public PageVo pageReviewProject(ReviewProjectListReq req) { + Page page = meetingExpertService.pageReviewProjectList(req); + return PageVo.of(page.getRecords(), page.getTotal()); + } + + public PageVo optionProject(MeetingOptionProjectReq req) { + String meetingType = req.getMeetingType(); + LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE); + switch (MeetingReviewTypeEnum.getByCode(meetingType)) { + case PRELIMINARY_SCHEME_REVIEW: + buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.PRE_APPLYING); + break; + case CONSTRUCTION_SCHEME_REVIEW: + buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.SCHEME_UNDER_REVIEW); + break; + case ACCEPTANCE_SCHEME_REVIEW: + buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW); + break; + case DEPT_JOIN_REVIEW: + buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW); + break; + case FAIRNESS_REVIEW: + break; + default: + return PageVo.empty(); + } + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Collection regionCodes = regionCache.listChildRegionCodeList(userDetail.getRegionCode(), userDetail.getRegionLevel()); + query.in(Project::getAreaCode, regionCodes); + Page page = projectService.page(req.page(), query); + PageVo result = PageVo.of(null, page.getTotal()); + if (result.getTotal() > 0) { + result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList)); + } + return result; + } + + public List projectsByMeetingId(Long meetingId) { + Meeting meeting = meetingService.getById(meetingId); + if (meeting.getIsInnerProject()) { + List projects = meetingInnerProjectService.listByMeetingId(meetingId); + List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); + List projectList = projectService.listByIds(projectIdList); + Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); + return CollUtils.convert(projectList, w -> { + MeetingReviewProjectVO vo = buildProjectList(w); + ExpertReview review = reviewMap.get(w.getId()); + if (review != null) { + vo.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); + } else { + vo.setReviewResult("--"); + } + return vo; + }); + } else { + List projects = meetingOuterProjectService.listByMeetingId(meetingId); + return BeanUtil.copyToList(projects, MeetingReviewProjectVO.class); + } + } + + private MeetingReviewProjectVO buildProjectList(Project project) { + return MeetingReviewProjectVO + .builder() + .id(project.getId()) + .projectCode(project.getProjectCode()) + .projectName(project.getProjectName()) + .declaredAmount(project.getDeclareAmount()) + .projectType(project.getProjectType()) + .projectYear(project.getProjectYear()) + .buildOrg(project.getBuildOrgName()) + .createOn(project.getCreateOn()) + .build(); + } + + private void buildOptionProjectQuery(LambdaQueryWrapper query, String meetingType, ProjectStatusEnum status) { + query.eq(Project::getStatus, status.getCode()); + String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" + + " m.is_inner_project = true and m.id = mip.meeting_id and nd_project.id = mip.project_id" + + " and m.type = %s and m.status != 3", meetingType); + String sql2 = String.format("select review_result in (2,3) from " + + " (select ner.review_result from meeting m inner join meeting_inner_project mip on" + + " m.is_inner_project = true and m.id = mip.meeting_id and nd_project.id = mip.project_id" + + " and m.type = %s and m.status != 3 left join nd_expert_review ner on ner.meeting_id = m.id " + + " and ner.project_id = mip.project_id and ner.is_final = true order by m.create_on desc limit 1) t", meetingType); + query.and(q1 -> q1.notExists(sql).or(q2 -> q2.apply(sql2))); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.java new file mode 100644 index 0000000..9743ada --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meeting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteAvoidRule; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface ExpertInviteAvoidRuleMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.xml new file mode 100644 index 0000000..fa89f37 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteAvoidRuleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.java new file mode 100644 index 0000000..ef12834 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meeting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface ExpertInviteRuleMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.xml new file mode 100644 index 0000000..4de4570 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/ExpertInviteRuleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.java new file mode 100644 index 0000000..4b46de6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.meeting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.common.model.entity.CountGroupByDTO; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertEvaluation; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; + +/** + *

+ * 专家评价表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-25 + */ +public interface MeetingExpertEvaluationMapper extends BaseMapper { + + Page> countExpertAttend(@Param("expertIds") Collection expertIds, @Param("isAttended") Boolean isAttended, Page> page); + + Page pageExpertEvaluationToDo(@Param("meetingIds") Collection meetingIds, Page po); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.xml new file mode 100644 index 0000000..1d0df39 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertEvaluationMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.java new file mode 100644 index 0000000..f463759 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meeting.mapper; + +import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-31 + */ +public interface MeetingExpertJudgeMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.xml new file mode 100644 index 0000000..bff239f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertJudgeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.java new file mode 100644 index 0000000..1029c8e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.meeting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.MeetingAndAttendStatusDTO; +import com.hz.pm.api.meeting.entity.dto.ReviewProjectDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.req.ReviewProjectListReq; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.List; + +/** + *

+ * 事务专家表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-27 + */ +public interface MeetingExpertMapper extends BaseMapper { + + /** + * 根据专家状态查询需要参加的会议信息 + * + * @param expertId 专家ID + * @param status 状态 + * @param meetingIds 会议ID + * @return 专家参会状态列表 + * @author WendyYang + **/ + List selectByExpertIdAndStatus(@Param("expertId") Long expertId, + @Param("status") Integer status, + @Param("meetingIds") List meetingIds); + + /** + * 分页查询专家列表 + * + * @param page 分页数据 + * @param status 状态{@link ExpertAttendStatusEnum} + * @param meetingId 会议ID + * @param inviteType 邀请类型 + * @return Page + * @author WendyYang + **/ + Page selectExpertByStatusAndMeetingId(Page page, @Param("status") Integer status, + @Param("meetingId") Long meetingId, + @Param("inviteType") Integer inviteType); + + /** + * 分页查询专家列表 + * + * @param page 分页数据 + * @param status 状态{@link ExpertAttendStatusEnum} + * @param meetingIds 会议ID + * @return Page + * @author WendyYang + **/ + Page selectExpertByStatusAndMeetingIds(Page page, @Param("status") Integer status, + @Param("meetingIds") Collection meetingIds); + + /** + * 查询时间窗口之内参与会议不超过{@code agreeCount}次的专家ID + * + * @param agreeCount 参与次数(包含) + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 专家ID集合 + * @author WendyYang + **/ + List listAgreeExpertIdByRecentDaysAndAgreeCount(@Param("agreeCount") Integer agreeCount, + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime); + + /** + * 根据会议ID与参与状态统计专家数量 + * + * @param status 会议状态 + * @param meetingId 会议ID + * @param inviteType 邀请类型 + * @return 数量 + */ + int countExpertByStatusAndMeetingId(@Param("status") Integer status, @Param("meetingId") Long meetingId, @Param("inviteType") Integer inviteType); + + /** + * 查询会议的所有被抽取人最后一条记录 + * + * @param meetingIds 会议ID + * @return 抽取记录 + * @author WendyYang + **/ + List listExpertLastByMeetingIds(@Param("meetingIds") Collection meetingIds); + + /** + * 查询专家待评审项目 + * + * @param page 分页 + * @param req 查询参数 + * @return 待评审项目分页数据 + * @author WendyYang + **/ + Page pageReviewProjectList(Page page, @Param("p") ReviewProjectListReq req); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.xml new file mode 100644 index 0000000..6ce0225 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = + me.expert_id and is_final = true) + + + not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = + me.expert_id and is_final = true) + + + + + + exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = + me.expert_id) + + + not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = + me.expert_id) + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.java new file mode 100644 index 0000000..1ae942b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meeting.mapper; + +import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 会议评审内部项目表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +public interface MeetingInnerProjectMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.xml new file mode 100644 index 0000000..f5effc7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingInnerProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.java new file mode 100644 index 0000000..917fc40 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meeting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.common.model.entity.CountGroupByDTO; +import com.hz.pm.api.meeting.entity.domain.Meeting; + +import java.util.List; + +/** + *

+ * 会议 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface MeetingMapper extends BaseMapper { + + List> meetingCountSummary(Long createBy); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.xml new file mode 100644 index 0000000..aff838d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingMapper.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.java new file mode 100644 index 0000000..2d94d56 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meeting.mapper; + +import com.hz.pm.api.meeting.entity.domain.MeetingOuterProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 会议评审外部项目 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +public interface MeetingOuterProjectMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.xml new file mode 100644 index 0000000..aace851 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingOuterProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteAvoidRuleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteAvoidRuleService.java new file mode 100644 index 0000000..35616f2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteAvoidRuleService.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.meeting.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteAvoidRule; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; + +/** + *

+ * IExpertInviteAvoidRuleService服务类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface IExpertInviteAvoidRuleService extends IService { + + ExpertInviteAvoidRule getByMeetingId(Long meetingId); + + /** + * 获取回避信息 + * + * @param meetingId 会议ID + * @return {@link AvoidRuleDTO} + * @author WendyYang + **/ + AvoidRuleDTO getAvoidInfo(Long meetingId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteRuleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteRuleService.java new file mode 100644 index 0000000..fdea1b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IExpertInviteRuleService.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.meeting.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.dto.AppointInviteRuleDTO; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface IExpertInviteRuleService extends IService { + + /** + * 查询会议所有的邀请规则 + * + * @param meetingId 会议ID + * @return 抽取规则集合 + * @author WendyYang + **/ + List listByMeetingId(Long meetingId); + + /** + * 查询会议所有的随机邀请规则 + * + * @param meetingId 会议ID + * @return 随机邀请规则 + * @author WendyYang + **/ + Map randomRuleByMeetingId(Long meetingId); + + /** + * 查询会议的指定邀请规则 + * + * @param meetingId 会议ID + * @return 指定邀请规则 + * @author WendyYang + **/ + AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertEvaluationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertEvaluationService.java new file mode 100644 index 0000000..dc78ee3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertEvaluationService.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.meeting.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.common.model.entity.CountGroupByDTO; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertEvaluation; + +import java.util.Collection; + +/** + *

+ * 专家评价表 服务类 + *

+ * + * @author WendyYang + * @since 2022-07-25 + */ +public interface IMeetingExpertEvaluationService extends IService { + + Page> listExpertAttendSummary(Collection expertIds, Boolean isAttended, Page> page); + + Page pageExpertEvaluationTodo(Collection meetingIds, PagePo po); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java new file mode 100644 index 0000000..b77cedf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.meeting.service; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-07-31 + */ +public interface IMeetingExpertJudgeService extends IService { + + default List listExistsMeetingExpertIds(Collection meetingExpertIds) { + if (CollUtil.isEmpty(meetingExpertIds)) { + return Collections.emptyList(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) + .select(MeetingExpertJudge::getMeetingExpertId) + .in(MeetingExpertJudge::getMeetingExpertId, meetingExpertIds); + return CollUtils.fieldList(list(query), MeetingExpertJudge::getMeetingExpertId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertService.java new file mode 100644 index 0000000..ea4df57 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertService.java @@ -0,0 +1,160 @@ +package com.hz.pm.api.meeting.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.CountConfirmByMeetingIdDTO; +import com.hz.pm.api.meeting.entity.dto.MeetingAndAttendStatusDTO; +import com.hz.pm.api.meeting.entity.dto.ReviewProjectDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.req.ReviewProjectListReq; + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + *

+ * 事务专家表 服务类 + *

+ * + * @author WendyYang + * @since 2022-07-27 + */ +public interface IMeetingExpertService extends IService { + + /** + * 查询专家的参与状态 + * + * @param expertId 专家ID + * @param status 状态 + * @param meetingIds 会议ID + * @return 会议参加状态统计 + * @author WendyYang + **/ + List listByExpertIdAndStatus(Long expertId, Integer status, List meetingIds); + + /** + * 查询每个会议的确认进度 + * + * @param meetingIds 事务ID + * @return 确认进度 + * @author WendyYang + **/ + Map countConfirmedByMeetingIds(List meetingIds); + + /** + * 根据事务ID查询所有邀请记录 + * + * @param meetingId 事务ID + * @return 邀请专家记录 + */ + List listByMeetingId(Long meetingId); + + /** + * 根据事务ID查询所有邀请记录 + * + * @param meetingIds 事务ID + * @return List + */ + List listByMeetingIds(List meetingIds); + + /** + * 获取专家参与事务的最新记录 + * + * @param meetingId 会议ID + * @param expertId 专家ID + * @return 专家参会记录 + * @author WendyYang + **/ + MeetingExpert getByMeetingIdAndExpertId(Long meetingId, Long expertId); + + /** + * 根据状态与会议ID分页查询专家列表 + * + * @param page 分页 + * @param meetingId 会议ID + * @param status 状态 + * @param inviteType 邀请类型 + * @return Page + * @author WendyYang + **/ + Page pageExpertByStatusAndMeetingId(Page page, Long meetingId, ExpertAttendStatusEnum status, Integer inviteType); + + /** + * 批量查询某个状态的专家邀请记录 + * + * @param page 分页参数 + * @param meetingIds 会议ID + * @param status 状态 + * @return 专家邀请记录 + * @author WendyYang + **/ + Page pageExpertByStatusAndMeetingIds(Page page, List meetingIds, ExpertAttendStatusEnum status); + + /** + * 根据邀请类型统计会议下某个状态的专家数量 + * + * @param status 状态 + * @param meetingId 会议ID + * @param inviteType 邀请类型 + * @return int + * @author WendyYang + **/ + int countExpertByStatusAndMeetingId(ExpertAttendStatusEnum status, Long meetingId, ExpertInviteTypeEnum inviteType); + + /** + * 查询所有同意参加的专家记录(批量会议) + * + * @param meetingIds 会议ID + * @return 同意参加的专家 + * @author WendyYang + **/ + List listAgreedExperts(Collection meetingIds); + + /** + * 查询所有同意参加的专家记录(单个会议) + * + * @param meetingId 会议ID + * @return 同意参加的专家 + * @author WendyYang + **/ + default List listAgreedExperts(Long meetingId) { + return listAgreedExperts(Collections.singletonList(meetingId)); + } + + /** + * 查询会议的所有被抽取人最后一条记录 + * + * @param meetingIds 会议ID + * @return 抽取记录 + * @author WendyYang + **/ + List listExpertLastByMeetingIds(Collection meetingIds); + + /** + * 查询会议的所有被抽取人最后一条记录 + * + * @param meetingId 会议ID + * @return 抽取记录 + * @author WendyYang + **/ + default List listExpertLastByMeetingId(Long meetingId) { + return listExpertLastByMeetingIds(Collections.singletonList(meetingId)); + } + + /** + * 查询专家待评审项目 + * + * @param req {@link ReviewProjectListReq} + * @return 待评审项目分页数据 + * @author WendyYang + **/ + Page pageReviewProjectList(ReviewProjectListReq req); + + List listAgreeExpertIdByRecentDaysAndAgreeCount(int agreeCount, LocalDateTime sTime, LocalDateTime eTime); + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingInnerProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingInnerProjectService.java new file mode 100644 index 0000000..7087388 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingInnerProjectService.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.meeting.service; + +import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 会议评审内部项目表 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +public interface IMeetingInnerProjectService extends IService { + + /** + * 查询会议评审的内部项目 + * + * @param meetingId 会议ID + * @return 会议关联的系统内部项目 + * @author WendyYang + **/ + List listByMeetingId(Long meetingId); + + /** + * 查询项目关联的所有会议 + * + * @param projectId 会议ID + * @return 项目关联的会议ID + * @author WendyYang + **/ + List listMeetingIdByProjectId(Long projectId); + + /** + * 查询项目关联的所有会议 + * + * @param projectCode 项目编号 + * @return 项目关联的会议ID + * @author WendyYang + **/ + List listMeetingIdByProjectCode(String projectCode); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingOuterProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingOuterProjectService.java new file mode 100644 index 0000000..2e8eabf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingOuterProjectService.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.meeting.service; + +import com.hz.pm.api.meeting.entity.domain.MeetingOuterProject; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 会议评审外部项目 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +public interface IMeetingOuterProjectService extends IService { + + /** + * 查询会议评审的外部项目 + * + * @param meetingId 会议ID + * @return 评审的外部项目 + * @author WendyYang + **/ + List listByMeetingId(Long meetingId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingService.java new file mode 100644 index 0000000..d74a096 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingService.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.meeting.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusByDashboard; + +import java.util.Map; + +/** + *

+ * 会议 服务类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +public interface IMeetingService extends IService { + + /** + * 停止抽取 + * + * @param meetingId 会议ID + **/ + void stopRandomInvite(Long meetingId); + + /** + * 工作台会议状态统计 + * + * @param createBy 创建人 + * @return 各状态会议统计 + * @author WendyYang + **/ + Map meetingCountSummary(Long createBy); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java new file mode 100644 index 0000000..a9964be --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteAvoidRule; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; +import com.hz.pm.api.meeting.mapper.ExpertInviteAvoidRuleMapper; +import com.hz.pm.api.meeting.service.IExpertInviteAvoidRuleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Service +public class ExpertInviteAvoidRuleServiceImpl extends ServiceImpl implements IExpertInviteAvoidRuleService { + + @Override + public ExpertInviteAvoidRule getByMeetingId(Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertInviteAvoidRule.class) + .eq(ExpertInviteAvoidRule::getMeetingId, meetingId); + return getOne(query); + } + + @Override + public AvoidRuleDTO getAvoidInfo(Long meetingId) { + ExpertInviteAvoidRule avoidRule = getByMeetingId(meetingId); + if (avoidRule == null) { + return null; + } + AvoidRuleDTO avoidInfo = new AvoidRuleDTO(); + avoidInfo.setAvoidOrgIdList(StrUtils.split(avoidRule.getAvoidOrgIds())); + avoidInfo.setAvoidUnitIdList(StrUtils.split(avoidRule.getAvoidUnitIds())); + avoidInfo.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); + avoidInfo.setWeekInviteCount(avoidRule.getWeekInviteCount()); + avoidInfo.setAvoidType(avoidRule.getAvoidType()); + return avoidInfo; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java new file mode 100644 index 0000000..56efdb7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.meeting.service.impl; + +import cn.hutool.json.JSONUtil; +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.service.impl.ServiceImpl; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.dto.AppointInviteRuleDTO; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.mapper.ExpertInviteRuleMapper; +import com.hz.pm.api.meeting.service.IExpertInviteRuleService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Service +public class ExpertInviteRuleServiceImpl extends ServiceImpl implements IExpertInviteRuleService { + + public static LambdaQueryWrapper wrapperByMeetingId(Long meetingId) { + return Wrappers.lambdaQuery(ExpertInviteRule.class).eq(ExpertInviteRule::getMeetingId, meetingId); + } + + @Override + public List listByMeetingId(Long meetingId) { + return list(wrapperByMeetingId(meetingId)); + } + + @Override + public Map randomRuleByMeetingId(Long meetingId) { + LambdaQueryWrapper query = wrapperByMeetingId(meetingId) + .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()); + List inviteRules = baseMapper.selectList(query); + return inviteRules.stream().collect(Collectors.toMap(ExpertInviteRule::getId, + w -> JSONUtil.toBean(w.getInviteRule(), RandomInviteRuleDTO.class))); + } + + @Override + public AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId) { + LambdaQueryWrapper query = wrapperByMeetingId(meetingId) + .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode()); + ExpertInviteRule inviteRule = baseMapper.selectOne(query); + AppointInviteRuleDTO rule = JSONUtil.toBean(inviteRule.getInviteRule(), AppointInviteRuleDTO.class); + rule.setId(inviteRule.getId()); + return rule; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java new file mode 100644 index 0000000..582aaf9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.common.model.entity.CountGroupByDTO; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.domain.MeetingExpertEvaluation; +import com.hz.pm.api.meeting.mapper.MeetingExpertEvaluationMapper; +import com.hz.pm.api.meeting.service.IMeetingExpertEvaluationService; +import org.springframework.stereotype.Service; + +import java.util.Collection; + +/** + *

+ * 专家评价表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-25 + */ +@Service +public class MeetingExpertEvaluationServiceImpl extends ServiceImpl implements IMeetingExpertEvaluationService { + + @Override + public Page> listExpertAttendSummary(Collection expertIds, Boolean isAttended, Page> page) { + return baseMapper.countExpertAttend(expertIds, isAttended, page); + } + + @Override + public Page pageExpertEvaluationTodo(Collection meetingIds, PagePo po) { + return baseMapper.pageExpertEvaluationToDo(meetingIds, new Page<>(po.getPageNumber(), po.getPageSize())); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertJudgeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertJudgeServiceImpl.java new file mode 100644 index 0000000..de0325a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertJudgeServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; +import com.hz.pm.api.meeting.mapper.MeetingExpertJudgeMapper; +import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-07-31 + */ +@Service +public class MeetingExpertJudgeServiceImpl extends ServiceImpl implements IMeetingExpertJudgeService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java new file mode 100644 index 0000000..6e58c6f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java @@ -0,0 +1,145 @@ +package com.hz.pm.api.meeting.service.impl; + +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.util.CollUtils; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.CountConfirmByMeetingIdDTO; +import com.hz.pm.api.meeting.entity.dto.MeetingAndAttendStatusDTO; +import com.hz.pm.api.meeting.entity.dto.ReviewProjectDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.entity.req.ReviewProjectListReq; +import com.hz.pm.api.meeting.mapper.ExpertInviteRuleMapper; +import com.hz.pm.api.meeting.mapper.MeetingExpertMapper; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + *

+ * 事务专家表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-27 + */ +@Service +@RequiredArgsConstructor +public class MeetingExpertServiceImpl extends ServiceImpl implements IMeetingExpertService { + + private final ExpertInviteRuleMapper inviteRuleMapper; + + @Override + public List listByExpertIdAndStatus(Long expertId, Integer status, List meetingIds) { + return baseMapper.selectByExpertIdAndStatus(expertId, status, meetingIds); + } + + @Override + public Map countConfirmedByMeetingIds(List meetingIds) { + List inviteRules = inviteRuleMapper.selectList(Wrappers.lambdaQuery(ExpertInviteRule.class) + .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()) + .in(ExpertInviteRule::getMeetingId, meetingIds)); + Map countByRandom = CollUtils.groupSumInt(inviteRules, ExpertInviteRule::getMeetingId, ExpertInviteRule::getInviteCount); + Page page = pageExpertByStatusAndMeetingIds(new Page<>(0, 500), meetingIds, null); + return page.getRecords().stream().collect(Collectors.groupingBy(MeetingExpert::getMeetingId, + Collectors.collectingAndThen(Collectors.toList(), + w -> { + Long meetingId = w.get(0).getMeetingId(); + CountConfirmByMeetingIdDTO confirm = CountConfirmByMeetingIdDTO.builder() + .confirmed(0) + .total(countByRandom.getOrDefault(meetingId, 0)) + .meetingId(meetingId) + .build(); + w.forEach(item -> { + ExpertAttendStatusEnum attendStatus = ExpertAttendStatusEnum.getByCode(item.getStatus()); + if (ExpertInviteTypeEnum.APPOINT.eq(item.getInviteType())) { + confirm.setTotal(confirm.getTotal() + 1); + } + // 除通知中的均为已确认 + if (attendStatus.equals(ExpertAttendStatusEnum.AGREED)) { + confirm.setConfirmed(confirm.getConfirmed() + 1); + } + }); + return confirm; + }))); + } + + @Override + public List listByMeetingId(Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getMeetingId, meetingId) + .orderByDesc(MeetingExpert::getUpdateOn); + return list(query); + } + + @Override + public List listByMeetingIds(List meetingIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) + .in(MeetingExpert::getMeetingId, meetingIds) + .orderByDesc(MeetingExpert::getUpdateOn); + return list(query); + } + + @Override + public MeetingExpert getByMeetingIdAndExpertId(Long meetingId, Long expertId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getExpertId, expertId) + .eq(MeetingExpert::getMeetingId, meetingId) + .orderByDesc(MeetingExpert::getUpdateOn) + .last("limit 1"); + return getOne(query); + } + + @Override + public Page pageExpertByStatusAndMeetingId(Page page, Long meetingId, ExpertAttendStatusEnum status, Integer inviteType) { + Integer statusCode = Optional.ofNullable(status).flatMap(w -> Optional.of(w.getCode())).orElse(null); + return baseMapper.selectExpertByStatusAndMeetingId(page, statusCode, meetingId, inviteType); + } + + @Override + public Page pageExpertByStatusAndMeetingIds(Page page, List meetingIds, ExpertAttendStatusEnum status) { + return baseMapper.selectExpertByStatusAndMeetingIds(page, status == null ? null : status.getCode(), meetingIds); + } + + @Override + public int countExpertByStatusAndMeetingId(ExpertAttendStatusEnum status, Long meetingId, ExpertInviteTypeEnum inviteType) { + Integer tempStatus = status == null ? null : status.getCode(); + Integer tempInviteType = inviteType == null ? null : inviteType.getCode(); + return baseMapper.countExpertByStatusAndMeetingId(tempStatus, meetingId, tempInviteType); + } + + @Override + public List listAgreedExperts(Collection meetingIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode()) + .in(MeetingExpert::getMeetingId, meetingIds); + return baseMapper.selectList(query); + } + + @Override + public List listExpertLastByMeetingIds(Collection meetingIds) { + return baseMapper.listExpertLastByMeetingIds(meetingIds); + } + + @Override + public Page pageReviewProjectList(ReviewProjectListReq req) { + return baseMapper.pageReviewProjectList(req.page(), req); + } + + @Override + public List listAgreeExpertIdByRecentDaysAndAgreeCount(int agreeCount, LocalDateTime sTime, LocalDateTime eTime) { + return baseMapper.listAgreeExpertIdByRecentDaysAndAgreeCount(agreeCount, sTime, eTime); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingInnerProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingInnerProjectServiceImpl.java new file mode 100644 index 0000000..c00918a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingInnerProjectServiceImpl.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; +import com.hz.pm.api.meeting.mapper.MeetingInnerProjectMapper; +import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 会议评审内部项目表 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +@Service +public class MeetingInnerProjectServiceImpl extends ServiceImpl implements IMeetingInnerProjectService { + + @Override + public List listByMeetingId(Long meetingId) { + return list(Wrappers.lambdaQuery(MeetingInnerProject.class) + .eq(MeetingInnerProject::getMeetingId, meetingId)); + } + + @Override + public List listMeetingIdByProjectId(Long projectId) { + LambdaQueryWrapper query = Wrappers + .lambdaQuery(MeetingInnerProject.class) + .eq(MeetingInnerProject::getProjectId, projectId); + return CollUtils.fieldList(list(query), MeetingInnerProject::getMeetingId); + } + + @Override + public List listMeetingIdByProjectCode(String projectCode) { + LambdaQueryWrapper query = Wrappers + .lambdaQuery(MeetingInnerProject.class) + .eq(MeetingInnerProject::getProjectCode, projectCode); + return CollUtils.fieldList(list(query), MeetingInnerProject::getMeetingId); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingOuterProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingOuterProjectServiceImpl.java new file mode 100644 index 0000000..40cb43b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingOuterProjectServiceImpl.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.meeting.entity.domain.MeetingOuterProject; +import com.hz.pm.api.meeting.mapper.MeetingOuterProjectMapper; +import com.hz.pm.api.meeting.service.IMeetingOuterProjectService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 会议评审外部项目 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-28 + */ +@Service +public class MeetingOuterProjectServiceImpl extends ServiceImpl implements IMeetingOuterProjectService { + + @Override + public List listByMeetingId(Long meetingId) { + return list(Wrappers.lambdaQuery(MeetingOuterProject.class) + .eq(MeetingOuterProject::getMeetingId, meetingId)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingServiceImpl.java new file mode 100644 index 0000000..0d94389 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingServiceImpl.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meeting.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.model.entity.CountGroupByDTO; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusByDashboard; +import com.hz.pm.api.meeting.mapper.MeetingMapper; +import com.hz.pm.api.meeting.service.IMeetingService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 会议 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-26 + */ +@Service +public class MeetingServiceImpl extends ServiceImpl implements IMeetingService { + + @Override + public void stopRandomInvite(Long meetingId) { + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class) + .eq(Meeting::getId, meetingId) + .set(Meeting::getInviteStatus, Boolean.TRUE); + update(update); + } + + @Override + public Map meetingCountSummary(Long createBy) { + List> meetingCountSummary = baseMapper.meetingCountSummary(createBy); + return CollUtils.listToMap(meetingCountSummary, w -> MeetingStatusByDashboard.valueOf(w.getGroupKey()), + CountGroupByDTO::getTotal); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertCallResultRewriteTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertCallResultRewriteTask.java new file mode 100644 index 0000000..e42f4ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertCallResultRewriteTask.java @@ -0,0 +1,174 @@ +package com.hz.pm.api.meeting.task; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.meeting.entity.domain.ExpertInviteRule; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import com.hz.pm.api.meeting.entity.dto.YxtCallBackDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.enumeration.ExpertInviteTypeEnum; +import com.hz.pm.api.meeting.service.IExpertInviteRuleService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.ningdatech.yxt.entity.SysMsgRecordDetail; +import com.ningdatech.yxt.service.ISysMsgRecordDetailService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Collectors; + +import static com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum.*; + +/** + *

+ * ExpertCallResultRewriteTask + *
+ * 专家电话结果回填 + *

+ * + * @author WendyYang + * @since 14:15 2022/8/18 + */ +@Slf4j +@Component +@AllArgsConstructor +public class ExpertCallResultRewriteTask { + + private final RandomInviteProperties randomInviteProperties; + + private final ThreadPoolTaskScheduler scheduler; + private final IMeetingExpertService meetingExpertService; + private final IExpertInviteRuleService inviteRuleService; + private final ISysMsgRecordDetailService msgRecordDetailService; + private final static int MINUTES_CALL_RESULT_FEEDBACK = 15; + + private static final String AGREE_KEY = "1"; + + @PostConstruct + public void initTask() { + if (!randomInviteProperties.getEnable()) { + log.warn("随机邀请已关闭……"); + return; + } + Instant startTime = Instant.now().plus(randomInviteProperties.getResultRewriteFixedRate(), ChronoUnit.MINUTES); + // 处理电话结果回填 + Duration fixedRate = Duration.ofMinutes(randomInviteProperties.getResultRewriteFixedRate()); + scheduler.scheduleAtFixedRate(this::rewritePhoneCallResult, startTime, fixedRate); + } + + + public void rewritePhoneCallResult() { + log.info("开始执行电话结果回填任务:{}", Thread.currentThread().getName()); + // 查询所有邀请的专家信息 状态为通话中的 + LambdaQueryWrapper meQuery = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getStatus, NOTICING.getCode()) + .eq(MeetingExpert::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()); + List experts = meetingExpertService.list(meQuery); + if (experts.isEmpty()) { + log.info("暂无电话结果回填任务执行"); + return; + } + // 所有随机邀请的规则ID + Map submitKeys = new HashMap<>(experts.size()); + Set randomRuleIds = experts.stream().peek(w -> submitKeys.put(w.getId(), w.getSubmitKey())) + .map(MeetingExpert::getRuleId).collect(Collectors.toSet()); + // 查询随机邀请回调等待时间 + Map callbackMinutes = new HashMap<>(randomRuleIds.size()); + if (!randomRuleIds.isEmpty()) { + List inviteRules = inviteRuleService.listByIds(randomRuleIds); + inviteRules.forEach(w -> { + RandomInviteRuleDTO rule = JSONObject.parseObject(w.getInviteRule(), RandomInviteRuleDTO.class); + callbackMinutes.put(w.getId(), rule.getWaitForCallbackMinutes()); + }); + } + LambdaQueryWrapper msgRecordDetailQuery = Wrappers.lambdaQuery(SysMsgRecordDetail.class) + .in(SysMsgRecordDetail::getSubmitKey, submitKeys.values()); + List recordDetailList = msgRecordDetailService.list(msgRecordDetailQuery); + if (recordDetailList.isEmpty()) { + return; + } + Map recordDetailMap = recordDetailList.stream() + .collect(Collectors.toMap(w -> w.getSubmitKey() + StrPool.UNDERSCORE + w.getReceiveNumber(), w -> w)); + List updates = new ArrayList<>(), agrees = new ArrayList<>(); + for (MeetingExpert expert : experts) { + String key = expert.getSubmitKey() + StrPool.UNDERSCORE + expert.getMobile(); + SysMsgRecordDetail msgRecordDetail = recordDetailMap.get(key); + if (msgRecordDetail == null) { + // 极端情况下获取不到submitKey异常情况 + continue; + } + Integer minutes = ObjectUtil.defaultIfNull(callbackMinutes.get(expert.getRuleId()), MINUTES_CALL_RESULT_FEEDBACK); + Optional status = getStatusByMsgRecordDetail(msgRecordDetail, minutes, expert.getCreateOn()); + if (status.isPresent()) { + MeetingExpert update = new MeetingExpert(); + update.setUpdateBy(0L); + update.setUpdateOn(LocalDateTime.now()); + update.setId(expert.getId()); + update.setStatus(status.get()); + if (AGREED.eq(update.getStatus())) { + // 发送专家确认参加的短信通知 + // sendAgreeNotice(expert); + agrees.add(expert); + } + updates.add(update); + } + } + meetingExpertService.updateBatchById(updates); + } + + private static Optional getStatusByMsgRecordDetail(SysMsgRecordDetail mrd, int minutes, LocalDateTime createOn) { + LocalDateTime limitTime = LocalDateTime.now().minusMinutes(minutes); + String callBackJson = mrd.getCallBackJson(); + boolean waiting = limitTime.isBefore(createOn); + boolean hasCallBack = StrUtils.isNotBlank(callBackJson); + if (!hasCallBack && waiting) { + return Optional.empty(); + } + ExpertAttendStatusEnum status; + if (hasCallBack) { + try { + YxtCallBackDTO callback = JSONObject.parseObject(callBackJson, YxtCallBackDTO.class); + LocalDateTime dialBeginTime = callback.getDialBeginTime(); + if (dialBeginTime == null) { + return Optional.empty(); + } + Integer resultCode = callback.getResultCode(); + if (resultCode != null && resultCode == 0) { + String pressKey = callback.getPressKey(); + if (pressKey != null) { + pressKey = pressKey.replaceAll("\\*", "").trim(); + } + if (StrUtils.isBlank(pressKey) && waiting) { + return Optional.empty(); + } + status = AGREE_KEY.equals(pressKey) ? AGREED : REFUSED; + } else { + if (waiting) { + return Optional.empty(); + } + status = REFUSED; + } + } catch (Exception e) { + log.error("获取电话回调结果异常{}", mrd, e); + status = UNANSWERED; + } + } else { + // 超时未回复设置为拒绝参加 + status = REFUSED; + } + return Optional.of(status.getCode()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertInviteExecutorConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertInviteExecutorConfig.java new file mode 100644 index 0000000..f73bf5d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertInviteExecutorConfig.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.meeting.task; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; + +/** + *

+ * ExpertInviteExecutorConfig + *

+ * + * @author WendyYang + * @since 16:21 2022/8/16 + */ +@Configuration +public class ExpertInviteExecutorConfig { + + @Bean(name = "expertInviteScheduler") + public ThreadPoolTaskScheduler threadPoolTaskScheduler() { + ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.setPoolSize(3); + scheduler.setThreadGroupName("expert-invite"); + scheduler.setThreadNamePrefix("invite-executor-"); + scheduler.setAwaitTerminationSeconds(60); + scheduler.setWaitForTasksToCompleteOnShutdown(true); + return scheduler; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertRandomInviteTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertRandomInviteTask.java new file mode 100644 index 0000000..3078349 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/ExpertRandomInviteTask.java @@ -0,0 +1,354 @@ +package com.hz.pm.api.meeting.task; + +import cn.hutool.core.util.ArrayUtil; +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.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.SpringUtils; +import com.ningdatech.cache.model.cache.CacheHashKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.common.util.SpringContextHolder; +import com.hz.pm.api.meeting.builder.ExpertInviteBuilder; +import com.hz.pm.api.meeting.entity.domain.Meeting; +import com.hz.pm.api.meeting.entity.domain.MeetingExpert; +import com.hz.pm.api.meeting.entity.dto.AvoidRuleDTO; +import com.hz.pm.api.meeting.entity.dto.ExpertChooseDTO; +import com.hz.pm.api.meeting.entity.dto.InviteCacheDTO; +import com.hz.pm.api.meeting.entity.dto.RandomInviteRuleDTO; +import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.hz.pm.api.meeting.entity.req.ConfirmedRosterReq; +import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; +import com.hz.pm.api.meeting.manage.ExpertInviteManage; +import com.hz.pm.api.meeting.manage.MeetingManage; +import com.hz.pm.api.meeting.service.IExpertInviteAvoidRuleService; +import com.hz.pm.api.meeting.service.IExpertInviteRuleService; +import com.hz.pm.api.meeting.service.IMeetingExpertService; +import com.hz.pm.api.meeting.service.IMeetingService; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.atomic.AtomicInteger; + + +/** + *

+ * 专家随机邀请任务 + *

+ * + * @author WendyYang + * @since 21:25 2022/8/15 + */ +@Slf4j +@Component +@AllArgsConstructor +public class ExpertRandomInviteTask { + + private final RandomInviteProperties properties; + private static final String MEETING_ID_INVITE_RANDOM = "MEETING_ID_INVITE_RANDOM"; + + private static final Duration EXPIRE_TIME = Duration.ofDays(60); + + private final CachePlusOps cachePlusOps; + @Resource(name = "expertInviteScheduler") + private ThreadPoolTaskScheduler scheduler; + private final IMeetingExpertService meetingExpertService; + private final IExpertInviteRuleService inviteRuleService; + private final IMeetingService meetingService; + private final ExpertInviteManage expertInviteManage; + private final IExpertInviteAvoidRuleService inviteAvoidRuleService; + private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; + + /** + * 用来存入线程执行句柄, 停止定时任务时使用 + */ + private static final ConcurrentMap> INVITE_TASK_MAP = new ConcurrentHashMap<>(); + + private ExpertRandomInviteTask currProxy() { + return (ExpertRandomInviteTask) AopContext.currentProxy(); + } + + private CacheHashKey getCacheKey(Long meetingId) { + String field = meetingId == null ? null : meetingId.toString(); + return new CacheHashKey(MEETING_ID_INVITE_RANDOM, field, EXPIRE_TIME); + } + + @PostConstruct + public void initTask() { + if (!properties.getEnable()) { + log.warn("随机邀请已关闭……"); + return; + } + initInviteTaskAfterStarted(); + } + + /** + * 项目重启之后重新初始化邀请任务 + */ + private void initInviteTaskAfterStarted() { + Map caches = cachePlusOps.hGetAll(getCacheKey(null)); + if (MapUtils.isEmpty(caches)) { + log.info("暂无需要初始化的抽取会议信息"); + return; + } + Integer inviteDelay = properties.getInviteDelay(); + for (InviteCacheDTO cache : caches.values()) { + Boolean reInvite = cache.getReInvite(); + LocalDateTime tsTime = cache.getTaskStartTime(); + boolean added = addInviteTask(cache.getMeetingId(), true, inviteDelay, reInvite, tsTime); + if (!added) { + cachePlusOps.hDel(getCacheKey(cache.getMeetingId())); + } + } + } + + /** + * 专家抽取校验(抽取数量是否不足) + * + * @param meetingId 会议ID + * @return boolean + * @author WendyYang + **/ + private boolean inviteCountCheck(Long meetingId) { + Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); + if (ruleMap.isEmpty()) { + return Boolean.FALSE; + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) + .select(MeetingExpert::getRuleId, MeetingExpert::getStatus) + .in(MeetingExpert::getRuleId, ruleMap.keySet()) + .eq(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode()); + List experts = meetingExpertService.list(query); + if (experts.isEmpty()) { + return Boolean.TRUE; + } + Map cntMap = CollUtils.groupCount(experts, MeetingExpert::getRuleId); + for (Map.Entry entry : ruleMap.entrySet()) { + Long agreeCnt = cntMap.getOrDefault(entry.getKey(), 0L); + if (agreeCnt < entry.getValue().getCount()) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + /** + * 唤醒某个会议的抽取任务 + * + * @param meetingId 会议ID + * @param reInvite 是否可邀请已拒绝的专家 + * @author WendyYang + **/ + public void notifyInviteTask(Long meetingId, boolean... reInvite) { + boolean tmpReInvite = ArrayUtil.isEmpty(reInvite) || reInvite[0]; + if (!INVITE_TASK_MAP.containsKey(meetingId)) { + if (addInviteTask(meetingId, false, properties.getInviteDelay(), tmpReInvite, LocalDateTime.now())) { + log.info("重置会议的随机抽取状态:{}", meetingId); + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class); + update.set(Meeting::getInviteStatus, false); + update.eq(Meeting::getId, meetingId); + meetingService.update(update); + InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, tmpReInvite, LocalDateTime.now()); + cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); + } + } + } + + /** + * 添加专家抽取校验任务 + * + * @param meetingId 会议ID + * @param checked 是否前置校验 + * @param delayTime 延迟执行时间 + * @param reInvite 是否可以邀请被拒绝的专家 + * @param tsTime 任务启动时间 + * @return 是否添加任务成功 + * @author WendyYang + **/ + private boolean addInviteTask(Long meetingId, boolean checked, int delayTime, boolean reInvite, LocalDateTime tsTime) { + if (checked && !inviteCountCheck(meetingId)) { + // 如果抽取数量满足直接返回 + return Boolean.FALSE; + } + Instant startTime = LocalDateTime.now().plusMinutes(delayTime).atZone(ZoneId.systemDefault()).toInstant(); + ScheduledFuture future = scheduler.scheduleAtFixedRate(() -> { + ExpertRandomInviteTask bean = SpringContextHolder.getBean(ExpertRandomInviteTask.class); + try { + bean.invite(meetingId, reInvite, tsTime); + } catch (Exception e) { + log.error("执行专家邀请任务异常:{}", meetingId, e); + } + }, startTime, Duration.ofMinutes(properties.getInviteFixedRate())); + INVITE_TASK_MAP.putIfAbsent(meetingId, future); + log.info("添加专家抽取后台任务:{}", meetingId); + return Boolean.TRUE; + } + + /** + * 创建会议时添加抽取任务 + * + * @param meetingId 会议ID + * @param tsTime 开始时间 + * @author WendyYang + **/ + public void addInviteTaskByMeetingCreate(Long meetingId, LocalDateTime tsTime) { + Assert.isTrue(properties.getEnable(), "随机邀请已关闭"); + addInviteTask(meetingId, false, properties.getInviteDelay(), false, tsTime); + InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false, tsTime); + cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); + } + + /** + * 抽取过程 + * + * @param meetingId 会议ID + * @param reInvite 是否可以邀请已拒绝的专家 + * @param tsTime 任务开启时间 + */ + @Transactional(rollbackFor = Exception.class) + public void invite(Long meetingId, Boolean reInvite, LocalDateTime tsTime) { + log.info("开始进行专家后台抽取:{}", meetingId); + Meeting meeting = meetingService.getById(meetingId); + if (meeting.getInviteStatus() || meeting.getStartTime().isBefore(LocalDateTime.now())) { + log.info("会议已开始停止抽取:{}", meeting); + killTaskAndDelCacheMeetingId(meetingId); + return; + } + // 随机邀请规则 + Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); + // 回避规则 + AvoidRuleDTO avoidRule = inviteAvoidRuleService.getAvoidInfo(meetingId); + // 还需要抽取的规则数量 + AtomicInteger notIgnoreCnt = new AtomicInteger(ruleMap.size()); + AtomicInteger notSupportCnt = new AtomicInteger(0); + LocalDateTime msTime = meeting.getStartTime(); + LocalDateTime meTime = meeting.getStartTime(); + ruleMap.forEach((ruleId, value) -> { + List tmpExperts = meetingExpertService.listExpertLastByMeetingId(meetingId); + Map expertMap = CollUtils.listToMap(tmpExperts, MeetingExpert::getExpertId); + // 统计通知中与同意参加专家数量 + Map countMap = countByAttendStatus(expertMap); + ExpertCntBO cnt = countMap.getOrDefault(ruleId, ExpertCntBO.zeroInit()); + int wouldAttendCnt = cnt.getAgreeCnt() + cnt.getNoticeCnt(); + if (wouldAttendCnt == value.getCount()) { + if (cnt.getAgreeCnt().equals(value.getCount())) { + notIgnoreCnt.decrementAndGet(); + } + return; + } + int needInviteCnt = value.getCount() - wouldAttendCnt; + ExpertChooseDTO expertChoose = expertInviteManage.expertReplaceByRandomRule(avoidRule, value, + tmpExperts, needInviteCnt, msTime, meTime, tsTime, reInvite); + + if (expertChoose.getTotal() > 0) { + List expertMeetings = CollUtils.convert(expertChoose.getExperts(), w -> { + MeetingExpert expert = ExpertInviteBuilder.getExpertByRandom(meetingId, w, ruleId); + expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode()); + return expert; + }); + meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertMeetings); + log.info("会议:{} 后台抽取专家:{}名", meetingId, expertMeetings.size()); + meetingExpertService.saveBatch(expertMeetings); + } else { + // 抽取人数不够 + notSupportCnt.incrementAndGet(); + } + }); + if (notIgnoreCnt.get() == 0 || notIgnoreCnt.get() == notSupportCnt.get()) { + log.info("停止会议随机邀请:{} 未完成抽取规则数量 {} 无可抽取专家规则数量 {}", meetingId, notIgnoreCnt, notSupportCnt); + meetingService.stopRandomInvite(meetingId); + if (notIgnoreCnt.get() == notSupportCnt.get() && notIgnoreCnt.get() > 0) { + // 当未完成抽取且无专家可抽取时 + meetingCallOrMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName()); + } + } + // 所有抽取规则抽取人数满足 自动召开会议 + if (notIgnoreCnt.get() == 0 && notSupportCnt.get() == 0) { + MeetingManage meetingManage = SpringUtils.getBean(MeetingManage.class); + ConfirmedRosterReq req = new ConfirmedRosterReq(); + req.setReconfirmed(false); + req.setMeetingId(meetingId); + meetingManage.confirmedRoster(req); + } + } + + private void killTaskAndDelCacheMeetingId(Long meetingId) { + cachePlusOps.hDel(getCacheKey(meetingId)); + ScheduledFuture future = INVITE_TASK_MAP.get(meetingId); + if (future != null) { + INVITE_TASK_MAP.remove(meetingId); + if (!future.isCancelled()) { + future.cancel(true); + } + } + } + + @Transactional(rollbackFor = Exception.class) + public void cancelByMeetingIdAndKillTask(Long meetingId) { + log.info("终止专家抽取:{}", meetingId); + meetingService.stopRandomInvite(meetingId); + killTaskAndDelCacheMeetingId(meetingId); + } + + //================================================================================================================== + + private Map countByAttendStatus(Map expertMap) { + Map cntMap = new HashMap<>(8); + expertMap.values().forEach(w -> { + Long ruleId = w.getRuleId(); + ExpertCntBO cnt = cntMap.computeIfAbsent(ruleId, k -> ExpertCntBO.zeroInit()); + if (ExpertAttendStatusEnum.AGREED.eq(w.getStatus())) { + cnt.incrAgreeCnt(); + } else if (ExpertAttendStatusEnum.NOTICING.eq(w.getStatus())) { + cnt.incrNoticeCnt(); + } + }); + return cntMap; + } + + @Data + public static class ExpertCntBO { + + private Integer agreeCnt; + + private Integer noticeCnt; + + public ExpertCntBO(Integer agreeCnt, Integer noticeCnt) { + this.agreeCnt = agreeCnt; + this.noticeCnt = noticeCnt; + } + + public void incrAgreeCnt() { + agreeCnt++; + } + + public void incrNoticeCnt() { + noticeCnt++; + } + + public static ExpertCntBO zeroInit() { + return new ExpertCntBO(0, 0); + } + + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/RandomInviteProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/RandomInviteProperties.java new file mode 100644 index 0000000..d6f9f57 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/task/RandomInviteProperties.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.meeting.task; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + *

+ * TelInviteTaskProperties + *

+ * + * @author WendyYang + * @since 17:25 2022/9/9 + */ +@Data +@Component +@ConfigurationProperties(prefix = "random-invite") +public class RandomInviteProperties { + + /** + * 是否开启随机抽取 + */ + private Boolean enable = true; + /** + * 电话结果回填执行频率(分钟) + */ + private Integer resultRewriteFixedRate = 2; + /** + * 随机邀请延迟执行(分钟) + */ + private Integer inviteDelay = 2; + /** + * 随机邀请执行频率(分钟) + */ + private Integer inviteFixedRate = 3; + /** + * 会议抽取完成通知 管理员下发会议通知 + */ + private Integer meetingInviteCompleteNoticeRate = 1; + + /** + * 近期会议数量(以此来降低专家抽中间隔) + */ + private Integer recentMeetingCount = 5; + + /** + * 参会次数限制天数 + */ + private Integer recentDays = 7; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java new file mode 100644 index 0000000..6243da7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meta.assembler; + + +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.vo.ResDictionaryVO; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:53 + */ + +public class MetaDictionaryAssembler { + + public static DictionaryDTO toDictionaryDTO(MetaDictionary dictionaryManage) { + DictionaryDTO dictionaryDTO = new DictionaryDTO(); + dictionaryDTO.setDescribe(dictionaryManage.getDictionaryDescribe()); + dictionaryDTO.setDictionaryCode(dictionaryManage.getDictionaryCode()); + dictionaryDTO.setDictionaryType(dictionaryManage.getDictionaryType()); + dictionaryDTO.setName(dictionaryManage.getDictionaryName()); + dictionaryDTO.setReadonly(dictionaryManage.getReadonly()); + dictionaryDTO.setSortValue(dictionaryManage.getSortValue()); + return dictionaryDTO; + } + + public static ResDictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { + ResDictionaryVO resDictionaryVO = new ResDictionaryVO(); + resDictionaryVO.setDescribe(dictionaryDTO.getDescribe()); + resDictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); + resDictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); + resDictionaryVO.setName(dictionaryDTO.getName()); + resDictionaryVO.setReadonly(dictionaryDTO.getReadonly()); + resDictionaryVO.setSortValue(dictionaryDTO.getSortValue()); + return resDictionaryVO; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java new file mode 100644 index 0000000..8bd3b0e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.meta.assembler; + +import com.hz.pm.api.meta.model.entity.MetaTag; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; +import com.hz.pm.api.meta.model.vo.ResTagTreeVO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:57 + */ + +public class MetaTagAssembler { + + public static TagDTO toTagDTO(MetaTag metaTagManage) { + TagDTO tagDTO = new TagDTO(); + tagDTO.setParentCode(metaTagManage.getParentCode()); + tagDTO.setTagCode(metaTagManage.getTagCode()); + tagDTO.setTagLevel(metaTagManage.getTagLevel()); + tagDTO.setTagName(metaTagManage.getTagName()); + return tagDTO; + } + + public static List toTagTreeDTOList(List tagDTOList) { + if (CollectionUtils.isEmpty(tagDTOList)) { + return new ArrayList<>(); + } + return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); + + } + + public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { + TagTreeDTO tagTreeDTO = new TagTreeDTO(); + tagTreeDTO.setParentCode(tagDTO.getParentCode()); + tagTreeDTO.setTagCode(tagDTO.getTagCode()); + tagTreeDTO.setTagLevel(tagDTO.getTagLevel()); + tagTreeDTO.setTagName(tagDTO.getTagName()); + return tagTreeDTO; + } + + public static List toTagTreeVOList(List tagTreeDTOList) { + List resTagTreeVOList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { + ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); + resTagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); + resTagTreeVO.setTagName(tagTreeDTO.getTagName()); + resTagTreeVO.setParentCode(tagTreeDTO.getParentCode()); + resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); + resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); + if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { + resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); + } + resTagTreeVOList.add(resTagTreeVO); + } + return resTagTreeVOList; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java new file mode 100644 index 0000000..441a1d2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:08 + */ +@AllArgsConstructor +@Getter +public enum DictAllTypeEnum { + + // 政治面貌 + POLITICAL("political"), + // 专家来源 + EXPERT_SOURCE("expert_source"), + // 学历 + EDU("edu"), + // 学位 + DEGREE("degree"), + // 在职状态 + JOB_STATUS("job_status"), + // 行政职级 + ADMINISTRATIVE_RANK("administrative_rank"), + // 内外围(专家类型) + EXPERT_TYPE("expert_type"), + // 单位类型 + COMPANY_ATTRIBUTE("company_attribute"), + // 职称级别 + TITLE_LEVEL("title_level"), + // 通知类型 + NOTICE_TYPE("notice_type"), + // 会议类型 + MEETING_TYPE("meeting_type"); + + private final String key; + + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java new file mode 100644 index 0000000..90248f9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:08 + */ +@AllArgsConstructor +@Getter +public enum DictExpertInfoTypeEnum { + + // 政治面貌 + POLITICAL("political"), + // 学历 + EDU("edu"), + // 学位 + DEGREE("degree"), + // 在职状态 + JOB_STATUS("job_status"), + // 行政职级 + ADMINISTRATIVE_RANK("administrative_rank"), + // 内外围(专家类型) + EXPERT_TYPE("expert_type"), + // 单位类型 + COMPANY_ATTRIBUTE("company_attribute"), + // 职称级别 + TITLE_LEVEL("title_level"), + // 推荐方式 + RECOMMENDED_WAY("recommended_way"); + + + private final String key; + + public static List getAll() { + List dictionaryList = new ArrayList<>(); + DictExpertInfoTypeEnum[] values = DictExpertInfoTypeEnum.values(); + for (DictExpertInfoTypeEnum typeEnum : values) { + dictionaryList.add(typeEnum.key); + } + return dictionaryList; + } + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (DictExpertInfoTypeEnum typeEnum : DictExpertInfoTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static DictExpertInfoTypeEnum of(String key) { + for (DictExpertInfoTypeEnum statusEnum : DictExpertInfoTypeEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal DictionaryExpertInfoTypeEnum = %s", key)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertTagEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertTagEnum.java new file mode 100644 index 0000000..c3122b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertTagEnum.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午11:13 + */ +@AllArgsConstructor +@Getter +public enum ExpertTagEnum { + + // 专家来源 + EXPERT_SOURCE("expert_source"), + // 擅长方向 + GOOD_AT("good_at"), + // 技术专长 + TECHNICAL_EXPERTISE("technical_expertise"), + // 行业领域 + INDUSTRY_SECTOR("industry_sector"), + // 其他 + OTHER("other"); + + private final String key; + + public static List getAll() { + List tagList = new ArrayList<>(); + ExpertTagEnum[] values = ExpertTagEnum.values(); + for (ExpertTagEnum fieldEnum : values) { + tagList.add(fieldEnum.key); + } + return tagList; + } + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertTagEnum fieldEnum : ExpertTagEnum.values()) { + if (fieldEnum.key.equals(key)) { + return true; + } + } + return false; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/TagConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/TagConst.java new file mode 100644 index 0000000..683edfd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/TagConst.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meta.constant; + +/** + * @author liuxinxin + * @date 2022/8/27 下午1:49 + */ + +public class TagConst { + + private TagConst() { + } + + /** + * 标签类型顶级时 parent_code 为 -1 + */ + public static final String TAG_ROOT_PARENT_CODE = "-1"; + + public static final Long TAG_ROOT_LEVEL = 1L; + + public static final String TAG_CREATOR = "管理员"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java new file mode 100644 index 0000000..ea36eaa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.meta.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.meta.manage.MetaManage; +import com.hz.pm.api.meta.model.po.ReqAddDictionaryPO; +import com.hz.pm.api.meta.model.po.ReqDictionaryListPO; +import com.hz.pm.api.meta.model.vo.ResDictionaryListVO; +import com.hz.pm.api.meta.validate.DictionaryRequestValidator; +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.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author liuxinxin + * @since 2022-07-21 + */ +@RestController +@Validated +@RequiredArgsConstructor +@RequestMapping("/api/v1/meta/dictionary") +@Api(tags = "基础数据接口") +public class MetaDictionaryManageController { + + // private final IMetaDictionaryManageService metaDictionaryManageService; + private final MetaManage metaManage; + + @PostMapping("/list") + @ApiOperation("字典筛选数据返回") + public List expertDictList(@RequestBody ReqDictionaryListPO request) { + DictionaryRequestValidator.dictionaryRequestValidator(request); + return metaManage.getDictionaryList(request); + } + + @PostMapping("/common/list") + @ApiOperation("通用字典筛选数据返回") + public List commonDictList(@RequestBody ReqDictionaryListPO request) { + DictionaryRequestValidator.dictionaryRequestValidator(request); + return metaManage.commonDictList(request); + } + + @PostMapping("/add/dictionary") + @ApiOperation("添加字典值") + @WebLog("添加字典值") + public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO reqAddDictionaryPO) { + metaManage.addDictionary(reqAddDictionaryPO); + } + + @PostMapping("/remove/dictionary/{dictionaryCode}") + @ApiOperation("删除字典值") + @WebLog("删除字典值") + public void removeDictionary(@PathVariable String dictionaryCode) { + metaManage.removeDictionary(dictionaryCode); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaTagManageController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaTagManageController.java new file mode 100644 index 0000000..a86e1f4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaTagManageController.java @@ -0,0 +1,82 @@ +package com.hz.pm.api.meta.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.meta.manage.MetaManage; +import com.hz.pm.api.meta.model.po.ReqAddTagTypePO; +import com.hz.pm.api.meta.model.po.ReqTagListPO; +import com.hz.pm.api.meta.model.po.ReqTagQueryPO; +import com.hz.pm.api.meta.model.vo.ResTagListVO; +import com.hz.pm.api.meta.model.vo.ResTagTreeVO; +import com.hz.pm.api.meta.model.vo.ResTagTypeVO; +import com.hz.pm.api.meta.validate.TagListRequestValidator; +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.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author liuxinxin + * @since 2022-07-21 + */ +@RestController +@Validated +@RequiredArgsConstructor +@RequestMapping("/api/v1/meta") +@Api(value = "MetaController", tags = "基础数据接口") +public class MetaTagManageController { + + /** + * 专家标签的缓存时间设置为5分钟,单位秒 + */ + private static final Long MAX_AGE = 5 * 60L; + /** + * max-age=86400 + */ + private static final String MAX_AGE_STR = "max-age=" + MAX_AGE; + private final MetaManage metaManage; + + @PostMapping("/tag") + @ApiOperation("获取专家标签的树状结构") + public List getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { + response.setHeader("Cache-Control", MAX_AGE_STR); + TagListRequestValidator.tagListRequestValidator(request); + return metaManage.getTagTree(request); + } + + @PostMapping("/tag/query") + @ApiOperation("标签查询接口") + public List tagQuery(@Valid @RequestBody ReqTagQueryPO reqTagQueryPO) { + return metaManage.tagQuery(reqTagQueryPO); + } + + @PostMapping("/tag-tyoe/list") + @ApiOperation("获取标签分类列表") + public List tagTypeList() { + return metaManage.tagTypeList(); + } + + @PostMapping("/add/tag-type") + @ApiOperation("新增标签分类") + @WebLog("新增标签分类") + public void addTagType(@Valid @RequestBody ReqAddTagTypePO request) { + metaManage.addTagType(request); + } + + @PostMapping("/remove/tag/{tagCode}") + @ApiOperation("删除标签") + @WebLog("删除标签") + public void removeTagName(@PathVariable String tagCode) { + metaManage.removeTagName(tagCode); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java new file mode 100644 index 0000000..127d473 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.meta.helper; + + + +import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:03 + */ + +public interface DictionaryCache { + + /** + * 根据字典类型枚举 获取 字典列表 + * + * @param dictionaryType + * @return + */ + List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType); + + /** + * 根据字典类型 获取 字典列表 + * + * @param dictionaryType + * @return + */ + List getDictionaryListByDictionaryType(String dictionaryType); + + /** + * 根据字典类型、字典编码 获取 字典实体 + * + * @param dictionaryType + * @param code + * @return + */ + DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code); + + /** + * 根据字典编码 获取 字典实体 + * + * @param dictionaryCode + * @return + */ + DictionaryDTO getByCode(String dictionaryCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelper.java new file mode 100644 index 0000000..b7e28cb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meta.helper; + +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.meta.model.ExpertRegionInfo; + +/** + * @author liuxinxin + * @date 2023/3/2 上午11:02 + */ + +public interface ExpertUserInfoHelper { + + ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId); + + ExpertRegionInfo getExpertRegionInfo(Long expertUserId); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelperImpl.java new file mode 100644 index 0000000..a787314 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/ExpertUserInfoHelperImpl.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.meta.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.ExpertRegionInfo; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2022/8/30 下午2:17 + * 公共专家相关信息工具类 用于获取专家的一些基础信息 + */ +@Component +@RequiredArgsConstructor +public class ExpertUserInfoHelperImpl implements ExpertUserInfoHelper { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + + /** + * 获取专家 + * + * @param expertUserId + * @return + */ + @Override + public ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId) { + return iExpertUserFullInfoService + .getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class).eq(ExpertUserFullInfo::getUserId, expertUserId)); + } + + /** + * 获取专家层级 + * + * @param expertUserId + * @return + */ + @Override + public ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { + ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); + + Integer regionLevel = one.getRegionLevel(); + String regionCode = one.getRegionCode(); + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(regionCode); + expertRegionInfo.setRegionLevel(regionLevel); + return expertRegionInfo; + } + +// /** +// * 专家是否已经出库 +// */ +// public Boolean isDelivery(Long expertUserId) { +// ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); +// if (Objects.isNull(one)) { +// return true; +// } +// return ExpertAccountStatusEnum.DELIVERY.getKey().equals(one.getExpertAccountStatus()); +// } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/TagCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/TagCache.java new file mode 100644 index 0000000..7512ec2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/TagCache.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.meta.helper; + + +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; + +import java.util.List; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:56 + */ + +public interface TagCache { + + /** + * @param level 最多几级标签 + * @param rootTagCode 根标签类型及对应的字段类型 + * @return + */ + TagTreeDTO getTagTreeDTO(int level, String rootTagCode); + + /** + * 根据标签编码获取 实体类 + * + * @param tagCode + * @return + */ + TagDTO getByTagCode(String tagCode); + + /** + * 导入原专家库数据使用 + * + * @return + */ + Map getNameTagDtoMap(); + + /** + * 获取所有子节点包含当前节点 + * + * @param code 标签编码 + * @return + */ + List listChildren(String code); + + /** + * 获取所有子节点包含当前节点的编码 + * + * @param code 标签编码 + * @return + */ + List listChildrenCodes(String code); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java new file mode 100644 index 0000000..e6fc232 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.meta.helper.basic; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.service.IMetaDictionaryService; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:03 + */ +public abstract class AbstractDictionaryCache implements InitializingBean, DictionaryCache { + + @Autowired + private IMetaDictionaryService iMetaDictionaryService; + + protected Map dictionaryMap = new ConcurrentHashMap<>(); + protected LoadingCache> dictionaryCacheHelper; + + @Override + public void afterPropertiesSet() { + dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) + .refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { + List dictionaryDTOList = iMetaDictionaryService.queryAll(); + dictionaryMap = buildCateMap(dictionaryDTOList); + Map> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); + return dictionaryTypeListMap.get(key); + }); + warmUp(); + } + + private Map buildCateMap(List dictionaryDTOList) { + Map dictionaryDtoMap = new ConcurrentHashMap<>(128); + dictionaryDTOList.forEach(dictionaryDTO -> dictionaryDtoMap.put(dictionaryDTO.getDictionaryCode(), dictionaryDTO)); + return dictionaryDtoMap; + } + + private void warmUp() { + for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { + dictionaryCacheHelper.get(typeEnum.getKey()); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java new file mode 100644 index 0000000..5fc7f1a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.meta.helper.basic; + +import cn.hutool.core.lang.Assert; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.hz.pm.api.meta.assembler.MetaTagAssembler; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; +import com.hz.pm.api.meta.service.IMetaTagService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:56 + */ +public abstract class AbstractTagsCache implements InitializingBean, TagCache { + + protected static final int MAX_LEVEL = 4; + + @Autowired + private IMetaTagService iMetaTagService; + + protected LoadingCache> tagsCache; + + protected Map tagDtoMap; + + @Override + public void afterPropertiesSet() { + tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) + .refreshAfterWrite(5, TimeUnit.MINUTES) + .build(key -> { + // 查询全部 + List tagDTOList = iMetaTagService.queryAll(); + Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); + tagDtoMap = buildCateMap(tagDTOList); + List tagInLevel = tagDTOList.stream().filter(tagDto -> { + // 只过滤出小于等于level的tag + if (Objects.isNull(tagDto.getTagLevel())) { + return false; + } + return Integer.parseInt(key) >= tagDto.getTagLevel(); + }).collect(Collectors.toList()); + List treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); + return toTreeStructure(treeDtos); + }); + warmUp(); + } + + private Map buildCateMap(List tagDTOList) { + Map tagDtoMapTemp = new ConcurrentHashMap<>(1024); + tagDTOList.forEach(tagDTO -> tagDtoMapTemp.put(tagDTO.getTagCode(), tagDTO)); + return tagDtoMapTemp; + } + + private List toTreeStructure(List rootList) { + List nodeList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : rootList) { + if ("-1".equals(tagTreeDTO.getParentCode()) || Objects.isNull(tagTreeDTO.getParentCode())) { + nodeList.add(tagTreeDTO); + } + tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), rootList)); + } + return nodeList; + } + + public void warmUp() { + for (int level = 1; level <= MAX_LEVEL; level++) { + tagsCache.get(level + ""); + } + } + + protected List getChildren(String tagCode, List list) { + List childList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : list) { + if (tagCode.equals(tagTreeDTO.getParentCode())) { + childList.add(tagTreeDTO); + } + } + for (TagTreeDTO tagTreeDTO : childList) { + tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), list)); + } + if (CollectionUtils.isEmpty(childList)) { + return Collections.emptyList(); + } + return childList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java new file mode 100644 index 0000000..89c4870 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.meta.helper.impl; + +import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.helper.basic.AbstractDictionaryCache; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:47 + */ +@Component +public class DictionaryCacheImpl extends AbstractDictionaryCache { + + @Override + public List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { + return dictionaryCacheHelper.get(dictionaryType.getKey()); + } + + @Override + public List getDictionaryListByDictionaryType(String dictionaryType) { + return dictionaryCacheHelper.get(dictionaryType); + } + + @Override + public DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code) { + return Objects.requireNonNull(dictionaryCacheHelper.get(dictionaryType.getKey())) + .stream().filter(w -> w.getDictionaryCode().equals(code)) + .findFirst().orElse(null); + } + + @Override + public DictionaryDTO getByCode(String dictionaryCode) { + return dictionaryMap.get(dictionaryCode); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java new file mode 100644 index 0000000..1019aac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java @@ -0,0 +1,109 @@ +package com.hz.pm.api.meta.helper.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.meta.helper.basic.AbstractTagsCache; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; +import io.micrometer.core.instrument.util.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:51 + * 标签树 + */ +@Slf4j +@Component +public class TagsCacheImpl extends AbstractTagsCache { + + @Override + public TagTreeDTO getTagTreeDTO(int level, String rootTagCode) { + List tagTreeDtos = tagsCache.get(level + ""); + for (TagTreeDTO tagTreeDTO : tagTreeDtos) { + if (tagTreeDTO.getTagCode().equals(rootTagCode)) { + return tagTreeDTO; + } + } + throw new BizException("rootTagCode not exist"); + } + + @Override + public TagDTO getByTagCode(String tagCode) { + if (StringUtils.isBlank(tagCode)) { + return null; + } + return tagDtoMap.get(tagCode); + } + + /** + * 导入原专家库数据使用 + * + * @return + */ + @Override + public Map getNameTagDtoMap() { + Map nameTagDtoMap = new HashMap<>(1024); + for (String key : tagDtoMap.keySet()) { + nameTagDtoMap.put(tagDtoMap.get(key).getTagName(), tagDtoMap.get(key)); + } + return nameTagDtoMap; + } + + + /** + * 获取所有子节点包含当前节点 + * + * @param code 标签编码 + * @return java.util.List + * @author WendyYang + **/ + @Override + public List listChildren(String code) { + List allTree = tagsCache.get(String.valueOf(MAX_LEVEL)); + assert allTree != null; + List children = getChildren(code, allTree); + TagDTO tagDTO = tagDtoMap.get(code); + TagTreeDTO rootNode = BeanUtil.copyProperties(tagDTO, TagTreeDTO.class); + rootNode.setChildren(children); + return treeToList(rootNode); + } + + /** + * 获取所有子节点包含当前节点的编码 + * + * @param code 标签编码 + * @return java.util.List + * @author WendyYang + **/ + @Override + public List listChildrenCodes(String code) { + return CollUtils.fieldList(listChildren(code), TagTreeDTO::getTagCode); + } + + /** + * tree -> list + * + * @param tagTreeDTO 树节点 + * @return java.util.List + * @author WendyYang + **/ + private List treeToList(TagTreeDTO tagTreeDTO) { + List result = new ArrayList<>(); + result.add(tagTreeDTO); + if (tagTreeDTO.getChildren() != null && !tagTreeDTO.getChildren().isEmpty()) { + tagTreeDTO.getChildren().forEach(node -> { + result.addAll(treeToList(node)); + }); + } + return result; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java new file mode 100644 index 0000000..b207a53 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java @@ -0,0 +1,283 @@ +package com.hz.pm.api.meta.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.enumeration.BoolDisplayEnum; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; +import com.hz.pm.api.meta.assembler.MetaTagAssembler; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.constant.TagConst; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.hz.pm.api.meta.model.entity.MetaTag; +import com.hz.pm.api.meta.model.po.*; +import com.hz.pm.api.meta.model.vo.*; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.meta.service.IExpertTagService; +import com.hz.pm.api.meta.service.IMetaDictionaryService; +import com.hz.pm.api.meta.service.IMetaTagService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/22 下午2:34 + */ +@Component +@RequiredArgsConstructor +public class MetaManage { + + private final DictionaryCache dictionaryCache; + private final TagCache tagCache; + private final IMetaDictionaryService metaDictionaryManageService; + private final IExpertDictionaryService iExpertDictionaryService; + private final IMetaTagService iMetaTagManageService; + private final IExpertTagService iExpertTagService; + + public List getDictionaryList(ReqDictionaryListPO request) { + List dictionaryTypeList = request.getDictionaryTypeList(); + if (CollectionUtils.isEmpty(dictionaryTypeList)) { + dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); + } + + List resDictionaryListVos = new ArrayList<>(); + for (String dictionaryType : dictionaryTypeList) { + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(dictionaryType); + List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List resDictionaryVOList = dictionaryList.stream() + .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + resDictionaryListVos.add(resDictionaryListVO); + } + return resDictionaryListVos; + } + + public List commonDictList(ReqDictionaryListPO request) { + List result = new ArrayList<>(); + if (request.getAllDict()) { + Map> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); + groupByType.forEach((k, v) -> { + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(k); + List resDictionaryVOList = v.stream() + .map(w -> { + ResDictionaryVO vo = new ResDictionaryVO(); + vo.setDescribe(w.getDictionaryDescribe()); + vo.setDictionaryCode(w.getDictionaryCode()); + vo.setDictionaryType(w.getDictionaryType()); + vo.setName(w.getDictionaryName()); + vo.setReadonly(w.getReadonly()); + vo.setSortValue(w.getSortValue()); + return vo; + }).collect(Collectors.toList()); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + result.add(resDictionaryListVO); + }); + } else { + List dictionaryTypeList = request.getDictionaryTypeList(); + for (String dictionaryType : dictionaryTypeList) { + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(dictionaryType); + List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List resDictionaryVOList = dictionaryList.stream() + .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + result.add(resDictionaryListVO); + } + } + return result; + } + + public List getTagTree(ReqTagListPO request) { + List rootTagCodeList = request.getRootTagCodeList(); + if (CollectionUtils.isEmpty(rootTagCodeList)) { + rootTagCodeList = ExpertTagEnum.getAll(); + } + List tagTreeDTOList = new ArrayList<>(); + for (String rootTagCode : rootTagCodeList) { + TagTreeDTO tagTreeDTO = tagCache.getTagTreeDTO(4, rootTagCode); + if (Objects.nonNull(tagTreeDTO)) { + tagTreeDTOList.add(tagTreeDTO); + } + } + return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); + } + + + /** + * 专家管理员才能调用 + * + * @param reqAddDictionaryPO + */ + @Transactional(rollbackFor = Exception.class) + public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { + String dictionaryType = reqAddDictionaryPO.getDictionaryType(); + boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); + if (!contains) { + throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); + } + String name = reqAddDictionaryPO.getName(); + Integer sortValue = reqAddDictionaryPO.getSortValue(); + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); + List dictionaryManageList = metaDictionaryManageService.list(eq); + + MetaDictionary saveRecord = new MetaDictionary(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setDictionaryName(name); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDictionaryCode(BizUtils.uuid32()); + saveRecord.setDictionaryType(dictionaryType); + saveRecord.setReadonly(BoolDisplayEnum.N.name()); + saveRecord.setSortValue(sortValue); + + List saveRecordList = new ArrayList<>(); + saveRecordList.add(saveRecord); + for (MetaDictionary metaDictionary : dictionaryManageList) { + if (metaDictionary.getSortValue() >= sortValue) { + metaDictionary.setSortValue(metaDictionary.getSortValue() + 1); + } + saveRecordList.add(metaDictionary); + } + boolean remove = metaDictionaryManageService + .remove(Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType)); + if (remove) { + metaDictionaryManageService.saveBatch(saveRecordList); + } + } + + public void removeDictionary(String dictionaryCode) { + LambdaUpdateWrapper eq = Wrappers.lambdaUpdate(MetaDictionary.class) + .eq(MetaDictionary::getDictionaryCode, dictionaryCode); + MetaDictionary one = metaDictionaryManageService.getOne(eq); + if (Objects.isNull(one)) { + throw BizException.wrap("字典值不存在"); + } + if (BoolDisplayEnum.judgeBoolean(one.getReadonly())) { + throw BizException.wrap("内置字典值无法删除"); + } + List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getDictionaryCode, dictionaryCode)); + if (CollUtil.isNotEmpty(expertDictionaryList)) { + throw BizException.wrap("该字典值已被使用无法删除"); + } + metaDictionaryManageService.removeById(one); + } + + public void addTagType(ReqAddTagTypePO request) { + String tagName = request.getTagName(); + LambdaQueryWrapper in = Wrappers.lambdaQuery(MetaTag.class) + .in(MetaTag::getTagName, tagName) + .in(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); + List list = iMetaTagManageService.list(in); + if (CollectionUtils.isNotEmpty(list)) { + throw BizException.wrap("该标签类型已存在"); + } + MetaTag saveRecord = new MetaTag(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setParentCode(TagConst.TAG_ROOT_PARENT_CODE); + saveRecord.setTagCode(BizUtils.uuid32()); + saveRecord.setTagName(tagName); + saveRecord.setTagLevel(TagConst.TAG_ROOT_LEVEL); + iMetaTagManageService.save(saveRecord); + } + + public void removeTagName(String tagCode) { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(ExpertTag.class) + .eq(ExpertTag::getTagCode, tagCode); + List expertTagList = iExpertTagService.list(eq); + if (CollectionUtils.isNotEmpty(expertTagList)) { + throw BizException.wrap("该标签正在使用无法删除"); + } + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, tagCode); + List list = iMetaTagManageService.list(queryWrapper); + if (CollectionUtils.isNotEmpty(list)) { + throw BizException.wrap("该标签存在子标签无法删除"); + } + LambdaQueryWrapper metaTagManageLambdaQueryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getTagCode, tagCode); + MetaTag one = iMetaTagManageService.getOne(metaTagManageLambdaQueryWrapper); + if (Objects.nonNull(one)) { + iMetaTagManageService.removeById(one); + } + } + + public List tagTypeList() { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); + List list = iMetaTagManageService.list(eq); + return list.stream().map(r -> { + ResTagTypeVO resTagTypeVO = new ResTagTypeVO(); + resTagTypeVO.setTagCode(r.getTagCode()); + resTagTypeVO.setTagLevel(r.getTagLevel()); + resTagTypeVO.setTagName(r.getTagName()); + resTagTypeVO.setTagName(r.getTagName()); + return resTagTypeVO; + }).collect(Collectors.toList()); + } + + public List tagQuery(ReqTagQueryPO reqTagQueryPO) { + String parentCode = reqTagQueryPO.getParentCode(); + if (StringUtils.isBlank(parentCode)) { + parentCode = TagConst.TAG_ROOT_PARENT_CODE; + } + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class) + .eq(MetaTag::getParentCode, parentCode); + List list = iMetaTagManageService.list(eq); + + List tagCodeList = CollUtils.fieldList(list, MetaTag::getTagCode); + Map> hasChildrenMap = new HashMap<>(16); + Map> useFrequencyMap = new HashMap<>(16); + if (CollectionUtils.isNotEmpty(tagCodeList)) { + List childrenMetaTagList = iMetaTagManageService.list(Wrappers.lambdaQuery(MetaTag.class) + .in(MetaTag::getParentCode, tagCodeList)); + hasChildrenMap = CollUtils.group(childrenMetaTagList, MetaTag::getParentCode); + + List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getTagCode, tagCodeList)); + useFrequencyMap = CollUtils.group(expertTagList, ExpertTag::getTagCode); + } + + Map> finalHasChildrenMap = hasChildrenMap; + Map> finalUseFrequencyMap = useFrequencyMap; + return list.stream().map(r -> { + ResTagListVO resTagListVO = new ResTagListVO(); + resTagListVO.setCreateTime(r.getCreateOn()); + resTagListVO.setCreator(TagConst.TAG_CREATOR); + resTagListVO.setTagLevel(r.getTagLevel()); + resTagListVO.setTagCode(r.getTagCode()); + resTagListVO.setTagName(r.getTagName()); + List metaTagManages = finalHasChildrenMap.get(r.getTagCode()); + if (CollUtil.isNotEmpty(metaTagManages)) { + resTagListVO.setIsLeaf(false); + resTagListVO.setHasChildren(true); + } else { + resTagListVO.setIsLeaf(true); + resTagListVO.setHasChildren(false); + } + long useFrequency = 0; + List expertTagList = finalUseFrequencyMap.get(r.getTagCode()); + if (CollUtil.isNotEmpty(expertTagList)) { + useFrequency = expertTagList.size(); + } + resTagListVO.setUseFrequency(useFrequency); + return resTagListVO; + }).collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.java new file mode 100644 index 0000000..e5dec9f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meta.mapper; + +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertDictionaryMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.xml new file mode 100644 index 0000000..f86db15 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.java new file mode 100644 index 0000000..c126c1a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meta.mapper; + +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertTagMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.xml new file mode 100644 index 0000000..9b9a982 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/ExpertTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.java new file mode 100644 index 0000000..31c6640 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meta.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.meta.model.entity.MetaDictionary; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaDictionaryMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.xml new file mode 100644 index 0000000..d76be24 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.java new file mode 100644 index 0000000..84082d2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.meta.mapper; + +import com.hz.pm.api.meta.model.entity.MetaTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaTagMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.xml new file mode 100644 index 0000000..00729b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/mapper/MetaTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/ExpertRegionInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/ExpertRegionInfo.java new file mode 100644 index 0000000..4e1afb8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/ExpertRegionInfo.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meta.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:43 + */ +@Data +@ApiModel("专家区域信息") +public class ExpertRegionInfo { + + /** + * 区域编码 + */ + @NotBlank + @ApiModelProperty("区域编码") + private String regionCode; + + /** + * 区域级别 + */ + @NotBlank + @ApiModelProperty("区域级别") + private Integer regionLevel; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/bo/RegionContainsBO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/bo/RegionContainsBO.java new file mode 100644 index 0000000..d15e952 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/bo/RegionContainsBO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.meta.model.bo; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午4:48 + */ +@Data +public class RegionContainsBO { + + /** + * 最高级节点级别 + */ + private Integer parentRegionTreeLevel; + + /** + * 所有区域码列表 + */ + private List containsRegionCodeList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java new file mode 100644 index 0000000..07252a8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.meta.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:49 + */ +@Data +public class DictionaryDTO { + + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + private String dictionaryCode; + + /** + * 名称 + */ + private String name; + + /** + * 描述 + */ + private String describe; + + /** + * 排序 + */ + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + private String readonly; + +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagDTO.java new file mode 100644 index 0000000..6843691 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.meta.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:53 + */ +@Data +public class TagDTO { + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + private String tagCode; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 标签级别 + */ + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + private String parentCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagTreeDTO.java new file mode 100644 index 0000000..bc9a185 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/TagTreeDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.meta.model.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:53 + */ +@Data +public class TagTreeDTO { + + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + private String tagCode; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 标签级别 + */ + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + private String parentCode; + + + private List children; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertDictionary.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertDictionary.java new file mode 100644 index 0000000..5931eb2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertDictionary.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("expert_dictionary") +@ApiModel(value = "ExpertDictionary对象", description = "") +public class ExpertDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryCode; + + private String expertInfoField; + + private Long userId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertTag.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertTag.java new file mode 100644 index 0000000..d2f45b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/ExpertTag.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("expert_tag") +@Data +@ApiModel(value = "ExpertTag对象", description = "") +public class ExpertTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String tagCode; + + private String expertInfoField; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaDictionary.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaDictionary.java new file mode 100644 index 0000000..e7d2b87 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaDictionary.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.meta.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 lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_dictionary") +@ApiModel(value = "MetaDictionary对象", description = "") +public class MetaDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryType; + + private String dictionaryCode; + + private String dictionaryName; + + private String dictionaryDescribe; + + private Integer sortValue; + + private Long createBy; + + private String readonly; + + private Long updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaTag.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaTag.java new file mode 100644 index 0000000..b48cd06 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/entity/MetaTag.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_tag") +@ApiModel(value = "MetaTag对象", description = "") +public class MetaTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String tagName; + + private Long tagLevel; + + private String parentCode; + + private String tagType; + + private String tagCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddDictionaryPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddDictionaryPO.java new file mode 100644 index 0000000..647fc5c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddDictionaryPO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/8/25 上午11:10 + */ +@Data +@ApiModel("新增字典值") +public class ReqAddDictionaryPO { + + @ApiModelProperty(value = "字典类型") + @NotBlank + private String dictionaryType; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotBlank + private String name; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + @NotNull + private Integer sortValue; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddTagTypePO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddTagTypePO.java new file mode 100644 index 0000000..bfb0f4b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqAddTagTypePO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/8/27 上午10:17 + */ +@ApiModel(description = "新增标签分类") +@Data +public class ReqAddTagTypePO { + + @ApiModelProperty("标签分类名") + @NotBlank + private String tagName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqDictionaryListPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqDictionaryListPO.java new file mode 100644 index 0000000..1a652c8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqDictionaryListPO.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:05 + */ +@Data +public class ReqDictionaryListPO { + + private List dictionaryTypeList; + + private Boolean allDict = false; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagListPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagListPO.java new file mode 100644 index 0000000..1a497c3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagListPO.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:43 + */ +@Data +public class ReqTagListPO { + private List rootTagCodeList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagQueryPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagQueryPO.java new file mode 100644 index 0000000..cac348f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/po/ReqTagQueryPO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:30 + */ +@Data +@ApiModel(description = "标签查询request") +public class ReqTagQueryPO { +// +// @ApiModelProperty("标签类型") +// private Long tagType; +// +// @ApiModelProperty("标签名") +// private String tagName; + + @ApiModelProperty("父级标签编码") + private String parentCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryListVO.java new file mode 100644 index 0000000..01ccc36 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryListVO.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:13 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") +public class ResDictionaryListVO { + + @ApiModelProperty(value = "字典名称") + private String dictionaryName; + + @ApiModelProperty(value = "字典选项名称") + private List dictionaryList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryVO.java new file mode 100644 index 0000000..a908887 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResDictionaryVO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午11:26 + */ +@Data +@ApiModel(value = "DictionaryListVO", description = "字典结构VO") +public class ResDictionaryVO { + + + @ApiModelProperty(value = "字典类型") + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + @ApiModelProperty(value = "编码") + private String dictionaryCode; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + @ApiModelProperty(value = "是否内置,内置不可删除") + private String readonly; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagListVO.java new file mode 100644 index 0000000..621c8ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagListVO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:35 + */ +@Data +@ApiModel(description = "标签列表展示") +public class ResTagListVO { + + @ApiModelProperty(value = "标签 编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + @ApiModelProperty(value = "使用频次") + private Long useFrequency; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "创建人") + private String creator; + + @ApiModelProperty(value = "是否为叶子节点") + private Boolean isLeaf; + + @ApiModelProperty(value = "是否有子集") + private Boolean hasChildren; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTreeVO.java new file mode 100644 index 0000000..51e1166 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTreeVO.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:27 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") +public class ResTagTreeVO { + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + @ApiModelProperty(value = " * 标签 编码\n" + + " * 根标签\u2028擅长方向 good_at\n" + + " * 技术专长 technical_expertise\n" + + " * 行业领域 industry_sector\n" + + " * 其他 other") + private String tagCode; + + /** + * 标签名称 + */ + @ApiModelProperty(value = "标签名称") + private String tagName; + + /** + * 标签级别 + */ + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + @ApiModelProperty(value = " * 标签父级id\n" + + " * 当parent_tag_code 为 -1 时为顶级标签") + private String parentCode; + + @ApiModelProperty(value = "子节点标签") + private List children; + + @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") + private String unionCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTypeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTypeVO.java new file mode 100644 index 0000000..5c862ea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/vo/ResTagTypeVO.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:20 + */ +@Data +@ApiModel(description = "标签类型VO") +public class ResTagTypeVO { + + @ApiModelProperty(value = "标签编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java new file mode 100644 index 0000000..536da40 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.meta.service; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertDictionaryService extends IService { + + + /** + * 根据专家ID批量查询专家字典信息 + * + * @param userIds 专家ID + * @param dictType 专家字典类型 + * @return / + * @author WendyYang + **/ + List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType); + + default void removeByUserId(Long userId) { + this.remove(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertTagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertTagService.java new file mode 100644 index 0000000..887d983 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertTagService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meta.service; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meta.model.entity.ExpertTag; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertTagService extends IService { + + default void removeByUserId(Long userId) { + remove(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java new file mode 100644 index 0000000..d1556d7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.meta.service; + +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaDictionaryService extends IService { + + List queryAll(); + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaTagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaTagService.java new file mode 100644 index 0000000..74eb54f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaTagService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.meta.service; + +import com.hz.pm.api.meta.model.entity.MetaTag; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.meta.model.dto.TagDTO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaTagService extends IService { + + List queryAll(); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java new file mode 100644 index 0000000..7f04708 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.meta.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.mapper.ExpertDictionaryMapper; +import com.hz.pm.api.meta.model.entity.ExpertDictionary; +import com.hz.pm.api.meta.service.IExpertDictionaryService; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { + + @Override + public List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType) { + // 获取专家职称 + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIds) + .eq(ExpertDictionary::getExpertInfoField, dictType.getKey()); + return list(query); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertTagServiceImpl.java new file mode 100644 index 0000000..fcbdd78 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertTagServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.meta.service.impl; + +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.mapper.ExpertTagMapper; +import com.hz.pm.api.meta.service.IExpertTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertTagServiceImpl extends ServiceImpl implements IExpertTagService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java new file mode 100644 index 0000000..b0ef27a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.meta.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; +import com.hz.pm.api.meta.service.IMetaDictionaryService; +import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; +import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { + + @Override + public List queryAll() { + List dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list(); + List dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); + return dictionaryDTOList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java new file mode 100644 index 0000000..70852c0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.meta.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.meta.assembler.MetaTagAssembler; +import com.hz.pm.api.meta.model.entity.MetaTag; +import com.hz.pm.api.meta.mapper.MetaTagMapper; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.service.IMetaTagService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaTagServiceImpl extends ServiceImpl implements IMetaTagService { + + + @Override + public List queryAll() { + List allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); + List allTagDTOList = allTags.stream().map(MetaTagAssembler::toTagDTO).collect(Collectors.toList()); + return allTagDTOList; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictionaryRequestValidator.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictionaryRequestValidator.java new file mode 100644 index 0000000..732fccd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictionaryRequestValidator.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.meta.validate; + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.model.po.ReqDictionaryListPO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:15 + */ + +public class DictionaryRequestValidator { + + public static void dictionaryRequestValidator(ReqDictionaryListPO reqDictionaryListPO) { + List dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList(); + if (CollectionUtils.isNotEmpty(dictionaryTypeList)) { + for (String dictionaryType : dictionaryTypeList) { + if (!DictExpertInfoTypeEnum.contains(dictionaryType)) { + throw new BizException("Illegal dictionaryType: " + dictionaryType); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/TagListRequestValidator.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/TagListRequestValidator.java new file mode 100644 index 0000000..20a7444 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/TagListRequestValidator.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.meta.validate; + + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.meta.constant.ExpertTagEnum; +import com.hz.pm.api.meta.model.po.ReqTagListPO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:44 + */ + +public class TagListRequestValidator { + + private TagListRequestValidator() { + } + + public static void tagListRequestValidator(ReqTagListPO request) { + List rootTagCodeList = request.getRootTagCodeList(); + if (CollectionUtils.isNotEmpty(rootTagCodeList)) { + for (String rootTagCode : rootTagCodeList) { + if (!ExpertTagEnum.contains(rootTagCode)) { + throw new BizException("Illegal rootTagCode:" + rootTagCode); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/constants/ProcDefContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/constants/ProcDefContant.java new file mode 100644 index 0000000..2c379af --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/constants/ProcDefContant.java @@ -0,0 +1,13 @@ +package com.hz.pm.api.organization.constants; + +/** + * @Classname ProcDefContant + * @Description + * @Date 2023/7/11 9:35 + * @Author PoffyZhang + */ +public interface ProcDefContant { + + public final static String MODELS_ID_PREFIX = "pd"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/DingOrganizationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/DingOrganizationController.java new file mode 100644 index 0000000..1b0178c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/DingOrganizationController.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.organization.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.organization.manage.OrganizationManage; +import com.hz.pm.api.organization.model.po.ReqOrganizationListPO; +import com.hz.pm.api.organization.model.po.ReqSynthesizePO; +import com.hz.pm.api.organization.model.vo.KeyTreeVO; +import com.hz.pm.api.organization.model.vo.OrganizationTreeVO; +import com.hz.pm.api.organization.model.vo.ResOrganizationListVO; +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 javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author Lierbao + * @since 2023-02-09 + */ + +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@Api(value = "DingOrganizationController", tags = "单位管理") +@RequestMapping("/api/v1/organization") +public class DingOrganizationController { + + private final OrganizationManage organizationManage; + + @ApiOperation("单位列表筛选") + @PostMapping("/list") + public PageVo organizationList(@Valid @RequestBody ReqOrganizationListPO reqOrganizationListPO) { + return organizationManage.organizationList(reqOrganizationListPO); + } + + @PostMapping("/get-child-list") + @ApiOperation("获取组织架构的树状结构(单位筛选列表)") + public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode, @RequestParam(value = "orgName", required = false) String orgName) { + return organizationManage.getChildOrganizationList(parentCode, orgName, false); + } + + @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") + @PostMapping("/tree-list") + public List treeVOList(@Valid @RequestBody ReqSynthesizePO request) { + return organizationManage.treeRubbishVOList(request); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java new file mode 100644 index 0000000..7b4b123 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.organization.controller; + + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.organization.manage.GovBusinessStripManage; +import com.hz.pm.api.organization.model.vo.GovBusinessStripTreeVO; +import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +@Controller +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@Api(value = "GovBusinessStripController", tags = "条线管理") +@RequestMapping("/api/v1/gov-business-strip") +public class GovBusinessStripController { + + private final GovBusinessStripManage govBusinessStripManage; + + @GetMapping("/get-child-list") + @ApiOperation("获取条线标签的的树状结构") + public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) { + return govBusinessStripManage.getChildOrganizationList(parentCode); + } + + + @GetMapping("/list") + @ApiOperation("获取省局条线列表") + public List getProvincialGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) { + return govBusinessStripManage.getProvincialGovBusinessStripList(businessStripName); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/MetaOrganizationLineTagController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/MetaOrganizationLineTagController.java new file mode 100644 index 0000000..30b8e98 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/MetaOrganizationLineTagController.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.organization.controller; + + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +@Controller +@RequestMapping("/pmapi.organization/meta-organization-line-tag") +public class MetaOrganizationLineTagController { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationMainManageTagController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationMainManageTagController.java new file mode 100644 index 0000000..faf0d80 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationMainManageTagController.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.organization.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@Controller +@RequestMapping("/pmapi.organization/organization-main-manage-tag") +public class OrganizationMainManageTagController { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationTagController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationTagController.java new file mode 100644 index 0000000..00caad4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/OrganizationTagController.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.organization.controller; + + +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-03-06 + */ +@RestController +@Api(tags = "组织标签(条线标签)") +@RequestMapping("/api/v1/organization-tag") +public class OrganizationTagController { + +// @PostMapping("条线单位") +// private + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java new file mode 100644 index 0000000..47a875b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java @@ -0,0 +1,86 @@ +package com.hz.pm.api.organization.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.organization.manage.ProcDefManage; +import com.wflow.bean.dto.WflowOrgProcdefDto; +import com.wflow.bean.vo.OrgProcdefVo; +import com.wflow.service.OrgProcdefService; +import com.wflow.workflow.service.OrgProcessModelService; +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.*; + +/** + * @Classname OrganizationProcessController + * @Description + * @Date 2023/1/13 11:13 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/organization/procdef") +@Api(value = "OrganizationProcdef", tags = "单位配置-流程配置") +@RequiredArgsConstructor +public class ProcDefController { + + private final OrgProcdefService orgProcdefService; + + private final OrgProcessModelService orgProcessModelService; + + private final ProcDefManage procDefManage; + + @ApiOperation(value = "单位流程配置列表", notes = "单位流程配置列表") + @GetMapping("/list") + public PageVo list(@RequestParam String orgCode, @RequestParam(defaultValue = "1") Integer pageNumber, + @RequestParam(defaultValue = "10") Integer pageSize) { + return orgProcdefService.getOrgProcessByOrgCode(orgCode, pageNumber, pageSize); + } + + @ApiOperation(value = "单位流程配置详情", notes = "单位流程配置详情") + @GetMapping("/detail/{processDefId}") + public OrgProcdefVo detail(@PathVariable String processDefId) { + return orgProcessModelService.getProcess(processDefId); + } + + @ApiOperation(value = "单位流程配置保存", notes = "单位流程配置保存") + @PostMapping("/save") + @WebLog("单位流程配置保存") + public String save(@Validated @RequestBody WflowOrgProcdefDto wflowOrgProcdefDto) { + return orgProcessModelService.saveProcessLs(wflowOrgProcdefDto); + } + + @ApiOperation(value = "单位流程配置启用", notes = "单位流程配置启用") + @PutMapping("/enable/{processDefId}") + @WebLog("单位流程配置启用") + public String enableProcess(@PathVariable String processDefId) { + orgProcessModelService.enableProcess(processDefId, Boolean.FALSE); + return "启用成功"; + } + + @ApiOperation(value = "单位流程配置禁用", notes = "单位流程配置禁用") + @PutMapping("/disable/{processDefId}") + @WebLog("单位流程配置禁用") + public String disableProcess(@PathVariable String processDefId) { + orgProcessModelService.enableProcess(processDefId, Boolean.TRUE); + return "禁用成功"; + } + + @ApiOperation(value = "单位流程配置部署", notes = "单位流程配置部署") + @PostMapping("/deploy/{processDefId}") + @WebLog("单位流程配置部署") + public String deploy(@Validated @PathVariable String processDefId) { + return orgProcessModelService.deployProcessLs(processDefId, null); + } + + @ApiOperation(value = "单位流程配置删除", notes = "单位流程配置删除") + @PostMapping("/delete/{processDefId}") + @WebLog("单位流程配置删除") + public Boolean delete(@PathVariable String processDefId) { + return orgProcessModelService.delProcess(processDefId); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/GovBusinessStrip.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/GovBusinessStrip.java new file mode 100644 index 0000000..8709cf3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/GovBusinessStrip.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.organization.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +@TableName("gov_business_strip") +@Data +@ApiModel(value = "GovBusinessStrip对象", description = "") +public class GovBusinessStrip implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 条线code + */ + private String businessStripCode; + + /** + * 条线名称 + */ + private String businessStripName; + + /** + * 父级条线code + */ + private String parentCode; + + /** + * 父级条线名称 + */ + private String parentName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/OrganizationMainManageTag.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/OrganizationMainManageTag.java new file mode 100644 index 0000000..cf0000f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/entity/OrganizationMainManageTag.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.organization.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@TableName("organization_main_manage_tag") +@ApiModel(value = "OrganizationMainManageTag对象", description = "") +public class OrganizationMainManageTag implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + + private String organizationCode; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public LocalDateTime getCreateOn() { + return createOn; + } + + public void setCreateOn(LocalDateTime createOn) { + this.createOn = createOn; + } + public LocalDateTime getUpdateOn() { + return updateOn; + } + + public void setUpdateOn(LocalDateTime updateOn) { + this.updateOn = updateOn; + } + public Long getCreateBy() { + return createBy; + } + + public void setCreateBy(Long createBy) { + this.createBy = createBy; + } + public Long getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Long updateBy) { + this.updateBy = updateBy; + } + public String getOrganizationCode() { + return organizationCode; + } + + public void setOrganizationCode(String organizationCode) { + this.organizationCode = organizationCode; + } + + @Override + public String toString() { + return "OrganizationMainManageTag{" + + "id=" + id + + ", createOn=" + createOn + + ", updateOn=" + updateOn + + ", createBy=" + createBy + + ", updateBy=" + updateBy + + ", organizationCode=" + organizationCode + + "}"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/GovBusinessStripHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/GovBusinessStripHelper.java new file mode 100644 index 0000000..5bc559c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/GovBusinessStripHelper.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.organization.helper; + +import com.hz.pm.api.organization.model.entity.DingOrganization; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/3/8 下午3:23 + */ + +public interface GovBusinessStripHelper { + + /** + * 获取上级条线单位 + * + * @param organizationCode + * @return + */ + List getSupGovBusinessStrip(String organizationCode); + + + /** + * 获取上级主管单位 + * + * @param organizationCode + * @return + */ + DingOrganization getSupMainManageOrganization(String organizationCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java new file mode 100644 index 0000000..890e749 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.organization.helper.impl; + +import com.hz.pm.api.organization.helper.GovBusinessStripHelper; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/3/8 下午3:34 + */ + +@Component +@RequiredArgsConstructor +public class GovBusinessStripHelperImpl implements GovBusinessStripHelper { + + private final IDingOrganizationService organizationService; + + @Override + public List getSupGovBusinessStrip(String organizationCode) { + List supGovBusinessStripList = new ArrayList<>(); + + DingOrganization dingOrganization = organizationService.getByOrgCode(organizationCode); + if (Objects.isNull(dingOrganization)) { + return null; + } + String businessStripCodes = dingOrganization.getBusinessStripCodes(); + if (StringUtils.isNotBlank(businessStripCodes)) { + String[] businessStripCodeList = businessStripCodes.split("|"); + for (String businessStripCode : businessStripCodeList) { + DingOrganization supGovBusinessStrip = getSupGovBusinessStrip(dingOrganization.getOrganizationCode(), businessStripCode); + if (Objects.nonNull(supGovBusinessStrip)) { + supGovBusinessStripList.add(supGovBusinessStrip); + } + } + } + return supGovBusinessStripList; + } + + private DingOrganization getSupGovBusinessStrip(String organizationCode, String businessStripCode) { + String tempParentOrgCode = organizationCode; + + HashSet tempParentOrgCodeSet = new HashSet<>(); + while (true) { + if (StringUtils.isBlank(tempParentOrgCode)) { + return null; + } + // 防止脏数据导致死循环 + if (!tempParentOrgCodeSet.add(tempParentOrgCode)) { + return null; + } + DingOrganization parentOrganization = organizationService.getParentOrganization(tempParentOrgCode); + if (Objects.isNull(parentOrganization)) { + return null; + } + String businessStripCodes = parentOrganization.getBusinessStripCodes(); + if (StringUtils.isNotBlank(businessStripCode) && businessStripCodes.contains(businessStripCode)) { + return parentOrganization; + } + tempParentOrgCode = parentOrganization.getParentCode(); + } + } + + @Override + public DingOrganization getSupMainManageOrganization(String organizationCode) { + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java new file mode 100644 index 0000000..e8fe06c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.organization.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.organization.entity.GovBusinessStrip; +import com.hz.pm.api.organization.model.entity.ProvincialGovBusinessStrip; +import com.hz.pm.api.organization.model.vo.GovBusinessStripTreeVO; +import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; +import com.hz.pm.api.organization.service.IGovBusinessStripService; +import com.hz.pm.api.organization.service.IProvincialGovBusinessStripService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/14 下午4:48 + */ + +@Component +@RequiredArgsConstructor +public class GovBusinessStripManage { + + private final IGovBusinessStripService iGovBusinessStripService; + + private final IProvincialGovBusinessStripService provincialGovBusinessStripService; + + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + @Value("${irs.province-gov.can-search}") + private Boolean canSearch; + + public List getChildOrganizationList(String parentCode) { + if (Objects.isNull(parentCode)) { + parentCode = "-1"; + } + List govBusinessStripList = iGovBusinessStripService.list(Wrappers.lambdaQuery(GovBusinessStrip.class) + .eq(GovBusinessStrip::getParentCode, parentCode)); + + return govBusinessStripList.stream().map(r -> { + GovBusinessStripTreeVO govBusinessStripTreeVO = new GovBusinessStripTreeVO(); + govBusinessStripTreeVO.setBusinessStripCode(r.getBusinessStripCode()); + govBusinessStripTreeVO.setBusinessStripName(r.getBusinessStripName()); + govBusinessStripTreeVO.setParentCode(r.getParentCode()); + govBusinessStripTreeVO.setParentName(r.getParentName()); + return govBusinessStripTreeVO; + }).collect(Collectors.toList()); + } + + public List getProvincialGovBusinessStripList(String businessStripName) { + List strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class) + .like(StringUtils.isNotBlank(businessStripName),ProvincialGovBusinessStrip::getBusinessStripName,businessStripName) + .orderByAsc(ProvincialGovBusinessStrip::getBusinessStripName)); + + if(CollUtil.isEmpty(strips)){ + return Collections.emptyList(); + } + + return strips.stream() + .map(p -> BeanUtil.copyProperties(p,ProvincialGovBusinessStripVO.class)) + .collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java new file mode 100644 index 0000000..5ce0447 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java @@ -0,0 +1,296 @@ +package com.hz.pm.api.organization.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +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.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.config.DingOrganizationProperties; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.model.po.ReqOrganizationListPO; +import com.hz.pm.api.organization.model.po.ReqSynthesizePO; +import com.hz.pm.api.organization.model.vo.KeyTreeVO; +import com.hz.pm.api.organization.model.vo.OrganizationTreeVO; +import com.hz.pm.api.organization.model.vo.ResOrganizationListVO; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/1/13 下午2:55 + */ +@Component +@RequiredArgsConstructor +public class OrganizationManage { + + private final IDingOrganizationService iDingOrganizationService; + + private final DingOrganizationProperties dingOrganizationProperties; + + private final IDingEmployeeInfoService iDingEmployeeInfoService; + + private final RegionCacheHelper regionCacheHelper; + + private final ICompanyFiscalCodeService iCompanyFiscalCodeService; + + public PageVo organizationList(ReqOrganizationListPO reqOrganizationListPO) { + String orgName = reqOrganizationListPO.getOrgName(); + Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit(); + String regionId = reqOrganizationListPO.getRegionId(); + + Page page = iDingOrganizationService + .page(new Page<>(reqOrganizationListPO.getPageNumber(), reqOrganizationListPO.getPageSize()) + , Wrappers.lambdaQuery(DingOrganization.class) + .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) + .eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") + .orderByAsc(DingOrganization::getId) + ); + + long total = page.getTotal(); + List records = page.getRecords(); + List resVOList = new ArrayList<>(); + if (CollUtil.isNotEmpty(records)) { + List organizationCodeList = records.stream().map(DingOrganization::getOrganizationCode) + .distinct().collect(Collectors.toList()); + Map orgFiscalCodeMap = iCompanyFiscalCodeService.getByOrgFiscalCodeMap(organizationCodeList); + + resVOList = records.stream().map(r -> { + ResOrganizationListVO resOrganizationListVO = new ResOrganizationListVO(); + resOrganizationListVO.setOrgCode(r.getOrganizationCode()); + resOrganizationListVO.setOrgName(r.getOrganizationName()); + String divisionCode = r.getDivisionCode(); + if (StringUtils.isNotBlank(divisionCode)) { + RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(divisionCode, 3); + resOrganizationListVO.setRegionId(regionDTO.getRegionCode()); + resOrganizationListVO.setRegionName(regionDTO.getRegionName()); + } + String fiscalCode = orgFiscalCodeMap.get(r.getOrganizationCode()); + resOrganizationListVO.setFiscalCode(fiscalCode); + return resOrganizationListVO; + }).collect(Collectors.toList()); + } + + PageVo pageVo = new PageVo<>(); + pageVo.setTotal(total); + pageVo.setRecords(resVOList); + return pageVo; + } + + public List getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { + List parentCodeList = new ArrayList<>(); + List dingOrganizationList = new ArrayList<>(); + if (StrUtils.isBlank(parentCode)) { + parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); + dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") + .in(DingOrganization::getOrganizationCode, parentCodeList)); + } else { + parentCodeList = CollectionUtil.toList(parentCode); + dingOrganizationList = iDingOrganizationService + .list(Wrappers.lambdaQuery(DingOrganization.class) + .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") + .in(DingOrganization::getParentCode, parentCodeList)); + } + + if (CollectionUtils.isEmpty(dingOrganizationList)) { + return new ArrayList<>(); + } + + dingOrganizationList.sort(Comparator.comparing(DingOrganization::getDisplayOrder)); + return dingOrganizationList.stream().map(r -> { + OrganizationTreeVO treeVO = new OrganizationTreeVO(); + treeVO.setId(r.getId()); + treeVO.setName(r.getOrganizationName()); +// Boolean enabled = "1".equals(r.get()); +// treeVO.setEnabled(enabled); + treeVO.setOrganizationCode(r.getOrganizationCode()); + treeVO.setParentCode(r.getParentCode()); +// treeVO.setSubCount(r.get()); +// Boolean isLeaf = true; +// Long subCount = r.getSubCount(); +// if (Objects.nonNull(subCount) && subCount > 0) { +// isLeaf = false; +// } +// treeVO.setIsLeaf(isLeaf); +// treeVO.setDeptSort(r.getDeptSort()); +// treeVO.setUnionCode(r.getName() + "##" + r.getOrganizationCode()); + return treeVO; + }).collect(Collectors.toList()); + } + + public List treeRubbishVOList(ReqSynthesizePO request) { + String organizationCode = request.getOrganizationCode(); + String organizationName = request.getOrganizationName(); + String employeeName = request.getEmployeeName(); + Boolean onlyUnit = request.getOnlyUnit(); + + // 用户搜索为特殊逻辑 + if (StringUtils.isNotBlank(employeeName)) { + return treeEmployeeQuery(employeeName, organizationCode); + } + + List dingOrganizationList = new ArrayList<>(); + List organizationCodeList = new ArrayList<>(); + if (StringUtils.isNotBlank(organizationName)) { + dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .like(DingOrganization::getOrganizationName, organizationName) + .in(onlyUnit, DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE, + DingOrganizationContant.HOLLOW))); + if (dingOrganizationList.size() == 0) { + return new ArrayList<>(); + } + } else if (StrUtils.isBlank(organizationCode)) { + organizationCodeList = dingOrganizationProperties.getDeptVisibleScopes(); + } else { + organizationCodeList = CollectionUtil.toList(organizationCode); + } + + if (CollectionUtil.isEmpty(dingOrganizationList)) { + dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getOrganizationCode, organizationCodeList) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")); + } + + List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { + KeyTreeVO keyTreeVO = new KeyTreeVO(); + keyTreeVO.setTitle(r.getOrganizationName()); + keyTreeVO.setKey(r.getOrganizationCode()); + keyTreeVO.setType("ORGANIZATION"); + return keyTreeVO; + }).collect(Collectors.toList()); + treeVOList(request.getNeedMember(), orgKeyTreeVOList, onlyUnit); + return orgKeyTreeVOList; + } + + public List treeEmployeeQuery(String employeeName, String organizationCode) { + List parentCodeList = CollUtil.toList(organizationCode).stream() + .filter(StringUtils::isNotBlank) + .collect(Collectors.toList()); + + // 获取所有的组织列表 + List organizationCodeList = new ArrayList<>(); + getChildList(organizationCodeList, parentCodeList); + organizationCodeList = organizationCodeList.stream().distinct().collect(Collectors.toList()); + + List dingEmployeeInfoList = iDingEmployeeInfoService + .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .like(DingEmployeeInfo::getEmployeeName, employeeName) + .eq(DingEmployeeInfo::getMainJob, "true") + .in(CollUtil.isNotEmpty(organizationCodeList), DingEmployeeInfo::getOrganizationCode, organizationCodeList) + ); + List resultOrganizationCodeList = dingEmployeeInfoList.stream() + .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) + .map(DingEmployeeInfo::getOrganizationCode) + .distinct().collect(Collectors.toList()); + + if (CollectionUtil.isEmpty(resultOrganizationCodeList)) { + return new ArrayList<>(); + } + + List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getOrganizationCode, resultOrganizationCodeList)); + + List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { + KeyTreeVO keyTreeVO = new KeyTreeVO(); + keyTreeVO.setTitle(r.getOrganizationName()); + keyTreeVO.setKey(r.getOrganizationCode()); + keyTreeVO.setType("ORGANIZATION"); + return keyTreeVO; + }).collect(Collectors.toList()); + + employeeNameSearcheTreeVOList(orgKeyTreeVOList, dingEmployeeInfoList); + return orgKeyTreeVOList; + } + + private void getChildList(List orgCodeList, List parentCodeList) { + if (CollUtil.isEmpty(parentCodeList)) { + return; + } + orgCodeList.addAll(parentCodeList); +// orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); + + for (String parentCode : parentCodeList) { + List childOrgList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getParentCode, parentCode)); + List newParentCodeList = childOrgList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); + getChildList(orgCodeList, newParentCodeList); + } + } + + private void employeeNameSearcheTreeVOList(List basicOrgKeyTreeVOList, List allDingEmployeeInfoList) { + Map> orgCodeEmployeeMap = allDingEmployeeInfoList.stream() + .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) + .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); + + for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { + String parentCode = basicOrgKeyTreeVO.getKey(); + + List dingEmployeeInfoList = orgCodeEmployeeMap.get(parentCode); + List memberChildren = dingEmployeeInfoList.stream().map(r -> { + KeyTreeVO child = new KeyTreeVO(); + child.setKey(r.getEmployeeCode()); + child.setTitle(r.getEmployeeName()); + child.setType("MEMBER"); + return child; + }).collect(Collectors.toList()); + basicOrgKeyTreeVO.setChildren(memberChildren); + } + } + + + public void treeVOList(Boolean needMember, List basicOrgKeyTreeVOList, Boolean onlyUnit) { + for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { + String parentCode = basicOrgKeyTreeVO.getKey(); + List childOrganizationList = getChildOrganizationList(parentCode, null, onlyUnit); + + List orgKeyTreeVOList = childOrganizationList.stream().map(r -> { + KeyTreeVO keyTreeVO = new KeyTreeVO(); + keyTreeVO.setTitle(r.getName()); + keyTreeVO.setKey(r.getOrganizationCode()); + keyTreeVO.setType("ORGANIZATION"); + return keyTreeVO; + }).collect(Collectors.toList()); + + if (StringUtils.isNotBlank(parentCode) && needMember) { + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); + + List memberChildren = dingEmployeeInfoList.stream().map(r -> { + KeyTreeVO child = new KeyTreeVO(); + child.setKey(r.getEmployeeCode()); + child.setTitle(r.getEmployeeName()); + child.setType("MEMBER"); + return child; + }).collect(Collectors.toList()); + + if (CollUtil.isNotEmpty(memberChildren)) { + orgKeyTreeVOList.addAll(memberChildren); + } + } + basicOrgKeyTreeVO.setChildren(orgKeyTreeVOList); + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/ProcDefManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/ProcDefManage.java new file mode 100644 index 0000000..a1ef89a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/ProcDefManage.java @@ -0,0 +1,166 @@ +package com.hz.pm.api.organization.manage; + +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.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.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; +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; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Classname ProcDefManage + * @Description + * @Date 2023/7/10 17:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class ProcDefManage { + private final IDingOrganizationService organizationService; + + private final OrgProcdefService orgProcdefService; + + private final OrgProcdefHistoryService orgProcdefHistoryService; + + private final ZwddClient zwddClient; + + /** + * 初始化 单位配置 + * @return + */ + public String init() { + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + ))); + + log.info("需要处理初始化单位配置的企业 数量为{}",orgs.size()); + + for(DingOrganization org : orgs){ + log.info("当前是 {}",org.getOrganizationName()); + String orgCode = org.getOrganizationCode(); + + List models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, orgCode)); + + log.info("已经有的单位流程 {}", JSON.toJSONString(models)); + + List types = models.stream().map(WflowOrgModels::getType).collect(Collectors.toList()); + //默认流程 + if(!types.contains(ProcessDefTypeEnum.DEFAULT.name())){ + saveDef(org,ProcessDefTypeEnum.DEFAULT); + } + //盖章流程 + if(!types.contains(ProcessDefTypeEnum.SEAL.name())){ + saveDef(org,ProcessDefTypeEnum.SEAL); + } + //联审流程 + if(!types.contains(ProcessDefTypeEnum.JOINT_REVIEW.name())){ + saveDef(org,ProcessDefTypeEnum.JOINT_REVIEW); + } + } + + return "初始化成功"; + } + + private void saveDef(DingOrganization org,ProcessDefTypeEnum defTypeEnum){ + String procDefId = ProcDefContant.MODELS_ID_PREFIX + IdUtil.objectId(); + WflowOrgModels defaultModel = new WflowOrgModels(); + defaultModel.setProcessDefId(procDefId); + defaultModel.setIsStop(Boolean.FALSE); + defaultModel.setProcess(StrPool.BRACE); + defaultModel.setCreated(LocalDateTime.now()); + defaultModel.setIsDelete(Boolean.FALSE); + defaultModel.setOrgCode(org.getOrganizationCode()); + defaultModel.setOrgName(org.getOrganizationName()); + defaultModel.setProcessDefName(defTypeEnum.getDesc()); + defaultModel.setType(defTypeEnum.name()); + defaultModel.setSort(1); + defaultModel.setVersion(1); + orgProcdefService.save(defaultModel); + + WflowOrgModelHistorys defaultHistory = new WflowOrgModelHistorys(); + defaultHistory.setProcessDefId(procDefId); + defaultHistory.setProcess(StrPool.BRACE); + defaultHistory.setCreated(LocalDateTime.now()); + defaultHistory.setOrgCode(org.getOrganizationCode()); + defaultHistory.setOrgName(org.getOrganizationName()); + defaultHistory.setProcessDefName(defTypeEnum.getDesc()); + defaultHistory.setType(defTypeEnum.name()); + defaultHistory.setVersion(0); + orgProcdefHistoryService.save(defaultHistory); + } + + public String initByArea(String areaCode) { + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + )) + .eq(DingOrganization::getDivisionCode,areaCode)); + + log.info("{}地区 需要处理初始化单位配置的企业 数量为{}",areaCode,orgs.size()); + + for(DingOrganization org : orgs){ + log.info("当前是 {}",org.getOrganizationName()); + String orgCode = org.getOrganizationCode(); + + List models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, orgCode)); + + log.info("已经有的单位流程 {}", JSON.toJSONString(models)); + + List types = models.stream().map(WflowOrgModels::getType).collect(Collectors.toList()); + //默认流程 + if(!types.contains(ProcessDefTypeEnum.DEFAULT.name())){ + saveDef(org,ProcessDefTypeEnum.DEFAULT); + } + //盖章流程 + if(!types.contains(ProcessDefTypeEnum.SEAL.name())){ + saveDef(org,ProcessDefTypeEnum.SEAL); + } + //联审流程 + if(!types.contains(ProcessDefTypeEnum.JOINT_REVIEW.name())){ + saveDef(org,ProcessDefTypeEnum.JOINT_REVIEW); + } + } + + 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/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.java new file mode 100644 index 0000000..056a66d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.mapper; + +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +public interface DingEmployeeInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.xml new file mode 100644 index 0000000..38bba49 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingEmployeeInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.java new file mode 100644 index 0000000..53b258a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.mapper; + +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-09 + */ +public interface DingOrganizationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.xml new file mode 100644 index 0000000..34865ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/DingOrganizationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.java new file mode 100644 index 0000000..866ccd0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.mapper; + +import com.hz.pm.api.organization.entity.GovBusinessStrip; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +public interface GovBusinessStripMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.xml new file mode 100644 index 0000000..459549a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/GovBusinessStripMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.java new file mode 100644 index 0000000..5f0ed38 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.mapper; + +import com.hz.pm.api.organization.entity.OrganizationMainManageTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +public interface OrganizationMainManageTagMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.xml new file mode 100644 index 0000000..cbd17cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/OrganizationMainManageTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.java new file mode 100644 index 0000000..66df76b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.organization.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.organization.model.entity.ProvincialGovBusinessStrip; + +/** + *

+ * Mapper 接口 + *

+ * @author zpf + * @since 2023-06-25 + */ +public interface ProvincialGovBusinessStripMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.xml new file mode 100644 index 0000000..c25cde6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/mapper/ProvincialGovBusinessStripMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingEmployeeInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingEmployeeInfo.java new file mode 100644 index 0000000..4a4e500 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingEmployeeInfo.java @@ -0,0 +1,84 @@ +package com.hz.pm.api.organization.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 Lierbao + * @since 2023-02-11 + */ +@TableName("ding_employee_info") +@Data +@ApiModel(value = "DingEmployeeInfo对象", description = "") +public class DingEmployeeInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + + private String employeeName; + + private String gmtCreate; + + private String empGender; + + private String empPoliticalStatusCode; + + private String empJobLevelCode; + + private String empBudgetedPostCode; + + private String status; + + private String posJobRankCode; + + private String orderInOrganization; + + private String mainJob; + + private String empPosUnitCode; + + private String empPosEmployeeRoleCode; + + private String empPosInnerInstitutionCode; + + private String employeeCode; + + private String jobAttributesCode; + + private String organizationCode; + + private String empPosVirtualOrganizationCode; + + private String empStatus; + + private Long accountId; + + /** + * 绑定系统用户手机号 + */ + private String bindUserMobile; + + @ApiModelProperty("头像") + private String avatar; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingOrganization.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingOrganization.java new file mode 100644 index 0000000..39fd783 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/DingOrganization.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.organization.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 lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-09 + */ +@TableName("ding_organization") +@ApiModel(value = "DingOrganization对象", description = "") +@Data +public class DingOrganization implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String institutionLevelCode; + + private String address; + + private String organizationName; + + private Long displayOrder; + + private String typeName; + + private Integer leaf; + + private LocalDateTime gmtCreate; + + private String typeCode; + + private String divisionCode; + + private String parentName; + + private String parentCode; + + private String organizationCode; + + private String businessStripCodes; + + private String status; + + private String unifiedSocialCreditCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/ProvincialGovBusinessStrip.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/ProvincialGovBusinessStrip.java new file mode 100644 index 0000000..f3e6d0b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/entity/ProvincialGovBusinessStrip.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.organization.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; + +/** + * @author Liuxinxin + * @since 2023-03-08 + */ +@TableName("nd_provincial_gov_business_strip") +@Data +@ApiModel(value = "省级条线实体", description = "省级条线实体") +public class ProvincialGovBusinessStrip { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("条线code") + private String businessStripCode; + + @ApiModelProperty("条线名称") + private String businessStripName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqOrganizationListPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqOrganizationListPO.java new file mode 100644 index 0000000..da473e1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqOrganizationListPO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.organization.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/16 上午11:50 + */ +@Data +@ApiModel("组织列表 请求PO") +public class ReqOrganizationListPO extends PagePo { + + @ApiModelProperty("单位名称") + private String orgName; + + @ApiModelProperty("浙政钉编码") + private String orgCode; + + @ApiModelProperty("所属区域id") + private String regionId; + + @ApiModelProperty("是否为主管单位") + private Boolean isCompetentUnit; + + @ApiModelProperty("是否为上级条线主管单位") + private Boolean isSuperiorLineCompetentUnit; + + @ApiModelProperty("是否只筛选单位") + private Boolean onlyUnit = false; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqSynthesizePO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqSynthesizePO.java new file mode 100644 index 0000000..ad9cb7f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/po/ReqSynthesizePO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.organization.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/3/28 上午10:11 + */ + +@Data +@ApiModel("单位列表综合筛选请求") +public class ReqSynthesizePO { + + @ApiModelProperty("组织code") + private String organizationCode; + + @ApiModelProperty("是否需要组织成员列表") + private Boolean needMember = false; + + @ApiModelProperty("单位名称") + private String organizationName; + + @ApiModelProperty("筛选人员姓名") + private String employeeName; + + @ApiModelProperty("是否只筛选单位") + private Boolean onlyUnit = false; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/GovBusinessStripTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/GovBusinessStripTreeVO.java new file mode 100644 index 0000000..1852a21 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/GovBusinessStripTreeVO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author Liuxinxin + * @since 2023-03-08 + */ +@Data +@ApiModel(value = "条线树形 responseVO", description = "") +public class GovBusinessStripTreeVO { + + private Long id; + + @ApiModelProperty("条线code") + private String businessStripCode; + + @ApiModelProperty("条线名称") + private String businessStripName; + + @ApiModelProperty("父级条线code") + private String parentCode; + + @ApiModelProperty("父级条线名称") + private String parentName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/KeyTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/KeyTreeVO.java new file mode 100644 index 0000000..015502f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/KeyTreeVO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/3/29 下午2:38 + */ + +@Data +@ApiModel("树形定制化接口") +public class KeyTreeVO { + + @ApiModelProperty("编码") + private String key; + + @ApiModelProperty("名称") + private String title; + + @ApiModelProperty("类型 ORGANIZATION/MEMBER") + private String type; + + @ApiModelProperty("子集") + private List children; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java new file mode 100644 index 0000000..a1d92eb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/3/28 上午10:40 + */ + +@Data +@ApiModel("组织列表") +public class OrganizationSynthesizeTreeVO { + + @ApiModelProperty("上级部门") + private String parentCode; + + @ApiModelProperty("浙政钉组织编号") + private String organizationCode; + + @ApiModelProperty("名称") + private String name; + +// @ApiModelProperty("自己组织列表") +// private List childOrganizationList; + + @ApiModelProperty("组织下成员列表") + private List memberList; + + + @ApiModel + @Data + public static class OrganizationMemberInfo { + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("姓名") + private String name; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java new file mode 100644 index 0000000..43730fc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/17 下午2:01 + */ +@Data +public class OrganizationTreeVO { + + private Long id; + + @ApiModelProperty("上级部门") + private String parentCode; + + @ApiModelProperty("浙政钉组织编号") + private String organizationCode; + + // @ApiModelProperty("子部门数目") +// private Long subCount; +// +// @ApiModelProperty("排序") +// private Long deptSort; +// +// @ApiModelProperty("状态(禁用,启用)") + private Boolean enabled; + + @ApiModelProperty("名称") + private String name; + +// @ApiModelProperty(value = "子节点") +// private List children; +// +// @ApiModelProperty(value = "是否为叶子节点") +// private Boolean isLeaf; +// + @ApiModelProperty(value = "社会同一信用代码") + private String unifiedSocialCreditCode;; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ProvincialGovBusinessStripVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ProvincialGovBusinessStripVO.java new file mode 100644 index 0000000..487bd5b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ProvincialGovBusinessStripVO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author Liuxinxin + * @since 2023-03-08 + */ +@Data +@ApiModel(value = "条线 responseVO", description = "") +public class ProvincialGovBusinessStripVO { + + @ApiModelProperty("条线code") + private String businessStripCode; + + @ApiModelProperty("条线名称") + private String businessStripName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ResOrganizationListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ResOrganizationListVO.java new file mode 100644 index 0000000..d64dc43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/ResOrganizationListVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.organization.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/16 上午11:50 + */ +@Data +@ApiModel("组织列表VO") +public class ResOrganizationListVO { + + public String id; + + @ApiModelProperty("单位名称") + private String orgName; + + @ApiModelProperty("浙政钉编码") + private String orgCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @ApiModelProperty("所属区域id") + private String regionId; + + @ApiModelProperty("所属区域") + private String regionName; + + @ApiModelProperty("是否为主管单位") + private Boolean isCompetentUnit; + + @ApiModelProperty("是否为上级条线主管单位") + private Boolean isSuperiorLineCompetentUnit; + + @ApiModelProperty("社会统一信用代码") + private String unifiedSocialCreditCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingEmployeeInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingEmployeeInfoService.java new file mode 100644 index 0000000..c28dfa1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingEmployeeInfoService.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.organization.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +public interface IDingEmployeeInfoService extends IService { + + /** + * 根据专家 专有钉codeList 获取专家组织codeList + * + * @param employeeCodeList + * @return + */ + List getEmployeesOrgCodeList(List employeeCodeList); + + List getEmployeeList(List employeeCodeList); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingOrganizationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingOrganizationService.java new file mode 100644 index 0000000..4a194c0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IDingOrganizationService.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.organization.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-09 + */ +public interface IDingOrganizationService extends IService { + + /** + * 根据组织code查询组织信息 + * + * @param orgCode + * @return + */ + DingOrganization getByOrgCode(String orgCode); + + /** + * 根据组织code查询父组织信息 + * + * @param orgCode + * @return + */ + DingOrganization getParentOrganization(String orgCode); + + /** + * 批量查询单位信息 + * + * @param codes 单位编码 + * @return 单位信息 + * @author WendyYang + **/ + List listByCodes(Collection codes); + + /** + * 批量查询单位名称 + * + * @param codes 单位编码 + * @return 单位信息 + * @author WendyYang + **/ + List listNameByCodes(Collection codes); + + + /** + * 根据orgCodeList 获取 code 和 名称 Map + * + * @param orgCodeList + * @return + */ + Map getOrgCodeAndNameMap(List orgCodeList); + + Map getOrgMap(List orgCodeList); + + /** + * 获取 key:专家code value:组织信息 (所属单位组织信息) + * @param employeeInfoList + * @return + */ + Map getEmpCodeOrgMap(List employeeInfoList); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IGovBusinessStripService.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IGovBusinessStripService.java new file mode 100644 index 0000000..9e301eb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IGovBusinessStripService.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.organization.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.organization.entity.GovBusinessStrip; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +public interface IGovBusinessStripService extends IService { + + /** + * 根据code查询名称 + * + * @param codes 条线编码 + * @return 条线名称 + * @author WendyYang + **/ + default List listNameByCodes(Collection codes) { + return CollUtils.fieldList(listByCodes(codes), GovBusinessStrip::getBusinessStripName); + } + + /** + * 根据code查询条线 + * + * @param codes 条线编码 + * @return 条线名称 + * @author WendyYang + **/ + default List listByCodes(Collection codes) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(GovBusinessStrip.class) + .in(GovBusinessStrip::getBusinessStripCode, codes); + return list(query); + } + + /** + * 根据code查询名称 + * + * @param code 条线编码 + * @return 条线名称 + * @author WendyYang + **/ + default String getNameByCode(String code) { + return Optional.ofNullable(getByCode(code)) + .flatMap(w -> Optional.of(w.getBusinessStripName())) + .orElse(StrPool.EMPTY); + } + + /** + * 根据code查询名称 + * + * @param code 条线编码 + * @return 条线名称 + * @author WendyYang + **/ + default GovBusinessStrip getByCode(String code) { + List strips = listByCodes(Collections.singletonList(code)); + return strips.isEmpty() ? null : strips.get(0); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IOrganizationMainManageTagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IOrganizationMainManageTagService.java new file mode 100644 index 0000000..b9e3356 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IOrganizationMainManageTagService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.service; + +import com.hz.pm.api.organization.entity.OrganizationMainManageTag; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +public interface IOrganizationMainManageTagService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IProvincialGovBusinessStripService.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IProvincialGovBusinessStripService.java new file mode 100644 index 0000000..3a12d62 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/IProvincialGovBusinessStripService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.organization.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.organization.model.entity.ProvincialGovBusinessStrip; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-03-08 + */ +public interface IProvincialGovBusinessStripService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingEmployeeInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingEmployeeInfoServiceImpl.java new file mode 100644 index 0000000..a2e8489 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingEmployeeInfoServiceImpl.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.organization.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.organization.mapper.DingEmployeeInfoMapper; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +@Service +public class DingEmployeeInfoServiceImpl extends ServiceImpl implements IDingEmployeeInfoService { + + @Override + public List getEmployeesOrgCodeList(List employeeCodeList) { + if (CollUtil.isEmpty(employeeCodeList)) { + return new ArrayList<>(); + } + List dingEmployeeInfoList = this.list(Wrappers.lambdaQuery(DingEmployeeInfo.class).in(DingEmployeeInfo::getEmployeeCode, employeeCodeList)); + List orgCodeList = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).distinct().collect(Collectors.toList()); + return orgCodeList; + } + + @Override + public List getEmployeeList(List employeeCodeList) { + if (CollUtil.isEmpty(employeeCodeList)) { + return new ArrayList<>(); + } + List dingEmployeeInfoList = this.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .in(DingEmployeeInfo::getEmployeeCode, employeeCodeList)); + return dingEmployeeInfoList; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingOrganizationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingOrganizationServiceImpl.java new file mode 100644 index 0000000..e0703bd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/DingOrganizationServiceImpl.java @@ -0,0 +1,104 @@ +package com.hz.pm.api.organization.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +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.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.organization.mapper.DingOrganizationMapper; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-09 + */ +@Service +public class DingOrganizationServiceImpl extends ServiceImpl implements IDingOrganizationService { + + @Override + public DingOrganization getByOrgCode(String orgCode) { + if (StringUtils.isBlank(orgCode)) { + return null; + } + return this.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, orgCode)); + } + + @Override + public DingOrganization getParentOrganization(String orgCode) { + DingOrganization dingOrganization = getByOrgCode(orgCode); + if (dingOrganization == null) { + return null; + } + String parentCode = dingOrganization.getParentCode(); + return getByOrgCode(parentCode); + } + + @Override + public List listByCodes(Collection codes) { + if (CollectionUtil.isEmpty(codes)) { + return new ArrayList<>(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getOrganizationCode, codes); + return list(query); + } + + @Override + public List listNameByCodes(Collection codes) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(DingOrganization.class) + .select(DingOrganization::getOrganizationName) + .in(DingOrganization::getOrganizationCode, codes); + return CollUtils.fieldList(list(query), DingOrganization::getOrganizationName); + } + + @Override + public Map getOrgCodeAndNameMap(List orgCodeList) { + orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); + List dingOrganizationList = listByCodes(orgCodeList); + return dingOrganizationList.stream() + .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode()) && StringUtils.isNotBlank(r.getOrganizationName())) + .collect(Collectors.toMap(DingOrganization::getOrganizationCode, DingOrganization::getOrganizationName)); + } + + @Override + public Map getOrgMap(List orgCodeList) { + orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); + if (CollectionUtil.isEmpty(orgCodeList)) { + return new HashMap<>(); + } + List dingOrganizationList = listByCodes(orgCodeList); + return dingOrganizationList.stream() + .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) + .collect(Collectors.toMap(DingOrganization::getOrganizationCode, r -> r)); + } + + @Override + public Map getEmpCodeOrgMap(List employeeInfoList) { + List orgCodeList = employeeInfoList.stream() + .map(DingEmployeeInfo::getEmpPosUnitCode) + .distinct().collect(Collectors.toList()); + + Map orgMap = this.getOrgMap(orgCodeList); + + Map empCodeOrgMap = new HashMap(); + for(DingEmployeeInfo dingEmployeeInfo:employeeInfoList){ + DingOrganization dingOrganization = orgMap.get(dingEmployeeInfo.getEmpPosUnitCode()); + if (Objects.nonNull(dingOrganization)){ + empCodeOrgMap.put(dingEmployeeInfo.getEmployeeCode(),dingOrganization); + } + } + return empCodeOrgMap; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/GovBusinessStripServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/GovBusinessStripServiceImpl.java new file mode 100644 index 0000000..1d5c29a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/GovBusinessStripServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.organization.service.impl; + +import com.hz.pm.api.organization.entity.GovBusinessStrip; +import com.hz.pm.api.organization.mapper.GovBusinessStripMapper; +import com.hz.pm.api.organization.service.IGovBusinessStripService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-03-08 + */ +@Service +public class GovBusinessStripServiceImpl extends ServiceImpl implements IGovBusinessStripService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/OrganizationMainManageTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/OrganizationMainManageTagServiceImpl.java new file mode 100644 index 0000000..abcd579 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/OrganizationMainManageTagServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.organization.service.impl; + +import com.hz.pm.api.organization.entity.OrganizationMainManageTag; +import com.hz.pm.api.organization.mapper.OrganizationMainManageTagMapper; +import com.hz.pm.api.organization.service.IOrganizationMainManageTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-03-09 + */ +@Service +public class OrganizationMainManageTagServiceImpl extends ServiceImpl implements IOrganizationMainManageTagService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java new file mode 100644 index 0000000..c9e5a0b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.organization.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.organization.mapper.ProvincialGovBusinessStripMapper; +import com.hz.pm.api.organization.model.entity.ProvincialGovBusinessStrip; +import com.hz.pm.api.organization.service.IProvincialGovBusinessStripService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-03-08 + */ +@Service +public class ProvincialGovBusinessStripServiceImpl extends ServiceImpl + implements IProvincialGovBusinessStripService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/constant/BizConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/constant/BizConst.java new file mode 100644 index 0000000..9e1ff34 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/constant/BizConst.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.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 = "复评员"; + + String FIRST_INDEX_NAME = "firstIndexName"; + String FIRST_INDEX_TITLE = "一级指标"; + String SECOND_INDEX_NAME = "secondIndexName"; + String SECOND_INDEX_TITLE = "二级指标"; + String THIRD_INDEX_NAME = "thirdIndexName"; + String THIRD_INDEX_TITLE = "三级指标"; + String INDEX_SCORE = "indexScore"; + String INDEX_SCORE_TITLE = "指标分值"; + String INDEX_DETAIL = "indexDetail"; + String INDEX_DETAIL_TITLE = "指标细则"; + String GRADE_DETAIL = "gradeDetail"; + String GRADE_DETAIL_TITLE = "评分细则"; + String SUPPORT_MATERIAL = "supportMaterial"; + String SUPPORT_MATERIAL_TITLE = "佐证材料"; + String SELF_APPRAISAL_BASIS = "selfAppraisalBasis"; + String SELF_APPRAISAL_BASIS_TITLE = "自评依据"; + String SELF_APPRAISAL_SCORE = "selfAppraisalScore"; + String SELF_APPRAISAL_SCORE_TITLE = "自评得分"; + String RE_APPRAISAL_BASIS = "refAppraisalBasis"; + String RE_APPRAISAL_BASIS_TITLE = "复评依据"; + String RE_APPRAISAL_SCORE = "reAppraisalScore"; + String RE_APPRAISAL_SCORE_TITLE = "复评得分"; + + String VERIFY_BASIS = "verifyBasis"; + String VERIFY_BASIS_TITLE = "核查依据"; + String VERIFY_SCORE = "verifyScore"; + String VERIFY_SCORE_TITLE = "核查得分"; + String IS_ADDITIONAL = "isAdditional"; + String IS_ADDITIONAL_TITLE = "是否附加指标"; + String RE_APPRAISAL = "(复评)"; + String VERIFY = "(核查)"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/AppAppraisalController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/AppAppraisalController.java new file mode 100644 index 0000000..1ce30c5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/AppAppraisalController.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.performance.manage.AppAppraisalManage; +import com.hz.pm.api.performance.model.vo.*; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.performance.manage.ReAppraisalManage; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; + +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/app-appraisal") +public class AppAppraisalController { + + private final AppAppraisalManage appAppraisalManage; + + @GetMapping("/list") + @ApiOperation("当前复评用户的应用绩效评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return appAppraisalManage.list(req); + } + + @GetMapping("/unEvaluate-list/{planId}") + @ApiOperation("当前绩效评价应用待评价列表") + public PageVo unEvaluateList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return appAppraisalManage.unEvaluateList(planId,req); + } + + @GetMapping("/evaluated-list/{planId}") + @ApiOperation("当前绩效评价应用已评价列表") + public PageVo evaluatedList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return appAppraisalManage.evaluatedList(planId,req); + } + + @GetMapping("/detail/{planId}/{appId}") + @ApiOperation("获取详情") + public AppAppraisalIndexDetailVO detail(@PathVariable Long planId,@PathVariable Long appId){ + return appAppraisalManage.detail(planId,appId); + } + + @PostMapping("/save") + @ApiOperation("保存分数") + @WebLog(value = "保存分数",modular = "绩效评价-应用评价") + public String saveAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return appAppraisalManage.saveAppraisal(param); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/IndicatorConfigController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/IndicatorConfigController.java new file mode 100644 index 0000000..c884447 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/IndicatorConfigController.java @@ -0,0 +1,135 @@ +package com.hz.pm.api.performance.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.performance.manage.IndicatorConfigManage; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.AppIndexVO; +import com.hz.pm.api.performance.model.vo.ProjectIndexTemplateVO; +import com.hz.pm.api.performance.model.vo.ProjectIndexVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * 绩效评价-指标配置 + * @return + * @author CMM + * @since 2023/07/26 16:29 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-指标配置") +@RequestMapping("/api/v1/indicator-config") +public class IndicatorConfigController { + + private final IndicatorConfigManage indicatorConfigManage; + + @GetMapping("/project/index/template/list") + @ApiOperation("项目指标模板列表") + public PageVo projectIndexTemplateList(PerformanceAppraisalListReq req) { + return indicatorConfigManage.projectIndexTemplateList(req); + } + + @GetMapping("/project/index/template/detail/{id}") + @ApiOperation("项目指标配置模板详情") + public ProjectIndexTemplateVO projectDetail(@PathVariable Long id) { + return indicatorConfigManage.projectDetail(id); + } + + @ApiOperation(value = "项目指标模版启用(禁用)", notes = "项目指标模版启用(禁用)") + @PutMapping("/project/index/{templateId}/active/{state}") + public String enOrDisProjectIndexTemplate(@PathVariable Long templateId, + @PathVariable Boolean state) { + Boolean result = indicatorConfigManage.enOrDisProjectIndexTemplate(templateId, state); + return Boolean.TRUE.equals(result) ? "操作成功":"操作失败"; + } + + @PostMapping("/project/index/template/save") + @ApiOperation("项目指标配置模板保存") + @WebLog("项目指标配置模板保存") + public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { + return indicatorConfigManage.projectTemplateSave(dto); + } + + @PostMapping("/project/index/template/copy/{id}") + @ApiOperation("项目指标配置模板复制") + @WebLog("项目指标配置模板复制") + public String projectTemplateCopy(@PathVariable Long id) { + return indicatorConfigManage.projectTemplateCopy(id); + } + + @PostMapping("/project/index/template/delete/{id}") + @ApiOperation("项目指标配置模板删除") + @WebLog("项目指标配置模板删除") + public String projectTemplateDelete(@PathVariable Long id) { + return indicatorConfigManage.projectTemplateDelete(id); + } + + @GetMapping("/project/index/list") + @ApiOperation("项目指标库列表") + public PageVo projectIndexList(PerformanceAppraisalListReq req) { + return indicatorConfigManage.projectIndexList(req); + } + + @PostMapping("/project/index/save") + @ApiOperation("项目指标库新增指标保存") + @WebLog("项目指标库新增指标保存") + public String projectIndexSave(@Valid @RequestBody PerformanceIndicatorProjectIndexSaveDTO dto) { + return indicatorConfigManage.projectIndexSave(dto); + } + + @PostMapping("/project/index/delete/{id}") + @ApiOperation("项目指标库指标删除") + @WebLog("项目指标库指标删除") + public String projectIndexDelete(@PathVariable Long id) { + return indicatorConfigManage.projectIndexDelete(id); + } + + @PostMapping("/project/index/detail/{id}") + @ApiOperation("项目指标库项目指标详情") + public ProjectIndexVO projectIndexDetail(@PathVariable Long id) { + return indicatorConfigManage.projectIndexDetail(id); + } + + @GetMapping("/app/index/list") + @ApiOperation("应用指标库列表") + public PageVo appIndexList(PerformanceAppraisalListReq req) { + return indicatorConfigManage.appIndexList(req); + } + + @PostMapping("/app/index/save") + @ApiOperation("应用指标库新增指标保存") + @WebLog("应用指标库新增指标保存") + public String appIndexSave(@Valid @RequestBody PerformanceIndicatorAppIndexSaveDTO dto) { + return indicatorConfigManage.appIndexSave(dto); + } + + @PostMapping("/app/index/delete/{id}") + @ApiOperation("应用指标库指标删除") + @WebLog("应用指标库指标删除") + public String appIndexDelete(@PathVariable Long id) { + return indicatorConfigManage.appIndexDelete(id); + } + + @PostMapping("/app/index/detail/{id}") + @ApiOperation("应用指标库应用指标详情") + public AppIndexVO appIndexDetail(@PathVariable Long id) { + return indicatorConfigManage.appIndexDetail(id); + } + + @ApiOperation(value = "应用指标启用(禁用)", notes = "应用指标启用(禁用)") + @PutMapping("/app/index/{appId}/active/{state}") + @WebLog("应用指标库指标启用(禁用)") + public String enOrDisAppIndex(@PathVariable Long appId, + @PathVariable Boolean state) { + Boolean result = indicatorConfigManage.enOrDisAppIndex(appId, state); + return Boolean.TRUE.equals(result) ? "操作成功":"操作失败"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/OrgSelfAppraisalController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/OrgSelfAppraisalController.java new file mode 100644 index 0000000..a7f3fd3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/OrgSelfAppraisalController.java @@ -0,0 +1,72 @@ +package com.hz.pm.api.performance.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.manage.OrgSelfAppraisalManage; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.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.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + * @Classname OrgSelfAppraisalController + * @Description + * @Date 2023/6/25 14:16 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-单位自评") +@RequestMapping("/api/v1/self-appraisal") +public class OrgSelfAppraisalController { + + private final OrgSelfAppraisalManage selfAppraisalManage; + + @GetMapping("/list") + @ApiOperation("当前用户的绩效评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return selfAppraisalManage.list(req); + } + + @GetMapping("/pending-list/{planId}") + @ApiOperation("当前绩效评价待自评列表") + public PageVo pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return selfAppraisalManage.pendingList(planId,req); + } + + @GetMapping("/appraisaled-list/{planId}") + @ApiOperation("当前绩效评价已自评列表") + public PageVo appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + 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("提交自评") + @WebLog(value = "提交自评",modular = "绩效评价-单位自评") + public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return selfAppraisalManage.submitSelfAppraisal(param); + } + + @GetMapping("/score/export") + @ApiOperation("自评打分导出") + @WebLog(value = "自评打分导出",modular = "绩效评价-单位自评") + public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, selfAppraisalManage::exportScore); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/PerformanceAppraisalPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/PerformanceAppraisalPlanController.java new file mode 100644 index 0000000..d8fc928 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/PerformanceAppraisalPlanController.java @@ -0,0 +1,136 @@ +package com.hz.pm.api.performance.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.performance.manage.PerformanceAppraisalPlanManage; +import com.hz.pm.api.performance.model.dto.AddAppraisalObjectDTO; +import com.hz.pm.api.performance.model.dto.PerformanceAppraisalCreateDTO; +import com.hz.pm.api.performance.model.dto.PerformanceAppraisalEditDTO; +import com.hz.pm.api.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalApplicationVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectGroupVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 PerformanceAppraisalController + * @Description + * @Date 2023/6/19 14:16 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-评价计划") +@RequestMapping("/api/v1/performance-appraisal/plan") +public class PerformanceAppraisalPlanController { + + private final PerformanceAppraisalPlanManage performanceAppraisalPlanManage; + + @GetMapping("/list") + @ApiOperation("评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return performanceAppraisalPlanManage.list(req); + } + + @GetMapping("/detail/{id}") + @ApiOperation("评价计划详情") + public PerformanceAppraisalVO detail(@PathVariable Long id) { + return performanceAppraisalPlanManage.detail(id); + } + + @PostMapping("/create") + @ApiOperation("绩效评价创建") + @WebLog("绩效评价创建") + public String create(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) { + return performanceAppraisalPlanManage.create(createDTO); + } + + @GetMapping("/final-project-list") + @ApiOperation("评价计划-终验项目列表") + public PageVo finalProjectList(PerformanceAppraisalListReq req) { + return performanceAppraisalPlanManage.finalProjectList(req); + } + + @GetMapping("/final-application-list") + @ApiOperation("评价计划-终验应用列表") + public PageVo finalApplicationList(PerformanceAppraisalListReq req) { + return performanceAppraisalPlanManage.finalApplicationList(req); + } + + @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("编辑绩效评价") + public String edit(@Valid @RequestBody PerformanceAppraisalEditDTO editDTO) { + return performanceAppraisalPlanManage.edit(editDTO); + } + + @PostMapping("/delete/{id}") + @ApiOperation("绩效评价删除") + @WebLog("绩效评价删除") + public String delete(@PathVariable Long id) { + 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, + @RequestParam(required = false) String name) { + return performanceAppraisalPlanManage.groupList(appraisalId,name); + } + + @GetMapping("/group/detail/{id}") + @ApiOperation("绩效评价分组详情") + public PerformanceAppraisalProjectGroupVO groupDetail(@PathVariable Long id) { + return performanceAppraisalPlanManage.groupDetail(id); + } + + @PostMapping("/group/save") + @ApiOperation("绩效评价分组保存") + @WebLog("绩效评价分组保存") + public String groupSave(@Valid @RequestBody PerformanceAppraisalProjectGroupSaveDTO dto) { + return performanceAppraisalPlanManage.groupSave(dto); + } + + @PostMapping("/group/delete/{id}") + @ApiOperation("绩效评价分组删除") + @WebLog("绩效评价分组删除") + public String groupDelete(@PathVariable Long id) { + return performanceAppraisalPlanManage.groupDelete(id); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/ReAppraisalController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/ReAppraisalController.java new file mode 100644 index 0000000..a8b403b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/ReAppraisalController.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.performance.controller; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.manage.ReAppraisalManage; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.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("提交复评") + @WebLog(value = "提交复评",modular = "绩效评价-人工复评") + public String submitReAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return reAppraisalManage.submitReAppraisal(param); + } + + @GetMapping("/score/export") + @ApiOperation("复评打分导出") + @WebLog(value = "复评打分导出",modular = "绩效评价-人工复评") + public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, reAppraisalManage::exportScore); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyAuditController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyAuditController.java new file mode 100644 index 0000000..d00f129 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyAuditController.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.performance.manage.RectifyAuditManage; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * RectifyController + * @return + * @author CMM + * @since 2023/08/12 15:45 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-项目整改核查") +@RequestMapping("/api/v1/rectify-audit") +public class RectifyAuditController { + + private final RectifyAuditManage rectifyAuditManage; + + @GetMapping("/list") + @ApiOperation("当前用户的绩效评价整改审核计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return rectifyAuditManage.list(req); + } + + @GetMapping("/unAudit-list/{planId}") + @ApiOperation("当前绩效评价待整改审核列表") + public PageVo unAuditList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return rectifyAuditManage.unAuditList(planId,req); + } + + @GetMapping("/audited-list/{planId}") + @ApiOperation("当前绩效评价已整改审核列表") + public PageVo auditedList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + return rectifyAuditManage.auditedList(planId,req); + } + + @PostMapping("/submit") + @ApiOperation("提交整改审核结果") + @WebLog(value = "提交整改审核结果",modular = "绩效评价-项目整改核查") + public String submit(@Valid @RequestBody ProjectAppraisalDTO param){ + return rectifyAuditManage.submit(param); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyController.java new file mode 100644 index 0000000..364b49e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/RectifyController.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.performance.manage.RectifyManage; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.model.vo.RectifyDetailVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * RectifyController + * + * @return + * @author CMM + * @since 2023/08/12 15:45 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-项目整改") +@RequestMapping("/api/v1/rectify") +public class RectifyController { + + private final RectifyManage rectifyManage; + + @GetMapping("/list") + @ApiOperation("当前用户的绩效评价整改计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return rectifyManage.list(req); + } + + @GetMapping("/unRectify-list/{planId}") + @ApiOperation("当前绩效评价待整改列表") + public PageVo unRectifyList(@PathVariable Long planId, + PerformanceAppraisalListReq req) { + return rectifyManage.unRectifyList(planId, req); + } + + @GetMapping("/rectified-list/{planId}") + @ApiOperation("当前绩效评价已整改列表") + public PageVo rectifiedList(@PathVariable Long planId, + PerformanceAppraisalListReq req) { + return rectifyManage.rectifiedList(planId, req); + } + + @GetMapping("/get-rectify-detail/{planId}/{projectCode}") + @ApiOperation("查看整改详情") + public RectifyDetailVO getRectifyDetail(@PathVariable Long planId, @PathVariable String projectCode) { + return rectifyManage.getRectifyDetail(planId, projectCode); + } + + @PostMapping("/fill-out-result") + @ApiOperation("填写整改情况") + @WebLog(value = "填写整改情况",modular = "绩效评价-项目整改") + public String fillOutResult(@Valid @RequestBody ProjectAppraisalDTO param) { + return rectifyManage.fillOutResult(param); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/VerifyController.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/VerifyController.java new file mode 100644 index 0000000..75b73e7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/controller/VerifyController.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.performance.controller; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.manage.VerifyManage; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.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("提交核查") + @WebLog(value = "提交核查",modular = "绩效评价-专家核查") + public String submitVerify(@Valid @RequestBody ProjectAppraisalDTO param){ + return verifyManage.submitVerify(param); + } + + @GetMapping("/score/export") + @ApiOperation("核查打分导出") + @WebLog(value = "核查打分导出",modular = "绩效评价-专家核查") + public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, verifyManage::exportScore); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java new file mode 100644 index 0000000..8d2a801 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java @@ -0,0 +1,98 @@ +package com.hz.pm.api.performance.convert; + +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 com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import org.apache.commons.lang3.StringUtils; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalApplication; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalApplicationVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; + +import cn.hutool.core.collection.CollUtil; + +/** + * @Classname PerformanceAppraisalConverer + * @Description + * @Date 2023/6/19 15:31 + * @Author PoffyZhang + */ +public class PerformanceAppraisalConveter { + + public static List convertProjects( + List projects, Map map) { + if(CollUtil.isNotEmpty(projects) && CollUtil.isNotEmpty(map)){ + return projects.stream().map(p -> { + PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); + vo.setIsReAppraisal(p.getIsReAppraisal()); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); + vo.setProjectId(p.getProjectId()); + if(map.containsKey(p.getProjectCode())){ + Project project = map.get(p.getProjectCode()); + vo.setProjectCode(project.getProjectCode()); + vo.setProjectName(project.getProjectName()); + vo.setProjectType(project.getProjectType()); + vo.setProjectTypeName(getProjectTypeName(project.getProjectType())); + vo.setBuildOrgName(project.getBuildOrgName()); + vo.setDeclareAmount(project.getDeclareAmount()); + vo.setProjectYear(project.getProjectYear()); + } + return vo; + }).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + public static List convertApplications( + List applications, Map map) { + if(CollUtil.isNotEmpty(applications) && CollUtil.isNotEmpty(map)){ + return applications.stream().map(a -> { + PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); + vo.setAppId(a.getApplicationId()); + if(map.containsKey(a.getApplicationId())){ + ProjectApplication application = map.get(a.getApplicationId()); + vo.setApplicationName(StringUtils.isNotBlank(application.getRelatedExistsApplication())? + application.getRelatedExistsApplication() : application.getApplicationName()); + vo.setApplicationType(application.getApplicationType()); + vo.setBizDomain(application.getBizDomain()); + vo.setBuildOrgName(application.getBuildOrgName()); + vo.setPublishSide(application.getPublishSide()); + } + return vo; + }).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + public static String getProjectTypeName(String projectType) { + if (Objects.nonNull(projectType)) { + return ProjectTypeNewEnum.getDesc(projectType); + } + 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/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppIndexTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppIndexTypeEnum.java new file mode 100644 index 0000000..904f52c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppIndexTypeEnum.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * AppIndexTypeEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum AppIndexTypeEnum { + /** + * 应用指标类型 + */ + COMMON(1, "通用指标"), + AUX(2, "辅助指标"), + BUSINESS(3,"业务指标"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (AppIndexTypeEnum t : AppIndexTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppraisalTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppraisalTypeEnum.java new file mode 100644 index 0000000..2e296f9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/AppraisalTypeEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.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, "专家核查"), + EXPERT_RECTIFY_AUDIT(4, "专家整改审核"), + APPLICATION_APPRAISAL(5, "应用评价"); + + 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/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/ConstructTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/ConstructTypeEnum.java new file mode 100644 index 0000000..45f3965 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/ConstructTypeEnum.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * ConstructTypeEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ConstructTypeEnum { + /** + * 建设类型 + */ + SOFT(1, "软件"), + HARDWARE(2, "硬件"), + SOFT_HARD(3, "软硬件"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ConstructTypeEnum t : ConstructTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/EvalObjectEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/EvalObjectEnum.java new file mode 100644 index 0000000..f8200cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/EvalObjectEnum.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateStageNameEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateStageNameEnum.java new file mode 100644 index 0000000..a899405 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateStageNameEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.performance.enumration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * PerformanceTemplateStageNameEnum + *

+ * + * @author Poffy + * @since 16:56 2023/6/27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum PerformanceTemplateStageNameEnum { + /** + * 模板阶段名称枚举 + */ + STAGE_1(1, "立项阶段"), + STAGE_2(2, "建设阶段"), + STAGE_3(3, "运行阶段"), + STAGE_4(4, "附加阶段"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (PerformanceTemplateStageNameEnum t : PerformanceTemplateStageNameEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateTypeEnum.java new file mode 100644 index 0000000..a44cec7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/PerformanceTemplateTypeEnum.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.performance.enumration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * PerformanceTemplateTypeEnum + *

+ * + * @author Poffy + * @since 16:56 2023/6/27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum PerformanceTemplateTypeEnum { + /** + * 模板类型 + */ + FIRST_INDEX(1, "第一指标"), + SECOND_INDEX(2, "第二指标"), + THIRD_INDEX(3, "第三指标"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (PerformanceTemplateTypeEnum t : PerformanceTemplateTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyAuditEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyAuditEnum.java new file mode 100644 index 0000000..1c985a4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyAuditEnum.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * RectifyAuditEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum RectifyAuditEnum { + /** + * 评价类型 + */ + APPROVED(1, "通过"), + NOT_APPROVED(2, "不通过"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (RectifyAuditEnum t : RectifyAuditEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyStatusEnum.java new file mode 100644 index 0000000..f5777c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/enumration/RectifyStatusEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * RectifyStatusEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum RectifyStatusEnum { + /** + * 整改状态 + */ + TO_BE_SUBMITTED(1, "整改情况待提交"), + NOT_APPROVED(2, "整改核查不通过"), + TO_BE_REVIEWED(3, "整改待审核"), + APPROVED(4,"整改审核通过"); + + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (RectifyStatusEnum t : RectifyStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/TemplateDetailBuildHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/TemplateDetailBuildHelper.java new file mode 100644 index 0000000..0e1c229 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/TemplateDetailBuildHelper.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.performance.helper; + +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.hz.pm.api.performance.model.vo.ProjectAppraisalIndexDetailVO; +import com.hz.pm.api.performance.model.vo.ProjectTemplateDetailVO; + +import java.util.List; + +/** + * 模板详情构建helper + * @return + * @author CMM + * @since 2023/08/09 22:28 + */ +public interface TemplateDetailBuildHelper { + /** + * 构建评价模板详情信息 + * + * @param templateDetails + * @param projectCode + * @param vo + * @return + */ + List buildTemplateDetail(List templateDetails, String projectCode, ProjectAppraisalIndexDetailVO vo); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java new file mode 100644 index 0000000..85cdecc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java @@ -0,0 +1,146 @@ +package com.hz.pm.api.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.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.enumration.PerformanceTemplateTypeEnum; +import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.hz.pm.api.performance.model.vo.ProjectAppraisalIndexDetailVO; +import com.hz.pm.api.performance.model.vo.ProjectTemplateDetailVO; +import com.hz.pm.api.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, String projectCode, 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::getAppraisalProjectCode,projectCode) + .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::getAppraisalProjectCode,projectCode) + .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.setReAppraisalTotalScore(sum); + } + } + // 按照核查人员分组 获取核查分数信息 + List verifyScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) + .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); + } + } + // 获取整改审核分数信息 + List rectifyAuditScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode())); + if (CollUtil.isNotEmpty(rectifyAuditScoreInfo)) { + detailThirdVo.setRectifyAuditScoreInfo(rectifyAuditScoreInfo); + BigDecimal score = rectifyAuditScoreInfo.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + if (Objects.nonNull(vo)) { + vo.setRectifyAuditTotalScore(score); + } + } + secondList.add(detailThirdVo); + } + } + detailSecondVo.setChildren(secondList); + firstList.add(detailSecondVo); + } + } + detailFirstVo.setChildren(firstList); + res.add(detailFirstVo); + + } + } + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java new file mode 100644 index 0000000..13dc138 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java @@ -0,0 +1,429 @@ +package com.hz.pm.api.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.map.MapUtil; +import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; +import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; +import com.hz.pm.api.performance.model.vo.*; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +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.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.hz.pm.api.performance.constant.BizConst; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * AppAppraisalManage + * @return + * @author CMM + * @since 2023/08/10 8:55 + */ +@Component +@Slf4j +@AllArgsConstructor +public class AppAppraisalManage { + private final IPerformanceAppraisalService performanceAppraisalService; + private final IRoleService roleService; + private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService; + private final IPerformanceAppraisalProjectGroupService groupService; + private final IProjectApplicationService projectApplicationService; + private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; + private final IPerformanceAppraisalAppIndicatorService performanceAppraisalAppIndicatorService; + private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; + /** + * 应用评价-评价计划列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + // 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 + 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 paas = performanceAppraisalApplicationService.list(); + // 没有包含应用的评价计划 + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + Set paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,paIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) + .collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + + public PageVo unEvaluateList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取分组所在评价计划添加的未完成评价的应用信息 + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, planId) + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); + // 没有当前用户待评价的应用信息 + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + List ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 + List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); + List appIds; + if (CollUtil.isNotEmpty(appraisalScoreInfos)) { + // 筛选出当前登录用户已进行打分的应用信息 + List scoredAppIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + ids.removeAll(scoredAppIds); + } + appIds = ids; + // 没有当前用户待评价的应用信息 + if(CollUtil.isEmpty(appIds)){ + return PageVo.empty(); + } + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, appIds) + .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); + projectApplicationService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); + vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + public PageVo evaluatedList(Long planId, PerformanceAppraisalListReq req) { + + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取评价计划添加的已完成评价的应用信息 + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, planId) + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 + List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); + List appIds = Lists.newArrayList(); + if (CollUtil.isNotEmpty(appraisalScoreInfos)) { + // 筛选出当前登录用户已进行打分的应用信息 + List scoredAppIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + appIds = scoredAppIds; + } + + // 没有当前用户已评价的应用信息 + if(CollUtil.isEmpty(appIds)){ + return PageVo.empty(); + } + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, appIds) + .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); + projectApplicationService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); + vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 是否可以评价 + * + * @param employeeCode + * @param appId + * @param appraisalId + * @return + */ + private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { + // 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 + // 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 + List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId,appId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,appraisalId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); + if (CollUtil.isEmpty(scoreInfos)){ + return true; + } + return Boolean.FALSE; + } + + + public AppAppraisalIndexDetailVO detail(Long planId, Long appId) { + + ProjectApplication projectApplication = projectApplicationService.getById(appId); + VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在!"); + + AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); + if (StringUtils.isNotBlank(projectApplication.getApplicationName())) { + resVo.setApplicationName(projectApplication.getApplicationName()); + }else { + resVo.setApplicationName(projectApplication.getRelatedExistsApplication()); + } + if (Objects.nonNull(projectApplication)){ + resVo.setBuildOrgName(projectApplication.getBuildOrgName()); + // todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 + resVo.setApplicationStatus("已验收"); + } + // 获取指标配置的应用指标信息 + // 通用指标 + List commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode()) + .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) + .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); + // 获取当前应用通用指标的的打分信息 + Map commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) + .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.COMMON.getCode())) + .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); + if (CollUtil.isNotEmpty(commonIndexList)) { + List commonIndexDetails = commonIndexList.stream().map(i -> { + AppIndexDetailVO vo = new AppIndexDetailVO(); + BeanUtils.copyProperties(i, vo); + PerformanceAppraisalAppScoreInfo scoreInfo = commonScoreInfoMap.get(i.getId()); + if (Objects.nonNull(scoreInfo)) { + vo.setAppraisalScore(scoreInfo.getAppraisalScore()); + } + return vo; + }).collect(Collectors.toList()); + resVo.setCommonIndexDetails(commonIndexDetails); + } + + // 辅助指标 + List auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode()) + .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) + .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); + // 获取当前应用辅助指标的的打分信息 + Map auxScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) + .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.AUX.getCode())) + .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); + if (CollUtil.isNotEmpty(auxIndexList)) { + List auxIndexDetails = auxIndexList.stream().map(i -> { + AppIndexDetailVO vo = new AppIndexDetailVO(); + BeanUtils.copyProperties(i, vo); + PerformanceAppraisalAppScoreInfo scoreInfo = auxScoreInfoMap.get(i.getId()); + if (Objects.nonNull(scoreInfo)) { + vo.setAppraisalScore(scoreInfo.getAppraisalScore()); + } + return vo; + }).collect(Collectors.toList()); + resVo.setAuxIndexDetails(auxIndexDetails); + } + // 获取应用的核心业务指标 + List coreBusinessIndicators = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .eq(ProjectCoreBusinessIndicators::getApplicationId, appId)); + // 获取当前应用业务指标的的打分信息 + Map businessScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) + .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.BUSINESS.getCode())) + .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); + if (CollUtil.isNotEmpty(coreBusinessIndicators)) { + List businessIndexDetails = coreBusinessIndicators.stream().map(c -> { + AppBusinessIndexDetailVO appBusinessIndexDetailVo = new AppBusinessIndexDetailVO(); + BeanUtils.copyProperties(c, appBusinessIndexDetailVo); + PerformanceAppraisalAppScoreInfo scoreInfo = businessScoreInfoMap.get(c.getId()); + if (Objects.nonNull(scoreInfo)) { + appBusinessIndexDetailVo.setAppraisalScore(scoreInfo.getAppraisalScore()); + } + return appBusinessIndexDetailVo; + }).collect(Collectors.toList()); + resVo.setBusinessIndexDetails(businessIndexDetails); + } + return resVo; + } + + public String saveAppraisal(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + + Long applicationId = param.getApplicationId(); + Long appraisalId = param.getAppraisalId(); + List appAppraisalInfoList = param.getAppAppraisalInfoList(); + + // 获取评价应用 + PerformanceAppraisalApplication appraisalApplication = performanceAppraisalApplicationService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalApplication::getApplicationId, applicationId)); + + List indexIds = appAppraisalInfoList.stream().filter(a -> AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) + .map(AppAppraisalInfoDTO::getIndexId) + .collect(Collectors.toList()); + List businessIndexIds = appAppraisalInfoList.stream() + .filter(a -> AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) + .map(AppAppraisalInfoDTO::getIndexId) + .collect(Collectors.toList()); + // 查出通用、辅助应用指标分数信息 + Map indexMap = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(indexIds)) { + List indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .in(PerformanceAppraisalAppIndicator::getId, indexIds)); + if (CollUtil.isEmpty(indexList)) { + throw new BizException("通用/辅助评价指标不存在!"); + } + indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); + } + + // 查出应用业务指标分数信息 + Map businessIndexMap = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(businessIndexIds)) { + List businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); + if (CollUtil.isEmpty(businessIndexList)) { + throw new BizException("核心业务评价指标不存在!"); + } + businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); + } + + Map finalIndexMap = indexMap; + Map finalBusinessIndexMap = businessIndexMap; + List scoreInfos = appAppraisalInfoList.stream().map(a -> { + if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())){ + PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.get(a.getIndexId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = appIndicator.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); + } + } else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { + ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = coreBusinessIndicators.getScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); + } + } + // 保存评价分数信息 + PerformanceAppraisalAppScoreInfo scoreInfo = new PerformanceAppraisalAppScoreInfo(); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setApplicationId(applicationId); + scoreInfo.setIndexId(a.getIndexId()); + scoreInfo.setIndexType(a.getIndexType()); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + scoreInfo.setUpdateOn(LocalDateTime.now()); + scoreInfo.setUpdateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)){ + // 计算评价总分并保存 + BigDecimal appraisalTotalScore = appAppraisalInfoList.stream() + .map(AppAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + appraisalApplication.setAppraisalTotalScore(appraisalTotalScore); + appraisalApplication.setAppraisalScoreTime(LocalDateTime.now()); + // 一个复评员打完分就认为完成了打分 + appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); + appraisalApplication.setUpdateBy(username); + performanceAppraisalApplicationService.updateById(appraisalApplication); + return "提交成功"; + } + return "提交失败"; + } + private void judgeCompleteAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalApplication appraisalApplication) { + // 获取该评价应用的复评打分信息 + List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, group.getAppraisalId()) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appraisalApplication.getApplicationId())); + String reAppraisalUsers = group.getReAppraisalUsers(); + List users = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(users)){ + String join = String.join(StrPool.COMMA, users); + if (join.equals(reAppraisalUsers)) { + appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java new file mode 100644 index 0000000..ed5a294 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java @@ -0,0 +1,566 @@ +package com.hz.pm.api.performance.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.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.performance.enumration.PerformanceTemplateTypeEnum; +import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; +import com.hz.pm.api.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; +import com.hz.pm.api.performance.model.dto.ProjectTemplateDetailDTO; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppIndicator; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectIndicator; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplate; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.AppIndexVO; +import com.hz.pm.api.performance.model.vo.ProjectIndexTemplateVO; +import com.hz.pm.api.performance.model.vo.ProjectIndexVO; +import com.hz.pm.api.performance.model.vo.ProjectTemplateDetailVO; +import com.hz.pm.api.performance.service.IPerformanceAppraisalAppIndicatorService; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectIndicatorService; +import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateDetailService; +import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +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.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname IndicatorTemplateManage + * @Description + * @Date 2023/6/26 14:15 + * @Author PoffyZhang + */ +@Slf4j +@Component +@AllArgsConstructor +public class IndicatorConfigManage { + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; + private final IPerformanceAppraisalAppIndicatorService appIndicatorService; + private final TemplateDetailBuildHelper templateDetailBuildHelper; + + /** + * 模板列表 + * @param req + * @return + */ + public PageVo projectIndexTemplateList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()) + .orderByDesc(PerformanceIndicatorProjectTemplate::getCreateOn); + indicatorProjectTemplateService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 查询项目模板详情 + * @param id + * @return + */ + public ProjectIndexTemplateVO projectDetail(Long id) { + PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); + if(Objects.isNull(template)){ + return null; + } + 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::getIsAdditional,Boolean.FALSE)); + // 获取模版附加绩效指标详情 + List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); + if(CollUtil.isNotEmpty(templateDetails)){ + List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, null, null); + vo.setTemplateDetails(templateDetailVos); + } + + if (CollUtil.isNotEmpty(additionalTemplateDetails)){ + List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, null, null); + vo.setAdditionalIndexDetails(additionalTemplateDetailVos); + } + return vo; + } + + /** + * 项目指标 模板保存 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + 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("该模板不存在!"); + template.setId(old.getId()); + }else{ + template.setId(null); + template.setCreateOn(LocalDateTime.now()); + template.setCreateBy(user.getUsername()); + } + template.setUpdateOn(LocalDateTime.now()); + template.setUpdateBy(user.getUsername()); + if(indicatorProjectTemplateService.saveOrUpdate(template)){ + //保存 模板指标的详情 + if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ + //先删除 + indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .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() + .map(PerformanceIndicatorProjectTemplateDetail::getIndexScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + boolean score = (BigDecimal.valueOf(100)).equals(sum); + VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!"); + } + } + // 保存 模版附加指标详情 + if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ + indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); + analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId()); + } + return BizConst.SAVE_SUCCESS; + } + throw new BizException(BizConst.SAVE_FAIL); + } + + /** + * 解析 项目考核指标 + * @param templateDetails + * @return + */ + public void analysisTemplateDetails( + List templateDetails,Long templateId) { + if(CollUtil.isEmpty(templateDetails)){ + return; + } + analysisTemplateDetailsInner(templateDetails,templateId,null); + } + + /** + * 解析 项目附加考核指标 + * @param additionalTemplateDetails + * @return + */ + public void analysisAdditionalTemplateDetails( + List additionalTemplateDetails,Long templateId) { + if(CollUtil.isEmpty(additionalTemplateDetails)){ + return; + } + analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); + } + + public void analysisTemplateDetailsInner(List templateDetails, + Long templateId,Long parentId) { + if(CollUtil.isEmpty(templateDetails)){ + return; + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + for(ProjectTemplateDetailDTO detail : templateDetails){ + //计算阶段的 + PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); + templateDetail.setCreateBy(user.getUsername()); + templateDetail.setCreateOn(LocalDateTime.now()); + templateDetail.setUpdateBy(user.getUsername()); + templateDetail.setUpdateOn(LocalDateTime.now()); + templateDetail.setTemplateId(templateId); + // 一级指标的父ID为null + templateDetail.setParentId(parentId); + templateDetail.setIsAdditional(Boolean.FALSE); + + indicatorProjectTemplateDetailService.save(templateDetail); + + if(CollUtil.isNotEmpty(detail.getChildren())){ + analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + } + } + } + + public void analysisAdditionalTemplateDetailsInner(List templateDetails, + Long templateId,Long parentId) { + if(CollUtil.isEmpty(templateDetails)){ + return; + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + for(ProjectTemplateDetailDTO detail : templateDetails){ + //计算阶段的 + PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); + templateDetail.setCreateBy(user.getUsername()); + templateDetail.setCreateOn(LocalDateTime.now()); + templateDetail.setUpdateBy(user.getUsername()); + templateDetail.setUpdateOn(LocalDateTime.now()); + templateDetail.setTemplateId(templateId); + // 标记为附加指标 + templateDetail.setIsAdditional(Boolean.TRUE); + // 一级指标的父ID为null + templateDetail.setParentId(parentId); + + indicatorProjectTemplateDetailService.save(templateDetail); + + if(CollUtil.isNotEmpty(detail.getChildren())){ + analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + } + } + } + + /** + * 装配 模板详情 + * @param templateDetails + * @return + */ + private List buildTemplateDetail(List templateDetails) { + 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 thirdList = Lists.newArrayList(); + for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { + if (Objects.nonNull(templateDetailFour.getParentId()) && + templateDetailFour.getParentId().equals(templateDetailThird.getId())) { + ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); + thirdList.add(detailFourVo); + } + } + detailThirdVo.setChildren(thirdList); + secondList.add(detailThirdVo); + } + } + detailSecondVo.setChildren(secondList); + firstList.add(detailSecondVo); + } + } + detailFirstVo.setChildren(firstList); + res.add(detailFirstVo); + + } + } + return res; + } + + + /** + * 删除项目模板 + * + * @param id + * @return + */ + public String projectTemplateDelete(Long id) { + PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); + VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); + + if (CommonEnum.YES.getCode().equals(projectTemplate.getStatus())) { + throw new BizException("操作失败 该模板 是启用状态!"); + } + + if (indicatorProjectTemplateService.removeById(id)) { + indicatorProjectTemplateDetailService + .remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); + return "删除成功"; + } + return "操作失败"; + } + + 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()); + } + return indicatorProjectTemplateService.updateById(projectTemplate); + } + + @Transactional(rollbackFor = Exception.class) + public String projectTemplateCopy(Long templateId) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); + PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate(); + BeanUtils.copyProperties(projectTemplate,newTemplate); + // 复制后,项目模版名称变更为xxx副本,状态为禁用 + newTemplate.setName(projectTemplate.getName() + CommonConst.COPY); + newTemplate.setStatus(CommonEnum.NO.getCode()); + newTemplate.setCreateOn(LocalDateTime.now()); + newTemplate.setCreateBy(user.getUsername()); + newTemplate.setUpdateOn(LocalDateTime.now()); + newTemplate.setUpdateBy(user.getUsername()); + // 副本ID要置空 + newTemplate.setId(null); + if (indicatorProjectTemplateService.save(newTemplate)) { + // 新增指标详情 + List projectTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateId)); + Map detailMap = projectTemplateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, p -> p)); + // 按层级逐个新增并保存各指标 + // 从三级指标开始 + List thirdList = projectTemplateDetails.stream() + .filter(p -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(p.getType())) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(thirdList)){ + throw new BizException("当前模板未配置三级指!"); + } + List templateDetails = Lists.newArrayList(); + for (PerformanceIndicatorProjectTemplateDetail templateDetail : thirdList) { + PerformanceIndicatorProjectTemplateDetail newThirdTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); + BeanUtils.copyProperties(templateDetail, newThirdTemplateDetail); + newThirdTemplateDetail.setTemplateId(newTemplate.getId()); + newThirdTemplateDetail.setCreateOn(LocalDateTime.now()); + newThirdTemplateDetail.setCreateBy(user.getUsername()); + newThirdTemplateDetail.setUpdateOn(LocalDateTime.now()); + newThirdTemplateDetail.setUpdateBy(user.getUsername()); + // 新的指标ID、parentId要置空 + newThirdTemplateDetail.setId(null); + newThirdTemplateDetail.setParentId(null); + indicatorProjectTemplateDetailService.save(newThirdTemplateDetail); + // 再保存关联的二级指标 + Long thirdParentId = templateDetail.getParentId(); + PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = detailMap.get(thirdParentId); + if (Objects.isNull(secondTemplateDetail)){ + throw new BizException("三级指标:" + templateDetail.getName() + "对应的二级指标不存在"); + } + PerformanceIndicatorProjectTemplateDetail newSecondTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); + BeanUtils.copyProperties(secondTemplateDetail, newSecondTemplateDetail); + newSecondTemplateDetail.setTemplateId(newTemplate.getId()); + newSecondTemplateDetail.setCreateOn(LocalDateTime.now()); + newSecondTemplateDetail.setCreateBy(user.getUsername()); + newSecondTemplateDetail.setUpdateOn(LocalDateTime.now()); + newSecondTemplateDetail.setUpdateBy(user.getUsername()); + // 新的指标Id、parentId要置空 + newSecondTemplateDetail.setId(null); + newSecondTemplateDetail.setParentId(null); + indicatorProjectTemplateDetailService.save(newSecondTemplateDetail); + // 关联三级指标 + newThirdTemplateDetail.setParentId(newSecondTemplateDetail.getId()); + templateDetails.add(newThirdTemplateDetail); + // 再保存关联的一级指标 + Long secondParentId = secondTemplateDetail.getParentId(); + PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = detailMap.get(secondParentId); + if (Objects.isNull(firstTemplateDetail)){ + throw new BizException("二级指标:" + secondTemplateDetail.getName() + "对应的一级指标不存在"); + } + PerformanceIndicatorProjectTemplateDetail newFirstTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); + BeanUtils.copyProperties(firstTemplateDetail, newFirstTemplateDetail); + newFirstTemplateDetail.setTemplateId(newTemplate.getId()); + newFirstTemplateDetail.setCreateOn(LocalDateTime.now()); + newFirstTemplateDetail.setCreateBy(user.getUsername()); + newFirstTemplateDetail.setUpdateOn(LocalDateTime.now()); + newFirstTemplateDetail.setUpdateBy(user.getUsername()); + // 新的指标ID、parentId要置空 + newFirstTemplateDetail.setId(null); + newFirstTemplateDetail.setParentId(null); + indicatorProjectTemplateDetailService.save(newFirstTemplateDetail); + // 关联二级指标 + newSecondTemplateDetail.setParentId(newFirstTemplateDetail.getId()); + templateDetails.add(newSecondTemplateDetail); + } + // 批量更新 + if (indicatorProjectTemplateDetailService.updateBatchById(templateDetails)) { + return "模版复制成功"; + } + } + return "模版复制失败"; + } + + public PageVo projectIndexList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisalProjectIndicator.class) + .like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalProjectIndicator::getIndexName, req.getIndexName()) + .eq(Objects.nonNull(req.getIndexLevel()), PerformanceAppraisalProjectIndicator::getIndexLevel, req.getIndexLevel()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceAppraisalProjectIndicator::getRegionCode, req.getRegionCode()) + .orderByDesc(PerformanceAppraisalProjectIndicator::getCreateOn); + projectIndicatorService.page(page,wrapper); + + if (CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List result = page.getRecords().stream() + .map(i -> BeanUtil.copyProperties(i, ProjectIndexVO.class)) + .collect(Collectors.toList()); + return PageVo.of(result,page.getTotal()); + } + + public String projectIndexSave(PerformanceIndicatorProjectIndexSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceAppraisalProjectIndicator projectIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectIndicator.class); + if(Objects.nonNull(dto.getId())){ + PerformanceAppraisalProjectIndicator old = projectIndicatorService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); + projectIndicator.setId(old.getId()); + }else{ + projectIndicator.setId(null); + projectIndicator.setCreateOn(LocalDateTime.now()); + projectIndicator.setCreateBy(user.getUsername()); + } + projectIndicator.setUpdateOn(LocalDateTime.now()); + projectIndicator.setUpdateBy(user.getUsername()); + if(projectIndicatorService.saveOrUpdate(projectIndicator)){ + return "指标新增成功"; + } + return "指标新增失败"; + } + + public String projectIndexDelete(Long id) { + PerformanceAppraisalProjectIndicator projectIndicator = projectIndicatorService.getById(id); + VUtils.isTrue(Objects.isNull(projectIndicator)).throwMessage("该项目指标不存在!"); + if (projectIndicatorService.removeById(id)) { + return "删除成功"; + } + return "操作失败"; + } + + public ProjectIndexVO projectIndexDetail(Long id) { + PerformanceAppraisalProjectIndicator projectIndex = projectIndicatorService.getById(id); + if(Objects.isNull(projectIndex)){ + return null; + } + return BeanUtil.copyProperties(projectIndex, ProjectIndexVO.class); + } + + public PageVo appIndexList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalAppIndicator::getIndexName, req.getIndexName()) + .orderBy(Boolean.FALSE,Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort); + appIndicatorService.page(page,wrapper); + + if (CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List result = page.getRecords().stream() + .map(i -> BeanUtil.copyProperties(i, AppIndexVO.class)) + .collect(Collectors.toList()); + return PageVo.of(result,page.getTotal()); + } + + public String appIndexSave(PerformanceIndicatorAppIndexSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceAppraisalAppIndicator appIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalAppIndicator.class); + if(Objects.nonNull(dto.getId())){ + PerformanceAppraisalAppIndicator old = appIndicatorService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); + appIndicator.setId(old.getId()); + }else{ + appIndicator.setId(null); + appIndicator.setCreateOn(LocalDateTime.now()); + appIndicator.setCreateBy(user.getUsername()); + } + appIndicator.setUpdateOn(LocalDateTime.now()); + appIndicator.setUpdateBy(user.getUsername()); + if(appIndicatorService.saveOrUpdate(appIndicator)){ + return "指标新增成功"; + } + return "指标新增失败"; + } + + public String appIndexDelete(Long id) { + PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(id); + VUtils.isTrue(Objects.isNull(appIndicator)).throwMessage("该应用指标不存在!"); + if (appIndicatorService.removeById(id)) { + return "删除成功"; + } + return "操作失败"; + } + + public AppIndexVO appIndexDetail(Long id) { + PerformanceAppraisalAppIndicator appIndex = appIndicatorService.getById(id); + if(Objects.isNull(appIndex)){ + return null; + } + return BeanUtil.copyProperties(appIndex, AppIndexVO.class); + } + + public Boolean enOrDisAppIndex(Long appId, Boolean state) { + PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(appId); + if (Boolean.TRUE.equals(state)){ + appIndicator.setIsDisplay(Boolean.TRUE); + }else { + appIndicator.setIsDisplay(Boolean.FALSE); + } + return appIndicatorService.updateById(appIndicator); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java new file mode 100644 index 0000000..afc7a2b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java @@ -0,0 +1,510 @@ +package com.hz.pm.api.performance.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.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.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.performance.constant.BizConst; +import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; +import com.hz.pm.api.performance.model.dto.SelfAppraisalScoreExportDTO; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.*; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.performance.util.ExcelFillCellMergeStrategy; +import com.hz.pm.api.performance.util.MultiColumnMergeStrategy; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname OrgSelfAppraisalManage + * @Description + * @Date 2023/6/19 14:18 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class OrgSelfAppraisalManage { + + 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; + /** + * 绩效列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + //当前登录用户 单位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); + performanceAppraisalService.page(page,wrapper); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) + .collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + public PageVo pendingList(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.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 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(CollUtil.isEmpty(page.getRecords())){ + 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 已经自评表 + * + * @param planId + * @param req + * @return + */ + 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(); + } + + // 获取本单位在当前评价计划内的项目 + 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(CollUtil.isEmpty(page.getRecords())){ + 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 是否可以自评 + * @param appraisalProject + * @return + */ + 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("项目不存在!"); + // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 + String 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) + .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) + .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); + List templates = indicatorProjectTemplateService.list(wrapper); + VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + if (templates.size() > 1){ + throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); + } + PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); + // 装配项目指标详情及分数信息 + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); + // 获取模版附加绩效指标详情 + List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); + List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,projectCode,vo); + List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,projectCode,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 "提交失败"; + } + + public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + String projectCode = param.getProjectCode(); + Long appraisalId = param.getAppraisalId(); + + // 根据项目编码获取最新版本的项目信息 + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 + String 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) + .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) + .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); + List templates = indicatorProjectTemplateService.list(wrapper); + VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + if (templates.size() > 1){ + throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); + } + PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); + // 装配项目指标详情及分数信息 + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); + Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); + + List exportDataList = Lists.newArrayList(); + List exportAdditionalDataList = Lists.newArrayList(); + // 构建指标和打分详情 + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); + Map scoreInfoMap = scoreInfoList.stream() + .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); + + // 筛选出所有打分的三级指标模板详情ID + for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { + SelfAppraisalScoreExportDTO thirdDto = new SelfAppraisalScoreExportDTO(); + Long detailId = scoreInfo.getTemplateDetailId(); + PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); + thirdDto.setThirdIndexName(thirdTemplateDetail.getName()); + thirdDto.setIndexDetail(thirdTemplateDetail.getIndexDetail()); + thirdDto.setGradeDetail(thirdTemplateDetail.getGradeDetail()); + thirdDto.setSupportMaterial(thirdTemplateDetail.getSupportMaterial()); + thirdDto.setIndexScore(thirdTemplateDetail.getIndexScore()); + if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { + thirdDto.setIsAdditional(CommonEnum.YES.getDesc()); + } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + thirdDto.setIsAdditional(CommonEnum.NO.getDesc()); + } + PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); + if (Objects.nonNull(appraisalScoreInfo)) { + thirdDto.setAppraisalBasis(appraisalScoreInfo.getAppraisalBasis()); + thirdDto.setAppraisalScore(appraisalScoreInfo.getAppraisalScore()); + } + // 二级指标名称 + Long secondId = thirdTemplateDetail.getParentId(); + if (Objects.nonNull(secondId)) { + PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); + if (Objects.nonNull(secondTemplateDetail)) { + thirdDto.setSecondIndexName(secondTemplateDetail.getName()); + // 一级指标名称 + Long firstId = secondTemplateDetail.getParentId(); + if (Objects.nonNull(firstId)){ + PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); + if (Objects.nonNull(firstTemplateDetail)) { + thirdDto.setFirstIndexName(firstTemplateDetail.getName()); + } + } + } + } + if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + exportDataList.add(thirdDto); + }else { + exportAdditionalDataList.add(thirdDto); + } + } + exportDataList.addAll(exportAdditionalDataList); + + String fileName = "绩效评价_单位自评_评分明细表"; + ExcelDownUtil.setFileName(fileName, response); + int[] mergeColumnIndex = {0}; + // 需要从第几行开始合并 + int mergeRowIndex = 1; + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), SelfAppraisalScoreExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)) + .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(exportDataList); + } catch (IOException e) { + throw new RuntimeException(e); + } + + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java new file mode 100644 index 0000000..3324327 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java @@ -0,0 +1,1187 @@ +package com.hz.pm.api.performance.manage; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.wflow.workflow.bean.vo.ProcessTaskVo; +import org.checkerframework.checker.nullness.qual.Nullable; +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.CodeUtil; +import com.hz.pm.api.performance.convert.PerformanceAppraisalConveter; +import com.hz.pm.api.performance.enumration.EvalObjectEnum; +import com.hz.pm.api.performance.model.dto.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalApplicationVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectGroupVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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; + +/** + * @Classname PerformanceAppraisalManage + * @Description + * @Date 2023/6/19 14:18 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +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; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService; + private final ProjectLibManage projectLibManage; + private final IProjectApplicationService projectApplicationService; + + /** + * 绩效列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + Page page = req.page(); + String regionCode = req.getRegionCode(); + 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()) + .eq(StringUtils.isNotBlank(regionCode), PerformanceAppraisal::getRegionCode,regionCode) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + // 如果登录用户是区域管理员,能看到本区域的评价计划 + performanceAppraisalService.page(page,wrapper); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, paIds)); + + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE)); + if(CollUtil.isNotEmpty(projects)){ + projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + } + } + + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, applicationIds)); + if(CollUtil.isNotEmpty(apps)){ + applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); + } + } + + Map> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); + if(finalPapsGroupMap.containsKey(p.getId())){ + vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap)); + } + if(finalPaasGroupMap.containsKey(p.getId())){ + vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap)); + } + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + public PerformanceAppraisalVO detail(Long id) { + + PerformanceAppraisal pa = performanceAppraisalService.getById(id); + VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); + + PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); + //绩效关联的项目 + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id)); + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE)); + if(CollUtil.isNotEmpty(projects)){ + projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + } + } + + //绩效关联的应用 + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, id)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, applicationIds)); + if(CollUtil.isNotEmpty(apps)){ + applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); + } + } + + Map> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + if(finalPapsGroupMap.containsKey(vo.getId())){ + vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); + } + 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; + } + + /** + * 新建计划 + * @param createDTO + * @return + */ + @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(EvalObjectEnum.PROJECT.getCode())){ + saveProjects(createDTO,pa.getId(),user); + } + + if(CollUtil.isNotEmpty(createDTO.getApplicationIds()) + && StringUtils.isNotBlank(createDTO.getTarget()) + && createDTO.getTarget().contains(EvalObjectEnum.APP.getCode())){ + saveApplications(createDTO,pa.getId(),user); + } + + return "新建成功"; + } + + + /** + * 编辑计划 + * @param editDTO + * @return + */ + @Transactional + public String edit(PerformanceAppraisalEditDTO editDTO) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + deduplicationName(editDTO); + + PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO,PerformanceAppraisal.class); + + pa.setUpdateOn(LocalDateTime.now()); + pa.setUpdateBy(user.getUsername()); + performanceAppraisalService.updateById(pa); + String target = editDTO.getTarget(); + // 如果新编辑的评价计划不包含项目,删除原计划添加的评价项目信息 + if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.PROJECT.getCode())){ + performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); + } + + // 如果新编辑的评价计划不包含应用,删除原计划添加的评价应用信息 + if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.APP.getCode())){ + performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); + } + + if(StringUtils.isNotBlank(target) && + target.contains(EvalObjectEnum.PROJECT.getCode()) && + CollUtil.isNotEmpty(editDTO.getProjects())){ + saveProjects(editDTO,user); + } + + if(StringUtils.isNotBlank(target) && + target.contains(EvalObjectEnum.APP.getCode()) && + CollUtil.isNotEmpty(editDTO.getApplicationIds())){ + saveApplications(editDTO,user); + } + + return "编辑成功"; + } + + /** + * 名称去重 + * @param dto + */ + private void deduplicationName(PerformanceAppraisalCreateDTO dto) { + long count = performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) + .eq(PerformanceAppraisal::getName, dto.getName())); + VUtils.isTrue(count > 0).throwMessage("名称已经存在"); + } + + private void deduplicationName(PerformanceAppraisalEditDTO dto) { + if(StringUtils.isNotBlank(dto.getName())){ + long count =performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) + .eq(PerformanceAppraisal::getName,dto.getName()) + .ne(Objects.nonNull(dto.getId()),PerformanceAppraisal::getId,dto.getId())); + VUtils.isTrue(count > 0).throwMessage("名称已经存在"); + } + } + + @Transactional + public void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { + if(CollUtil.isEmpty(createDTO.getProjects())){ + return; + } + Integer startSelfDays = createDTO.getStartSelfDays(); + Integer completeSelfDays = createDTO.getCompleteSelfDays(); + List projects = createDTO.getProjects(); + + List proIdList = performanceAppraisalProjectService.list().stream() + .map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList()); + + List projectIdList = projects.stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); + // 判断提交时,项目是否已经被添加到其他评价计划中 + if (Boolean.TRUE.equals(haveIntersection(projectIdList, proIdList))){ + // 得到交集 + List intersection = Lists.newArrayList(projectIdList); + intersection.retainAll(proIdList); + // 获取重复添加的项目名称 + 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); + } + + 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()); + pap.setProjectCode(newProject.getProjectCode()); + pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); + pap.setCreateBy(user.getUsername()); + 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())){ + return; + } + + List applicationIdList = createDTO.getApplicationIds(); + // 获取已经创建的评价计划中添加的评价应用ID + List applicationIds = performanceAppraisalApplicationService.list().stream() + .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + + // 如果有交集,说明选择的应用中,有已经在其他评价计划中的应用 + 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); + } + + Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, applicationIdList)).stream() + .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); + for(Long applicationId : applicationIdList){ + PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); + paa.setAppraisalId(id); + paa.setApplicationId(applicationId); + ProjectApplication projectApplication = applicationMap.get(applicationId); + if (Objects.nonNull(projectApplication)){ + paa.setAppraisalProjectId(projectApplication.getProjectId()); + paa.setAppraisalProjectCode(projectApplication.getProjectCode()); + } + paa.setCreateBy(user.getUsername()); + paa.setCreateOn(LocalDateTime.now()); + paa.setUpdateBy(user.getUsername()); + paa.setUpdateOn(LocalDateTime.now()); + performanceAppraisalApplicationService.save(paa); + } + } + + @Transactional + public void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { + if(Objects.isNull(editDTO.getProjects())){ + return; + } + + // 删除计划内的项目 + performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); + // 删除项目的打分信息 + List projectIds = editDTO.getProjects().stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); + if (CollUtil.isEmpty(projectIds)){ + throw new BizException("请选择至少一个评价项目!"); + } + List projectCodes = projectService.listByIds(projectIds).stream().map(Project::getProjectCode).collect(Collectors.toList()); + // 删除项目的打分信息 + performanceAppraisalScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,editDTO.getId()) + .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCodes)); + + 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()); + pap.setProjectCode(newProject.getProjectCode()); + pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); + pap.setCreateBy(user.getUsername()); + 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); + } + } + + @Transactional + public void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { + if(Objects.isNull(editDTO.getApplicationIds())){ + return; + } + // 删除计划内的应用 + performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); + // 删除计划内应用的打分信息 + List applicationIdList = editDTO.getApplicationIds(); + if (CollUtil.isEmpty(applicationIdList)){ + throw new BizException("请选择至少一个应用!"); + } + // 删除应用的打分信息 + performanceAppraisalAppScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,editDTO.getId()) + .in(PerformanceAppraisalAppScoreInfo::getApplicationId,applicationIdList)); + + Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, applicationIdList)).stream() + .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); + for(Long applicationId : applicationIdList){ + PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); + paa.setAppraisalId(editDTO.getId()); + paa.setApplicationId(applicationId); + ProjectApplication projectApplication = applicationMap.get(applicationId); + if (Objects.nonNull(projectApplication)){ + paa.setAppraisalProjectId(projectApplication.getProjectId()); + paa.setAppraisalProjectCode(projectApplication.getProjectCode()); + } + paa.setCreateBy(user.getUsername()); + paa.setCreateOn(LocalDateTime.now()); + paa.setUpdateBy(user.getUsername()); + paa.setUpdateOn(LocalDateTime.now()); + performanceAppraisalApplicationService.save(paa); + } + } + + /** + * 删除绩效评价计划 + * 连带删除 其下所有 + * @param id + * @return + */ + public String delete(Long id) { + PerformanceAppraisal pa = performanceAppraisalService.getById(id); + VUtils.isTrue(Objects.isNull(pa)).throwMessage("绩效评价不存在 删除失败!"); + + // 获取评价计划内的待评价项目信息,并按自评开始时间排序 + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id) + .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalProject::getSelfAppraisalStart)); + // 获取计划内项目的自评开始时间 + Optional min = paps.stream().map(PerformanceAppraisalProject::getSelfAppraisalStart).min(LocalDateTime::compareTo); + if (min.isPresent()){ + // 比较当前时间与自评开始时间最小值 + if (LocalDateTime.now().isAfter(min.get())){ + throw new BizException("评价计划内已有项目到达自评时间,无法删除!"); + } + } + + if(performanceAppraisalService.removeById(id)){ + // 删除评价计划关联的项目 + //绩效关联的项目 + if (CollUtil.isNotEmpty(paps)) { + performanceAppraisalProjectService.removeBatchByIds(paps); + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + // 删除项目的打分信息 + List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, id) + .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCodes)); + if (CollUtil.isNotEmpty(scoreInfos)) { + performanceAppraisalScoreInfoService.removeBatchByIds(scoreInfos); + } + + } + // 删除评价计划关联的应用 + //绩效关联的应用 + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, id)); + if (CollUtil.isNotEmpty(paas)) { + performanceAppraisalApplicationService.removeBatchByIds(paas); + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + // 删除应用的打分信息 + List scoreInfos = performanceAppraisalAppScoreInfoService + .list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, id) + .in(PerformanceAppraisalAppScoreInfo::getApplicationId, applicationIds)); + if (CollUtil.isNotEmpty(scoreInfos)) { + performanceAppraisalAppScoreInfoService.removeBatchByIds(scoreInfos); + } + } + // 删除评级计划关联的分组信息 + groupService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId,id)); + return "删除成功"; + } + return "删除失败"; + } + + 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) + .orderByDesc(PerformanceAppraisalProjectGroup::getCreateOn)); + if(CollUtil.isEmpty(groups)){ + return Collections.emptyList(); + } + + Set allEmployeeCodes = Sets.newHashSet(); + Set projectCodes = Sets.newHashSet(); + Map userMap = Maps.newHashMap(); + Map projectMap = Maps.newHashMap(); + groups.stream().forEach(g -> { + allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); + allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); + projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes())); + }); + + if(CollUtil.isNotEmpty(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)); + } + } + + if(CollUtil.isNotEmpty(projectCodes)){ + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode,projectCodes) + .eq(Project::getNewest,Boolean.TRUE)); + if(CollUtil.isNotEmpty(projects)){ + projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + } + } + + Map finalProjectMap = projectMap; + Map finalUserMap = userMap; + return groups.stream().map(g -> { + PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); + vo.setAppraisalId(g.getAppraisalId()); + vo.setName(g.getName()); + vo.setCreateOn(g.getCreateOn()); + vo.setCreateBy(g.getCreateBy()); + vo.setUpdateBy(g.getUpdateBy()); + vo.setUpdateOn(g.getUpdateOn()); + vo.setId(g.getId()); + 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()); + } + + /** + * 分组详情 + * @param id + * @return + */ + public PerformanceAppraisalProjectGroupVO groupDetail(Long id) { + PerformanceAppraisalProjectGroup group = groupService.getById(id); + + if(Objects.isNull(group)){ + return null; + } + + Map projectMap = Maps.newHashMap(); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .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)); + } + + Map userMap = Maps.newHashMap(); + Set allEmployeeCodes = Sets.newHashSet(); + allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); + allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); + if(CollUtil.isNotEmpty(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)); + } + } + + PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); + vo.setAppraisalId(group.getAppraisalId()); + vo.setName(group.getName()); + vo.setCreateOn(group.getCreateOn()); + vo.setCreateBy(group.getCreateBy()); + vo.setUpdateBy(group.getUpdateBy()); + vo.setUpdateOn(group.getUpdateOn()); + vo.setId(group.getId()); + 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; + } + + /** + * 分组 保存 + * @param dto + * @return + */ + public String groupSave(PerformanceAppraisalProjectGroupSaveDTO dto) { + 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())){ + // 判断选择的项目是否已经在当前评价计划的其他分组内 + // 获取当前评价计划的其他分组的项目信息 + 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())){ + // 判断选择的复评人员是否已经在当前评价计划的其他分组内 + // 获取当前评价计划的其他分组的复评人员信息 + 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())){ + // 判断选择的核查人员是否已经在当前评价计划的其他分组内 + // 获取当前评价计划的其他分组的核查人员信息 + 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()); + groupService.saveOrUpdate(group); + 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 + * @return + */ + public String groupDelete(Long id) { + PerformanceAppraisalProjectGroup group = groupService.getById(id); + VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在"); + + //评价Id + Long appraisalId = group.getAppraisalId(); + + PerformanceAppraisal pa = performanceAppraisalService.getById(appraisalId); + VUtils.isTrue(Objects.isNull(pa)).throwMessage("评价不存在"); + + if(groupService.removeById(id)){ + return "删除成功"; + } + return "删除失败"; + } + + private List checkProject(String projectIds, Map projectMap) { + if(StringUtils.isBlank(projectIds)){ + return Collections.emptyList(); + } + return Arrays.stream(projectIds.split(StrPool.COMMA)).map(projectCode -> { + 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.setProjectId(project.getId()); + vo.setProjectCode(projectCode); + vo.setProjectYear(project.getProjectYear()); + vo.setDeclareAmount(project.getDeclareAmount()); + } + return vo; + }).collect(Collectors.toList()); + } + + private List checkUser(String users, Map userMap) { + if(StringUtils.isBlank(users)){ + return Collections.emptyList(); + } + 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(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List res = page.getRecords().stream().map(r -> { + PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); + vo.setAppId(r.getId()); + vo.setAppraisalProjectId(r.getProjectId()); + vo.setAppraisalProjectCode(r.getProjectCode()); + vo.setApplicationName(Objects.nonNull(r.getRelatedExistsApplication()) ? r.getRelatedExistsApplication() : r.getApplicationName()); + 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()); + if (CollUtil.isEmpty(projectCodes)){ + return PageVo.empty(); + } + 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); + return appraisalProjectVo; + }).collect(Collectors.toList()); + return PageVo.of(voList,voList.size()); + } + + public PageVo finalProjectList(PerformanceAppraisalListReq req) { + + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + + Long appraisalId = req.getAppraisalId(); + String projectName = req.getProjectName(); + String buildOrgName = req.getBuildOrgName(); + String projectType = req.getProjectType(); + Integer projectYear = req.getProjectYear(); + // 从项目库获取本区域已验收的项目列表 + ProjectListReq param = new ProjectListReq(); + param.setProjectName(projectName); + param.setBuildOrgName(buildOrgName); + param.setProjectType(projectType); + param.setProjectYear(projectYear); + param.setRegionCode(user.getRegionCode()); + param.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + // 获取已添加到评价计划中的项目 + List projectCodes = performanceAppraisalProjectService.list().stream() + .map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + // 如果是编辑评价计划,获取当前评价计划已添加的项目,并保留当前计划已添加的项目 + if (Objects.nonNull(appraisalId)) { + List projects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); + if (CollUtil.isNotEmpty(projects)){ + List projectCodeList = projects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + projectCodes.removeAll(projectCodeList); + } + } + // 过滤掉已经添加到评价计划中的项目(如果是编辑评价计划,保留当前计划已添加的项目) + param.setProjectCodes(projectCodes); + return projectLibManage.projectLibListWithPermission(param, user); + } + + public PageVo finalApplicationList(PerformanceAppraisalListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String regionCode = user.getRegionCode(); + Long appraisalId = req.getAppraisalId(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()); + + if (StringUtils.isNotBlank(req.getApplicationName())) { + wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName()) + .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName()))); + } + // 获取本区域已验收的项目关联的应用 + List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getAreaCode, regionCode) + .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())); + if (CollUtil.isEmpty(projectList)){ + return PageVo.empty(); + } + List projectCodeList = projectList.stream().map(Project::getProjectCode).collect(Collectors.toList()); + List projectVersionList = projectList.stream().map(Project::getVersion).collect(Collectors.toList()); + wrapper.in(ProjectApplication::getProjectCode,projectCodeList); + wrapper.in(ProjectApplication::getProjectVersion,projectVersionList); + wrapper.orderByDesc(ProjectApplication::getUpdateOn); + List appList = projectApplicationService.list(wrapper); + if (CollUtil.isEmpty(appList)){ + return PageVo.empty(); + } + + List applicationList = Lists.newArrayList(); + + // 按项目编号+应用名称+IRS关联应用名称分组,获取最新版本的应用 + Map> appMap = appList.stream().collect(Collectors.groupingBy(p -> p.getProjectCode() + p.getRelatedExistsApplication() + p.getApplicationName())); + for (Map.Entry> entry : appMap.entrySet()) { + List applications = entry.getValue(); + Optional max = applications.stream().max(Comparator.comparingInt(ProjectApplication::getProjectVersion)); + if (max.isPresent()){ + ProjectApplication application = max.get(); + applicationList.add(application); + } + } + if (CollUtil.isEmpty(applicationList)){ + return PageVo.empty(); + } + // 获取已添加到评价计划中的应用 + List applicationIdList = performanceAppraisalApplicationService.list().stream() + .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + // 如果是编辑评价计划,保留当前计划已添加的应用 + if (Objects.nonNull(appraisalId)) { + List projectApplications = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId)); + if (CollUtil.isNotEmpty(projectApplications)){ + List appIdList = projectApplications.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + applicationIdList.removeAll(appIdList); + } + } + List resList = applicationList.stream().filter(a -> !applicationIdList.contains(a.getId())).collect(Collectors.toList()); + if (CollUtil.isEmpty(resList)){ + return PageVo.empty(); + } + //List relatedAppList = Lists.newArrayList(); + //// TODO 对IRS关联应用是否按照应用名称和应用code进行去重(在不同项目中,已经在IRS注册过的同一个应用只显示一个)? + //List relatedList = resList.stream().filter(r -> StringUtils.isNotBlank(r.getRelatedExistsApplication())).collect(Collectors.toList()); + //if (CollUtil.isNotEmpty(relatedList)) { + // resList.removeAll(relatedList); + // Map> relatedAppMap = relatedList.stream() + // .collect(Collectors.groupingBy(r -> r.getRelatedExistsApplication() + r.getRelatedExistsApplicationCode())); + // for (Map.Entry> entry : relatedAppMap.entrySet()) { + // List value = entry.getValue(); + // relatedAppList.add(value.get(0)); + // } + // resList.addAll(relatedAppList); + //} + //// TODO 对初次建设应用,是否根据建设方案申报时填写的应用名称、应用类型、发布端、应用简介、等保级别、密评级别 去重? + Integer pageNumber = req.getPageNumber(); + Integer pageSize = req.getPageSize(); + List resultList = resList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List res = resultList.stream() + .map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res, resList.size()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java new file mode 100644 index 0000000..9cb228d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java @@ -0,0 +1,494 @@ +package com.hz.pm.api.performance.manage; + +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.CharsetUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.builder.ExcelWriterBuilder; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.model.dto.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import com.hz.pm.api.performance.util.*; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; +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.hz.pm.api.performance.constant.BizConst; +import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.http.HttpServletResponse; + +/** + * 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; + private final IProjectTagService projectTagService; + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + /** + * 复评-评价计划列表 + * @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, 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 = Lists.newArrayList(); + if (reAppraisalUsers.contains(StrPool.COMMA)) { + empCodeList.addAll(Arrays.asList(reAppraisalUsers.split(StrPool.COMMA))); + }else { + empCodeList.add(reAppraisalUsers); + } + 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); + if (Objects.isNull(projectGroup)){ + throw new BizException("当前复评用户所在分组不存在!"); + } + 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(ProjectTypeNewEnum.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) { + // 获取该评价计划的该分组内的复评人员对该项目的的复评打分信息 + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, group.getAppraisalId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, appraisalProject.getProjectCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); + // 判断打分人员是否为分组内的复评人员 + if (CollUtil.isNotEmpty(scoreInfoList)) { + Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); + if (CollUtil.isNotEmpty(users)) { + String reAppraisalUsers = group.getReAppraisalUsers(); + String join = String.join(StrPool.COMMA, users); + if (join.equals(reAppraisalUsers)) { + // 标记项目完成复评 + appraisalProject.setIsCompleteReAppraisal(Boolean.TRUE); + } + } + } + } + + public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + String projectCode = param.getProjectCode(); + Long appraisalId = param.getAppraisalId(); + + // 根据项目编码获取最新版本的项目信息 + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 + String 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) + .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) + .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); + List templates = indicatorProjectTemplateService.list(wrapper); + VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + if (templates.size() > 1){ + throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); + } + PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); + // 装配项目指标详情及分数信息 + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); + Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); + + List> exportDataList = Lists.newArrayList(); + List> exportAdditionalDataList = Lists.newArrayList(); + // 构建指标和打分详情 + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) + .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); + Map scoreInfoMap = scoreInfoList.stream() + .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); + + // 获取复评打分人员信息 + List reScoreInfoList = scoreInfoList.stream() + .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) + .collect(Collectors.toList()); + List reUserList = reScoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .collect(Collectors.toList()); + + // 筛选出所有打分的三级指标模板详情ID + for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { + HashMap scoreMap = MapUtil.newHashMap(); + Long detailId = scoreInfo.getTemplateDetailId(); + PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); + + // 二级指标名称 + Long secondId = thirdTemplateDetail.getParentId(); + if (Objects.nonNull(secondId)) { + PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); + if (Objects.nonNull(secondTemplateDetail)) { + // 一级指标名称 + Long firstId = secondTemplateDetail.getParentId(); + if (Objects.nonNull(firstId)){ + PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); + if (Objects.nonNull(firstTemplateDetail)) { + scoreMap.put(BizConst.FIRST_INDEX_NAME,firstTemplateDetail.getName()); + scoreMap.put(BizConst.SECOND_INDEX_NAME,secondTemplateDetail.getName()); + } + } + } + } + scoreMap.put(BizConst.THIRD_INDEX_NAME,thirdTemplateDetail.getName()); + scoreMap.put(BizConst.INDEX_SCORE,thirdTemplateDetail.getIndexScore()); + scoreMap.put(BizConst.INDEX_DETAIL,thirdTemplateDetail.getIndexDetail()); + scoreMap.put(BizConst.GRADE_DETAIL,thirdTemplateDetail.getGradeDetail()); + scoreMap.put(BizConst.SUPPORT_MATERIAL,thirdTemplateDetail.getSupportMaterial()); + PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); + // 构建自评和复评打分信息 + if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())){ + scoreMap.put(BizConst.SELF_APPRAISAL_BASIS,appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(BizConst.SELF_APPRAISAL_SCORE,appraisalScoreInfo.getAppraisalScore()); + } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); + } + + if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { + scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.YES.getDesc()); + } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.NO.getDesc()); + } + if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + exportDataList.add(scoreMap); + }else { + exportAdditionalDataList.add(scoreMap); + } + } + exportDataList.addAll(exportAdditionalDataList); + String fileName = "绩效评价_人工复评_评分明细表"; + ExcelDownUtil.setFileName(fileName, response); + int[] mergeColumnIndex = {0}; + // 需要从第几行开始合并 + int mergeRowIndex = 2; + + List headList = Lists.newArrayList(); + headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME,BizConst.FIRST_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME,BizConst.SECOND_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME,BizConst.THIRD_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_SCORE,BizConst.INDEX_SCORE_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_DETAIL,BizConst.INDEX_DETAIL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.GRADE_DETAIL,BizConst.GRADE_DETAIL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL,BizConst.SUPPORT_MATERIAL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS,BizConst.SELF_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE,BizConst.SELF_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + for (String reUser : reUserList) { + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS,BizConst.RE_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE,BizConst.RE_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + } + headList.add(new ExcelHead(BizConst.IS_ADDITIONAL,BizConst.IS_ADDITIONAL_TITLE,StrPool.EMPTY)); + + // 数据导出处理函数 + try { + response.setCharacterEncoding(CharsetUtil.UTF_8); + response.setContentType(ContentTypeUtils.APPLICATION_EXCEL); + ExcelWriterBuilder writerBuilder = EasyExcel.write(); + writerBuilder.file(response.getOutputStream()); + writerBuilder.autoCloseStream(true); + writerBuilder.registerWriteHandler(new ExcelSheetVerticalCellStyleStrategy()); + writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)); + writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)); + writerBuilder.head(ExcelUtils.getHead(reUserList,Lists.newArrayList())) + .sheet(fileName) + .doWrite(ExcelUtils.convertData(headList, exportDataList)); + } catch (IOException e) { + throw new BizException(e.getMessage()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java new file mode 100644 index 0000000..c3a669b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java @@ -0,0 +1,382 @@ +package com.hz.pm.api.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.text.StrPool; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.enumration.RectifyAuditEnum; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +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.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.performance.enumration.RectifyStatusEnum; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.model.vo.RectifyDetailVO; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * RectifyAuditManage + * + * @return + * @author CMM + * @since 2023/08/12 17:36 + */ +@Component +@Slf4j +@AllArgsConstructor +public class RectifyAuditManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final UserInfoHelper userInfoHelper; + private final IPerformanceAppraisalProjectGroupService groupService; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + /** + * 绩效列表 + * + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + // 当前登录用户 单位code + 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 verifyLeader = projectGroup.getVerifyLeader(); + if (Objects.nonNull(verifyLeader) && verifyLeader.equals(employeeCode)) { + groups.add(projectGroup); + } + } + // 当前登录专家没有绩效分组信息 + if (CollUtil.isEmpty(groups)) { + return PageVo.empty(); + } + + // 获取分组所在的评价计划ID + List appraisalIds = + groups.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); + + // 获取评价计划内的所有需整改核查项目信息(整改状态为整改待审核、整改审核不通过、整改审核通过) + List paps = performanceAppraisalProjectService.list(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, appraisalIds) + .and(wp -> wp.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()) + .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode())) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); + // 评价计划内符合条件的项目数为空 + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + + Set appraisalIdList = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId, appraisalIdList).orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + // 按评价计划分组 + Map> papsMap = + paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + // 统计评价计划待核查项目数量(整改状态为:整改待审核) + List projects = papsMap.get(p.getId()); + if (CollUtil.isNotEmpty(projects)) { + List unRectifyAuditProjects = + projects.stream().filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setUnRectifyAuditNumber(unRectifyAuditProjects.size()); + // 统计评价计划已核查项目数量(整改状态为:整改核查不通过、整改审核通过) + List rectifiedAuditProjects = + paps.stream() + .filter(d -> RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setRectifiedAuditNumber(rectifiedAuditProjects.size()); + } + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); + } + + public PageVo unAuditList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 + PerformanceAppraisalProjectGroup projectGroup = + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + // 当前登录专家没有为核查组长的绩效分组信息 + if (Objects.isNull(projectGroup)) { + return PageVo.empty(); + } + + String groupProjectCodes = projectGroup.getProjectCodes(); + List codes = Lists.newArrayList(); + if (groupProjectCodes.contains(StrPool.COMMA)) { + codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); + } else { + codes.add(groupProjectCodes); + } + // 获取评价计划内已添加的核查组长为当前登录专家用户的待整改审核项目信息 + List paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + // 获取本单位在当前评价计划内的项目 + 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) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .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 = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + vo.setGroupId(projectGroup.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public PageVo auditedList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 + PerformanceAppraisalProjectGroup projectGroup = + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + // 当前登录专家没有为核查组长的绩效分组信息 + if (Objects.isNull(projectGroup)) { + return PageVo.empty(); + } + + String groupProjectCodes = projectGroup.getProjectCodes(); + List codes = Lists.newArrayList(); + if (groupProjectCodes.contains(StrPool.COMMA)) { + codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); + } else { + codes.add(groupProjectCodes); + } + // 获取评价计划内已添加的核查组长为当前登录专家用户的已整改审核项目信息 + List< + PerformanceAppraisalProject> paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) + .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + // 获取评价计划内的项目 + 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) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .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 = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + vo.setGroupId(projectGroup.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String submit(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(); + Integer rectifyAuditResult = param.getRectifyAuditResult(); + String rectifyAuditOpinion = param.getRectifyAuditOpinion(); + String rectifyAuditAppendix = param.getRectifyAuditAppendix(); + 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_RECTIFY_AUDIT.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 rectifyTotalScore = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 保存整改审核相关信息 + appraisalProject.setRectifyTotalScore(rectifyTotalScore); + appraisalProject.setRectifyScoreTime(LocalDateTime.now()); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + appraisalProject.setRectifyAuditResult(rectifyAuditResult); + appraisalProject.setRectifyAuditOpinion(rectifyAuditOpinion); + appraisalProject.setRectifyAuditAppendix(rectifyAuditAppendix); + if (RectifyAuditEnum.APPROVED.getCode().equals(rectifyAuditResult)) { + appraisalProject.setRectifyStatus(RectifyStatusEnum.APPROVED.getCode()); + } else if (RectifyAuditEnum.NOT_APPROVED.getCode().equals(rectifyAuditResult)) { + appraisalProject.setRectifyStatus(RectifyStatusEnum.NOT_APPROVED.getCode()); + } + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java new file mode 100644 index 0000000..a3da2c1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java @@ -0,0 +1,297 @@ +package com.hz.pm.api.performance.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +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.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.performance.enumration.RectifyStatusEnum; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.model.vo.RectifyDetailVO; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; +import com.hz.pm.api.performance.service.IPerformanceAppraisalService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * RectifyManage + * + * @return + * @author CMM + * @since 2023/08/12 17:36 + */ +@Component +@Slf4j +@AllArgsConstructor +public class RectifyManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final UserInfoHelper userInfoHelper; + + /** + * 绩效列表 + * + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + // 当前登录用户 单位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) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); + // 按评价计划分组 + Map> papsMap = + paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + 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); + performanceAppraisalService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + // 统计评价计划待整改项目数量(整改状态为:整改情况待提交、整改核查不通过) + List projects = papsMap.get(p.getId()); + List unRectifyProjects = projects.stream() + .filter(d -> RectifyStatusEnum.TO_BE_SUBMITTED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setUnRectifyNumber(unRectifyProjects.size()); + // 统计评价计划已整改项目数量(整改状态为:整改待审核、整改审核通过) + List rectifiedProjects = + paps.stream() + .filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setRectifiedNumber(rectifiedProjects.size()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); + } + + public PageVo unRectifyList(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()) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_SUBMITTED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()))); + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + if (CollUtil.isEmpty(paps)) { + 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 (CollUtil.isEmpty(page.getRecords())) { + 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.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public PageVo rectifiedList(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()) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + if (CollUtil.isEmpty(paps)) { + 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 (CollUtil.isEmpty(page.getRecords())) { + 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.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public RectifyDetailVO getRectifyDetail(Long planId, String projectCode) { + RectifyDetailVO vo = new RectifyDetailVO(); + // 根据评价计划ID和项目编号获取评价项目信息 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, planId) + .eq(PerformanceAppraisalProject::getProjectCode, projectCode)); + VUtils.isTrue(Objects.isNull(appraisalProject)).throwMessage("该项目已被移除评价计划,请返回上一页或者刷新重试!!"); + BeanUtils.copyProperties(appraisalProject, vo); + String rectifySubmitEmployeeCode = appraisalProject.getRectifySubmitEmployeeCode(); + if (StringUtils.isNotBlank(rectifySubmitEmployeeCode)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifySubmitEmployeeCode); + vo.setRectifySubmitEmployee(userFullInfoDto); + } + String rectifyResSubEmpCode = appraisalProject.getRectifyResSubEmpCode(); + if (StringUtils.isNotBlank(rectifyResSubEmpCode)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifyResSubEmpCode); + vo.setRectifyResSubEmployee(userFullInfoDto); + } + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + } + + @Transactional(rollbackFor = Exception.class) + public String fillOutResult(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(); + String rectifyResult = param.getRectifyResult(); + String rectifyResultAppendix = param.getRectifyResultAppendix(); + + // 判断该项目是否还存在于计划或分组中 + 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("该项目已被移除评价计划,请返回上一页或者刷新重试!"); + } + appraisalProject.setRectifyResult(rectifyResult); + appraisalProject.setRectifyResultAppendix(rectifyResultAppendix); + appraisalProject.setRectifyResSubEmpCode(employeeCode); + appraisalProject.setRectifyResSubTime(LocalDateTime.now()); + // 更新整改状态为整改待审核 + appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_REVIEWED.getCode()); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + if (performanceAppraisalProjectService.updateById(appraisalProject)) { + return "提交审核成功!"; + } + return "提交审核失败"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java new file mode 100644 index 0000000..043c4cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java @@ -0,0 +1,513 @@ +package com.hz.pm.api.performance.manage; + +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.CharsetUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.builder.ExcelWriterBuilder; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.constant.BizConst; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; +import com.hz.pm.api.performance.util.*; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +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.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.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.enumration.RectifyStatusEnum; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; +import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.http.HttpServletResponse; + +/** + * 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 IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + private final IPerformanceAppraisalProjectGroupService groupService; + private final IProjectTagService projectTagService; + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + /** + * 核查-评价计划列表 + * @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.setVerifyGroupId(group.getId()); + vo.setVerifyGroupName(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); + if (Objects.isNull(projectGroup)){ + throw new BizException("当前核查用户所在分组不存在!"); + } + 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); + vo.setCanVerify(checkCanVerify(employeeCode,appraisalProject.getProjectCode(),appraisalId)); + // 如果登录用户是核查组长,该项目可填写整改意见 + String verifyLeader = projectGroup.getVerifyLeader(); + if (employeeCode.equals(verifyLeader)){ + vo.setCanRectify(Boolean.TRUE); + } + vo.setGroupId(groupId); + 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.setVerifyTotalScore(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()); + appraisalProject.setRectifySubmitEmployeeCode(employeeCode); + appraisalProject.setRectifySubmitTime(LocalDateTime.now()); + appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_SUBMITTED.getCode()); + } + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } + + private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { + // 获取该评价计划当前分组对该项目的核查打分信息 + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,group.getAppraisalId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,appraisalProject.getProjectCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); + + // 判断打分人员是否为分组内的核查人员 + if (CollUtil.isNotEmpty(scoreInfoList)) { + Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); + if (CollUtil.isNotEmpty(users)) { + String verificationUsers = group.getVerificationUsers(); + String join = String.join(StrPool.COMMA, users); + if (join.equals(verificationUsers)) { + // 标记项目完成核查 + appraisalProject.setIsCompleteVerify(Boolean.TRUE); + } + } + } + } + + public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + String projectCode = param.getProjectCode(); + Long appraisalId = param.getAppraisalId(); + + // 根据项目编码获取最新版本的项目信息 + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 + String 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) + .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) + .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); + List templates = indicatorProjectTemplateService.list(wrapper); + VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + if (templates.size() > 1){ + throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); + } + PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); + // 装配项目指标详情及分数信息 + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); + Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); + + List> exportDataList = Lists.newArrayList(); + List> exportAdditionalDataList = Lists.newArrayList(); + // 构建指标和打分详情 + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) + .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()).or() + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); + Map scoreInfoMap = scoreInfoList.stream() + .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); + + // 获取复评打分人员信息 + List reScoreInfoList = scoreInfoList.stream() + .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) + .collect(Collectors.toList()); + List reUserList = reScoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .collect(Collectors.toList()); + + // 获取核查打分人员信息 + List verifyScoreInfoList = scoreInfoList.stream() + .filter(s -> AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(s.getAppraisalType())) + .collect(Collectors.toList()); + List verifyUserList = verifyScoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .collect(Collectors.toList()); + + // 筛选出所有打分的三级指标模板详情ID + for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { + HashMap scoreMap = MapUtil.newHashMap(); + Long detailId = scoreInfo.getTemplateDetailId(); + PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); + + // 二级指标名称 + Long secondId = thirdTemplateDetail.getParentId(); + if (Objects.nonNull(secondId)) { + PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); + if (Objects.nonNull(secondTemplateDetail)) { + // 一级指标名称 + Long firstId = secondTemplateDetail.getParentId(); + if (Objects.nonNull(firstId)){ + PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); + if (Objects.nonNull(firstTemplateDetail)) { + scoreMap.put(BizConst.FIRST_INDEX_NAME,firstTemplateDetail.getName()); + scoreMap.put(BizConst.SECOND_INDEX_NAME,secondTemplateDetail.getName()); + } + } + } + } + scoreMap.put(BizConst.THIRD_INDEX_NAME,thirdTemplateDetail.getName()); + scoreMap.put(BizConst.INDEX_SCORE,thirdTemplateDetail.getIndexScore()); + scoreMap.put(BizConst.INDEX_DETAIL,thirdTemplateDetail.getIndexDetail()); + scoreMap.put(BizConst.GRADE_DETAIL,thirdTemplateDetail.getGradeDetail()); + scoreMap.put(BizConst.SUPPORT_MATERIAL,thirdTemplateDetail.getSupportMaterial()); + + PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); + // 构建自评和复评打分信息 + if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())){ + scoreMap.put(BizConst.SELF_APPRAISAL_BASIS,appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(BizConst.SELF_APPRAISAL_SCORE,appraisalScoreInfo.getAppraisalScore()); + } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); + } else if (AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(appraisalScoreInfo.getAppraisalType())) { + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); + } + + if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { + scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.YES.getDesc()); + } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.NO.getDesc()); + } + if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { + exportDataList.add(scoreMap); + }else { + exportAdditionalDataList.add(scoreMap); + } + } + exportDataList.addAll(exportAdditionalDataList); + String fileName = "绩效评价_专家核查_评分明细表"; + ExcelDownUtil.setFileName(fileName, response); + int[] mergeColumnIndex = {0}; + // 需要从第几行开始合并 + int mergeRowIndex = 2; + + List headList = Lists.newArrayList(); + headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME,BizConst.FIRST_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME,BizConst.SECOND_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME,BizConst.THIRD_INDEX_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_SCORE,BizConst.INDEX_SCORE_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_DETAIL,BizConst.INDEX_DETAIL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.GRADE_DETAIL,BizConst.GRADE_DETAIL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL,BizConst.SUPPORT_MATERIAL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS,BizConst.SELF_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE,BizConst.SELF_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + for (String reUser : reUserList) { + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS,BizConst.RE_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE,BizConst.RE_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + } + + for (String verifyUser : verifyUserList) { + headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_BASIS,BizConst.VERIFY_BASIS_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_SCORE,BizConst.VERIFY_SCORE_TITLE,StrPool.EMPTY)); + } + headList.add(new ExcelHead(BizConst.IS_ADDITIONAL,BizConst.IS_ADDITIONAL_TITLE,StrPool.EMPTY)); + + // 数据导出处理函数 + try { + response.setCharacterEncoding(CharsetUtil.UTF_8); + response.setContentType(ContentTypeUtils.APPLICATION_EXCEL); + ExcelWriterBuilder writerBuilder = EasyExcel.write(); + writerBuilder.file(response.getOutputStream()); + writerBuilder.autoCloseStream(true); + writerBuilder.registerWriteHandler(new ExcelSheetVerticalCellStyleStrategy()); + writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)); + writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)); + writerBuilder.head(ExcelUtils.getHead(reUserList,verifyUserList)) + .sheet(fileName) + .doWrite(ExcelUtils.convertData(headList, exportDataList)); + } catch (IOException e) { + throw new BizException(e.getMessage()); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java new file mode 100644 index 0000000..2033c9d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppIndicator; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-29 + */ +public interface PerformanceAppraisalAppIndicatorMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml new file mode 100644 index 0000000..1fd492d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java new file mode 100644 index 0000000..65e1ce9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +public interface PerformanceAppraisalAppScoreInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml new file mode 100644 index 0000000..6598ea4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.java new file mode 100644 index 0000000..1571cb7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalApplication; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalApplicationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.xml new file mode 100644 index 0000000..0e9a238 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalApplicationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java new file mode 100644 index 0000000..9dbdca1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; +import com.hz.pm.api.projectlib.model.entity.Project; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.xml new file mode 100644 index 0000000..e024702 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.java new file mode 100644 index 0000000..8d1df92 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectGroup; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalProjectGroupMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml new file mode 100644 index 0000000..79ccebe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java new file mode 100644 index 0000000..1d8f7fe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectIndicator; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-28 + */ +public interface PerformanceAppraisalProjectIndicatorMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml new file mode 100644 index 0000000..923091f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java new file mode 100644 index 0000000..a4b7690 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalProjectMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.xml new file mode 100644 index 0000000..6acb4c2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.java new file mode 100644 index 0000000..5714c51 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml new file mode 100644 index 0000000..c992eca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java new file mode 100644 index 0000000..4dd8dfb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml new file mode 100644 index 0000000..b65c1da --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java new file mode 100644 index 0000000..9e47561 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplate; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml new file mode 100644 index 0000000..963ce41 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java new file mode 100644 index 0000000..925aa2e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.mapper; + +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +public interface ProjectCoreBusinessIndicatorsMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml new file mode 100644 index 0000000..ad72537 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java new file mode 100644 index 0000000..d15ef05 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppAppraisalInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppAppraisalInfoDTO.java new file mode 100644 index 0000000..056c670 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppAppraisalInfoDTO.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +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 AppAppraisalInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用指标ID") + private Long indexId; + + @ApiModelProperty("评价得分") + @NotNull(message = "得分不能为空!") + private BigDecimal score; + + @ApiModelProperty("指标类型") + private Integer indexType; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppraisalProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppraisalProjectDTO.java new file mode 100644 index 0000000..7f0471a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AppraisalProjectDTO.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.performance.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.validation.constraints.NotNull; + +/** + * @Classname AppraisalProjectDTO + * @Description + * @Date 2023/6/19 17:08 + * @Author PoffyZhang + */ +@Data +public class AppraisalProjectDTO { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID 必填") + private Long id; + + @ApiModelProperty("是否复评") + private Boolean isReAppraisal = Boolean.FALSE; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalCreateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalCreateDTO.java new file mode 100644 index 0000000..163f740 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalCreateDTO.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.performance.model.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalApplicationVO; +import com.hz.pm.api.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; + +/** + * @Classname PerformanceAppraisalCreateDTO + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价创建对象", description = "绩效评价创建对象") +public class PerformanceAppraisalCreateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("计划名称") + @NotBlank(message = "请输入计划名称") + @Size(max = 50) + private String name; + + @ApiModelProperty("终验后 xx 天开始自评") + @NotNull(message = "开始自评时间不能为空") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") + private Integer startSelfDays; + + @ApiModelProperty("xx 天需完成自评") + @NotNull(message = "完成自评时间不能为空") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") + private Integer completeSelfDays; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + @NotBlank(message = "评价目标不能为空") + private String target; + + @ApiModelProperty("评价项目 只有ID 和是否复评") + private List projects; + + @ApiModelProperty("评价应用ids") + private List applicationIds; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java new file mode 100644 index 0000000..82cdff5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.performance.model.dto; + +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; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PerformanceAppraisalEditDTO + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价编辑对象", description = "绩效评价编辑对象") +public class PerformanceAppraisalEditDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "编辑的时候 id必填") + private Long id; + + @ApiModelProperty("计划名称") + private String name; + + @ApiModelProperty("终验后 xx 天开始自评") + @NotNull(message = "开始自评时间不能为空") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") + private Integer startSelfDays; + + @ApiModelProperty("xx 天需完成自评") + @NotNull(message = "完成自评时间不能为空") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") + private Integer completeSelfDays; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + private String target; + + @ApiModelProperty("评价项目 只有ID 和是否复评") + private List projects; + + @ApiModelProperty("评价应用ids") + private List applicationIds; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java new file mode 100644 index 0000000..4588aa4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.performance.model.dto; + +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; +import java.util.List; + +/** + * @Classname PerformanceAppraisalProjectGroupSaveDTO + * @Description 绩效评价和项目分组 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") +public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("计划id") + private Long appraisalId; + + @ApiModelProperty("状态 0关闭 1开启") + private Integer status = 0; + + @ApiModelProperty("分组内的所有项目code") + private List projectCodes; + + @ApiModelProperty("复评人员") + private List reAppraisalUsers; + + @ApiModelProperty("核查人员") + private List verificationUsers; + + @ApiModelProperty("核查组长") + private String verifyLeader; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java new file mode 100644 index 0000000..3d83884 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import org.hibernate.validator.constraints.Range; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绩效评级-应用指标库 新增指标保存 + * @return + * @author CMM + * @since 2023/07/29 10:04 + */ +@Data +@ApiModel(value = "绩效评价考核应用指标库", description = "绩效评价考核应用指标库") +public class PerformanceIndicatorAppIndexSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标所属模块") + private String indexOwningModule; + + @ApiModelProperty("指标展示顺序") + private Integer sort; + + @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") + private Integer displayForm; + + @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") + private Integer indexType; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java new file mode 100644 index 0000000..3771991 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.Size; + +/** + * 绩效评级-项目指标库 新增指标保存 + * @return + * @author CMM + * @since 2023/07/28 15:44 + */ +@Data +@ApiModel(value = "绩效评价考核项目指标库", description = "绩效评价考核项目指标库") +public class PerformanceIndicatorProjectIndexSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + @Size(max = 50) + private String indexName; + + @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") + private Integer indexLevel; + + @ApiModelProperty("指标分值") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则") + @Size(max = 200) + private String indexDetail; + + @ApiModelProperty("评分细则") + @Size(max = 200) + private String gradeDetail; + + @ApiModelProperty("佐证材料") + @Size(max = 200) + private String supportMaterial; + + @ApiModelProperty("丽水 区域code") + private String regionCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java new file mode 100644 index 0000000..2033046 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.performance.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname PerformanceIndicatorProjectTemplateSaveDTO + * @Description 绩效评价考核模板 保存 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") +public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("项目类型 ") + private Integer projectType; + + @ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") + private Integer constructType; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; + + @ApiModelProperty("状态 0 1") + private Integer status; + + @ApiModelProperty("绩效指标详情") + private List templateDetails; + + @ApiModelProperty("附加绩效指标详情") + private List additionalIndexDetails; + + @ApiModelProperty("项目标签信息") + private List projectTagIds; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalDTO.java new file mode 100644 index 0000000..eceb038 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalDTO.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.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 applicationId; + + @ApiModelProperty("评价项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("评价项目Code") + private String appraisalProjectCode; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("项目模板指标详情评价信息集合") + private List appraisalInfoList; + + @ApiModelProperty("应用指标评价信息集合") + private List appAppraisalInfoList; + + @ApiModelProperty("项目是否需要整改") + private Boolean isRectify; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("评价项目所在分组ID") + private Long groupId; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalInfoDTO.java new file mode 100644 index 0000000..dba3f5f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectAppraisalInfoDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectCoreBusinessDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectCoreBusinessDTO.java new file mode 100644 index 0000000..c46c02c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectCoreBusinessDTO.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.Size; + +/** + * @author CMM + * @since 2023/07/26 15:05 + */ +@ApiModel(value = "ProjectCoreBusinessDTO对象", description = "") +@Data +public class ProjectCoreBusinessDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("核心业务ID") + private Long id; + + @ApiModelProperty("核心业务") + private String coreBusiness; + + @ApiModelProperty("业务指标分值") + @Range(min = 0, max = 10, message = "数值范围不正确,数值应大于0小于10") + private BigDecimal score; + + @ApiModelProperty("业务指标名称") + @Size(max = 100) + private String businessIndicatorName; + + @ApiModelProperty("业务指标描述") + @Size(max = 100) + private String businessIndicatorDescription; + + @ApiModelProperty("指标设计依据") + @Size(max = 100) + private String indexDesignBasis; + + @ApiModelProperty("指标计算方法") + @Size(max = 100) + private String indexCalculationMethod; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectTemplateDetailDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectTemplateDetailDTO.java new file mode 100644 index 0000000..f709d4d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ProjectTemplateDetailDTO.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.performance.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Range; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Classname PerformanceIndicatorProjectTemplateDetail + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树") +public class ProjectTemplateDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关联模板ID") + private Long templateId; + + @ApiModelProperty("指标ID") + private Long indexId; + + @ApiModelProperty("指标名称") + private String name; + + @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") + private Integer type; + + @ApiModelProperty("父级指标id") + private Long parentId; + + @ApiModelProperty("指标分值 3级指标才有") + @Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则 3级指标才有") + private String indexDetail; + + @ApiModelProperty("评分细则") + private String gradeDetail; + + @ApiModelProperty("佐证材料 描述") + private String supportMaterial; + + @ApiModelProperty("子指标") + private List children; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalInfoDTO.java new file mode 100644 index 0000000..4bd70d3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalInfoDTO.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 应用评价信息 + * @return + * @author CMM + * @since 2023/08/08 18:46 + */ +@Data +public class ReAppraisalInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("复评依据") + private String reAppraisalBasis; + + @ApiModelProperty("复评得分") + private BigDecimal reAppraisalScore; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalScoreExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalScoreExportDTO.java new file mode 100644 index 0000000..201e4e3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/ReAppraisalScoreExportDTO.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import com.alibaba.excel.annotation.ExcelProperty; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绩效打分详情导出实体 + * + * @author CMM + * @since 2023/08/16 10:31 + */ +@Data +public class ReAppraisalScoreExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("一级指标名称") + @ExcelProperty(value = "一级指标",index = 0) + private String firstIndexName; + + @ApiModelProperty("二级指标名称") + @ExcelProperty(value = "二级指标",index = 1) + private String secondIndexName; + + @ApiModelProperty("三级指标名称") + @ExcelProperty(value = "三级指标",index = 2) + private String thirdIndexName; + + @ApiModelProperty("指标分值 3级指标才有") + @ExcelProperty(value = "指标分值",index = 3) + private BigDecimal indexScore; + + @ApiModelProperty("指标细则 3级指标才有") + @ExcelProperty(value = "指标细则",index = 4) + private String indexDetail; + + @ApiModelProperty("评分细则") + @ExcelProperty(value = "评分细则",index = 5) + private String gradeDetail; + + @ApiModelProperty("佐证材料描述") + @ExcelProperty(value = "佐证材料",index = 6) + private String supportMaterial; + + @ApiModelProperty("自评依据") + @ExcelProperty(value = "自评依据",index = 7) + private String selfAppraisalBasis; + + @ApiModelProperty("自评得分") + @ExcelProperty(value = "自评得分",index = 8) + private BigDecimal selfAppraisalScore; + + @ApiModelProperty("复评依据") + @ExcelProperty(value = "复评依据",index = 9) + private String refAppraisalBasis; + + @ApiModelProperty("复评得分") + @ExcelProperty(value = "复评得分",index = 10) + private BigDecimal reAppraisalScore; + + @ApiModelProperty("是否为附加指标") + @ExcelProperty(value = "是否附加指标",index = 11) + private String isAdditional; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/SelfAppraisalScoreExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/SelfAppraisalScoreExportDTO.java new file mode 100644 index 0000000..8039d5b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/SelfAppraisalScoreExportDTO.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绩效打分详情导出实体 + * + * @author CMM + * @since 2023/08/16 10:31 + */ +@Data +public class SelfAppraisalScoreExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("一级指标名称") + @ExcelProperty(value = "一级指标",index = 0) + private String firstIndexName; + + @ApiModelProperty("二级指标名称") + @ExcelProperty(value = "二级指标",index = 1) + private String secondIndexName; + + @ApiModelProperty("三级指标名称") + @ExcelProperty(value = "三级指标",index = 2) + private String thirdIndexName; + + @ApiModelProperty("指标分值 3级指标才有") + @ExcelProperty(value = "指标分值",index = 3) + private BigDecimal indexScore; + + @ApiModelProperty("指标细则 3级指标才有") + @ExcelProperty(value = "指标细则",index = 4) + private String indexDetail; + + @ApiModelProperty("评分细则") + @ExcelProperty(value = "评分细则",index = 5) + private String gradeDetail; + + @ApiModelProperty("佐证材料描述") + @ExcelProperty(value = "佐证材料",index = 6) + private String supportMaterial; + + @ApiModelProperty("自评依据") + @ExcelProperty(value = "自评依据",index = 7) + private String appraisalBasis; + + @ApiModelProperty("自评得分") + @ExcelProperty(value = "自评得分",index = 8) + private BigDecimal appraisalScore; + + @ApiModelProperty("是否为附加指标") + @ExcelProperty(value = "是否附加指标",index = 9) + private String isAdditional; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ExcelHead.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ExcelHead.java new file mode 100644 index 0000000..5cc6ec0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ExcelHead.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.performance.model.entity; + +/** + * @author CMM + * @since 2023/08/17 21:03 + */ + +import lombok.Data; + +/** + * Excel 导出类 - ExcelHead + */ +@Data +public class ExcelHead { + /** + * 内容里的字段名称 + */ + private String fieldName; + /** + * 显示值,一般为中文的 + */ + private String title; + /** + * 如果为 null 的值 + */ + private T nullValue; + public ExcelHead(String fieldName, String title) { + this.fieldName = fieldName; + this.title = title; + } + public ExcelHead(String fieldName, String title, T nullValue) { + this.fieldName = fieldName; + this.title = title; + this.nullValue = nullValue; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisal.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisal.java new file mode 100644 index 0000000..b1d1aa0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisal.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.performance.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; + +/** + * @Classname PerformanceAppraisal + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_appraisal") +@ApiModel(value = "绩效评价对象", description = "绩效评价对象") +public class PerformanceAppraisal implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("计划名称") + private String name; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + private String target; + + @ApiModelProperty("终验后 xx 天开始自评") + private Integer startSelfDays; + + @ApiModelProperty("xx 天需完成自评") + private Integer completeSelfDays; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppIndicator.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppIndicator.java new file mode 100644 index 0000000..572067b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppIndicator.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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-07-29 + */ +@TableName("nd_performance_appraisal_app_indicator") +@ApiModel(value = "NdPerformanceAppraisalAppIndicator对象", description = "") +@Data +public class PerformanceAppraisalAppIndicator implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标所属模块") + private String indexOwningModule; + + @ApiModelProperty("指标展示顺序") + private Integer sort; + + @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") + private Integer displayForm; + + @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") + private Integer indexType; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("是否展示") + private Boolean isDisplay; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppScoreInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppScoreInfo.java new file mode 100644 index 0000000..da02f83 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalAppScoreInfo.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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-14 + */ +@Data +@TableName("nd_performance_appraisal_app_score_info") +@ApiModel(value = "NdPerformanceAppraisalAppScoreInfo对象", description = "") +public class PerformanceAppraisalAppScoreInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private String updateBy; + + @ApiModelProperty("评价指标ID") + private Long indexId; + + @ApiModelProperty("指标类型 1 通用指标、2 辅助指标、3 业务指标") + private Integer indexType; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; + + @ApiModelProperty("评价员工code") + private String appraisalEmployeeCode; + + @ApiModelProperty("评价员工姓名") + private String appraisalEmployeeName; + + @ApiModelProperty("评价应用ID") + private Long applicationId; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalApplication.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalApplication.java new file mode 100644 index 0000000..ec9780a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalApplication.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.performance.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceAppraisalApplication + * @Description 绩效评价和应用关联对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_appraisal_application") +@ApiModel(value = "绩效评价和应用关联对象", description = "绩效评价和应用关联对象") +public class PerformanceAppraisalApplication implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("计划id") + private Long appraisalId; + + @ApiModelProperty("应用ID") + private Long applicationId; + + @ApiModelProperty("应用关联的项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("应用关联的项目code") + private String appraisalProjectCode; + + @ApiModelProperty("评价总分") + private BigDecimal appraisalTotalScore; + + @ApiModelProperty("打分时间") + private LocalDateTime appraisalScoreTime; + + @ApiModelProperty("是否完成评价") + private Boolean isCompleteAppraisal; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java new file mode 100644 index 0000000..8b69692 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java @@ -0,0 +1,123 @@ +package com.hz.pm.api.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; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceAppraisalProject + * @Description 绩效评价和项目关联对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_appraisal_project") +@ApiModel(value = "绩效评价和项目关联对象", description = "绩效评价和项目关联对象") +public class PerformanceAppraisalProject implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("计划id") + private Long appraisalId; + + @ApiModelProperty("项目id") + private Long projectId; + + @ApiModelProperty("项目编码") + private String projectCode; + + @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 BigDecimal rectifyTotalScore; + + @ApiModelProperty("整改审核打分时间") + private LocalDateTime rectifyScoreTime; + + @ApiModelProperty("项目是否需要整改") + private Boolean isRectify; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("整改提交人员工code") + private String rectifySubmitEmployeeCode; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + + @ApiModelProperty("是否完成自评") + private Boolean isCompleteSelfAppraisal; + + @ApiModelProperty("是否完成复评") + private Boolean isCompleteReAppraisal; + + @ApiModelProperty("是否完成核查") + private Boolean isCompleteVerify; + + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人员工code") + private String rectifyResSubEmpCode; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectGroup.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectGroup.java new file mode 100644 index 0000000..03a69a7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectGroup.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.performance.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; + +/** + * @Classname PerformanceAppraisalProjectGroup + * @Description 绩效评价和项目分组 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_appraisal_project_group") +@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") +public class PerformanceAppraisalProjectGroup implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("计划id") + private Long appraisalId; + + @ApiModelProperty("分组内的所有项目code") + private String projectCodes; + + @ApiModelProperty("复评人员") + private String reAppraisalUsers; + + @ApiModelProperty("核查人员") + private String verificationUsers; + + @ApiModelProperty("核查组长") + private String verifyLeader; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectIndicator.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectIndicator.java new file mode 100644 index 0000000..f723f68 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProjectIndicator.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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-07-28 + */ +@TableName("nd_performance_appraisal_project_indicator") +@ApiModel(value = "NdPerformanceAppraisalProjectIndicator对象", description = "") +@Data +public class PerformanceAppraisalProjectIndicator implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") + private Integer indexLevel; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则") + private String indexDetail; + + @ApiModelProperty("评分细则") + private String gradeDetail; + + @ApiModelProperty("佐证材料") + private String supportMaterial; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private String updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java new file mode 100644 index 0000000..2d158b0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.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 专家核查、4 专家整改审核、5 应用评价") + private Integer appraisalType; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("评价项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("评价项目Code") + private String appraisalProjectCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java new file mode 100644 index 0000000..49daa64 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.performance.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 liquibase.pro.packaged.I; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PerformanceIndicatorTemplate + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_indicator_project_template") +@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") +public class PerformanceIndicatorProjectTemplate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("建设类型") + private Integer constructType; + + @ApiModelProperty("状态 0关闭 1开启") + private Integer status; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; + + @ApiModelProperty("项目标签信息") + private String projectTagIds; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java new file mode 100644 index 0000000..ab339e9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.performance.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceIndicatorProjectTemplateDetail + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@TableName("nd_performance_indicator_project_template_detail") +@ApiModel(value = "绩效评价考核项目指标模板详情", description = "绩效评价考核项目指标模板详情") +public class PerformanceIndicatorProjectTemplateDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + + @ApiModelProperty("关联模板ID") + private Long templateId; + + @ApiModelProperty("指标ID") + private Long indexId; + + @ApiModelProperty("指标名称") + private String name; + + @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") + private Integer type; + + @ApiModelProperty("父级指标id") + private Long parentId; + + @ApiModelProperty("指标分值 3级指标才有") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则 3级指标才有") + private String indexDetail; + + @ApiModelProperty("评分细则") + private String gradeDetail; + + @ApiModelProperty("佐证材料描述") + private String supportMaterial; + + @ApiModelProperty("是否为附加指标") + private Boolean isAdditional; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ProjectCoreBusinessIndicators.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ProjectCoreBusinessIndicators.java new file mode 100644 index 0000000..b21f1e4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/ProjectCoreBusinessIndicators.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.Digits; +import javax.validation.constraints.Size; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-07-26 + */ +@TableName("nd_project_core_business_indicators") +@ApiModel(value = "NdProjectCoreBusinessIndicators对象", description = "") +@Data +public class ProjectCoreBusinessIndicators implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("核心业务") + private String coreBusiness; + + @ApiModelProperty("业务指标分值") + private BigDecimal score; + + @ApiModelProperty("业务指标名称") + private String businessIndicatorName; + + @ApiModelProperty("业务指标描述") + private String businessIndicatorDescription; + + @ApiModelProperty("指标设计依据") + private String indexDesignBasis; + + @ApiModelProperty("指标计算方法") + private String indexCalculationMethod; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("关联的应用ID") + private Long applicationId; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalExportReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalExportReq.java new file mode 100644 index 0000000..f59a67b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalExportReq.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.performance.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * PerformanceAppraisalExportReq + * @return + * @author CMM + * @since 2023/08/16 17:07 + */ +@Data +public class PerformanceAppraisalExportReq { + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("评价计划Id") + private Long appraisalId; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java new file mode 100644 index 0000000..df0b298 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.performance.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.time.LocalDateTime; + +/** + *

+ * PerformanceAppraisalListReq + *

+ * + * @author ZPF + * @since 09:32 2023/06/13 + */ +@Data +public class PerformanceAppraisalListReq extends PagePo { + + @ApiModelProperty("计划名称") + private String planName; + + @ApiModelProperty("开始时间") + private String start; + + @ApiModelProperty("结束时间") + private String end; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("模板名称") + private String templateName; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标级别 1一级指标 2二级指标 3三级指标") + private Integer indexLevel; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppAppraisalIndexDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppAppraisalIndexDetailVO.java new file mode 100644 index 0000000..ea214a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppAppraisalIndexDetailVO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalScoreInfo; +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 AppAppraisalIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("申报/建设单位") + private String buildOrgName; + + @ApiModelProperty("应用状态") + private String applicationStatus; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("通用指标详情") + private List commonIndexDetails; + + @ApiModelProperty("辅助指标详情") + private List auxIndexDetails; + + @ApiModelProperty("业务指标详情") + private List businessIndexDetails; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppBusinessIndexDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppBusinessIndexDetailVO.java new file mode 100644 index 0000000..91187c8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppBusinessIndexDetailVO.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * AppIndexDetailVO + * @return + * @author CMM + * @since 2023/08/14 8:55 + */ +@Data +public class AppBusinessIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("核心业务") + private String coreBusiness; + + @ApiModelProperty("业务指标分值") + private BigDecimal score; + + @ApiModelProperty("业务指标名称") + private String businessIndicatorName; + + @ApiModelProperty("业务指标描述") + private String businessIndicatorDescription; + + @ApiModelProperty("指标设计依据") + private String indexDesignBasis; + + @ApiModelProperty("指标计算方法") + private String indexCalculationMethod; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("关联的应用ID") + private Long applicationId; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexDetailVO.java new file mode 100644 index 0000000..8f25d76 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexDetailVO.java @@ -0,0 +1,69 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * AppIndexDetailVO + * @return + * @author CMM + * @since 2023/08/14 8:55 + */ +@Data +public class AppIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标所属模块") + private String indexOwningModule; + + @ApiModelProperty("指标展示顺序") + private Integer sort; + + @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") + private Integer displayForm; + + @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") + private Integer indexType; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("是否展示") + private Boolean isDisplay; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人") + private String updateBy; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexVO.java new file mode 100644 index 0000000..1a4dd88 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/AppIndexVO.java @@ -0,0 +1,67 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绩效评价-项目指标库 + * @return + * @author CMM + * @since 2023/07/28 14:45 + */ +@Data +@ApiModel(value = "绩效评价项目指标库", description = "绩效评价项目指标库") +public class AppIndexVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标所属模块") + private String indexOwningModule; + + @ApiModelProperty("指标展示顺序") + private Integer sort; + + @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") + private Integer displayForm; + + @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") + private Integer indexType; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("是否展示") + private Boolean isDisplay; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalAppVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalAppVO.java new file mode 100644 index 0000000..b6856f6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalAppVO.java @@ -0,0 +1,99 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * PerformanceAppraisalAppVO + * @return + * @author CMM + + */ +@Data +@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") +public class PerformanceAppraisalAppVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("删除时间") + private LocalDateTime deleteOn; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("是否数改系统 0:否 1:是") + private Integer isDigitalModification; + + @ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") + private String digitalModification; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; + + @ApiModelProperty("应用简介") + private String applicationSummary; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + + private Long createBy; + + private Long updateBy; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目版本") + private Integer projectVersion; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("应用核心业务") + private Boolean coreBusinessList; + + @ApiModelProperty("是否可以评价") + private Boolean canAppraisal; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalApplicationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalApplicationVO.java new file mode 100644 index 0000000..25252b2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalApplicationVO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.performance.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Classname PerformanceAppraisalApplicationVO + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") +public class PerformanceAppraisalApplicationVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + private Long appId; + + @ApiModelProperty("应用关联的项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("应用关联的项目code") + private String appraisalProjectCode; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("应用领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectGroupVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectGroupVO.java new file mode 100644 index 0000000..84e7257 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectGroupVO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.performance.model.vo; + +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +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; + +/** + * @Classname PerformanceAppraisalProjectGroupVO + * @Description 绩效评价和项目分组 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") +public class PerformanceAppraisalProjectGroupVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("计划id") + private Long appraisalId; + + @ApiModelProperty("分组内的所有项目") + private List projects; + + @ApiModelProperty("复评人员") + private List reAppraisalUsers; + + @ApiModelProperty("核查人员") + private List verificationUsers; + + @ApiModelProperty("核查组长") + private UserFullInfoDTO verifyLeader; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectVO.java new file mode 100644 index 0000000..ae3da0f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -0,0 +1,136 @@ +package com.hz.pm.api.performance.model.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PerformanceAppraisalProjectVO + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价项目对象", description = "绩效评价项目对象") +public class PerformanceAppraisalProjectVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("项目类型名") + private String projectTypeName; + + @ApiModelProperty("是否复评") + private Boolean isReAppraisal; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @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("整改提交人") + private UserFullInfoDTO rectifySubmitEmployee; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("所在分组ID") + private Long groupId; + + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改状态名称") + private String rectifyStatusName; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人员工code") + private String rectifyResSubEmpCode; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalVO.java new file mode 100644 index 0000000..a15783b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/PerformanceAppraisalVO.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.performance.model.vo; + +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; + +/** + * @Classname PerformanceAppraisal + * @Description 绩效评价对象 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价对象", description = "绩效评价对象") +public class PerformanceAppraisalVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("计划名称") + private String name; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + private String target; + + @ApiModelProperty("评价项目列表") + private List projects; + + @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; + + @ApiModelProperty("待整改项目数") + private Integer unRectifyNumber; + + @ApiModelProperty("已整改项目数") + private Integer rectifiedNumber; + + @ApiModelProperty("待核查项目数") + private Integer unRectifyAuditNumber; + + @ApiModelProperty("已核查项目数") + private Integer rectifiedAuditNumber; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectAppraisalIndexDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectAppraisalIndexDetailVO.java new file mode 100644 index 0000000..cb02e3a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectAppraisalIndexDetailVO.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("整改审核总得分") + private BigDecimal rectifyAuditTotalScore; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java new file mode 100644 index 0000000..690a3b4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.performance.model.vo; + +import com.hz.pm.api.performance.model.dto.ProjectTemplateDetailDTO; +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; + +/** + * @Classname PerformanceIndicatorProjectTemplateVO + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价项目指标模板", description = "绩效评价项目指标模板") +public class ProjectIndexTemplateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("模板名称") + private String name; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") + private Integer constructType; + + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; + + @ApiModelProperty("状态 0关闭 1开启") + private Integer status; + + @ApiModelProperty("项目标签信息") + private List projectTagIds; + + @ApiModelProperty("绩效指标详情") + private List templateDetails; + + @ApiModelProperty("附加绩效指标详情") + private List additionalIndexDetails; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java new file mode 100644 index 0000000..04d6d11 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绩效评价-项目指标库 + * @return + * @author CMM + * @since 2023/07/28 14:45 + */ +@Data +@ApiModel(value = "绩效评价项目指标库", description = "绩效评价项目指标库") +public class ProjectIndexVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") + private Integer indexLevel; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则") + private String indexDetail; + + @ApiModelProperty("评分细则") + private String gradeDetail; + + @ApiModelProperty("佐证材料") + private String supportMaterial; + + @ApiModelProperty("丽水 区域code") + private String regionCode; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectTemplateDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectTemplateDetailVO.java new file mode 100644 index 0000000..96853f0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectTemplateDetailVO.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.performance.model.vo; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalScoreInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * @Classname PerformanceIndicatorProjectTemplateDetail + * @Description 绩效评价考核项目指标模板 + * @Date 2023/6/19 14:02 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树") +public class ProjectTemplateDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("关联模板ID") + private Long templateId; + + @ApiModelProperty("指标ID") + private Long indexId; + + @ApiModelProperty("指标名称") + private String name; + + @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") + private Integer type; + + @ApiModelProperty("父级指标id") + private Long parentId; + + @ApiModelProperty("指标分值 3级指标才有") + private BigDecimal indexScore; + + @ApiModelProperty("指标细则 3级指标才有") + private String indexDetail; + + @ApiModelProperty("评分细则") + private String gradeDetail; + + @ApiModelProperty("佐证材料描述") + private String supportMaterial; + + @ApiModelProperty("是否为附加指标") + private Boolean isAdditional; + + @ApiModelProperty("子指标") + private List children; + + @ApiModelProperty("自评分数信息") + private List selfAppraisalScoreInfo; + + @ApiModelProperty("复评分数信息") + private Map> reAppraisalScoreInfo; + + @ApiModelProperty("复评得分信息") + private Map reAppraisalTotalScoreInfo; + + @ApiModelProperty("核查分数信息") + private Map> verifyScoreInfo; + + @ApiModelProperty("核查得分信息") + private Map verifyTotalScoreInfo; + + @ApiModelProperty("自评分数信息") + private List rectifyAuditScoreInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java new file mode 100644 index 0000000..4a2e773 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.performance.model.vo; + +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 整改详情 + * + * @author CMM + * @since 2023/08/13 15:36 + */ +@Data +@ApiModel(value = "整改详情", description = "整改详情") +public class RectifyDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("整改提交人") + private UserFullInfoDTO rectifySubmitEmployee; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人") + private UserFullInfoDTO rectifyResSubEmployee; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改状态名称") + private String rectifyStatusName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppIndicatorService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppIndicatorService.java new file mode 100644 index 0000000..05821fe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppIndicatorService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppIndicator; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-07-29 + */ +public interface IPerformanceAppraisalAppIndicatorService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppScoreInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppScoreInfoService.java new file mode 100644 index 0000000..3bd52fc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalAppScoreInfoService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +public interface IPerformanceAppraisalAppScoreInfoService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalApplicationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalApplicationService.java new file mode 100644 index 0000000..27127ee --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalApplicationService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalApplication; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalApplicationService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectGroupService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectGroupService.java new file mode 100644 index 0000000..4183f29 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectGroupService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectGroup; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalProjectGroupService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectIndicatorService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectIndicatorService.java new file mode 100644 index 0000000..1aecbfb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectIndicatorService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectIndicator; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-07-28 + */ +public interface IPerformanceAppraisalProjectIndicatorService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectService.java new file mode 100644 index 0000000..bf90019 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalProjectService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalProjectService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalScoreInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalScoreInfoService.java new file mode 100644 index 0000000..bf24fd4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalScoreInfoService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalService.java new file mode 100644 index 0000000..d0e73f6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceAppraisalService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java new file mode 100644 index 0000000..357e563 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceIndicatorProjectTemplateDetailService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateService.java new file mode 100644 index 0000000..3b50cc8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IPerformanceIndicatorProjectTemplateService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplate; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceIndicatorProjectTemplateService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IProjectCoreBusinessIndicatorsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IProjectCoreBusinessIndicatorsService.java new file mode 100644 index 0000000..3c7283f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/IProjectCoreBusinessIndicatorsService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.performance.service; + +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +public interface IProjectCoreBusinessIndicatorsService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java new file mode 100644 index 0000000..3b63515 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppIndicator; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalAppIndicatorMapper; +import com.hz.pm.api.performance.service.IPerformanceAppraisalAppIndicatorService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-07-29 + */ +@Service +public class PerformanceAppraisalAppIndicatorServiceImpl extends ServiceImpl implements IPerformanceAppraisalAppIndicatorService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java new file mode 100644 index 0000000..ff34bca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalAppScoreInfoMapper; +import com.hz.pm.api.performance.service.IPerformanceAppraisalAppScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +@Service +public class PerformanceAppraisalAppScoreInfoServiceImpl extends ServiceImpl implements IPerformanceAppraisalAppScoreInfoService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java new file mode 100644 index 0000000..c9edb01 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalApplicationMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalApplication; +import com.hz.pm.api.performance.service.IPerformanceAppraisalApplicationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价和应用 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalApplicationServiceImpl extends ServiceImpl implements IPerformanceAppraisalApplicationService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java new file mode 100644 index 0000000..29020cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalProjectGroupMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectGroup; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectGroupService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价分组 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalProjectGroupServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectGroupService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java new file mode 100644 index 0000000..c370a17 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProjectIndicator; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalProjectIndicatorMapper; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectIndicatorService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-07-28 + */ +@Service +public class PerformanceAppraisalProjectIndicatorServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectIndicatorService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java new file mode 100644 index 0000000..c037ce3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalProjectMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价和项目 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalProjectServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java new file mode 100644 index 0000000..16679ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalScoreInfoMapper; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalServiceImpl.java new file mode 100644 index 0000000..77b3753 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceAppraisalServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceAppraisalMapper; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; +import com.hz.pm.api.performance.service.IPerformanceAppraisalService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalServiceImpl extends ServiceImpl implements IPerformanceAppraisalService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java new file mode 100644 index 0000000..f329f6c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceIndicatorProjectTemplateDetailMapper; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateDetailService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价详情 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl + implements IPerformanceIndicatorProjectTemplateDetailService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java new file mode 100644 index 0000000..95ad719 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.performance.mapper.PerformanceIndicatorProjectTemplateMapper; +import com.hz.pm.api.performance.model.entity.PerformanceIndicatorProjectTemplate; +import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateService; +import org.springframework.stereotype.Service; + +/** + *

+ * 绩效评价 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl + implements IPerformanceIndicatorProjectTemplateService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java new file mode 100644 index 0000000..0332042 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.performance.service.impl; + +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.hz.pm.api.performance.mapper.ProjectCoreBusinessIndicatorsMapper; +import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-07-26 + */ +@Service +public class ProjectCoreBusinessIndicatorsServiceImpl extends ServiceImpl implements IProjectCoreBusinessIndicatorsService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java new file mode 100644 index 0000000..359a50c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.performance.util; + +/** + * @author CMM + * @since 2023/08/17 21:02 + */ + +import cn.hutool.core.util.CharsetUtil; +import com.ningdatech.basic.exception.BizException; +import com.wflow.config.ResponseCode; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +/** + * Content-type 工具类 + * @return + * @author CMM + * @since 2023/08/17 21:05 + */ +public final class ContentTypeUtils { + public static final String CONTENT_DISPOSITION; + public static final String APPLICATION_EXCEL; + static { + CONTENT_DISPOSITION = "Content-Disposition"; + APPLICATION_EXCEL = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + } + public static String encode(String fileName) { + + try { + return "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8) + ".xlsx"; + } catch (UnsupportedEncodingException e) { + throw new BizException(e.getMessage()); + } + } +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelFillCellMergeStrategy.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelFillCellMergeStrategy.java new file mode 100644 index 0000000..fab0746 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelFillCellMergeStrategy.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.performance.util; + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.write.handler.CellWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteTableHolder; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.util.CellRangeAddress; + +import java.util.List; + +/** + * 单元格合并策略 + * + * @author CMM + * @since 2023/08/17 10:57 + */ + +public class ExcelFillCellMergeStrategy implements CellWriteHandler { + + private int[] mergeColumnIndex; + private int mergeRowIndex; + + public ExcelFillCellMergeStrategy() { + } + + public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndex) { + this.mergeRowIndex = mergeRowIndex; + this.mergeColumnIndex = mergeColumnIndex; + } + + + @Override + public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List> list, Cell cell, Head head, Integer integer, Boolean aBoolean) { + //当前行 + int curRowIndex = cell.getRowIndex(); + //当前列 + int curColIndex = cell.getColumnIndex(); + + if (curRowIndex > mergeRowIndex) { + for (int columnIndex : mergeColumnIndex) { + if (curColIndex == columnIndex) { + mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); + break; + } + } + } + } + + + + /** + * 当前单元格向上合并 + * + * @param cell 当前单元格 + * @param curRowIndex 当前行 + * @param curColIndex 当前列 + */ + private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) { + //获取当前行的当前列的数据和上一行的当前列列数据,通过上一行数据是否相同进行合并 + Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); + Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex); + Object preData = preCell.getCellType() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue(); + + // 比较当前行的第一列的单元格与上一行是否相同,相同合并当前单元格与上一行 + if (curData.equals(preData)) { + Sheet sheet = writeSheetHolder.getSheet(); + List mergeRegions = sheet.getMergedRegions(); + boolean isMerged = false; + for (int i = 0; i < mergeRegions.size() && !isMerged; i++) { + CellRangeAddress cellRangeAddr = mergeRegions.get(i); + // 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元 + if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) { + sheet.removeMergedRegion(i); + cellRangeAddr.setLastRow(curRowIndex); + sheet.addMergedRegion(cellRangeAddr); + isMerged = true; + } + } + // 若上一个单元格未被合并,则新增合并单元 + if (!isMerged) { + CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex); + sheet.addMergedRegion(cellRangeAddress); + } + } + } + + @Override + public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) { + + } + + @Override + public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) { + + } +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelSheetVerticalCellStyleStrategy.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelSheetVerticalCellStyleStrategy.java new file mode 100644 index 0000000..f25e0c4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelSheetVerticalCellStyleStrategy.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.performance.util; + +/** + * @author CMM + * @since 2023/08/17 21:01 + */ + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy; + +/** + * excel 样式设置 + * @return + * @author CMM + * @since 2023/08/17 21:07 + */ +public class ExcelSheetVerticalCellStyleStrategy extends AbstractVerticalCellStyleStrategy { + /** + * 头部样式 + * + * @return 样式 + */ + @Override + protected WriteCellStyle headCellStyle(Head head) { + return ExcelUtils.writeCellStyle(); + } + /** + * 内容样式 + * + * @return 样式 + */ + @Override + protected WriteCellStyle contentCellStyle(Head head) { + return ExcelUtils.writeCellStyle(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java new file mode 100644 index 0000000..e7a6121 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java @@ -0,0 +1,118 @@ +package com.hz.pm.api.performance.util; + +/** + * @author CMM + * @since 2023/08/17 20:59 + */ + +import java.util.List; +import java.util.Map; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.performance.constant.BizConst; +import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.VerticalAlignment; + +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.google.common.collect.Lists; +import com.hz.pm.api.performance.model.entity.ExcelHead; + +/** + * excel 工具类 + * @return + * @author CMM + * @since 2023/08/17 21:07 + */ +public class ExcelUtils { + /** + * 构造excel基础样式 + * + * @return 样式 + */ + public static WriteCellStyle writeCellStyle() { + WriteCellStyle writeCellStyle = new WriteCellStyle(); + writeCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); + writeCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + writeCellStyle.setWrapped(true); + writeCellStyle.setBorderBottom(BorderStyle.THIN); + writeCellStyle.setBorderLeft(BorderStyle.THIN); + writeCellStyle.setBorderRight(BorderStyle.THIN); + writeCellStyle.setBorderTop(BorderStyle.THIN); + return writeCellStyle; + } + + /** + * 表内容数据转换 + * + * @param headList 表头数据 + * @param dataList 表内容数据转换 + * @return List> + */ + public static List> convertData(List headList, List> dataList) { + List> result = Lists.newArrayList(); + //对 dataList 转为 easyExcel 的数据格式 + for (Map data : dataList) { + List row = Lists.newArrayList(); + for (ExcelHead h : headList) { + Object o = data.get(h.getFieldName()); + //需要对null的处理,转换为空字符串 + row.add(handler(o, h.getNullValue())); + } + result.add(row); + } + return result; + } + /** + * null 值处理 + * @param nullValue 默认值 + * @return 默认值 + */ + private static Object handler(Object o, Object nullValue) { + return o != null ? o : nullValue; + } + + public static List> getHead(List reUserList,List verifyUserList) { + + List> list = Lists.newArrayList(); + list.add(Lists.newArrayList(BizConst.FIRST_INDEX_TITLE)); + list.add(Lists.newArrayList(BizConst.SECOND_INDEX_TITLE)); + list.add(Lists.newArrayList(BizConst.THIRD_INDEX_TITLE)); + list.add(Lists.newArrayList(BizConst.INDEX_SCORE_TITLE)); + list.add(Lists.newArrayList(BizConst.INDEX_DETAIL_TITLE)); + list.add(Lists.newArrayList(BizConst.GRADE_DETAIL_TITLE)); + list.add(Lists.newArrayList(BizConst.SUPPORT_MATERIAL_TITLE)); + list.add(Lists.newArrayList(BizConst.SELF_APPRAISAL_BASIS_TITLE)); + list.add(Lists.newArrayList(BizConst.SELF_APPRAISAL_SCORE_TITLE)); + if (CollUtil.isNotEmpty(reUserList)) { + List reUserHead = Lists.newArrayList(); + reUserHead.add(BizConst.RE_APPRAISAL_BASIS_TITLE); + reUserHead.add(BizConst.RE_APPRAISAL_SCORE_TITLE); + for (String reUser : reUserList) { + for (String h : reUserHead) { + List reUsers = Lists.newArrayList(); + reUsers.add(reUser + BizConst.RE_APPRAISAL); + reUsers.add(h); + list.add(reUsers); + } + } + } + + if (CollUtil.isNotEmpty(verifyUserList)) { + List verifyUserHead = Lists.newArrayList(); + verifyUserHead.add(BizConst.VERIFY_BASIS_TITLE); + verifyUserHead.add(BizConst.VERIFY_SCORE_TITLE); + for (String verifyUser : reUserList) { + for (String h : verifyUserHead) { + List reUsers = Lists.newArrayList(); + reUsers.add(verifyUser + BizConst.VERIFY); + reUsers.add(h); + list.add(reUsers); + } + } + } + list.add(Lists.newArrayList(BizConst.IS_ADDITIONAL_TITLE)); + return list; + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/MultiColumnMergeStrategy.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/MultiColumnMergeStrategy.java new file mode 100644 index 0000000..bb65187 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/MultiColumnMergeStrategy.java @@ -0,0 +1,109 @@ +package com.hz.pm.api.performance.util; + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.write.merge.AbstractMergeStrategy; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.util.CellRangeAddress; + +import java.util.ArrayList; +import java.util.List; + +/** + * 指定列单元格合并策略 + * + * @author CMM + * @since 2023/08/17 11:26 + */ + +public class MultiColumnMergeStrategy extends AbstractMergeStrategy { + + // 合并的列编号,从0开始,指定的index或自己按字段顺序数 + private Integer startCellIndex = 0; + private Integer endCellIndex = 0; + + // 数据集大小,用于区别结束行位置 + private Integer maxRow = 0; + + // 禁止无参声明 + private MultiColumnMergeStrategy() { + } + + /** + * 每行每列都会进入,循环注意条件限制 + */ + @Override + protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { + int currentCellIndex = cell.getColumnIndex(); + int currentRowIndex = cell.getRowIndex(); + + // 判断该列是否需要合并 + if (currentCellIndex < startCellIndex || currentCellIndex > endCellIndex) { + return; + } + + Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); + String currentCellValue = curData.toString(); + + List rowList; + if (dataList.size() > currentRowIndex - 1) { + rowList = dataList.get(currentRowIndex - 1); + } else { + rowList = new ArrayList<>(); + dataList.add(rowList); + } + rowList.add(currentCellValue); + + // 结束的位置触发下最后一次没完成的合并 + if (relativeRowIndex == (maxRow - 1) && currentCellIndex == endCellIndex) { + System.out.println(JSONObject.toJSONString(dataList)); + List tempList = null; + Integer tempIndex = null; + for (int i = 0; i < dataList.size(); i++) { + if (tempList == null) { + tempList = dataList.get(i); + tempIndex = i; + continue; + } + List currList = dataList.get(i); + if (tempList.equals(currList)) { + if (i >= dataList.size() - 1) { + // 结束的位置触发下最后一次没完成的合并 + for (int j = 0; j < tempList.size(); j++) { + sheet.addMergedRegionUnsafe(new CellRangeAddress(tempIndex + 1, i + 1, startCellIndex + j, startCellIndex + j)); + } + } + continue; + } + + // 当前行数据和上一行数据不同且上面有多行相同数据时触发合并 + if (i - tempIndex > 1) { + for (int j = 0; j < tempList.size(); j++) { + sheet.addMergedRegionUnsafe(new CellRangeAddress(tempIndex + 1, i, startCellIndex + j, startCellIndex + j)); + } + } + + + tempIndex = i; + tempList = currList; + + + } + + } + } + + + public MultiColumnMergeStrategy(Integer maxRow, Integer startCellIndex, Integer endCellIndex) { + this.startCellIndex = startCellIndex; + this.endCellIndex = endCellIndex; + this.maxRow = maxRow; + } + + // 记录上一次合并的信息 + private final List> dataList = new ArrayList<>(); +} + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java new file mode 100644 index 0000000..c0bf6e4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.portrait.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.portrait.manage.TagManage; +import com.hz.pm.api.portrait.model.dto.TagDTO; +import com.hz.pm.api.portrait.model.dto.TagToProjectDTO; +import com.hz.pm.api.portrait.model.req.TagPageReq; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java new file mode 100644 index 0000000..a07b401 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java @@ -0,0 +1,221 @@ +package com.hz.pm.api.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import com.hz.pm.api.portrait.model.dto.TagDTO; +import com.hz.pm.api.portrait.model.dto.TagToProjectDTO; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.model.entity.Tag; +import com.hz.pm.api.portrait.model.req.TagPageReq; +import com.hz.pm.api.portrait.model.vo.TagVO; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.portrait.service.ITagService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final RegionCacheHelper regionCacheHelper; + + /** + * 标签分页 + * @param areaCode + * @param req + * @return + */ + public PageVo list(String areaCode, TagPageReq req) { + RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY); + String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null; + LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) + .eq(Objects.nonNull(regionCode),Tag::getAreaCode, regionCode) + .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 BizConst.SAVE_SUCCESS; + } + + /** + * 标签名 去重 + * @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); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).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 BizConst.SAVE_SUCCESS; + } + + public String removeTagToProject(TagToProjectDTO dto) { + String projectCode = dto.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/ProjectTagMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/ProjectTagMapper.java new file mode 100644 index 0000000..3988290 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/ProjectTagMapper.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.portrait.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.portrait.model.entity.ProjectTag; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface ProjectTagMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/TagMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/TagMapper.java new file mode 100644 index 0000000..4b1f919 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/mapper/TagMapper.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.portrait.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.portrait.model.entity.Tag; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface TagMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java new file mode 100644 index 0000000..03f0d06 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagToProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagToProjectDTO.java new file mode 100644 index 0000000..c5f3ced --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagToProjectDTO.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/ProjectTag.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/ProjectTag.java new file mode 100644 index 0000000..3d1c965 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/ProjectTag.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/Tag.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/Tag.java new file mode 100644 index 0000000..0532f07 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/entity/Tag.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/req/TagPageReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/req/TagPageReq.java new file mode 100644 index 0000000..4bd9c0c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/req/TagPageReq.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java new file mode 100644 index 0000000..e9c2467 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java new file mode 100644 index 0000000..0c08527 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.portrait.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.model.entity.Tag; + +import java.util.List; + +/** + * @Classname ITagService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface IProjectTagService extends IService { + /** + * 获取项目 标签 + * @param projectCode + * @return + */ + List getProjectTas(String projectCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/ITagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/ITagService.java new file mode 100644 index 0000000..0582bb9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/ITagService.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.portrait.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.portrait.model.entity.Tag; + +/** + * @Classname ITagService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface ITagService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/ProjectTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/ProjectTagServiceImpl.java new file mode 100644 index 0000000..07ab69c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/ProjectTagServiceImpl.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.portrait.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.portrait.mapper.ProjectTagMapper; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.model.entity.Tag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.portrait.service.ITagService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +@RequiredArgsConstructor +public class ProjectTagServiceImpl extends ServiceImpl implements IProjectTagService { + + private final ITagService tagService; + + /** + * 获取项目标签 + * @param projectCode + * @return + */ + @Override + public List getProjectTas(String projectCode) { + List proTags = this.list(Wrappers.lambdaQuery(ProjectTag.class) + .eq(ProjectTag::getProjectCode, projectCode)); + if(CollUtil.isEmpty(proTags)){ + return Collections.emptyList(); + } + List tagIds = proTags.stream().map(ProjectTag::getTagId).collect(Collectors.toList()); + return tagService.listByIds(tagIds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/TagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/TagServiceImpl.java new file mode 100644 index 0000000..0bebc61 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/impl/TagServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.portrait.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.portrait.mapper.TagMapper; +import com.hz.pm.api.portrait.model.entity.Tag; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java new file mode 100644 index 0000000..cbb40a9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.projectdeclared.contants; + +import com.google.common.collect.Lists; +import com.hz.pm.api.user.entity.UserInfo; + +import java.util.List; + +public interface DeclaredProjectContant { + + class ProcessDef { + public static final String PROJECT_STAGE_1 = "单位内部审批流程"; + + public static final String PROJECT_STAGE_2 = "项目预审审批流程"; + + public static final String PROJECT_STAGE_3 = "部门联合审批流程"; + + public static final String PROJECT_STAGE_4 = "建设方案审批流程"; + + public static final String PROJECT_STAGE_5 = "验收申报审批流程"; + } + + class Instance { + public static final String PROVINCE_INSTANCE_ID = "PROVINCE_AUDIT"; + } + + class Biz { + public static final String CORE_BIZ = "{\"msg\":\"操作成功\",\"code\":0,\"data\":[{\"id\":6366,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"947\",\"uuid\":\"5922bdbb-ae35-4f4d-b6e0-916cf01b9a6a\",\"sysName\":\"丽水市数据中心平台\"}],\"coreMaterials\":[{\"id\":11317,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划申报)\"},{\"id\":66025,\"comaterialName\":\"测试信息\"},{\"id\":70165,\"comaterialName\":\"演示系统信息\"},{\"id\":11318,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划申报)\"},{\"id\":60284,\"comaterialName\":\"测试需求信息\"},{\"id\":60285,\"comaterialName\":\"测试需求的信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6367,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划调整申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11319,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划调整申报)\"},{\"id\":11320,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划调整申报)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6368,\"matterOrg\":4,\"matterName\":\"信息化项目立项\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"2095\",\"uuid\":\"2b4a5100-708c-4716-b713-79be1860edf9\",\"sysName\":\"丽水市公共数据管理系统\"}],\"coreMaterials\":[{\"id\":69142,\"comaterialName\":\"演示项目信息\"},{\"id\":11321,\"comaterialName\":\"项目定密正式意见信息\"},{\"id\":11322,\"comaterialName\":\"项目数据资源承诺共享开放目录信息\"},{\"id\":11324,\"comaterialName\":\"项目申请立项正式函信息\"},{\"id\":11323,\"comaterialName\":\"项目建设方案信息(信息化项目立项)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6369,\"matterOrg\":4,\"matterName\":\"信息化项目验收\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"1020\",\"uuid\":\"103afdd3-5078-4e8e-9f3e-8890b42d9276\",\"sysName\":\"协同平台\"}],\"coreMaterials\":[{\"id\":11325,\"comaterialName\":\"项目验收申请函信息(电子公文正式件)\"},{\"id\":11329,\"comaterialName\":\"项目初验意见书信息\"},{\"id\":11328,\"comaterialName\":\"第三方测评报告信息(立项批复投资估算>500万)\"},{\"id\":11327,\"comaterialName\":\"项目监理报告信息(立项批复投资估算>200万)\"},{\"id\":11330,\"comaterialName\":\"项目验收完整归档资料信息\"},{\"id\":60411,\"comaterialName\":\"测试数据项数量信息\"},{\"id\":69141,\"comaterialName\":\"演示验收信息\"},{\"id\":11326,\"comaterialName\":\"项目竣工报告信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6370,\"matterOrg\":4,\"matterName\":\"办公助手人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11331,\"comaterialName\":\"办公助手人员变更表单信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6371,\"matterOrg\":4,\"matterName\":\"办公助手单位新增申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11332,\"comaterialName\":\"办公助手单位新增申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6372,\"matterOrg\":4,\"matterName\":\"办公助手短信数量申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":17570,\"comaterialName\":\"办公助手短信数量申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6373,\"matterOrg\":4,\"matterName\":\"办公助手通知公告发布申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11335,\"comaterialName\":\"通知公告发布申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6374,\"matterOrg\":4,\"matterName\":\"丽水市党政机关公文交换系统单位新增\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11336,\"comaterialName\":\"公文交换系统单位新增信息\"},{\"id\":17572,\"comaterialName\":\"公章替换说明函信息\"},{\"id\":17571,\"comaterialName\":\"机关代字(红头文号)模板信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6375,\"matterOrg\":4,\"matterName\":\"丽水市党政机关协同办公系统人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11337,\"comaterialName\":\"协同办公系统人员变更信息\"}],\"page\":null,\"limit\":null,\"startRow\":null}],\"total\":10}"; + } + + class Project{ + public static final Integer YEAR_THREE = 2; + public static final Integer YEAR_FOUR = 4; + + public static final Integer YEAR_DRAW_SURPLUS = 100; + + public static final String FIXED_NUMBER = "0130"; + public static final Long MAX_PROJECT_ID = 999L; + + public static final Long MIN_PROJECT_ID = 1L; + } + + class ReviewChecklist { + public static final List REVIEW_HUMANS_ZZD = Lists.newArrayList("GE_dce116d65ffe48a3aee6c14c1c5a3031", + "GE_573158a366554bdbb483f8f93d594bf7","GE_fe1cd568b453456ead00f471ecddf6a2","GE_fc1e28e29b5a4cf39c7b7c83278db6f4", + "GE_16580afcdf7d4d379fd3690ba47f3b58","GE_9c901c85eaeb42abbb485b7aa4d4358f","GE_a4c2c56ed3204600805e0f7b7dca9044"); + + public static final List REVIEW_HUMANS_ZYD = Lists.newArrayList("GE_6dc0e5a3513d41f684b6b01aeb94d887", + "GE_39be254f6cb84ad0b30c9bd5bda657d7","GE_051f5e34c0c4467b873cde517a21669b","GE_e68c7af513474eaa959b7ce7141a4d9f", + "GE_c3e4d8e8067b4fce91b28b570cffc67a","GE_809a061236b941d281446df6f14dc8f0","GE_6168943503de45919c42d46e05b24fa1"); + public static final Integer INIT_NUM = 0; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/ProjectCodeContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/ProjectCodeContant.java new file mode 100644 index 0000000..762adb9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/ProjectCodeContant.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.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"; + String SHUZI_4 = "%04d"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java new file mode 100644 index 0000000..e305ea7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java @@ -0,0 +1,104 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.ConstructionManage; +import com.hz.pm.api.projectdeclared.model.dto.ContractSaveDTO; +import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSaveDTO; +import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO; +import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; +import com.hz.pm.api.projectdeclared.model.vo.ProjectContractListVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @Classname ConstructionController + * @Description 申报项目-建设中 + * @Date 2023/5/29 09:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared/construction") +@Api(value = "ConstructionController", tags = "申报管理-建设中") +@RequiredArgsConstructor +public class ConstructionController { + private final ConstructionManage constructionManage; + + @ApiOperation(value = "待合同备案的项目列表", notes = "合同备案的项目列表") + @GetMapping("/contract/project-list") + public PageVo projectlist(@ModelAttribute ProjectListReq req) { + return constructionManage.projectLibList(req); + } + + @ApiOperation(value = "已经完善合同信息的项目列表", notes = "已经完善合同信息的项目列表") + @GetMapping("/contract/project-list-perfect") + public PageVo projectlistPerfect(@ModelAttribute ProjectListReq req) { + return constructionManage.projectlistPerfect(req); + } + + @GetMapping("/contract/export") + @ApiOperation("待合同备案的项目列表导出") + @WebLog("待合同备案的项目列表导出") + public void exportList(ProjectListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,constructionManage::exportList); + } + + @ApiOperation(value = "合同备案的详情-通过项目ID", notes = "合同备案的详情-通过项目ID") + @GetMapping("/contract/detail/{projectId}") + public ContractVO detailContractByProjectId(@PathVariable Long projectId) { + return constructionManage.detailContractByProjectId(projectId); + } + + @ApiOperation(value = "填写合同信息", notes = "填写合同信息") + @WebLog("填写合同信息") + @PostMapping("/submit-contract") + public String submitContract(@Validated @RequestBody ContractSaveDTO dto) { + return constructionManage.submitContract(dto); + } + + @ApiOperation(value = "补充实际支付金额", notes = "补充实际支付金额") + @WebLog("补充实际支付金额") + @PostMapping("/supplement") + public String supplement(@Validated @RequestBody List plans) { + return constructionManage.supplement(plans); + } + + @ApiOperation(value = "待初验备案的项目列表", notes = "待初验备案的项目列表") + @GetMapping("/pre-ins/project-list") + public PageVo preProjectList(@ModelAttribute ProjectListReq req) { + return constructionManage.preProjectlist(req); + } + + @GetMapping("/pre-ins/export") + @ApiOperation("待初验备案的项目列表导出") + @WebLog("待初验备案的项目列表导出") + public void exportPreList(ProjectListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,constructionManage::exportPreList); + } + + @ApiOperation(value = "初验备案的详情-通过项目ID", notes = "初验备案的详情-通过项目ID") + @GetMapping("/pre-ins/detail/{projectId}") + public PreInsVO detailPreInsByProjectId(@PathVariable Long projectId) { + return constructionManage.detailPreInsByProjectId(projectId); + } + + @ApiOperation(value = "填写初验信息", notes = "填写初验信息") + @WebLog("填写初验信息") + @PostMapping("/submit-pre-ins") + public String submitPreIns(@Validated @RequestBody PreInsSaveDTO dto) { + return constructionManage.submitPreIns(dto); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java new file mode 100644 index 0000000..c5206e0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.ConstructionPlanManage; +import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; + +/** + * @Classname ConstructionPlanController + * @Description 建设方案申报 + * @Date 2023/2/13 9:53 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/construction") +@Api(value = "ConstructionPlan", tags = "申报管理-建设方案申报") +@RequiredArgsConstructor +public class ConstructionPlanController { + + private final ConstructionPlanManage constructionPlanManage; + + @ApiOperation(value = "可申报建设方案项目列表", notes = "可申报建设方案项目列表") + @GetMapping("/list") + public PageVo list(@Validated @ModelAttribute ConstrctionPlanListReq planReq) { + return constructionPlanManage.projectLibList(planReq); + } + + @ApiOperation(value = "建设方案申报", notes = "建设方案申报") + @WebLog("建设方案申报") + @PostMapping("/start") + public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + String instanceId = constructionPlanManage.startTheProcess(dto); + return "建设方案申报 【" + instanceId + "】 成功"; + } + + @GetMapping("/export") + @ApiOperation("可申报建设方案项目列表导出") + @WebLog("可申报建设方案项目列表导出") + public void exportList(ConstrctionPlanListReq planReq, HttpServletResponse response) { + ExcelDownUtil.downXls(response, planReq, constructionPlanManage::exportList); + } + + @ApiOperation(value = "建设方案专家建议", notes = "建设方案专家建议") + @WebLog("建设方案专家建议") + @PostMapping("/construction-suggestions") + public String constructionSuggestions(@Validated @RequestBody ContructionSuggestionsDTO dto) { + constructionPlanManage.constructionSuggestions(dto); + return "专家建设方案建议保存成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java new file mode 100644 index 0000000..7b6c6fc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.projectdeclared.controller; + +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; +import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; +import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectListParamDTO; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; +import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname DeclaredProjectController + * @Description 申报项目 + * @Date 2023/1/31 11:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared") +@Api(value = "DeclaredProject", tags = "申报管理-申报项目") +@RequiredArgsConstructor +public class DeclaredProjectController { + private final DeclaredProjectManage declaredProjectManage; + + private final ProjectAdjustmentManage projectAdjustmentManage; + + private final GovProjectCollectionManage collectionManage; + + @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") + @GetMapping("/list") + public PageVo list(@ModelAttribute ProjectListReq req) { + return declaredProjectManage.projectLibList(req); + } + + @ApiOperation(value = "核心业务列表", notes = "核心业务列表") + @GetMapping("/core-biz") + public JSONObject bizList(@RequestParam(required = false) String businessName, + @RequestParam(required = false) Integer pageSize, + @RequestParam(required = false) Integer pageNumber, + @RequestParam(required = false) String orgCode) { + return declaredProjectManage.bizList(businessName,pageSize,pageNumber,orgCode); + } + + @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") + @GetMapping("/draft") + public PageVo draft(@ModelAttribute DeclaredProjectListParamDTO params) { + return declaredProjectManage.pageDraft(params); + } + + @ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情") + @GetMapping("/draft/{id}") + public ProjectDraftVO draft(@PathVariable(value = "id") Long id) { + return declaredProjectManage.draftDatail(id); + } + + @ApiOperation(value = "申报项目保存至草稿箱", notes = "申报项目保存至草稿箱") + @WebLog("申报项目保存至草稿箱") + @PostMapping("/save-to-draft") + public Object saveToDraft(@Validated @RequestBody ProjectDraftSaveDTO dto) { + return declaredProjectManage.saveToDraft(dto); + } + + @ApiOperation(value = "申报项目", notes = "申报项目") + @WebLog("申报项目") + @PostMapping("/start") + public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + String instanceId = declaredProjectManage.startTheProcess(dto); + return "启动流程实例 【" + instanceId + "】 成功"; + } + + @ApiOperation(value = "重新申报项目", notes = "重新申报项目") + @WebLog("重新申报项目") + @PostMapping("/restart") + public String reStartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + return projectAdjustmentManage.adjustment(dto); + } + + @GetMapping("/export") + @ApiOperation("申报项目列表导出") + @WebLog("申报项目列表导出") + public void exportList(ProjectListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,declaredProjectManage::exportList); + } + + @PostMapping("/remove/{projectCode}") + @ApiOperation("申报项目删除-预审失败") + @WebLog("申报项目删除-预审失败") + public String remove(@PathVariable String projectCode){ + return declaredProjectManage.removeProject(projectCode); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DelayedApplyController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DelayedApplyController.java new file mode 100644 index 0000000..3ce6fea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DelayedApplyController.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.DelayedApplyManage; +import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; +import com.hz.pm.api.projectdeclared.model.vo.DelayedApplyVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @Classname DelayedProjectController + * @Description + * @Date 2023/6/7 18:50 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared/delayed") +@Api(value = "DelayedProjectController", tags = "申报管理-延期项目") +@RequiredArgsConstructor +public class DelayedApplyController { + + private final DelayedApplyManage delayedApplyManage; + + @ApiOperation(value = "过期的项目列表", notes = "过期的项目列表") + @GetMapping("/project-list") + public PageVo projectlist(@ModelAttribute ProjectListReq req) { + 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) { + return delayedApplyManage.detailByProjectId(projectId); + } + + @GetMapping("/export") + @ApiOperation("过期的项目列表导出") + @WebLog("过期的项目列表导出") + public void exportList(ProjectListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,delayedApplyManage::exportList); + } + + @ApiOperation(value = "延期申报", notes = "延期申报") + @WebLog("延期申报") + @PostMapping("/apply") + public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) { + String instanceId = delayedApplyManage.startDelayedApplyProcess(dto); + return "启动延期申请流程实例 【" + instanceId + "】 成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java new file mode 100644 index 0000000..29a3e3e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; + + +/** + * @Classname FinalAcceptanceController + * @Description 申报项目-终验 + * @Date 2023/6/2 09:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared/final-acc") +@Api(value = "FinalAcceptanceController", tags = "申报管理-终验") +@RequiredArgsConstructor +public class FinalAcceptanceController { + private final FinalAcceptanceManage finalAcceptanceManage; + + @ApiOperation(value = "待终验申报的项目列表", notes = "待终验申报的项目列表") + @GetMapping("/project-list") + public PageVo projectlist(@ModelAttribute ProjectListReq req) { + return finalAcceptanceManage.projectLibList(req); + } + + @GetMapping("/export") + @ApiOperation("待终验申报的项目导出") + @WebLog("待终验申报的项目导出") + public void exportList(ProjectListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,finalAcceptanceManage::exportList); + } + + @ApiOperation(value = "待终验申报的项目列表", notes = "待终验申报的项目列表") + @GetMapping("/detail/{projectId}") + public FinalAcceptanceVO detailByProjectId(@PathVariable Long projectId) { + return finalAcceptanceManage.detailByProjectId(projectId); + } + + @ApiOperation(value = "终验申报", notes = "终验申报") + @WebLog("终验申报") + @PostMapping("/start-process") + public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + 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/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/OperationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/OperationController.java new file mode 100644 index 0000000..41d3300 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/OperationController.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectdeclared.manage.OperationManage; +import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; +import com.hz.pm.api.projectdeclared.model.vo.OperationVO; +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.*; + +/** + * @Classname OperationController + * @Description 申报项目-实施 + * @Date 2023/7/31 09:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared/operation") +@Api(value = "OperationController", tags = "申报管理-实施") +@RequiredArgsConstructor +public class OperationController { + private final OperationManage operationManage; + + @ApiOperation(value = "实施详情", notes = "实施详情") + @GetMapping("/detail/{projectId}") + public OperationVO detail(@PathVariable Long projectId) { + return operationManage.detail(projectId); + } + + @PostMapping("/push-operation") + @ApiOperation("填写实施计划") + @WebLog("填写实施计划") + public String pushOperation(@RequestBody OperationDTO operation) { + return operationManage.pushOperation(operation); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PrequalificationDeclaredController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PrequalificationDeclaredController.java new file mode 100644 index 0000000..5974fb6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PrequalificationDeclaredController.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.projectdeclared.controller; + +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.log.annotation.WebLog; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.PrequalificationDeclaredProjectManage; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.req.PrequalificationDeclaredListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname PrequalificationDeclaredController + * @Description 预审申报 + * @Date 2023/2/12 9:03 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/prequalification") +@Api(value = "Prequalification", tags = "申报管理-预审申报") +@RequiredArgsConstructor +public class PrequalificationDeclaredController { + + private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; + + @ApiOperation(value = "可预审申报项目列表", notes = "可预审申报项目列表") + @GetMapping("/list") + public PageVo list(@Validated @ModelAttribute PrequalificationDeclaredListReq preReq) { + return prequalificationDeclaredProjectManage.pageInfo(preReq); + } + + @ApiOperation(value = "申报预审", notes = "申报预审") + @WebLog("申报预审") + @PostMapping("/start") + public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + return prequalificationDeclaredProjectManage.startTheProcess(dto); + } + + @GetMapping("/export") + @ApiOperation("可预审申报项目列表导出") + @WebLog("可预审申报项目列表导出") + public void exportList(PrequalificationDeclaredListReq preReq, HttpServletResponse response){ + ExcelDownUtil.downXls(response,preReq,prequalificationDeclaredProjectManage::exportList); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java new file mode 100644 index 0000000..503284b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; +import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Classname ConstructionPlanController + * @Description 建设方案申报 + * @Date 2023/2/13 9:53 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/project/adjustment") +@Api(value = "ProjectAdjustment", tags = "申报管理-项目内容调整") +@RequiredArgsConstructor +public class ProjectAdjustmentController { + + private final ProjectAdjustmentManage projectAdjustmentManage; + + @ApiOperation(value = "可做项目内容调整的列表", notes = "可做项目内容调整的列表") + @GetMapping("/list") + public PageVo list(@Validated @ModelAttribute AdjustmentListReq preReq) { + return projectAdjustmentManage.projectLibList(preReq); + } + + @ApiOperation(value = "项目内容调整", notes = "项目内容调整") + @WebLog("项目内容调整") + @PostMapping + public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + String instanceId = projectAdjustmentManage.adjustment(dto); + return "项目内容调整并且重新申报 【" + instanceId + "】 成功"; + } + + @GetMapping("/export") + @ApiOperation("项目内容调整列表导出") + @WebLog("项目内容调整列表导出") + public void exportList(AdjustmentListReq preReq, HttpServletResponse response){ + ExcelDownUtil.downXls(response,preReq,projectAdjustmentManage::exportList); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java new file mode 100644 index 0000000..1a0f07e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; +import com.hz.pm.api.projectdeclared.manage.PurchaseManage; +import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +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 javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @Classname PurchaseController + * @Description 申报项目-采购结果备案 + * @Date 2023/5/29 09:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared/purchase") +@Api(value = "PurchaseController", tags = "申报管理-采购结果备案") +@RequiredArgsConstructor +public class PurchaseController { + private final PurchaseManage purchaseManage; + + private final ProjectAdjustmentManage projectAdjustmentManage; + + @ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") + @GetMapping("/project-list") + public PageVo projectlist(@ModelAttribute ProjectListReq req) { + return purchaseManage.projectLibList(req); + } + + @ApiOperation(value = "采购结果备案详情", notes = "采购结果备案详情") + @GetMapping("/detail/{projectId}") + public List detailByProjectId(@PathVariable Long projectId) { + return purchaseManage.detailByProjectId(projectId); + } + + @GetMapping("/export") + @ApiOperation("待采购结果备案列表导出") + @WebLog("待采购结果备案列表导出") + public void exportList(ProjectListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, purchaseManage::exportList); + } + + @ApiOperation(value = "填写采购结果", notes = "填写采购结果") + @WebLog("填写采购结果") + @PostMapping("/submit-result") + public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) { + return purchaseManage.submitResult(dto); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java new file mode 100644 index 0000000..d641744 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectdeclared.manage.ReviewChecklistManage; +import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; +import com.hz.pm.api.projectdeclared.model.vo.ReviewCheckInfoVO; +import com.hz.pm.api.projectdeclared.model.vo.ReviewChecklistApproveVO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectReviewCheckListItemVO; +import com.wflow.bean.dto.FormsReviewChecklistDto; +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 ReviewChecklistController + * @Description + * @Date 2023/11/7 17:00 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/review-checklist") +@Api(value = "Review-Checklist", tags = "审查清单") +@RequiredArgsConstructor +public class ReviewChecklistController { + + private final ReviewChecklistManage reviewChecklistManage; + + @ApiOperation(value = "建设方案后审查清单", notes = "建设方案后审查清单") + @GetMapping("/list") + public PageVo list(@ModelAttribute ProjectListReq req) { + return reviewChecklistManage.projectLibList(req); + } + + @ApiOperation(value = "审查清单审核", notes = "审查清单审核") + @PostMapping("/approve") + @WebLog("审查清单审核") + public String approve(@RequestBody List dtos) { + return reviewChecklistManage.approve(dtos); + } + + @ApiOperation(value = "查看某个项目的意见汇总", notes = "查看某个项目的意见汇总") + @GetMapping("/summary-list/{projectCode}") + public List summaryList(@PathVariable String projectCode) { + return reviewChecklistManage.summaryList(projectCode); + } + + @ApiOperation(value = "意见汇总提交", notes = "意见汇总提交") + @PostMapping("/summary/{projectCode}") + @WebLog("意见汇总提交") + public String summary(@PathVariable String projectCode) { + return reviewChecklistManage.summary(projectCode); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/converter/ApplicationConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/converter/ApplicationConverter.java new file mode 100644 index 0000000..58a52ae --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/converter/ApplicationConverter.java @@ -0,0 +1,244 @@ +package com.hz.pm.api.projectdeclared.converter; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.provincial.model.dto.FileDTO; +import com.hz.pm.api.provincial.model.dto.ProvincialApplicationDTO; +import com.hz.pm.api.provincial.model.dto.ProvincialProjectDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname ApplicationConverter + * @Description + * @Date 2023/3/13 17:38 + * @Author PoffyZhang + */ +@Slf4j +public class ApplicationConverter { + + public static ProvincialProjectDTO convertProject(Project projectInfo, List applications, + FileService fileService, String active) { + return ProvincialProjectDTO.builder() + //暂时先写死 + .operationManageUnit(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? + "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getHigherSuperOrgCode()) + .digitalReform(String.valueOf(projectInfo.getBizDomain())) + .regionCode(projectInfo.getAreaCode()) + .regionName(projectInfo.getArea()) + .projectName(projectInfo.getProjectName()) + .projectId(projectInfo.getProjectCode()) + .projectType(convertProjectType(projectInfo.getProjectType())) + .totalMoney(projectInfo.getDeclareAmount()) + .yearBudget(projectInfo.getAnnualPlanAmount()) + .budgetFrom(checkAddBudget(projectInfo.getDeclareHaveAmount() + , projectInfo.getDeclareGovOwnFinanceAmount(), + projectInfo.getDeclareGovSuperiorFinanceAmount(), + projectInfo.getDeclareBankLendingAmount(), + projectInfo.getDeclareOtherAmount())) + .year(String.valueOf(projectInfo.getProjectYear())) + .financialCode(projectInfo.getFinancialCode()) + .developCode(projectInfo.getDevelopCode()) + .beginTime(projectInfo.getBeginTime()) + .endTime(projectInfo.getEndTime()) + .buildBasis("立项依据") + .buildBasisFile(convertBasicFile(projectInfo.getBuildBasis(), fileService)) + .projectSummary(projectInfo.getProjectIntroduction()) + .responsibleMan(projectInfo.getResponsibleMan()) + .responsibleManPhone(projectInfo.getResponsibleManMobile()) + .contactName(projectInfo.getContactName()) + .contactPhone(projectInfo.getContactPhone()) + .buildUnit(projectInfo.getBuildOrgName()) + .buildUnitCode(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? + "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getBuildOrgCode()) + .superUnit(projectInfo.getSuperOrg()) + .superUnitCode(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? + "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getSuperOrgCode()) + .projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(), fileService)) + .unitThreePlan(convertFile(projectInfo.getMainResponsibilitiesApplicantFile(), fileService)) + .otherFile(convertFile(projectInfo.getPreliminaryPlanFile(), fileService)) + .projectRemark(projectInfo.getProjectRemarks()) + .includeApplication(projectInfo.getIncludeApplication()) + .isEffective(1) + .projectApplyFile(convertFile(projectInfo.getProjectApplicationForm(), fileService)) + .researchReport(convertFile(projectInfo.getPreliminaryPlanFile(), fileService)) + .applicationInfo(convertApplications(applications, fileService)) + .build(); + } + + private static Integer convertProjectType(String projectType) { + if(StringUtils.isBlank(projectType)){ + return null; + } + + if(Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), + ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode()).contains(projectType)){ + return ProjectTypeEnum.BUILD.getCode(); + }else if(Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), + ProjectTypeNewEnum.XU_OPERA.getCode()).contains(projectType)){ + return ProjectTypeEnum.DEV_OPS.getCode(); + } + return null; + } + + private static String checkAddBudget(BigDecimal declareHaveAmount, BigDecimal declareGovOwnFinanceAmount, + BigDecimal declareGovSuperiorFinanceAmount, BigDecimal declareBankLendingAmount, + BigDecimal otherAmount) { + StringBuilder sb = new StringBuilder(); + + if (Objects.nonNull(declareHaveAmount) && declareHaveAmount.compareTo(BigDecimal.ZERO) > 0) { + sb.append("自有资金,"); + } + if (Objects.nonNull(declareGovOwnFinanceAmount) && declareGovOwnFinanceAmount.compareTo(BigDecimal.ZERO) > 0) { + sb.append("政府投资-本级财政资金,"); + } + if (Objects.nonNull(declareGovSuperiorFinanceAmount) && declareGovSuperiorFinanceAmount.compareTo(BigDecimal.ZERO) > 0) { + sb.append("政府投资-上级财政资金,"); + } + if (Objects.nonNull(declareBankLendingAmount) && declareBankLendingAmount.compareTo(BigDecimal.ZERO) > 0) { + sb.append("银行贷款,"); + } + if (Objects.nonNull(otherAmount) && otherAmount.compareTo(BigDecimal.ZERO) > 0) { + sb.append("其他资金"); + } + return sb.toString(); + } + + //放入项目 app + private static List convertApplications(List applications, + FileService fileService) { + if (CollUtil.isEmpty(applications)) { + return Collections.emptyList(); + } + return applications.stream().map(app -> convertApp(app, fileService)).collect(Collectors.toList()); + } + + private static ProvincialApplicationDTO convertApp(ProjectApplication projectApplication, FileService fileService) { + return ProvincialApplicationDTO.builder() + .clouds(convertCloud(projectApplication)) + .isFirst(projectApplication.getIsFirst()) + .applicationName((projectApplication.getApplicationName())) + .applicationCode(StringUtils.isNotBlank(projectApplication.getAppCode()) ? + projectApplication.getAppCode() : projectApplication.getRelatedExistsApplicationCode()) + .relatedExistsApplication(projectApplication.getRelatedExistsApplication()) + .applicationType(2) + .buildLevel(projectApplication.getBuildLevel()) + .isUniteBuild(projectApplication.getIsUniteBuild()) + .unionBuildKind(projectApplication.getUnionBuildKind()) + .applicationSummary(projectApplication.getApplicationSummary()) + .applicationRemark(projectApplication.getApplicationRemark()) + .isFiveDomain(projectApplication.getIsDigitalModification()) + .fiveDomain(projectApplication.getDigitalModification()) + .bizDomain(projectApplication.getBizDomain()) + .isBizCooperate(projectApplication.getIsBizCooperate()) + .userRange(projectApplication.getUsesRangeRemark()) + .useGovCloud(projectApplication.getUseGovCloud()) + .nationalITSpec(projectApplication.getNationalItSpec()) + .netEnv(String.valueOf(projectApplication.getNetEnv())) + .secrecyGrade(projectApplication.getSecrecyGrade()) + .passwordGrade(projectApplication.getPasswordGrade()) + .accountAppName(projectApplication.getAccountAppName()) + .brainAccountAppName(projectApplication.getDomainBrainAccount()) + .useCommonData(projectApplication.getUseCommonData()) + .dataName(projectApplication.getDataName()) + .commonComponents(projectApplication.getCommonComponents()) + .useCommonComponent(projectApplication.getUseCommonComponent()) + .isProduceCommonComponent(projectApplication.getProduceCommonComponent()) + .produceCommonComponent(projectApplication.getProduceCommonComponents()) + .publishSide(projectApplication.getPublishSide()) + .isS2(projectApplication.getIsAccountAppName()) + .accountAppName(projectApplication.getAccountAppName()) + .applicationEstimateFile(convertFile(projectApplication.getApplicationEstimateFile(), fileService)) + .cooperativeUnit(projectApplication.getBizCooperateInfo()) + .build(); + } + + private static String convertFile(String applicationEstimateFile, FileService fileService) { + try { + JSONArray jsonArrays = JSON.parseArray(applicationEstimateFile); + List files = jsonArrays.stream().map(json -> { + JSONObject fileJson = (JSONObject) JSON.toJSON(json); + Long fileId = fileJson.getLong("id"); + String fileName = fileJson.getString("originalFileName"); + Map fileMap = fileService.findUrlById(Arrays.asList(fileId)); + String url = fileMap.get(fileId); + url = removeExpire(url); + FileDTO file = new FileDTO(); + file.setFileId(String.valueOf(fileId)); + file.setFileName(fileName); + file.setAccessUrl(url); + return file; + }).collect(Collectors.toList()); + return JSON.toJSONString(files); + } catch (Exception e) { + log.info("转换省局上传 文件出错 {}", e.getMessage()); + } + return null; + } + + /** + * 去除掉 oss链接的超时时间 + * + * @param url + * @return + */ + private static String removeExpire(String url) { + if (StringUtils.isNotBlank(url)) { + String s = "Expires"; + return url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY); + } + return StringUtils.EMPTY; + } + + //立项依据的文件格式不一样 + private static String convertBasicFile(String applicationEstimateFile, FileService fileService) { + try { + List files = Lists.newArrayList(); + JSONArray jsonArrays = JSON.parseArray(applicationEstimateFile); + jsonArrays.forEach(json -> { + JSONObject fileJson = (JSONObject) JSON.toJSON(json); + JSONArray fileList = fileJson.getJSONArray("fileList"); + fileList.forEach(f -> { + JSONObject fJson = (JSONObject) JSON.toJSON(f); + Long fileId = fJson.getLong("id"); + String fileName = fJson.getString("originalFileName"); + Map fileMap = fileService.findUrlById(Lists.newArrayList(fileId)); + String url = fileMap.get(fileId); + url = removeExpire(url); + FileDTO file = new FileDTO(); + file.setFileId(String.valueOf(fileId)); + file.setFileName(fileName); + file.setAccessUrl(url); + files.add(file); + }); + }); + return JSON.toJSONString(files); + } catch (Exception e) { + log.info("转换省局上传 basic文件出错 {}", e.getMessage()); + } + return null; + } + + private static List convertCloud(ProjectApplication projectApplication) { + return Lists.newArrayList(ProvincialApplicationDTO.Cloud.builder() + .cloudType(projectApplication.getCloudsType()) + .cloudNums(projectApplication.getCloudsNumber()) + .cloudBasicSpec(projectApplication.getCloudsFoundationSpecifications()) + .cloudUseDescription(projectApplication.getCloudsDescription()) + .build()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java new file mode 100644 index 0000000..387b921 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -0,0 +1,574 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.*; +import com.hz.pm.api.projectdeclared.model.entity.Contract; +import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.vo.*; +import com.hz.pm.api.projectdeclared.service.IContractService; +import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; +import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @Classname ContructionManage + * @Description + * @Date 2023/5/29 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ConstructionManage { + + private final IProjectService projectService; + private final UserInfoHelper userInfoHelper; + + private final IPurchaseService purchaseService; + + private final IContractService contractService; + + private final IPaymentPlanService paymentPlanService; + + private final IPreInsAcceptancePersonService acceptancePersonService; + + private final StateMachineUtils stateMachineUtils; + + /** + * 待采购的-项目列表 + * + * @param req + * @return + */ + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //建设中状态 + query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + query.isNull(Project::getContractAmount); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.orderByAsc(Project::getTransactionTime); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + 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); + } + + /** + * 已完善合同信息的列表 + * @param req + * @return + */ + public PageVo projectlistPerfect(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //建设中状态以后的 都是 + query.and(q1 -> q1.gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) + .or(q2 -> q2.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) + .isNotNull(Project::getContractAmount))); + query.eq(Project::getNewest, Boolean.TRUE); + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.orderByAsc(Project::getUpdateOn); + Page page = projectService.page(req.page(), query); + + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + List projects = page.getRecords(); + List projectCodes = projects.stream().map(Project::getProjectCode) + .collect(Collectors.toList()); + List paymentPlans = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .in(PaymentPlan::getProjectCode, projectCodes)); + Map> paymentMap = paymentPlans.stream() + .collect(Collectors.groupingBy(PaymentPlan::getProjectCode)); + + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectContractListVO item = BeanUtil.copyProperties(w,ProjectContractListVO.class); + item.setBuildOrg(w.getBuildOrgName()); + item.setSupplemented(checkIsSupplement(w,paymentMap)); + return item; + }); + return PageVo.of(records, page.getTotal()); + } + + /** + * 判断 是否需要补充 + * @param w + * @param paymentMap + * @return + */ + private Boolean checkIsSupplement(Project w, Map> paymentMap) { + if(paymentMap.containsKey(w.getProjectCode())){ + List paymentPlans = paymentMap.get(w.getProjectCode()); + if(CollUtil.isEmpty(paymentPlans)){ + return Boolean.FALSE; + } + for (PaymentPlan plan : paymentPlans){ + if(Objects.isNull(plan.getActualPaymentAmount())){ + return Boolean.FALSE; + } + } + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + public void exportList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //待采购状态 + query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + query.isNull(Project::getContractAmount); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + query.orderByAsc(Project::getTransactionTime); + List records = projectService.list(query); + + AtomicInteger serialNumber = new AtomicInteger(0); + List collect = Lists.newArrayList(); + if (CollUtil.isNotEmpty(records)) { + List projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); + + List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId, projectIds)); + Map purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); + + collect = records.stream().map(r -> { + DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + exportDTO.setApprovedAmount(r.getApprovalAmount()); + exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + if (purchaseMap.containsKey(r.getId())) { + Purchase purchase = purchaseMap.get(r.getId()); + exportDTO.setTransactionAmount(purchase.getTransactionAmount()); + exportDTO.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + } + return exportDTO; + }).collect(Collectors.toList()); + } + + String fileName = "合同备案项目列表"; + ExcelDownUtil.setFileName(fileName, response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 获取合同备案详情 + * + * @param projectId + * @return + */ + public ContractVO detailContractByProjectId(Long projectId) { + Project project = projectService.getNewProject(projectId); + if(Objects.isNull(project)){ + return null; + } + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectCode, project.getProjectCode()) + .last(BizConst.LIMIT_1)); + + ContractVO vo = BeanUtil.copyProperties(contract, ContractVO.class); + + List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .eq(PaymentPlan::getProjectCode, project.getProjectCode()) + .orderByAsc(PaymentPlan::getPaymentTime)); + + if (CollUtil.isNotEmpty(payments)) { + vo.setPayments(convertPayments(payments, contract.getTotalAmount())); + } + + return vo; + } + + private List convertPayments(List payments, BigDecimal totalAmount) { + if (CollUtil.isEmpty(payments)) { + return Collections.emptyList(); + } + return payments.stream().map(p -> { + PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); + vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" + : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) + .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); + return vo; + }) + .collect(Collectors.toList()); + } + + /** + * 填写合同信息 + * + * @param dto + * @return + */ + public String submitContract(ContractSaveDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Long projectId = dto.getProjectId(); + VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); + Project project = projectService.getNewProject(dto.getProjectId()); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); + + Contract contractEntity = new Contract(); + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectId, projectId) + .last(BizConst.LIMIT_1)); + + BeanUtil.copyProperties(dto, contractEntity); + if (Objects.isNull(contract)) { + contractEntity.setCreateOn(LocalDateTime.now()); + contractEntity.setCreateBy(employeeCode); + } else { + contractEntity.setId(contract.getId()); + } + contractEntity.setProjectId(projectId); + contractEntity.setProjectCode(project.getProjectCode()); + if (contractService.saveOrUpdate(contractEntity)) { + //存 付款计划信心 + if (Objects.nonNull(dto.getPayments())) { + //先删除 + paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class) + .eq(PaymentPlan::getProjectId, projectId)); + if (CollUtil.isNotEmpty(dto.getPayments())) { + List payments = dto.getPayments().stream().map(d -> { + PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class); + plan.setProjectId(projectId); + plan.setProjectCode(project.getProjectCode()); + plan.setCreateOn(LocalDateTime.now()); + plan.setUpdateOn(LocalDateTime.now()); + plan.setCreateBy(employeeCode); + plan.setUpdateBy(employeeCode); + return plan; + }).collect(Collectors.toList()); + + paymentPlanService.saveBatch(payments); + } + } + } + + //判断下 如果和初验都完成了 才进入下一阶段 + if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { + //进入到下一状态 + stateMachineUtils.pass(project); + } + project.setUpdateOn(LocalDateTime.now()); + if (Objects.nonNull(dto.getDeliveryTime())) { + project.setDeliveryTime(dto.getDeliveryTime()); + } + if (Objects.nonNull(dto.getTotalAmount())) { + project.setContractAmount(dto.getTotalAmount()); + } + projectService.updateById(project); + + return "填写成功"; + } + + /** + * 待初验项目列表 + * + * @param req + * @return + */ + public PageVo preProjectlist(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //建设中状态 + query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + //交货时间 排序 + query.isNotNull(Project::getDeliveryTime); + query.orderByAsc(Project::getDeliveryTime); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApprovedAmount(w.getApprovalAmount()); + item.setApprovalDate(w.getApprovalDate()); + 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); + } + + public void exportPreList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //待采购状态 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + //交货时间 排序 + query.isNotNull(Project::getDeliveryTime); + query.orderByAsc(Project::getDeliveryTime); + List records = projectService.list(query); + + List collect = Lists.newArrayList(); + if (CollUtil.isNotEmpty(records)) { + AtomicInteger serialNumber = new AtomicInteger(0); + collect = records.stream().map(r -> { + DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + 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()); + } + + String fileName = "合同备案项目列表"; + ExcelDownUtil.setFileName(fileName, response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 查询初验信息 + * + * @param projectId + * @return + */ + public PreInsVO detailPreInsByProjectId(Long projectId) { + Project project = projectService.getById(projectId); + PreInsVO vo = new PreInsVO(); + vo.setProjectId(projectId); + vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials()); + vo.setIsCompletedLogCollection(project.getIsCompletedLogCollection()); + vo.setActualPerformanceIndicators(project.getActualPerformanceIndicators()); + LambdaQueryWrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .eq(PreInsAcceptancePerson::getProjectId, projectId) + .orderByAsc(PreInsAcceptancePerson::getCreateOn); + List acceptancePersons = acceptancePersonService.list(query); + vo.setAcceptancePersons(convertPersons(acceptancePersons)); + return vo; + } + + private List convertPersons(List acceptancePersons) { + if (CollUtil.isEmpty(acceptancePersons)) { + return Collections.emptyList(); + } + return acceptancePersons.stream() + .map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)) + .collect(Collectors.toList()); + } + + /** + * 填写初验信息 + * + * @param dto + * @return + */ + public String submitPreIns(PreInsSaveDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Long projectId = dto.getProjectId(); + VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); + Project project = projectService.getNewProject(dto.getProjectId()); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); + + //初验人员 + if (Objects.nonNull(dto.getAcceptancePersons())) { + //先删除 + acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .eq(PreInsAcceptancePerson::getProjectId, projectId)); + if (CollUtil.isNotEmpty(dto.getAcceptancePersons())) { + List persons = dto.getAcceptancePersons().stream().map(d -> { + PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class); + person.setProjectId(projectId); + person.setCreateOn(LocalDateTime.now()); + person.setUpdateOn(LocalDateTime.now()); + person.setCreateBy(employeeCode); + person.setUpdateBy(employeeCode); + return person; + }).collect(Collectors.toList()); + + acceptancePersonService.saveBatch(persons); + } + } + + + //判断下 如果和初验都完成了 才进入下一阶段 + if (Objects.nonNull(project.getDeliveryTime())) { + //进入到下一状态 + stateMachineUtils.pass(project); + } + project.setUpdateOn(LocalDateTime.now()); + project.setPreliminaryInspectionMaterials(dto.getPreliminaryInspectionMaterials()); + project.setIsCompletedLogCollection(dto.getIsCompletedLogCollection()); + project.setActualPerformanceIndicators(dto.getActualPerformanceIndicators()); + projectService.updateById(project); + + return "填写成功"; + } + + /** + * 补充项目 合同 实际支付信息 + * @param plans + * @return + */ + public String supplement(List plans) { + if(CollUtil.isEmpty(plans)){ + throw new BizException("入参"); + } + + for(PaymentPlanSupplementDTO plan : plans){ + PaymentPlan paymentPlan = paymentPlanService.getById(plan.getId()); + VUtils.isTrue(Objects.isNull(paymentPlan)) + .throwMessage("保存失败 该支付信息不存在 :" + plan.getId()); + VUtils.isTrue(Objects.nonNull(paymentPlan.getActualPaymentAmount())) + .throwMessage("保存失败 该支付信息已经保存过 实际支付金额 :" + plan.getId() + "," + paymentPlan.getActualPaymentAmount()); + paymentPlan.setActualPaymentAmount(plan.getActualPaymentAmount()); + paymentPlanService.updateById(paymentPlan); + } + + return "保存成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java new file mode 100644 index 0000000..ed68a12 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java @@ -0,0 +1,369 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.NdDateUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.ConstructionPlanExportDTO; +import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; +import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; +import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +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 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.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +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; + +/** + * @Classname DeclaredProjectManage + * @Description + * @Date 2023/2/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ConstructionPlanManage { + + private final IProjectService projectService; + private final ProcessInstanceService processService; + private final ProcessModelService processModelService; + private final StateMachineUtils stateMachineUtils; + private final IProjectInstService projectInstService; + private final ProjectLibManage projectLibManage; + private final UserInfoHelper userInfoHelper; + private final DefaultDeclaredProjectManage declaredProjectManage; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final NoticeManage noticeManage; + private final RegionCacheHelper regionCacheHelper; + private final HistoryService historyService; + + private final IConstrctionSuggestionsService constrctionSuggestionsService; + /** + * 建设方案 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String startTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) + .throwMessage("获取登录用户失败!"); + + ProjectDTO projectInfo = dto.getProjectInfo(); + Long projectInfoId = projectInfo.getId(); + VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败 缺少项目ID!"); + Project oldProject = projectService.getById(projectInfoId); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); + + // 判断 项目当前状态 是不是 方案待申报 + VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(oldProject.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) + .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); + + if(StringUtils.isNotBlank(user.getRegionCode())){ + projectInfo.setAreaCode(user.getRegionCode()); + projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); + } + + projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); + projectInfo.setBuildOrgName(user.getEmpPosUnitName()); + + // 项目名称去重 + if(StringUtils.isNotBlank(projectInfo.getProjectName()) && !projectInfo.getProjectName() + .equals(oldProject.getProjectName())){ + projectInfo.setProjectCode(oldProject.getProjectCode()); + defaultDeclaredProjectManage.checkDuplication(projectInfo); + } + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(projectInfo); + + //如果主管单位没有 那么主管单位就是自己 + if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ + projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); + projectInfo.setSuperOrg(user.getEmpPosUnitName()); + } + + Project constructProject = new Project(); + BeanUtils.copyProperties(projectInfo,constructProject); + constructProject.setStatus(oldProject.getStatus()); + constructProject.setStage(oldProject.getStage()); + + String regionCode = user.getRegionCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 建设申报流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 建设申报流程配置", regionCode)); + } + + //如果被禁用了的话 直接跳过 进入到下一个状态 + if(model.getIsStop()){ + //被禁用了 调2次状态机 + stateMachineUtils.pass(constructProject); + stateMachineUtils.pass(constructProject); + constructProject.setUpdateOn(LocalDateTime.now()); + projectService.updateById(constructProject); + return "因为建设方案流程被禁用了 直接跳过!"; + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params, oldProject,dto); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); + String instanceId = processService.startProcessLs(model, params, orgModelMap); + log.info("建设方案项目申报成功 【{}】", instanceId); + + // 保存建设项目相关 + Project buildProject = new Project(); + if(dto.getRestart()){ + //如果是重新提交 不用生成新版本 前面已经生成过了 + buildProject = contructionPlanModifyProject(oldProject, instanceId); + }else{ + buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject); + } + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + private Project contructionPlanModifyProject(Project project, String instanceId) { + stateMachineUtils.pass(project); + project.setUpdateOn(LocalDateTime.now()); + project.setInstCode(instanceId); + projectService.updateById(project); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()); + projectInstService.save(projectInst); + + return project; + } + + /** + * 驳回 重新提交建设方案 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) + .throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); + //直接先到待方案审批 + Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, + ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),Boolean.TRUE); + dto.getProjectInfo().setId(project.getId()); + dto.setRestart(Boolean.TRUE); + return startTheProcess(dto); + } + + /** + * 提交建设方案项目 时 更新信息 + * + * @param project + * @param instanceId + */ + private void modifyProject(Project project, String instanceId, String constructionPlanFile) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + project.setUpdateOn(LocalDateTime.now()); + project.setInstCode(instanceId); + project.setConstructionPlanFile(constructionPlanFile); + //调用状态机 进入下一个通过状态 + stateMachineUtils.pass(project); + projectService.updateById(project); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setInstType(InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInstService.save(projectInst); + } catch (Exception e) { + log.error("提交建设方案 项目信息修改 错误 ", e); + throw new BusinessException("提交建设方案 项目信息修改 错误 :" + e.getMessage()); + } + } + + /** + * 查项目 + * + * @param planReq + * @return + */ + public PageVo projectLibList(ConstrctionPlanListReq planReq) { + //限定参数 复制bean + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(planReq, req); + //项目阶段 状态 已定 方案待申报 + req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + //放入用户的单位 + req.setBuildOrgCode(user.getEmpPosUnitCode()); + return projectLibManage.projectLibList(req); + } + + public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) { + //限定参数 复制bean + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(planReq, req); + //项目阶段 状态 已定 方案待申报 + req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + //放入用户的单位 + req.setBuildOrgCode(user.getEmpPosUnitCode()); + req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + Page page = projectService.page(req.page(), query); + List records = page.getRecords(); + + + List collect = records.stream().map(r -> { + ConstructionPlanExportDTO exportDTO = new ConstructionPlanExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + return exportDTO; + }).collect(Collectors.toList()); + for (int i = 0; i < collect.size(); i++) { + collect.get(i).setSerialNumber(i + 1); + } + String fileName = "建设方案申报项目列表"; + ExcelDownUtil.setFileName(fileName, response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 专家建设方案建议 暂存 等流程成功后 保存到项目 + * @param dto + */ + public void constructionSuggestions(ContructionSuggestionsDTO dto) { + String instanceId = dto.getInstanceId(); + + Project project = projectService.getProjectByCode(dto.getProjectCode()); + if(Objects.isNull(project)){ + throw new BizException("该项目不存在!"); + } + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId) + .eq(ProjectInst::getProjectId,project.getId()) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(projectInst)){ + throw new BizException("该流程的项目关联信息不存在!"); + } + + if(!InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(projectInst.getInstType())){ + throw new BizException("此流程不是建设方案流程 保存失败!"); + } + + ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto,ProjectConstructionSuggestions.class); + ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) + .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) + .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(pcs)){ + saveEntity.setId(pcs.getId()); + } + saveEntity.setInstanceId(instanceId); + constrctionSuggestionsService.saveOrUpdate(saveEntity); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java new file mode 100644 index 0000000..43fa3ea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -0,0 +1,505 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +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; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +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.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import com.hz.pm.api.irs.manage.ProjectIrsManage; +import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; +import com.hz.pm.api.irs.service.IProjectCoreBizService; +import com.hz.pm.api.projectdeclared.contants.DeclaredProjectContant; +import com.hz.pm.api.projectdeclared.model.dto.*; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; +import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; +import com.hz.pm.api.projectdeclared.service.IProjectDraftService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +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; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @Classname DeclaredProjectManage + * @Description + * @Date 2023/2/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class DeclaredProjectManage { + + private final IProjectService projectService; + + private final ProjectLibManage projectLibManage; + + private final IProjectDraftService projectDraftService; + + private final ProcessInstanceService processService; + + private final ProcessModelService processModelService; + + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + + private final NoticeManage noticeManage; + + private final UserInfoHelper userInfoHelper; + + private final RegionCacheHelper regionCacheHelper; + + private final ProjectIrsManage projectIrsManage; + + private final GovProjectCollectionManage collectionManage; + + @Value("${spring.profiles.active}") + private String active; + + /** + * 新项目 启动实例 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String startTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + ProjectDTO projectInfo = dto.getProjectInfo(); + + if(StringUtils.isNotBlank(user.getRegionCode())){ + projectInfo.setAreaCode(user.getRegionCode()); + projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); + } + + projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); + projectInfo.setBuildOrgName(user.getEmpPosUnitName()); + + //项目名称去重 + defaultDeclaredProjectManage.checkDuplication(projectInfo); + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(projectInfo); + + //写死 是否有主管单位 + projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); + projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); + + //如果主管单位没有 那么主管单位就是自己 + if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ + projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); + projectInfo.setSuperOrg(user.getEmpPosUnitName()); + } + + //如果是重新提交的话 判断下 项目是否存在 + if(Objects.nonNull(projectInfo.getId())){ + //新申报的项目不允许带项目id + projectInfo.setId(null); + } + + String regionCode = user.getRegionCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到单位流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); + dto.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + params.setFormData(dto.getFormData()); + //开始申报 + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Project project = new Project(); + BeanUtils.copyProperties(projectInfo,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); + String instanceId = processService.startProcessLs(model, params,orgModelMap); + log.info("申报项目成功 【{}】", instanceId); + + //如果是重新提交的话 判断下 项目是否存在 + //保存项目相关 + Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); + if(Objects.nonNull(projectInfo.getDraftId())){ + //如果是草稿箱提交 删除对应的草稿箱 + projectDraftService.removeById(projectInfo.getDraftId()); + } + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + + /** + * 重新提交 启动实例 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String reStartTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) + .throwMessage("获取登录用户失败!"); + String employeeCode = user.getEmployeeCode(); + ProjectDTO projectDto = dto.getProjectInfo(); + projectDto.setAreaCode(user.getRegionCode()); + projectDto.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); + projectDto.setBuildOrgCode(user.getEmpPosUnitCode()); + projectDto.setBuildOrgName(user.getEmpPosUnitName()); + + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + + //项目名称去重 + if(StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())){ + projectDto.setProjectCode(projectInfo.getProjectCode()); + defaultDeclaredProjectManage.checkDuplication(projectDto); + } + + //写死 是否有主管单位 + projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); + projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); + + //如果主管单位没有 那么主管单位就是自己 + if(CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())){ + projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); + projectInfo.setSuperOrg(user.getEmpPosUnitName()); + projectDto.setSuperOrgCode(user.getEmpPosUnitCode()); + projectDto.setSuperOrg(user.getEmpPosUnitName()); + } + + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(projectDto); + + String regionCode = projectInfo.getAreaCode(); + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到单位流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); + } + + //首先要判断 项目当前状态 是不是 单位内部拒绝 + VUtils.isTrue(!ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params,dto); + + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Project project = new Project(); + BeanUtils.copyProperties(projectDto,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); + String instanceId = processService.startProcessLs(model, params,orgModelMap); + log.info("重新申报项目成功 【{}】", instanceId); + + //保存项目相关 + Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + public PageVo pageDraft(DeclaredProjectListParamDTO params) { + Long userId = LoginUserUtil.getUserId(); + Page page = params.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectDraft.class) + .eq(ProjectDraft::getUserId,userId) + .ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime()) + .le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime()) + .eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType()) + .eq(Objects.nonNull(params.getProjectYear()), ProjectDraft::getProjectYear, params.getProjectYear()) + .eq(Objects.nonNull(params.getProjectStage()), ProjectDraft::getStage, params.getProjectStage()) + .eq(Objects.nonNull(params.getProjectStatus()), ProjectDraft::getStatus, params.getProjectStatus()) + .like(StringUtils.isNotBlank(params.getProjectName()), ProjectDraft::getProjectName, params.getProjectName()) + .orderByDesc(ProjectDraft::getUpdateOn); + projectDraftService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(record -> { + ProjectDraftVO vo = new ProjectDraftVO(); + BeanUtils.copyProperties(record, vo); + vo.setBizDomain(Objects.nonNull(record.getBizDomain()) ? String.valueOf(record.getBizDomain()) : StringUtils.EMPTY); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); + } + + public ProjectDraftVO draftDatail(Long id) { + ProjectDraft draft = projectDraftService.getById(id); + ProjectDraftVO vo = new ProjectDraftVO(); + BeanUtils.copyProperties(draft, vo); + vo.setBizDomain(Objects.nonNull(draft.getBizDomain()) ? String.valueOf(draft.getBizDomain()) : StringUtils.EMPTY); + if(StringUtils.isNotBlank(draft.getProjectApplicationList())){ + vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class)); + } + if(StringUtils.isNotBlank(draft.getDynamicForm())){ + vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class)); + } + return vo; + } + + /** + * 保存至草稿箱 + * + * @param dto + * @return + */ + public Long saveToDraft(ProjectDraftSaveDTO dto) { + Long userId = LoginUserUtil.getUserId(); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + + ProjectDTO projectInfo = dto.getProjectInfo(); + ProjectDraft draft = new ProjectDraft(); + BeanUtils.copyProperties(projectInfo, draft); + //写死 是否有主管单位 + draft.setIsHigherSuperOrg(CommonEnum.YES.getCode()); + draft.setIsSuperOrg(CommonEnum.YES.getCode()); + draft.setUserId(String.valueOf(userId)); + draft.setBuildOrgCode(user.getEmpPosUnitCode()); + draft.setBuildOrgName(user.getEmpPosUnitName()); + draft.setAreaCode(user.getRegionCode()); + + if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ + draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); + } + if(CollUtil.isNotEmpty(projectInfo.getApplicationList())){ + draft.setProjectApplicationList(JSON.toJSONString(projectInfo.getApplicationList())); + } + if (Objects.isNull(draft.getId())) { + draft.setCreateOn(LocalDateTime.now()); + }else{ + ProjectDraft old = projectDraftService.getById(draft.getId()); + if(Objects.isNull(old)){ + draft.setCreateOn(LocalDateTime.now()); + } + } + draft.setUpdateOn(LocalDateTime.now()); + draft.setUserId(String.valueOf(userId)); + projectDraftService.saveOrUpdate(draft); + return draft.getId(); + } + + /** + * 项目列表 + * @param req + * @return + */ + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 + preQuery(query,user); + query.eq(Project::getNewest,Boolean.TRUE); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = BeanUtil.copyProperties(w,ProjectLibListItemVO.class); + return item; + }); + return PageVo.of(records, total); + } + + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 + private void preQuery(LambdaQueryWrapper query,UserFullInfoDTO user) { + //如果当前登录是单位管理员 + if(user.getIsOrgAdmin()){ + query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) + .eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()) + .or(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()))); + }else{ + //否则 只能看到 非预审 并且 + query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode())); + } + } + + public void exportList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 + preQuery(query,user); + query.eq(Project::getNewest,Boolean.TRUE); + List records = projectService.list(query); + + AtomicInteger serialNumber = new AtomicInteger(0); + List collect = records.stream().map(r -> { + DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "项目申报列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 查询 核心业务 + * @param businessName + * @return + */ + public JSONObject bizList(String businessName,Integer limit, Integer page,String orgCode) { + 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 = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_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)){ + if(StringUtils.isNotBlank(orgCode)){ + String[] orgCodes = orgCode.split(StrPool.COMMA); + JSONArray finalArray = new JSONArray(); + for(String og : orgCodes){ + JSONObject res = projectIrsManage.searchCoreBiz(businessName,og,limit,page); + if(Objects.nonNull(res)){ + JSONArray dataArray = res.getJSONArray(BizConst.RESPONSE_KEY_DATA); + if(CollUtil.isNotEmpty(dataArray)){ + finalArray.addAll(dataArray); + } + } + } + jsonObject.put("data",finalArray); + jsonObject.put("total",finalArray.size()); + }else{ + jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); + } + } + return jsonObject; + } + + /** + * 预审失败的时候 可以删除项目 + * @param projectCode + */ + @Transactional + public String removeProject(String projectCode) { + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)) + .throwMessage("该项目不存在"); + VUtils.isTrue(Objects.isNull(project.getStatus()) || + !ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode().equals(project.getStatus())) + .throwMessage("不是预审不通过 状态 不能删除!"); + + return collectionManage.removeProject(Lists.newArrayList(projectCode)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java new file mode 100644 index 0000000..ca8e8ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -0,0 +1,352 @@ +package com.hz.pm.api.projectdeclared.manage; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; +import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; +import com.hz.pm.api.projectdeclared.service.IDeclaredStatisticsService; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.bean.entity.WflowOrgModels; +import com.wflow.enums.OrgTypeEnum; +import com.wflow.enums.ProcessDefTypeEnum; +import com.wflow.exception.BusinessException; +import com.wflow.service.OrgProcdefService; +import com.wflow.workflow.bean.dto.OrgInfoDTO; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessModelService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname DefaultDeclaredProjectManage + * + * @Description + * @Date 2023/2/14 17:12 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class DefaultDeclaredProjectManage { + + private final IProjectService projectService; + + private final UserInfoHelper userInfoHelper; + + private final ProcessModelService processModelService; + private final OrgProcdefService orgProcdefService; + + private final IDeclaredStatisticsService statisticsService; + + /** + * 公共的发起流程方法 + */ + public void startProcess(ProjectDTO projectDTO,UserFullInfoDTO user,Integer processType){ + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, user.getRegionCode()) + .eq(WflowModels::getProcessType, processType) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到对应流程配置", user.getRegionCode()); + throw new BusinessException(String.format("此 【%s】区域找不到对应流程配置", user.getRegionCode())); + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(buildUser(user.getEmployeeCode())); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + BeanUtils.copyProperties(projectDTO, conditionDto); + Map formData = Maps.newHashMap(); + formData.putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + params.setFormData(formData); + + } + + //项目名称去重 + public void checkDuplication(ProjectDTO project){ + VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectName,project.getProjectName()) + .eq(Project::getNewest,Boolean.TRUE) + .ne(Objects.nonNull(project.getProjectCode()),Project::getProjectCode,project.getProjectCode())) > 0) + .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); + } + + public void checkAmount(ProjectDTO projectInfo) { + if(Objects.nonNull(projectInfo.getDeclareAmount())){ + BigDecimal declareAmount = projectInfo.getDeclareAmount(); + BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); + BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); + BigDecimal bankLendingAmount = projectInfo.getDeclareBankLendingAmount(); + BigDecimal haveAmount = projectInfo.getDeclareHaveAmount(); + BigDecimal otherAmount = projectInfo.getDeclareOtherAmount(); + BigDecimal totalAmount = govSuperFinanceAmount + .add(govOwnFinanceAmount).add(bankLendingAmount).add(haveAmount).add(otherAmount); + VUtils.isTrue(declareAmount.compareTo(totalAmount) != 0) + .throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】",declareAmount,totalAmount)); + + //判断 年度计划金额 如果开着的话 + if(Objects.nonNull(projectInfo.getAnnualPlanAmount())){ + BigDecimal annualPlanAmount = projectInfo.getAnnualPlanAmount(); + + VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0",annualPlanAmount)); + VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】",annualPlanAmount,declareAmount)); + + BigDecimal annualGovSuperAmount = projectInfo.getAnnualPlanGovSuperiorFinanceAmount(); + BigDecimal annualOwnSuperAmount = projectInfo.getAnnualPlanGovOwnFinanceAmount(); + BigDecimal annualBankLendingAmount = projectInfo.getAnnualPlanBankLendingAmount(); + BigDecimal annualHaveAmount = projectInfo.getAnnualPlanHaveAmount(); + BigDecimal anualOtherAmount = projectInfo.getAnnualPlanOtherAmount(); + BigDecimal totalAnnual = annualGovSuperAmount + .add(annualOwnSuperAmount).add(annualBankLendingAmount).add(annualHaveAmount).add(anualOtherAmount); + VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】",annualPlanAmount,totalAnnual)); + } + } + } + + public ProcessInstanceUserDto buildUser(String employeeCode){ + UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + + VUtils.isTrue(Objects.isNull(userInfoDetail)) + .throwMessage(String.format("【%s】获取不到用户!",employeeCode)); + + return ProcessInstanceUserDto.builder() + .userId(String.valueOf(userInfoDetail.getEmployeeCode())) + .userName(userInfoDetail.getRealName()) + .orgCode(userInfoDetail.getEmpPosUnitCode()) + .orgName(userInfoDetail.getEmpPosUnitName()) + .build(); + } + + public Map buildOrgModelMap(String employeeCode,Project project) { + Map orgMap = new HashMap<>(); + + // 查出所有的单位流程配置 + List orgModelsList = orgProcdefService.list(); + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + if(Objects.isNull(userFullInfo)){ + log.warn("取不到员工 返回空map"); + return Collections.emptyMap(); + } + + String startOrgCode = userFullInfo.getEmpPosUnitCode(); + String startOrgName = userFullInfo.getEmpPosUnitName(); + String startOrgParentCode; + String startOrgParentName; + // 如果申报时 上级主管单位,由该单位自己审核 + if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ + startOrgParentCode = startOrgCode; + startOrgParentName = startOrgName; + }else { + startOrgParentCode = project.getSuperOrgCode(); + startOrgParentName = project.getSuperOrg(); + } + //查询 当前发起人及主管单位所在区域的 单位流程配置 + OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); + startOrgInfoDto.setOrganizationCode(startOrgCode); + startOrgInfoDto.setOrganizationName(startOrgName); + + startOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(startOrgCode) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType())|| + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + OrgInfoDTO parentOrgInfoDto = new OrgInfoDTO(); + parentOrgInfoDto.setOrganizationCode(startOrgParentCode); + parentOrgInfoDto.setOrganizationName(startOrgParentName); + parentOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(startOrgParentCode) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); + + // 如果是指定单位,直接根据流程定义ID放入map + OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); + orgInfoDTO.setOrgModelMap(orgModelsList.stream() + .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); + orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); + + //如果有上级条线主管单位 并且 不是市本级 + if(!RegionConst.RC_LS.equals(project.getAreaCode()) && + CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ + OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); + parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); + parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); + parentLineOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(project.getHigherSuperOrgCode()) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); + } + return orgMap; + } + + public Map buildOrgModelMapUserOrgCode(Project project) { + Map orgMap = new HashMap<>(); + + // 查出所有的单位流程配置 + List orgModelsList = orgProcdefService.list(); + + String startOrgCode = project.getBuildOrgCode(); + String startOrgName = project.getBuildOrgName(); + String startOrgParentCode; + String startOrgParentName; + // 如果申报时 上级主管单位,由该单位自己审核 + if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ + startOrgParentCode = startOrgCode; + startOrgParentName = startOrgName; + }else { + startOrgParentCode = project.getSuperOrgCode(); + startOrgParentName = project.getSuperOrg(); + } + //查询 当前发起人及主管单位所在区域的 单位流程配置 + OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); + startOrgInfoDto.setOrganizationCode(startOrgCode); + startOrgInfoDto.setOrganizationName(startOrgName); + + startOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(startOrgCode) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + OrgInfoDTO parentOrgInfoDto = new OrgInfoDTO(); + parentOrgInfoDto.setOrganizationCode(startOrgParentCode); + parentOrgInfoDto.setOrganizationName(startOrgParentName); + parentOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(startOrgParentCode) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); + + // 如果是指定单位,直接根据流程定义ID放入map + OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); + orgInfoDTO.setOrgModelMap(orgModelsList.stream() + .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); + orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); + + //如果有上级条线主管单位 并且 不是市本级 + if(!RegionConst.RC_LS.equals(project.getAreaCode()) && + CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ + OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); + parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); + parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); + parentLineOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(project.getHigherSuperOrgCode()) + && Boolean.FALSE.equals(v.getIsDelete()) + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || + ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) + .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); + + orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); + } + return orgMap; + } + + //根据提交者的单位 + public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ + //查此人建设单位的项目 + return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); + } + + //根据提交者的区域 他是区管或者超管 + public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ + //查此人建设单位的项目 + return statisticsService.getRegionStatistics(user.getRegionCode(),year); + } + + /** + * 把条件值放入工作流 用于判断条件 根据dto + * @param params + * @param dto + */ + public void buildCondition(ProcessStartParamsVo params, DefaultDeclaredDTO dto) { + //放入条件判断的项目字段 + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); + dto.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + params.setFormData(dto.getFormData()); + } + + /** + * 把条件值放入工作流 用于判断条件 根据d项目实体 + * @param params + * @param projectInfo + */ + public void buildCondition(ProcessStartParamsVo params, Project projectInfo) { + //放入条件判断的项目字段 + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + BeanUtils.copyProperties(projectInfo, conditionDto); + params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + })); + } + + public void buildCondition(ProcessStartParamsVo params, Project projectInfo,DefaultDeclaredDTO dto) { + //放入条件判断的项目字段 优先取dto的 再取项目的 + ProjectDTO pdto = dto.getProjectInfo(); + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + conditionDto.setProjectId(projectInfo.getId()); + conditionDto.setDeclareAmount(Objects.nonNull(pdto) && Objects.nonNull(pdto.getDeclareAmount()) + ?pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); + conditionDto.setIsDigitalReform(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsDigitalReform()) + ?pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); + conditionDto.setIsTemporaryAugment(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsTemporaryAugment()) + ?pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); + conditionDto.setBizDomain(Objects.nonNull(pdto) && Objects.nonNull(pdto.getBizDomain()) + ?pdto.getBizDomain() : projectInfo.getBizDomain()); + params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + })); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java new file mode 100644 index 0000000..bfe63b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -0,0 +1,330 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.google.common.collect.Lists; +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; +import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; +import com.hz.pm.api.projectdeclared.model.vo.DelayedApplyVO; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.exception.BusinessException; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @Classname DelayedManage + * @Description + * @Date 2023/5/29 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class DelayedApplyManage { + + private final IProjectService projectService; + private final UserInfoHelper userInfoHelper; + private final ProcessModelService processModelService; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final ProcessInstanceService processInstanceService; + private final ProjectLibManage projectLibManage; + private final NoticeManage noticeManage; + private final IProjectInstService projectInstService; + private final HistoryService historyService; + + private final INdProjectDelayApplyService projectDelayApplyService; + + /** + * 延期的-项目列表 + * @param req + * @return + */ + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //待终验 并且已经过期 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); + query.eq(Project::getNewest,Boolean.TRUE); + query.isNotNull(Project::getApprovalDate); + query.isNotNull(Project::getBuildCycle); + query.orderByAsc(Project::getApprovalDate); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApprovedAmount(w.getApprovalAmount()); + item.setApprovalDate(w.getApprovalDate()); + item.setBuildCycle(StringUtils.isNotBlank(w.getBuildCycle()) ? + Integer.valueOf(w.getBuildCycle()) : null); + item.setPlanAcceptanceTime(w.getPlanAcceptanceTime()); + // 判断当前项目是否已经开启了延期申请并且没有审批完成 + ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) + .eq(ProjectDelayApply::getProjectId, w.getId()) + .orderByDesc(ProjectDelayApply::getCreateOn) + .last("limit 1")); + if (Objects.nonNull(delayApply)) { + String instCode = delayApply.getInstanceId(); + // 获取流程实例 + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instCode) + .singleResult(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode)); + Integer instType = projectInst.getInstType(); + // 延期申请流程还未审核结束 + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + Objects.isNull(newInstance.getEndActivityId())) { + item.setCanDelayApply(Boolean.FALSE); + } + // 如果是延期申请审核被驳回,设置项目可以申请延期申报 + else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { + item.setCanDelayApply(Boolean.TRUE); + } + } + return item; + }); + return PageVo.of(records, total); + } + + public void exportList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //待终验 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest,Boolean.TRUE); + query.isNotNull(Project::getApprovalDate); + query.isNotNull(Project::getBuildCycle); + query.orderByAsc(Project::getApprovalDate); + List records = projectService.list(query); + + AtomicInteger serialNumber = new AtomicInteger(0); + List collect = Lists.newArrayList(); + if(CollUtil.isNotEmpty(records)){ + collect = records.stream().map(r -> { + DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? + NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); + return exportDTO; + }).collect(Collectors.toList()); + } + + String fileName = "待终验申请项目列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 延期申请 + * @param dto + * @return + */ + public String delayedApply(DelayedApplyDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Long projectId = dto.getProjectId(); + Project project = projectService.getNewProject(projectId); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 以终验 + VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 已立项|待终验"); + + VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) + || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) + .throwMessage("当前项目还未过期验收"); + + return "申请发起成功"; + } + + /** + * 开启延期申请审批流程 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String startDelayedApplyProcess(DelayedApplyDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Long projectId = dto.getProjectId(); + Project project = projectService.getNewProject(projectId); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 以终验 + VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 已立项|待终验"); + + VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) + || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) + .throwMessage("当前项目还未过期验收"); + + String regionCode = project.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_DELAY.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到延期申请流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到延期申请流程配置", regionCode)); + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params, project); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); + String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); + log.info("延期申请申报成功 【{}】", instanceId); + + // 保存项目延期实例相关 + projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(project,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + /** + * 查询延期 详情 + * @param projectId + * @return + */ + public DelayedApplyVO detailByProjectId(Long projectId) { + ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) + .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/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java new file mode 100644 index 0000000..af5ea8f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -0,0 +1,310 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.google.common.collect.Lists; +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @Classname FinalAcceptanceManage + * @Description 终验 + * @Date 2023/6/2 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class FinalAcceptanceManage { + + private final IProjectService projectService; + private final UserInfoHelper userInfoHelper; + + private final ProcessModelService processModelService; + + private final ProcessInstanceService processInstanceService; + + private final DefaultDeclaredProjectManage declaredProjectManage; + + private final NoticeManage noticeManage; + + private final ProjectLibManage projectLibManage; + + /** + * 待采购的-项目列表 + * @param req + * @return + */ + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //待终验 并且还未过期 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); + query.eq(Project::getNewest,Boolean.TRUE); + query.isNotNull(Project::getApprovalDate); + query.isNotNull(Project::getBuildCycle); + query.orderByAsc(Project::getApprovalDate); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApprovedAmount(w.getApprovalAmount()); + item.setApprovalDate(w.getApprovalDate()); + item.setBuildCycle(StringUtils.isNotBlank(w.getBuildCycle()) ? + Integer.valueOf(w.getBuildCycle()) : null); + item.setPlanAcceptanceTime(w.getPlanAcceptanceTime()); + return item; + }); + return PageVo.of(records, total); + } + + public void exportList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //待终验 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest,Boolean.TRUE); + query.isNotNull(Project::getApprovalDate); + query.isNotNull(Project::getBuildCycle); + query.orderByAsc(Project::getApprovalDate); + List records = projectService.list(query); + + AtomicInteger serialNumber = new AtomicInteger(0); + List collect = Lists.newArrayList(); + if(CollUtil.isNotEmpty(records)){ + collect = records.stream().map(r -> { + DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? + NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); + return exportDTO; + }).collect(Collectors.toList()); + } + + String fileName = "待终验申请项目列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + + public FinalAcceptanceVO detailByProjectId(Long projectId) { + FinalAcceptanceVO vo = new FinalAcceptanceVO(); + + Project project = projectService.getById(projectId); + vo.setProjectId(projectId); + if(Objects.nonNull(project)){ + vo.setFinalAcceptanceMaterials(project.getFinalAcceptanceMaterials()); + // TODO IRS接口获取 应用信息 + vo.setApps(Collections.emptyList()); + } + + return vo; + } + + /** + * 开启流程 + * @param dto + * @return + */ + public String startProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) + .throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getNewProject(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); + + String regionCode = projectInfo.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); + } + + //首先要判断 项目当前状态 是不是 方案待申报 + VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && + !ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + //把条件值给放入工作流 + declaredProjectManage.buildCondition(params, projectInfo); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); + log.info("终验方案项目申报成功 【{}】", instanceId); + + //保存终验项目 + //生成新版本 并且进入下一状态 + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.FALSE); + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + /** + * 重新申报 + * @param dto + * @return + */ + public String restartProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) + .throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("重新提交失败 缺少项目ID!"); + Project projectInfo = projectService.getNewProject(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("重新提交失败 此项目不存在!"); + VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); + + String regionCode = projectInfo.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); + } + + //首先要判断 项目当前状态 是不是 方案待申报 + VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && + !ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + //把条件值给放入工作流 + declaredProjectManage.buildCondition(params,projectInfo, dto); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); + log.info("终验方案项目重新申报成功 【{}】", instanceId); + + //保存终验项目 + //生成新版本 并且进入下一状态 + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/IrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/IrsManage.java new file mode 100644 index 0000000..a9dd42f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/IrsManage.java @@ -0,0 +1,139 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.common.base.Joiner; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.common.util.RefreshKeyUtil; +import com.hz.pm.api.irs.manage.AppIrsManage; +import com.hz.pm.api.irs.model.dto.ApiApplyDTO; +import com.hz.pm.api.irs.model.dto.ForwardDTO; +import com.hz.pm.api.irs.utils.RefreshTokenUtil; +import com.hz.pm.api.projectdeclared.model.entity.IrsApplication; +import com.hz.pm.api.projectdeclared.model.entity.NdPiotTasks; +import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO; +import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO; +import com.hz.pm.api.projectdeclared.service.INdPiotTasksService; +import com.hz.pm.api.projectdeclared.service.IrsApplicationService; +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.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.security.NoSuchAlgorithmException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname IrsManage + * @Description + * @Date 2023/3/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class IrsManage { + + @Value("${irs.is-search-app}") + private Boolean isSearchApp; + + private final IrsApplicationService irsApplicationService; + + private final INdPiotTasksService piotTasksService; + + private final AppIrsManage appIrsManage; + + + public List applicationList(String areaCode) { + //不请求IRS + if(!isSearchApp) { + List list = irsApplicationService.list(); + if(CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return CollUtils.convert(list,app -> BeanUtil.copyProperties(app,IrsApplicationVO.class)); + } + + try { + ApiApplyDTO apiApplay = new ApiApplyDTO(); + apiApplay.setAreaCode(areaCode); + JSONArray jsonArray = appIrsManage.searchApps(apiApplay); + if(CollUtil.isNotEmpty(jsonArray)){ + return jsonArray.stream().map(apply -> { + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(apply)); + IrsApplicationVO vo = new IrsApplicationVO(); + vo.setApplicationCode(jsonObject.getString("appId")); + vo.setApplicationName(jsonObject.getString("name")); + return vo; + }).collect(Collectors.toList()); + } + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + return Collections.emptyList(); + } + + public List listPiotTasks() { + List list = piotTasksService.list(); + if(CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return CollUtils.convert(list,task -> BeanUtil.copyProperties(task,PiotTasksVO.class)); + } + + public String getCreditCode() throws NoSuchAlgorithmException { + String appSecret = RefreshTokenUtil.refrshByAppScret(); + String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; + String dataName = "丽水市大数据"; + long timestamp = System.currentTimeMillis(); + String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp); + String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey + + "&sign=" + sign + "&requestTime=" + timestamp; + RestTemplate restTemplate = new RestTemplate(HttpUtil.generateHttpRequestFactory()); + log.info("url:" + url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + } + + /** + * 转发IRS请求 + * @param dto + * @return + */ + public String forward(ForwardDTO dto) { + try{ + String url = dto.getUrl(); + url = url + "?" + asUrlParams(dto.getData()); + log.info("url :{}",url); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + }catch (Exception e){ + log.error("e:" + e); + } + return BizConst.OP_FAIL; + } + + public static String asUrlParams(Map source){ + return Joiner.on("&") + // 用指定符号代替空值,key 或者value 为null都会被替换 + .useForNull("") + .withKeyValueSeparator("=") + .join(source); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java new file mode 100644 index 0000000..95b934d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java @@ -0,0 +1,94 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +import com.hz.pm.api.projectdeclared.model.vo.OperationVO; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @Classname OperationManage + * @Description + * @Date 2023/7/31 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class OperationManage { + + private final IOperationService operationService; + + private final IProjectService projectService; + + private final StateMachineUtils stateMachineUtils; + + /** + * 获取实施详情 + * @param projectId + * @return + */ + public OperationVO detail(Long projectId) { + Project project = projectService.getNewProject(projectId); + VUtils.isTrue(Objects.isNull(project)) + .throwMessage("项目不存在!"); + + Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) + .eq(Operation::getProjectCode, project.getProjectCode()) + .last(BizConst.LIMIT_1)); + + return BeanUtil.copyProperties(operation,OperationVO.class); + } + + public String pushOperation(OperationDTO operation) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + Project project = projectService.getNewProject(operation.getProjectId()); + VUtils.isTrue(Objects.isNull(project)) + .throwMessage("项目不存在!"); + + //首先要判断 项目当前状态 是不是 待开工状态 + VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); + + Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) + .eq(Operation::getProjectCode, project.getProjectCode()) + .last(BizConst.LIMIT_1)); + + Operation entity = BeanUtil.copyProperties(operation, Operation.class); + if(Objects.nonNull(old)){ + entity.setId(old.getId()); + }else{ + entity.setCreateOn(LocalDateTime.now()); + entity.setCreateBy(user.getUsername()); + } + 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()); + projectService.updateById(project); + } + + return entity.getProjectCode(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java new file mode 100644 index 0000000..7bec4ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -0,0 +1,351 @@ +package com.hz.pm.api.projectdeclared.manage; + +import com.alibaba.excel.EasyExcel; +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.google.common.collect.Lists; +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.dto.PretrialDeclaredExportDTO; +import com.hz.pm.api.projectdeclared.model.req.PrequalificationDeclaredListReq; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname ProqualificationDeclaredProjectManage + * @Description + * @Date 2023/2/13 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class PrequalificationDeclaredProjectManage { + + private final IProjectService projectService; + + private final ProjectLibManage projectLibManage; + + private final StateMachineUtils stateMachineUtils; + + private final IProjectStagingService projectStagingService; + + private final UserInfoHelper userInfoHelper; + + private final ProcessModelService processModelService; + + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + + private final ProcessInstanceService processInstanceService; + + private final IProjectInstService projectInstService; + + private final NoticeManage noticeManage; + + /** + * 提交预审 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String startTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getNewProject(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + + //要判断 当前操作人 是不是项目主管单位的人 + VUtils.isTrue(Objects.isNull(user.getEmpPosUnitCode())) + .throwMessage(String.format("当前登录人没有单位 【%s】",user.getRealName())); + VUtils.isTrue(!user.getEmpPosUnitCode().equals(projectInfo.getSuperOrgCode())) + .throwMessage(String.format("只有主管单位 【%s】的人 才能够提交",projectInfo.getSuperOrg())); + + //首先要判断 项目当前状态 是不是 待预审 + VUtils.isTrue((!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) && + !ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(projectInfo.getStatus())) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 待预审状态(省级部门联审成功)或者未立项阶段"); + + //使用状态机 进入下一步 看看需不需要走省级审批 放入文件 + if(StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())){ + projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); + } + stateMachineUtils.pass(projectInfo); + String instanceId = null; + //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) + if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS + .getCode().equals(projectInfo.getStatus())){ + //入库暂存表 后续处理 对接外部接口 + projectInfo.setUpdateOn(LocalDateTime.now()); + //保存一下 当前的主管单位发起人 + projectInfo.setPreStartUserId(employeeCode); + //当前实例置为空 + projectInfo.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + if(projectStagingService.addByProject(projectInfo,"省级部门联审") + && projectService.updateById(projectInfo)){ + return "提交省级部门联审成功"; + } + return "提交省级部门联审失败"; + }else if(ProjectStatusEnum.PRE_APPLYING + .getCode().equals(projectInfo.getStatus())){ + //如果是非省级联审的项目 直接提交 预审 + instanceId = directStartProcess(projectInfo,employeeCode,dto.getRestart()); + }else{ + throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); + } + + return "提交预审成功【" + instanceId + "】"; + } + + /** + * 重新提交预审 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + //重新提交 生成新版本号 回到 待预审状态 + Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),Boolean.FALSE); + dto.getProjectInfo().setId(project.getId()); + dto.setRestart(Boolean.TRUE); + return startTheProcess(dto); + } + + //直接提交预审方法 提取 在省级联审通过的时候 也可以用 + public String directStartProcess(Project projectInfo,String employeeCode,Boolean restart){ + VUtils.isTrue(Objects.isNull(employeeCode)) + .throwMessage("发起人 员工code 不能为空!"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setProcessUsers(Collections.emptyMap()); + + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params,projectInfo); + + String regionCode = projectInfo.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 预审流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode)); + } + + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); + String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); + log.info("提交预审项目成功 【{}】", instanceId); + + log.info("restart 【{}】", restart); + //保存预审项目 + if(restart){ + //如果是重新提交 不用生成新版本 前面已经生成过了 + preModifyProject(projectInfo, instanceId); + }else{ + projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, + ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); + } + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + /** + * 提交预审项目 时 更新信息 + * + * @param project + * @param instanceId + */ + private void preModifyProject(Project project, String instanceId) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + project.setUpdateOn(LocalDateTime.now()); + project.setInstCode(instanceId); + projectService.updateById(project); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); + projectInstService.save(projectInst); + } catch (Exception e) { + log.error("提交预审 项目信息修改 错误 ", e); + throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage()); + } + } + + /** + * 查询项目库 + * @param preReq + * @return + */ + public PageVo pageInfo(PrequalificationDeclaredListReq preReq) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + //限定参数 复制bean + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(preReq,req); + //项目阶段 状态 已定 待预审和省级部门联审成功 + req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), + ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + buildPermission(query,user); + query.eq(Project::getNewest,Boolean.TRUE); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if(user.getIsOrgAdmin() && + (ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) || + ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(item.getStatus())) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())){ + item.setCanPreDeclared(Boolean.TRUE); + } + return item; + }); + return PageVo.of(records, total); + } + + /** + * build 项目的角色权限到req + * @param query + */ + public UserFullInfoDTO buildPermission(LambdaQueryWrapper query,UserFullInfoDTO user){ + if(user.getIsOrgAdmin()){ + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()) + .or(q2 -> q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) + .and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) + .or(s2 -> s2.eq(Project::getStatus,ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) + .eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()))); + }else{ + query.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()); + } + return user; + } + + public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) { + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(preReq,req); + //项目阶段 状态 已定 待预审 + req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), + ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //角色权限 + buildPermission(query,user); + query.eq(Project::getNewest,Boolean.TRUE); + List records = projectService.list(query); + + List collect = records.stream().map(r -> { + PretrialDeclaredExportDTO exportDTO = new PretrialDeclaredExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + return exportDTO; + }).collect(Collectors.toList()); + for (int i = 0; i < collect.size(); i++) { + collect.get(i).setSerialNumber(i + 1); + } + String fileName = "预审申报项目列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), PretrialDeclaredExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java new file mode 100644 index 0000000..0815904 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java @@ -0,0 +1,207 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.NdDateUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.dto.ProjectAdjustmentExportDTO; +import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectdeclared.utils.ReStartProcessMapUtil; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @Classname ProjectAdjustmentManage + * @Description 项目内容调整 + * @Date 2023/2/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ProjectAdjustmentManage { + + private final IProjectService projectService; + + private final IProjectApplicationService projectApplicationService; + + private final ReStartProcessMapUtil reStartProcessMapUtil; + + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + + private final ProjectLibManage projectLibManage; + + private final UserInfoHelper userInfoHelper; + private final GenerateProjectCodeUtil generateProjectCodeUtil; + + /** + * 项目内容调整 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String adjustment(DefaultDeclaredDTO dto) { + ProjectDTO projectDto = dto.getProjectInfo(); + Project projectInfo = projectService.getById(projectDto.getId()); + + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); + + //项目名称去重 + if(StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())){ + projectDto.setProjectCode(projectInfo.getProjectCode()); + defaultDeclaredProjectManage.checkDuplication(projectDto); + } + + //金额check + if(Objects.nonNull(projectDto.getDeclareAmount())){ + defaultDeclaredProjectManage.checkAmount(projectDto); + } + + //修改项目内容 +// if(!modifyProject(projectDto)){ +// throw new BusinessException("调整项目失败!"); +// } + + //最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 + Function declaredFunction = + reStartProcessMapUtil.reStartProcessMap.get(projectInfo.getStatus()); + VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); + return declaredFunction.apply(dto); + } + + private Boolean modifyProject(ProjectDTO projectDto) { + //先修改项目信息 + Project project = new Project(); + BeanUtils.copyProperties(projectDto,project); + project.setUpdateOn(LocalDateTime.now()); + if(!projectService.updateById(project)){ + throw new BusinessException("项目调整失败"); + } + //再修改应用信息 + if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ + //采取批量删除 批量添加的方式 + projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId,project.getId())); + //批量添加 + List applications = projectDto.getApplicationList().stream().map(application -> { + ProjectApplication projectApplication = new ProjectApplication(); + BeanUtils.copyProperties(application, projectApplication); + projectApplication.setProjectId(project.getId()); + projectApplication.setProjectCode(project.getProjectCode()); + projectApplication.setProjectVersion(project.getVersion()); + return projectApplication; + }).collect(Collectors.toList()); + projectApplicationService.saveBatch(applications); + } + return Boolean.TRUE; + } + + /** + * 项目库 + * @param preReq + * @return + */ + public PageVo projectLibList(AdjustmentListReq preReq) { + //限定参数 复制bean + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(preReq,req); + //项目阶段 状态 已定 方案待申报 + req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 + req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + //放入用户的单位 + req.setBuildOrgCode(user.getEmpPosUnitCode()); + return projectLibManage.projectLibList(req); + } + + public void exportList(HttpServletResponse response, AdjustmentListReq preReq) { + //限定参数 复制bean + ProjectListReq req = new ProjectListReq(); + BeanUtils.copyProperties(preReq,req); + //项目阶段 状态 已定 方案待申报 + req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 + req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + //放入用户的单位 + req.setBuildOrgCode(user.getEmpPosUnitCode()); + + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + List records = projectService.list(query); + + AtomicInteger serialNumber = new AtomicInteger(0); + List collect = records.stream().map(r -> { + ProjectAdjustmentExportDTO exportDTO = new ProjectAdjustmentExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "项目内容调整列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java new file mode 100644 index 0000000..c74552f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -0,0 +1,236 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; +import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @Classname PurchaseManage + * @Description + * @Date 2023/5/29 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class PurchaseManage { + + private final IProjectService projectService; + private final UserInfoHelper userInfoHelper; + + private final IPurchaseService purchaseService; + + private final StateMachineUtils stateMachineUtils; + + /** + * 待采购的-项目列表 + * + * @param req + * @return + */ + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + //待采购状态 + query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), + ProjectStatusEnum.OPERATION.getCode())); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + query.orderByAsc(Project::getApprovalDate); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApprovedAmount(w.getApprovalAmount()); + item.setApprovalDate(w.getApprovalDate()); + return item; + }); + return PageVo.of(records, total); + } + + public void exportList(HttpServletResponse response, ProjectListReq param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //待采购状态 + //只能看自己单位的 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); + query.orderByAsc(Project::getApprovalDate); + List records = projectService.list(query); + Assert.notEmpty(records, "暂无数据可导出"); + List data = Lists.newArrayList(); + + AtomicInteger serialNumber = new AtomicInteger(0); + records.forEach(r -> { + DeclaredProjectExportDTO dpe = new DeclaredProjectExportDTO(); + BeanUtils.copyProperties(r, dpe); + dpe.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + dpe.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + dpe.setCreateOn(createOnStr); + dpe.setSerialNumber(serialNumber.incrementAndGet()); + dpe.setApprovedAmount(r.getApprovalAmount()); + dpe.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + data.add(dpe); + }); + + String fileName = "采购结果待备案项目列表"; + ExcelDownUtil.setFileName(fileName, response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(data); + } catch (IOException e) { + log.error("导出异常", e); + throw BizException.wrap("导出失败,请重试"); + } + } + + /** + * 获取采购结果备案详情 + * + * @param projectId + * @return + */ + public List detailByProjectId(Long projectId) { + List purchases = purchaseService.listByProjectId(projectId); + return BeanUtil.copyToList(purchases, PurchaseVO.class); + } + + /** + * 填写采购结果 + * + * @param dto + * @return + */ + public String submitResult(PurchaseSaveDTO dto) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = user.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); + + Long projectId = dto.getProjectId(); + VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); + Project project = projectService.getNewProject(dto.getProjectId()); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) + || !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) + .throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段"); + + List purchases = purchaseService.listByProjectId(projectId); + Map purchaseMap = CollUtils.listToMap(purchases, Purchase::getId); + List purchaseEntities = CollUtils.convert(dto.getTenders(), w -> { + Purchase purchase = BeanUtil.copyProperties(w, Purchase.class); + purchase.setProjectId(projectId); + if (!purchaseMap.containsKey(w.getId())) { + purchase.setCreateBy(employeeCode); + } + return purchase; + }); + + if (purchaseService.saveOrUpdateBatch(purchaseEntities)) { + // 如果 需要推送项目和应用管理的话 只有遂昌县才有 + // String areaCode = project.getAreaCode(); + // String appCode = dto.getAppCode(); + // if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){ + // try{ + // + // }catch (Exception e){ + // log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage()); + // } + // } + //进入到下一状态 + stateMachineUtils.pass(project); + project.setUpdateOn(LocalDateTime.now()); + + // 获取总的成交时间及金额 + LocalDateTime lastTransactionTime = null; + BigDecimal transactionAmountTotal = BigDecimal.ZERO; + for (Purchase purchase : purchaseEntities) { + if (lastTransactionTime == null) { + lastTransactionTime = purchase.getTransactionTime(); + } else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) { + lastTransactionTime = purchase.getTransactionTime(); + } + transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount()); + } + + project.setTransactionAmount(transactionAmountTotal); + project.setTransactionTime(lastTransactionTime); + projectService.updateById(project); + + return "填写成功"; + } + + return "保存失败"; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java new file mode 100644 index 0000000..05f6d09 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java @@ -0,0 +1,133 @@ +package com.hz.pm.api.projectdeclared.manage; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname ReviewByDeptJointManage + * @Description 部门联审 + * @Date 2023/2/17 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ReviewByDeptJointManage { + + private final IProjectService projectService; + + private final ProcessModelService processModelService; + + private final ProcessInstanceService processService; + + private final IProjectInstService projectInstService; + private final DefaultDeclaredProjectManage declaredProjectManage; + private final ProjectLibManage projectLibManage; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + + private final NoticeManage noticeManage; + + /** + * 部门联审 + * @param project + * @return + */ + @Transactional(rollbackFor = Exception.class) + public Boolean startTheProcess(Project project) { + //这里是任务发起的 所以用项目发起人 + String startUserCode = project.getSponsor(); + + VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getNewProject(project.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + String regionCode = projectInfo.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()) + .last("limit 1")); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode)); + } + //要判断 项目当前状态 是不是 部门联审 + VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); + + // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 + VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())) + .throwMessage("提交失败 项目信息 缺少项目发起人!"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + //发起人的信息 + params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); + params.setProcessUsers(Collections.emptyMap()); + + Map formData = Maps.newHashMap(); + //放入条件判断的项目字段 + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params,projectInfo); + + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); + String instanceId = processService.startProcessLs(model, params,orgModelMap); + log.info("部门联审申报成功 【{}】", instanceId); + + //保存项目信息 + projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); + + //发送给第一个审批人消息 + noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return Boolean.TRUE; + } + + private Boolean modifyProject(Project project, String instanceId) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + project.setUpdateOn(LocalDateTime.now()); + project.setInstCode(instanceId); + projectService.updateById(project); + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); + projectInstService.save(projectInst); + } catch (Exception e) { + log.error("部门联审 修改项目信息 错误 ", e); + throw new BusinessException("部门联审 修改项目信息 错误 :" + e.getMessage()); + } + return Boolean.TRUE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java new file mode 100644 index 0000000..a83f664 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -0,0 +1,121 @@ +package com.hz.pm.api.projectdeclared.manage; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @Classname ReviewByProvincialDeptManage + * @Description 省级部门联审 + * @Date 2023/2/17 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ReviewByProvincialDeptManage { + + private final IProjectService projectService; + + private final FileService fileService; + + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + private final IProjectApplicationService applicationService; + + private final ProjectLibManage projectLibManage; + + @Value("${spring.profiles.active}") + private String active; + + /** + * 省级部门联审 + * @param project + * @return + */ + @Transactional(rollbackFor = Exception.class) + public Boolean startTheProcess(Project project) { + VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(project.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + String regionCode = projectInfo.getAreaCode(); + + //首先要判断 项目当前状态 是不是 省级部门联审 + VUtils.isTrue(!ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); + + // 对接省级联审的接口 + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, projectInfo.getId())); + if(joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(projectInfo,applications,fileService,active))){ + return Boolean.TRUE; + } + + return Boolean.FALSE; + } + + /** + * 省级部门联审 重新提交 + * @param declaringDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO declaringDTO) { + ProjectDTO project = declaringDTO.getProjectInfo(); + VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getNewProject(project.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + String regionCode = projectInfo.getAreaCode(); + + //首先要判断 项目当前状态 是不是 省级部门联审不通过 + VUtils.isTrue(!ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 省级部门联审不通过状态或者未立项阶段"); + + // 对接省级联审的接口 + Project p = projectLibManage.saveProjectWithVersionAndStatus(project,null, + ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(),Boolean.FALSE); + + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, p.getId())); + + //入库暂存表 后续处理 对接外部接口 + p.setUpdateOn(LocalDateTime.now()); + //保存一下 当前的主管单位发起人 + p.setPreStartUserId(p.getSponsor()); + //当前实例置为空 + p.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + declaringDTO.getProjectInfo().setId(p.getId()); + projectService.updateById(p); + if(!joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(p,applications,fileService,active))){ + throw new BusinessException("提交省级部门联审失败"); + } + + return String.valueOf(p.getId()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java new file mode 100644 index 0000000..2c79cc2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -0,0 +1,447 @@ +package com.hz.pm.api.projectdeclared.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +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.google.common.collect.Lists; +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.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.utils.DataScopeUtil; +import com.hz.pm.api.projectdeclared.contants.DeclaredProjectContant; +import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; +import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; +import com.hz.pm.api.projectdeclared.service.IReviewChecklistApproveService; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectReviewCheckListItemVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.bean.dto.FormsReviewChecklistDto; +import com.wflow.bean.dto.ReviewChecklistModuleDto; +import com.wflow.enums.ReviewChecklistResultEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname ReviewChecklistManage + * @Description + * @Date 2023/11/7 17:04 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ReviewChecklistManage { + + @Value("${spring.profiles.active}") + private String active; + + private final IProjectService projectService; + + private final RegionCacheHelper regionCacheHelper; + + private final IReviewChecklistApproveService reviewChecklistApproveService; + + private final UserInfoHelper userInfoHelper; + + public PageVo projectLibList(ProjectListReq req) { + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //项目查最新 + query.eq(Project::getNewest, Boolean.TRUE); + //建设方案提交后的状态 + query.ge(Project::getStatus,ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()) + .ne(Project::getStatus,ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()) + .eq(Project::getAreaCode,RegionConst.RC_LS); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + buildReviewCheckPermission(query, user); + + Page page = projectService.page(req.page(), query); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + List projectCodes = page.getRecords().stream().map(Project::getProjectCode) + .collect(Collectors.toList()); + //求出 审查了的 信息 + List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) + .in(ReviewChecklistApprove::getProjectCode, projectCodes)); + Map> approveMap = + approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode)); + + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + List users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans); + Set userSet = Sets.newHashSet(); + Map userMap = users.stream().filter(u -> userSet.add(u.getEmployeeCode())) + .collect(Collectors.toMap(u -> u.getEmployeeCode() + , u -> u.getUsername())); + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + // 审查人员情况 + item.setVerifiedHumans(computeVerify(item,approveMap.get(w.getProjectCode()),userMap,user)); + item.setReviewCheckFinish(w.getReviewCheckFinish()); + return item; + }); + return PageVo.of(records, page.getTotal()); + } + + private String computeVerify(ProjectReviewCheckListItemVO item,List reviewChecklistApproves, + Map userMap,UserInfoDetails user) { + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + + Integer maxNums = reviewHumans.size(); + Integer finishNums = 0; + Set computeHumanSet = reviewHumans.stream().collect(Collectors.toSet()); + + if(CollUtil.isEmpty(reviewChecklistApproves)){ + item.setReviewCheckNotApprove(convertUser(userMap,computeHumanSet)); + return finishNums + StrPool.SLASH + maxNums; + } + for(ReviewChecklistApprove approve : reviewChecklistApproves){ + if(StringUtils.isNotBlank(approve.getCreateByCode()) || + computeHumanSet.contains(approve.getCreateByCode())){ + if(StringUtils.isNotBlank(user.getEmployeeCode()) && + user.getEmployeeCode().equals(approve.getCreateByCode())){ + item.setApproved(Boolean.TRUE); + } + if(computeHumanSet.remove(approve.getCreateByCode())){ + //说明 有指定人 审核过 + finishNums++; + } + } + } + item.setReviewCheckNotApprove(convertUser(userMap,computeHumanSet)); + + return finishNums + StrPool.SLASH + maxNums; + } + + private String convertUser(Map userMap, Set computeHumanSet) { + if(CollUtil.isEmpty(userMap) || CollUtil.isEmpty(computeHumanSet)){ + return StringUtils.EMPTY; + } + return computeHumanSet.stream().filter(s -> StringUtils.isNotBlank(s) && userMap.containsKey(s)) + .map(s -> userMap.get(s)).collect(Collectors.joining(StrPool.COMMA)); + } + + public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper query, UserInfoDetails user) { + UserFullInfoDTO userDto = BeanUtil.copyProperties(user,UserFullInfoDTO.class); + //1.只有 市本级能看到 + String regionCode = user.getRegionCode(); + String employeeCode = user.getEmployeeCode(); + //如果是七大审查之一 就可以看 + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + if(reviewHumans.contains(employeeCode)){ + log.warn("为七大审查人之一 可以查看"); + return userDto; + } + + if(!regionCode.equals(RegionConst.RC_LS) || StringUtils.isBlank(employeeCode)){ + log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}",user.getUsername(), + user.getRegionCode(),user.getEmployeeCode()); + query.eq(Project::getId, 0L); + return userDto; + } + + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + query.eq(Project::getId, 0L); + return userDto; + } + + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 看不了 + query.eq(Project::getId, 0L); + break; + case COMPANY_MANAGER: + case VISITOR: + case DASHBOARD: + //单位管理员 看 + query.eq(Project::getId, 0L); + break; + case SUPER_ADMIN: + //超级管理员 可以看 + break; + case REGION_MANAGER: + //区域管理员 可以看 + break; + default: + //没有权限的话 就让它查不到 + query.eq(Project::getId, 0L); + break; + } + return userDto; + } + + /** + * 去审批 + * @param dtos + * @return + */ + public String approve(List dtos) { + if(CollUtil.isEmpty(dtos)){ + throw new BizException("传入数据不能为空!"); + } + ReviewChecklistApproveDTO reviewChecklistApproveFirst = dtos.get(0); + String projectCode = reviewChecklistApproveFirst.getProjectCode(); + + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long userId = user.getUserId(); + String employeeCode = user.getEmployeeCode(); + String username = user.getUsername(); + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + + if(StringUtils.isBlank(employeeCode) || !reviewHumans.contains(employeeCode)){ + throw new BizException("当前操作员 不是七大审查人之一!"); + } + + VUtils.isTrue(reviewChecklistApproveService.count(Wrappers.lambdaQuery(ReviewChecklistApprove.class) + .eq(ReviewChecklistApprove::getProjectCode,projectCode) + .eq(ReviewChecklistApprove::getCreateByCode,employeeCode)) > 0) + .throwMessage("此项目 当前审查员 已经审批过 请不要重复审批"); + + for(ReviewChecklistApproveDTO dto : dtos){ + ReviewChecklistApprove saveEntity = new ReviewChecklistApprove(); + saveEntity.setCreateBy(username); + saveEntity.setCreateById(userId); + saveEntity.setCreateByCode(employeeCode); + saveEntity.setTitle(dto.getTitle()); + saveEntity.setContent(dto.getContent()); + saveEntity.setSubTitle(dto.getSubTitle()); + saveEntity.setCorrPageNum(dto.getCorrPageNum()); + saveEntity.setRejectionSituation(dto.getRejectionSituation()); + saveEntity.setResponseSituation(dto.getResponseSituation()); + saveEntity.setReviewComments(dto.getReviewComments()); + saveEntity.setReviewResult(dto.getReviewResult()); + saveEntity.setProjectCode(dto.getProjectCode()); + reviewChecklistApproveService.save(saveEntity); + } + + return BizConst.OP_SUCCESS; + } + + /** + * 查看待意见汇总 列表 + * @param projectCode + * @return + */ + public List summaryList(String projectCode) { + List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) + .eq(ReviewChecklistApprove::getProjectCode, projectCode) + .orderByAsc(ReviewChecklistApprove::getCreateOn)); + if(CollUtil.isEmpty(approves)){ + return Collections.emptyList(); + } + + //做成map + Map> groupTitleMap = approves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); + //去重标题 + Set titleSet = Sets.newHashSet(); + List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())) + .collect(Collectors.toList()); + + List res = dupTitle.stream() + .map(r -> { + FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); + vo.setTitle(r.getTitle()); + if(groupTitleMap.containsKey(r.getTitle())){ + List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); + vo.setModules(convertModules(reviewChecklistApproves)); + } + return vo; + }) + .collect(Collectors.toList()); + + return res; + } + + public String summary(String projectCode) { + //修改到 项目里去 + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); + VUtils.isTrue(Objects.nonNull(project.getReviewCheckFinish()) && project.getReviewCheckFinish()) + .throwMessage("项目的审查清单已经合并过了!"); + + List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) + .eq(ReviewChecklistApprove::getProjectCode, projectCode) + .orderByAsc(ReviewChecklistApprove::getCreateOn)); + if(CollUtil.isEmpty(approves)){ + throw new BizException("该项目 未被七大审查人 审批!"); + } + + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + Set computeHumanSet = reviewHumans.stream().collect(Collectors.toSet()); + for(ReviewChecklistApprove approve : approves){ + if(computeHumanSet.contains(approve.getCreateByCode())){ + computeHumanSet.remove(approve.getCreateByCode()); + } + } + if(CollUtil.isNotEmpty(computeHumanSet)){ + throw new BizException("此项目的审查清单 未被七大审核人 审批完!"); + } + + //做成map 并且还要 未通过的 + Map> groupTitleMap = approves.stream() + .filter(r -> Objects.nonNull(r.getReviewResult()) && Lists.newArrayList( + ReviewChecklistResultEnum.NOT_PASS.getCode(),ReviewChecklistResultEnum.ONE_VOTE_VETO.getCode()) + .contains(r.getReviewResult())) + .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); + //去重子标题 + Set titleSet = Sets.newHashSet(); + List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())).collect(Collectors.toList()); + + List res = dupTitle.stream() + .map(r -> { + FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); + vo.setTitle(r.getTitle()); + if(groupTitleMap.containsKey(r.getTitle())){ + List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); + vo.setModules(convertModulesFinal(reviewChecklistApproves)); + } + return vo; + }) + .collect(Collectors.toList()); + //修改 并且 已经合并 + project.setReviewChecklist(JSON.toJSONString(res)); + project.setReviewCheckFinish(Boolean.TRUE); + projectService.updateById(project); + + return BizConst.OP_SUCCESS; + } + + private List convertModules(List reviewChecklistApproves) { + //做成map + Map> groupSubTitleMap = reviewChecklistApproves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); + //去重子标题 + Set subSubTitleSet = Sets.newHashSet(); + List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) + .collect(Collectors.toList()); + return dupSubTitle.stream() + .map(r -> { + ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); + vo.setSubTitle(r.getSubTitle()); + vo.setContent(r.getContent()); + vo.setReviewComments(r.getReviewComments()); + vo.setRejectionSituation(r.getRejectionSituation()); + vo.setResponseSituation(r.getResponseSituation()); + vo.setCorrPageNum(r.getCorrPageNum()); + if(groupSubTitleMap.containsKey(r.getSubTitle())){ + List approves = groupSubTitleMap.get(r.getSubTitle()); + StringBuffer reviewCommentsSb = new StringBuffer(); + + for(ReviewChecklistApprove approve : approves){ + ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); + reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + (Objects.nonNull(match)?match.getDesc():StringUtils.EMPTY) + + (StringUtils.isNotBlank(approve.getReviewComments())?StrPool.COMMA+approve.getReviewComments():StringUtils.EMPTY) + "\n"); + } + vo.setReviewComments(reviewCommentsSb.toString()); + } + return vo; + }) + .collect(Collectors.toList()); + } + + private List convertModulesFinal(List reviewChecklistApproves) { + //做成map + Map> groupSubTitleMap = reviewChecklistApproves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); + //去重子标题 + Set subSubTitleSet = Sets.newHashSet(); + List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) + .collect(Collectors.toList()); + return dupSubTitle.stream() + .map(r -> { + ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); + vo.setSubTitle(r.getSubTitle()); + vo.setContent(r.getContent()); + vo.setReviewComments(r.getReviewComments()); + vo.setRejectionSituation(r.getRejectionSituation()); + vo.setResponseSituation(r.getResponseSituation()); + vo.setCorrPageNum(r.getCorrPageNum()); + if(groupSubTitleMap.containsKey(r.getSubTitle())){ + List approves = groupSubTitleMap.get(r.getSubTitle()); + StringBuffer reviewCommentsSb = new StringBuffer(); + if(CollUtil.isEmpty(approves)){ + vo.setReviewComments("通过"); + }else{ + Integer index = 1; + for(ReviewChecklistApprove approve : approves){ + ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); + reviewCommentsSb.append(index + StrPool.DOT + (Objects.nonNull(match)?match.getDesc():StringUtils.EMPTY) + + (StringUtils.isNotBlank(approve.getReviewComments())?StrPool.COMMA+approve.getReviewComments():StringUtils.EMPTY) + "\n"); + index++; + } + vo.setReviewComments(reviewCommentsSb.toString()); + } + } + return vo; + }) + .collect(Collectors.toList()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ConstructionSuggestionsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ConstructionSuggestionsMapper.java new file mode 100644 index 0000000..346cc25 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ConstructionSuggestionsMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface ConstructionSuggestionsMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.java new file mode 100644 index 0000000..d1f3e80 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.Contract; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface ContractMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.xml new file mode 100644 index 0000000..fff3661 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ContractMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java new file mode 100644 index 0000000..a40b20a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; +import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface DeclaredStatisticsMapper extends BaseMapper { + + DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); + + DeclaredProjectStatisticsPO getRegionStatistics(@Param("regionCode") String regionCode,@Param("year") Integer year); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml new file mode 100644 index 0000000..186b0c1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.java new file mode 100644 index 0000000..8c78511 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.IrsApplication; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface IrsApplicationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.xml new file mode 100644 index 0000000..140a2bc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/IrsApplicationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.java new file mode 100644 index 0000000..520b5ab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.IrsApplication; +import com.hz.pm.api.projectdeclared.model.entity.NdPiotTasks; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface NdPiotTasksMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.xml new file mode 100644 index 0000000..9ec4b01 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/NdPiotTasksMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.java new file mode 100644 index 0000000..5b63d00 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.Operation; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface OperationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.xml new file mode 100644 index 0000000..a5ef91f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/OperationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.java new file mode 100644 index 0000000..3806637 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface PaymentPlanMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.xml new file mode 100644 index 0000000..269bedc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PaymentPlanMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.java new file mode 100644 index 0000000..3a2ae27 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface PreInsAcceptancePersonMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml new file mode 100644 index 0000000..b7f7206 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.java new file mode 100644 index 0000000..902b3d1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface ProjectDraftMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.xml new file mode 100644 index 0000000..d980b94 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/ProjectDraftMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.java new file mode 100644 index 0000000..eaa2c6f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface PurchaseMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.xml new file mode 100644 index 0000000..0efeca3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ConstructionPlanExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ConstructionPlanExportDTO.java new file mode 100644 index 0000000..5b358e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ConstructionPlanExportDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 建设方案申报列表导出实体类 + * + * @author CMM + * @since 2023/03/10 10:20 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ConstructionPlanExportDTO { + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("申报金额(万元)") + private BigDecimal declareAmount; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("创建时间") + private String createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java new file mode 100644 index 0000000..e10db74 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname Contract + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "合同对象", description = "") +public class ContractSaveDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("合同名称") + private String name; + + @ApiModelProperty("合同总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("供应商开户行") + private String supplierBank; + + @ApiModelProperty("供应商开户行帐号") + private String supplierAccount; + + @ApiModelProperty("质保期 年") + private Integer warrantyPeriod; + + @ApiModelProperty("质保金") + private BigDecimal retentionMoney; + + @ApiModelProperty("合同完成时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime contractTime; + + @ApiModelProperty("交货日期") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime deliveryTime; + + @ApiModelProperty("附件") + private String attachment; + + @ApiModelProperty("支付计划") + private List payments; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContructionSuggestionsDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContructionSuggestionsDTO.java new file mode 100644 index 0000000..acbb8ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContructionSuggestionsDTO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * @Classname ContructionSuggestionsDTO + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "专家建设建议", description = "") +public class ContructionSuggestionsDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("实例ID") + @NotNull(message = "实例ID不能为空") + private String instanceId; + + @ApiModelProperty("项目编号") + @NotNull(message = "项目编号不能为空") + private String projectCode; + + @ApiModelProperty("建议项目总投资") + @NotNull(message = "建议项目总投资不能为空") + private BigDecimal proposeTotalInvest; + + @ApiModelProperty("建议年度预算") + @NotNull(message = "建议年度预算不能为空") + private BigDecimal proposeAnnualBudget; + + @ApiModelProperty("建议评审意见附件") + @NotBlank(message = "建议评审意见附件不能为空") + private String proposeAttachFiles; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java new file mode 100644 index 0000000..d289b0b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java @@ -0,0 +1,69 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + + +/** + * 申报项目列表导出实体类 + * + * @author CMM + * @since 2023/03/10 10:20 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeclaredProjectExportDTO { + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("申报金额(万元)") + private BigDecimal declareAmount; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("创建时间") + private String createOn; + + @ExcelProperty("项目状态") + private String statusName; + + @ExcelProperty("批复金额") + private BigDecimal approvedAmount; + + @ExcelProperty("立项批复时间") + private String approvalDate; + + @ExcelProperty("成交金额") + private BigDecimal transactionAmount; + + @ExcelProperty("成交时间") + private String transactionTime; + + @ExcelProperty("成交时间") + private String deliveryTime; + + @ExcelProperty("合同金额") + private BigDecimal contractAmount; + + @ExcelProperty("年度预算") + private BigDecimal annualPlanAmount; + + @ExcelProperty("计划验收时间") + private String planAcceptanceTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectListParamDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectListParamDTO.java new file mode 100644 index 0000000..1a683a1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectListParamDTO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * @Classname DeclaredProjectParamDto + * @Description + * @Date 2023/2/1 14:52 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeclaredProjectListParamDTO extends PagePo { + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目类型 1建设 2运维") + private Integer projectType; + + @ApiModelProperty("项目阶段") + private Integer projectStage; + + @ApiModelProperty("项目状态") + private Integer projectStatus; + + @ApiModelProperty("项目年份") + private Integer projectYear; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("开始时间") + private String startTime; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("结束时间") + private String endTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java new file mode 100644 index 0000000..0aa5926 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Maps; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Map; + +/** + * @Classname DefaultDeclaredDTO + * @Description + * @Date 2023/2/14 17:16 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DefaultDeclaredDTO implements Serializable { + + @NotNull + @ApiModelProperty("项目信息") + private ProjectDTO projectInfo; + + @ApiModelProperty("表单信息 新增模块") + private Map formData; + + @ApiModelProperty("是否是重新提交 默认false") + private Boolean restart = Boolean.FALSE; + + public Map getFormData(){ + if(CollUtil.isEmpty(this.formData)){ + this.formData = Maps.newHashMap(); + return this.formData; + } + return this.formData; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DelayedApplyDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DelayedApplyDTO.java new file mode 100644 index 0000000..e97c5d7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DelayedApplyDTO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.validation.constraints.NotNull; + +/** + * @Classname DelayedApplyDTO + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "DelayedApplyDTO", description = "延期申请") +public class DelayedApplyDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("延期时长 月") + @NotNull(message = "请填写时长") + private Integer delayedMonth; + + @ApiModelProperty("延期理由") + private String delayedReason; + + @ApiModelProperty("佐证材料") + private String supportingMaterials; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java new file mode 100644 index 0000000..a6798f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @Classname OperationDTO + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@ApiModel(value = "实施对象DTO", description = "实施对象DTO") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OperationDTO { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("项目Code") + private String projectCode; + + @ApiModelProperty("项目开工时间") + @NotNull(message = "项目开工时间不能为空") + private LocalDateTime projectStartDate; + + @ApiModelProperty("初验时间") + @NotNull(message = "初验时间不能为空") + private LocalDateTime initialInspectionDate; + + @ApiModelProperty("终验时间") + @NotNull(message = "终验时间不能为空") + private LocalDateTime finalInspectionDate; + + @ApiModelProperty("开始实施时间") + @NotNull(message = "开始实施时间不能为空") + private LocalDateTime startTrialOperationDate; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSaveDTO.java new file mode 100644 index 0000000..b7bec96 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSaveDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PaymentPlan + * @Description + * @Date 2023/5/30 16:11 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PaymentPlan", description = "") +public class PaymentPlanSaveDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("付款计划") + private String planAmount; + + @ApiModelProperty("支付金额") + private BigDecimal paymentAmount; + + @ApiModelProperty("实际支付金额") + private BigDecimal actualPaymentAmount; + + @ApiModelProperty("支付时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime paymentTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java new file mode 100644 index 0000000..0f15309 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PaymentPlan + * @Description + * @Date 2023/5/30 16:11 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PaymentPlanSupplementDTO", description = "") +public class PaymentPlanSupplementDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "id必传") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("实际支付金额") + private BigDecimal actualPaymentAmount; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java new file mode 100644 index 0000000..0dcab7b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @Classname PreInsAcceptancePerson + * @Description 初验人员 + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PreInsAcceptancePersonSaveDTO", description = "") +public class PreInsAcceptancePersonSaveDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("人员名称") + private String personName; + + @ApiModelProperty("单位") + private String unit; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java new file mode 100644 index 0000000..6edacbc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PreInsSaveDTO + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PreInsSaveDTO", description = "") +public class PreInsSaveDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("初验材料") + @NotBlank(message = "请提交初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("初验验收人员") + private List acceptancePersons; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PretrialDeclaredExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PretrialDeclaredExportDTO.java new file mode 100644 index 0000000..bba6753 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PretrialDeclaredExportDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 预审申报列表导出实体类 + * + * @author CMM + * @since 2023/03/10 10:20 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PretrialDeclaredExportDTO { + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("申报金额(万元)") + private BigDecimal declareAmount; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("创建时间") + private String createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java new file mode 100644 index 0000000..39c3e6a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 项目内容调整列表导出实体类 + * + * @author CMM + * @since 2023/03/10 10:20 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectAdjustmentExportDTO { + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("申报金额(万元)") + private BigDecimal declareAmount; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("项目状态") + private String statusName; + + @ExcelProperty("创建时间") + private String createOn; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectConditionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectConditionDTO.java new file mode 100644 index 0000000..9114eb9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectConditionDTO.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Classname DeclaredProjectDto + * @Description 申报项目 里的条件判断实体 + * @Date 2023/2/1 14:52 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectConditionDTO implements Serializable { + + private Long projectId; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") + private Integer bizDomain; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java new file mode 100644 index 0000000..d9217ec --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 项目草稿箱 + *

+ * + * @author zpf + * @since 2023-02-06 + */ +@ApiModel(value = "NdProjectDraftDto", description = "") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class ProjectDraftSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @ApiModelProperty("项目信息") + private ProjectDTO projectInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java new file mode 100644 index 0000000..5e46f84 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; + +/** + * 项目续建申报列表导出实体 + * + * @author CMM + * @since 2023/02/21 15:03 + */ +@Data +public class ProjectRenewalDeclareExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("年度支付金额(万元)") + private BigDecimal annualPaymentAmount; + + @ExcelProperty("状态") + private String approvalStatusName; + + @ExcelProperty("创建时间") + private String createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseSaveDTO.java new file mode 100644 index 0000000..9e099f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseSaveDTO.java @@ -0,0 +1,85 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname Purchase + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "采购对象", description = "采购对象") +@AllArgsConstructor +public class PurchaseSaveDTO { + + @ApiModelProperty("项目ID") + @NotNull(message = "请传项目ID") + private Long projectId; + + @NotEmpty(message = "标段信息不能为空") + private List tenders; + + @Data + public static class TenderDTO { + + @ApiModelProperty("标段ID") + private Long id; + + @ApiModelProperty("标段名称") + private String bidName; + + @ApiModelProperty("供应商") + private String supplier; + + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + + @ApiModelProperty("供应商社会信用代码") + private String supplierSocialCreditCode; + + @ApiModelProperty("采购方式") + private String purchaseMethod; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime transactionTime; + + @ApiModelProperty("代理机构") + private String agency; + + @ApiModelProperty("代理机构社会统一信用代码") + private String purchaseSocialCreditCode; + + @ApiModelProperty("投标文件") + private String biddingDoc; + + @ApiModelProperty("招标文件") + private String bidDoc; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("应用编码") + private String appCode; + + @ApiModelProperty("预算执行确认书编号") + private String budgetExecConfirmNo; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ReviewChecklistApproveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ReviewChecklistApproveDTO.java new file mode 100644 index 0000000..63fb0ad --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ReviewChecklistApproveDTO.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.projectdeclared.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @Classname ReviewChecklistApproveDTO + * @Description + * @Date 2023/11/07 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ReviewChecklistApproveDTO", description = "") +public class ReviewChecklistApproveDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目编号") + @NotBlank(message = "请传项目编号") + private String projectCode; + + @ApiModelProperty("标题") + @NotBlank(message = "请传入标题") + private String title; + + @ApiModelProperty("子标题") + @NotBlank(message = "请传入子标题") + private String subTitle; + + @ApiModelProperty("内容") + @NotBlank(message = "请传入内容") + private String content; + + @ApiModelProperty("对应页码") + @NotBlank(message = "请传入对应页码") + private String corrPageNum; + + @ApiModelProperty("否决情形") + @NotBlank(message = "请传入否决情形") + private String rejectionSituation; + + @ApiModelProperty("响应情况") + @NotBlank(message = "请传入响应情况") + private String responseSituation; + + @ApiModelProperty("评审意见") + @NotBlank(message = "请传入评审意见") + private String reviewComments; + + @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") + @NotNull(message = "请传入审核结果") + private Integer reviewResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java new file mode 100644 index 0000000..1939cf8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.projectdeclared.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.joda.time.LocalDate; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname Contract + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@TableName("nd_contract") +@ApiModel(value = "合同对象", description = "") +public class Contract { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人人") + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("合同名称") + private String name; + + @ApiModelProperty("合同总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("供应商开户行") + private String supplierBank; + + @ApiModelProperty("供应商开户行帐号") + private String supplierAccount; + + @ApiModelProperty("质保期 年") + private Integer warrantyPeriod; + + @ApiModelProperty("质保金") + private BigDecimal retentionMoney; + + @ApiModelProperty("合同完成时间") + private LocalDateTime contractTime; + + @ApiModelProperty("交货日期") + private LocalDateTime deliveryTime; + + @ApiModelProperty("附件") + private String attachment; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/IrsApplication.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/IrsApplication.java new file mode 100644 index 0000000..abfa93a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/IrsApplication.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.projectdeclared.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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * irs项目 + *

+ * + * @author zpf + * @since 2023-03-06 + */ +@TableName("irs_application") +@ApiModel(value = "irs_application对象", description = "irs项目对象") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class IrsApplication implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("应用编码") + private String applicationCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/NdPiotTasks.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/NdPiotTasks.java new file mode 100644 index 0000000..8ff46a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/NdPiotTasks.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.projectdeclared.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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * irs任务对象 + *

+ * + * @author zpf + * @since 2023-03-06 + */ +@TableName("nd_piot_tasks") +@ApiModel(value = "irs_piot_tasks对象", description = "irs任务对象") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class NdPiotTasks implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("试点任务名称") + private String taskName; + + @ApiModelProperty("试点任务编号") + private String taskCode; + + @ApiModelProperty("所属重大应用名称") + private String importantTaskName; + + @ApiModelProperty("所属重大应用编号") + private String importantTaskCode; + + @ApiModelProperty("所属子场景应用名称") + private String subSceneApplicationName; + + private LocalDateTime createOn; + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java new file mode 100644 index 0000000..6be2c42 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.projectdeclared.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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.time.LocalDateTime; + +/** + * @Classname Operation + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@TableName("nd_project_operation") +@ApiModel(value = "实施对象", description = "实施对象") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Operation { + + @TableId(type = IdType.AUTO) + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目Code") + private String projectCode; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人 工号") + private String createBy; + + @ApiModelProperty("修改人 工号") + private String updateBy; + + @ApiModelProperty("项目开工时间") + private LocalDateTime projectStartDate; + + @ApiModelProperty("初验时间") + private LocalDateTime initialInspectionDate; + + @ApiModelProperty("终验时间") + private LocalDateTime finalInspectionDate; + + @ApiModelProperty("开始实施时间") + private LocalDateTime startTrialOperationDate; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java new file mode 100644 index 0000000..e4e7e1f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.projectdeclared.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * @Classname PaymentPlan + * @Description + * @Date 2023/5/30 16:11 + * @Author PoffyZhang + */ +@Data +@TableName("nd_payment_plan") +@ApiModel(value = "PaymentPlan", description = "") +public class PaymentPlan { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人人") + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("付款计划") + private String planAmount; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("计划支付金额") + private BigDecimal paymentAmount; + + @ApiModelProperty("实际支付金额") + private BigDecimal actualPaymentAmount; + + @ApiModelProperty("支付时间") + private LocalDateTime paymentTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java new file mode 100644 index 0000000..c541ace --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.projectdeclared.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PreInsAcceptancePerson + * @Description 初验人员 + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@TableName("nd_pre_ins_acceptance_person") +@ApiModel(value = "PreInsAcceptancePerson", description = "") +public class PreInsAcceptancePerson { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人人") + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("人员名称") + private String personName; + + @ApiModelProperty("单位") + private String unit; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java new file mode 100644 index 0000000..b4aeea5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.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.math.BigDecimal; + +/** + * @Classname ProjectContructionSuggestions + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@TableName("nd_project_constrctiuon_suggestions") +@ApiModel(value = "专家建设建议", description = "") +public class ProjectConstructionSuggestions { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("实例ID") + private String instanceId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("建议项目总投资") + private BigDecimal proposeTotalInvest; + + @ApiModelProperty("建议年度预算") + private BigDecimal proposeAnnualBudget; + + @ApiModelProperty("建议评审意见附件") + private String proposeAttachFiles; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectDraft.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectDraft.java new file mode 100644 index 0000000..20b6ccb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectDraft.java @@ -0,0 +1,370 @@ +package com.hz.pm.api.projectdeclared.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.hz.pm.api.common.compare.Compare; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目草稿箱 + *

+ * + * @author zpf + * @since 2023-02-06 + */ +@TableName("nd_project_draft") +@ApiModel(value = "NdProjectDraft对象", description = "") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectDraft implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域") + private Integer bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + private Integer isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("流程实例编号") + private String instCode; + + @ApiModelProperty("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("项目应用") + private String projectApplicationList; + + @ApiModelProperty("新增form内容") + private String dynamicForm; + + @ApiModelProperty("用户id") + private String userId; + + @ApiModelProperty("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + private Long createBy; + private Long updateBy; + + @ApiModelProperty("是否开启评审清单") + private Boolean isReviewChecklist; + + @ApiModelProperty("评审清单") + private String reviewChecklist; + + @ApiModelProperty("是否推送省里") + private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java new file mode 100644 index 0000000..877eba7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.projectdeclared.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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * @Classname Purchase + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@TableName("nd_purchase") +@ApiModel(value = "采购对象", description = "采购对象") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Purchase { + + @TableId(type = IdType.AUTO) + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("标段名称") + private String bidName; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人 工号") + private String createBy; + + @ApiModelProperty("修改人 工号") + private String updateBy; + + @ApiModelProperty("供应商") + private String supplier; + + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + + @ApiModelProperty("供应商社会信用代码") + private String supplierSocialCreditCode; + + @ApiModelProperty("采购方式 1公开招标 2自行采购") + private String purchaseMethod; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + private LocalDateTime transactionTime; + + @ApiModelProperty("代理机构") + private String agency; + + @ApiModelProperty("代理机构社会统一信用代码") + private String purchaseSocialCreditCode; + + @ApiModelProperty("投标文件") + private String biddingDoc; + + @ApiModelProperty("招标文件") + private String bidDoc; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("预算执行确认书编号") + private String budgetExecConfirmNo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ReviewChecklistApprove.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ReviewChecklistApprove.java new file mode 100644 index 0000000..fff80d8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ReviewChecklistApprove.java @@ -0,0 +1,67 @@ +package com.hz.pm.api.projectdeclared.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.time.LocalDateTime; + +/** + * @Classname ReviewChecklistApprove + * @Description + * @Date 2023/11/07 15:35 + * @Author PoffyZhang + */ +@Data +@TableName("nd_project_review_checklist_approve") +@ApiModel(value = "审查清单审核信息", description = "") +public class ReviewChecklistApprove { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("审批人") + private String createBy; + + @ApiModelProperty("审批时间") + private LocalDateTime createOn; + + @ApiModelProperty("审批人ID") + private Long createById; + + @ApiModelProperty("审批人code") + private String createByCode; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("子标题") + private String subTitle; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("对应页码") + private String corrPageNum; + + @ApiModelProperty("否决情形") + private String rejectionSituation; + + @ApiModelProperty("响应情况") + private String responseSituation; + + @ApiModelProperty("评审意见") + private String reviewComments; + + @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") + private Integer reviewResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/po/DeclaredProjectStatisticsPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/po/DeclaredProjectStatisticsPO.java new file mode 100644 index 0000000..e0e9ce9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/po/DeclaredProjectStatisticsPO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.projectdeclared.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @Classname DeclaredProjectStatistics + * @Description + * @Date 2023/3/20 16:29 + * @Author PoffyZhang + */ +@Data +public class DeclaredProjectStatisticsPO { + + @ApiModelProperty("总项目数") + private Integer totalNum; + @ApiModelProperty("建设项目数") + private Integer buildNum; + @ApiModelProperty("运维项目数") + private Integer operationNum; + + @ApiModelProperty("待立项数") + private Integer notApprovedNum; + @ApiModelProperty("已立项数") + private Integer approvedNum; + @ApiModelProperty("建设中数") + private Integer constructionNum; + @ApiModelProperty("待验收数") + private Integer tobeInspectedNum; + @ApiModelProperty("已归档数") + private Integer archivedNum; + + @ApiModelProperty("申报总金额") + private BigDecimal declaredAmount; + @ApiModelProperty("立项总金额") + private BigDecimal approvalAmount; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/AdjustmentListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/AdjustmentListReq.java new file mode 100644 index 0000000..e67ca5e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/AdjustmentListReq.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * @Classname AdjustmentListReq + * @Description + * @Date 2023/2/14 11:42 + * @Author PoffyZhang + */ +@Data +public class AdjustmentListReq extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMin; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMax; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/ConstrctionPlanListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/ConstrctionPlanListReq.java new file mode 100644 index 0000000..f143dce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/ConstrctionPlanListReq.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * @Classname PrequalificationDeclaredReq + * @Description + * @Date 2023/2/14 11:42 + * @Author PoffyZhang + */ +@Data +public class ConstrctionPlanListReq extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMin; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMax; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/PrequalificationDeclaredListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/PrequalificationDeclaredListReq.java new file mode 100644 index 0000000..12a6acb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/PrequalificationDeclaredListReq.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * @Classname PrequalificationDeclaredReq + * @Description + * @Date 2023/2/14 11:42 + * @Author PoffyZhang + */ +@Data +public class PrequalificationDeclaredListReq extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMin; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMax; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ContractVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ContractVO.java new file mode 100644 index 0000000..36e7a37 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ContractVO.java @@ -0,0 +1,80 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname Contract + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ContractVO", description = "") +public class ContractVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建人") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("修改人人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("合同名称") + private String name; + + @ApiModelProperty("合同总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("供应商开户行") + private String supplierBank; + + @ApiModelProperty("供应商开户行帐号") + private String supplierAccount; + + @ApiModelProperty("质保期 年") + private Integer warrantyPeriod; + + @ApiModelProperty("质保金") + private BigDecimal retentionMoney; + + @ApiModelProperty("合同完成时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime contractTime; + + @ApiModelProperty("交货日期") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime deliveryTime; + + @ApiModelProperty("附件") + private String attachment; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("支付计划") + private List payments; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/DelayedApplyVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/DelayedApplyVO.java new file mode 100644 index 0000000..57636a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/DelayedApplyVO.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @Classname DelayedApplyVO + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "DelayedApplyVO", description = "延期申请") +public class DelayedApplyVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("延期时间(几个月)") + private Integer delayTime; + + @ApiModelProperty("延期申请佐证材料") + private String delayApplyFile; + + @ApiModelProperty("延期申请理由") + private String delayApplyReason; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新人") + private Long updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("延期申请实例ID") + private String instanceId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/FinalAcceptanceVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/FinalAcceptanceVO.java new file mode 100644 index 0000000..1650120 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/FinalAcceptanceVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Classname FinalAcceptanceVO + * @Description 终验 + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@ApiModel(value = "终验", description = "终验") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class FinalAcceptanceVO { + + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("关联应用信息") + private List apps; + + @ApiModelProperty("终验材料") + private String finalAcceptanceMaterials; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/IrsApplicationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/IrsApplicationVO.java new file mode 100644 index 0000000..ca790d1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/IrsApplicationVO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * irs项目 + *

+ * + * @author zpf + * @since 2023-03-06 + */ +@ApiModel(value = "irs_application对象", description = "irs项目对象") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class IrsApplicationVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("应用编码") + private String applicationCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java new file mode 100644 index 0000000..2e521d3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @Classname Operation + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@ApiModel(value = "实施对象", description = "实施对象") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OperationVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目Code") + private String projectCode; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人 工号") + private String createBy; + + @ApiModelProperty("修改人 工号") + private String updateBy; + + @ApiModelProperty("项目开工时间") + private LocalDateTime projectStartDate; + + @ApiModelProperty("初验时间") + private LocalDateTime initialInspectionDate; + + @ApiModelProperty("终验时间") + private LocalDateTime finalInspectionDate; + + @ApiModelProperty("开始实施时间") + private LocalDateTime startTrialOperationDate; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PaymentPlanVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PaymentPlanVO.java new file mode 100644 index 0000000..ab1a673 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PaymentPlanVO.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname PaymentPlan + * @Description + * @Date 2023/5/30 16:11 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PaymentPlanVO", description = "") +public class PaymentPlanVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建人") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("修改人人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("付款计划") + private String planAmount; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("计划支付金额") + private BigDecimal paymentAmount; + + @ApiModelProperty("实际支付金额") + private BigDecimal actualPaymentAmount; + + @ApiModelProperty("支付比例") + private String ratio; + + @ApiModelProperty("支付时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime paymentTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PiotTasksVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PiotTasksVO.java new file mode 100644 index 0000000..c3244c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PiotTasksVO.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * irs任务对象 + *

+ * + * @author zpf + * @since 2023-03-06 + */ +@ApiModel(value = "irs_piot_tasks对象", description = "irs任务对象") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PiotTasksVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("试点任务名称") + private String taskName; + + @ApiModelProperty("试点任务编号") + private String taskCode; + + @ApiModelProperty("所属重大应用名称") + private String importantTaskName; + + @ApiModelProperty("所属重大应用编号") + private String importantTaskCode; + + @ApiModelProperty("所属子场景应用名称") + private String subSceneApplicationName; + + private LocalDateTime createOn; + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java new file mode 100644 index 0000000..a487285 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +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.time.LocalDateTime; + +/** + * @Classname PreInsAcceptancePerson + * @Description 初验人员 + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PreInsAcceptancePersonVO", description = "") +public class PreInsAcceptancePersonVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人人") + private String updateBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("人员名称") + private String personName; + + @ApiModelProperty("单位") + private String unit; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java new file mode 100644 index 0000000..7c4e602 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname PreInsVO + * @Description + * @Date 2023/5/30 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "PreInsVO", description = "初验备案详情") +public class PreInsVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("初验验收人员") + private List acceptancePersons; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectContractListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectContractListVO.java new file mode 100644 index 0000000..2a0c992 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectContractListVO.java @@ -0,0 +1,95 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * ProjectContractListVO + *

+ * + * @author ZPF + * @since 15:13 2023/11/15 + */ +@Data +@Builder +@ApiModel("合同项目库列表视图") +public class ProjectContractListVO { + + @Tolerate + public ProjectContractListVO() { + } + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("区域") + private String area; + + @ApiModelProperty("区域Code") + private String areaCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("申报年度") + private Integer projectYear; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + private String projectTypeName; + + @ApiModelProperty("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(元)") + private BigDecimal annualPlanAmount; + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } + + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime updateOn; + + @ApiModelProperty("能否能补充") + private Boolean supplemented = Boolean.FALSE; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredDetailVO.java new file mode 100644 index 0000000..47090c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredDetailVO.java @@ -0,0 +1,280 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * + *

+ * + * @author ZPF + * @since 15:13 2023/2/1 + */ +@Data +@ApiModel("项目详情") +public class ProjectDeclaredDetailVO { + + @ApiModelProperty("应用ID 新增为空") + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildUnitName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + private String buildUnitZheJiangGovernmentDingId; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域") + private String bizDomain; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private String buildLevel; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + private Integer isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovernmentOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovernmentSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovernmentOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovernmentSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + @ApiModelProperty("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("上级主管部门") + private String higherSuperUnit; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperUnitCode; + + @ApiModelProperty("主管部门名称") + private String superUnit; + + @ApiModelProperty("主管部门Code") + private String superUnitCode; + + @ApiModelProperty("前端所需验证字段") + private Integer allApplicationsDone; + + @ApiModelProperty("项目一级状态 10000 20000 30000") + private Integer projectStatusFirst; + + @ApiModelProperty("项目二级状态") + private Integer projectStatusSecond; + + @ApiModelProperty("项目应用") + private List projectApplications; + + @ApiModelProperty("新增form内容") + private String formData; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredListItemVO.java new file mode 100644 index 0000000..196c541 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDeclaredListItemVO.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * ProjectLibListItemVO + *

+ * + * @author WendyYang + * @since 15:13 2023/2/1 + */ +@Data +@ApiModel("申报项目列表视图") +public class ProjectDeclaredListItemVO { + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("批复金额") + private BigDecimal approvedAmount; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("项目状态1") + private Integer projectStatusFirst; + + @ApiModelProperty("项目状态") + private Integer projectStatusSecond; + + @ApiModelProperty("申报年度") + private Integer projectYear; + + @ApiModelProperty("申报单位") + private String buildUnit; + + @ApiModelProperty("业务领域") + private String bizDomain; + + 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 LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java new file mode 100644 index 0000000..c7d5a34 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java @@ -0,0 +1,373 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 项目草稿箱 + *

+ * + * @author zpf + * @since 2023-02-06 + */ +@ApiModel(value = "NdProjectDraft对象", description = "") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectDraftVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域") + private String bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + private Integer isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("流程实例编号") + private String instCode; + + @ApiModelProperty("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("项目应用") + private List applicationList; + + @ApiModelProperty("新增form内容") + private Map dynamicForm; + + @ApiModelProperty("用户id") + private String userId; + + @ApiModelProperty("21位项目编号") + private String projectCode; + + @ApiModelProperty("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("是否开启评审清单") + private Boolean isReviewChecklist; + + @ApiModelProperty("评审清单") + private String reviewChecklist; + + private Long createBy; + private Long updateBy; + + @ApiModelProperty("是否推送省里") + private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PurchaseVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PurchaseVO.java new file mode 100644 index 0000000..fc25984 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PurchaseVO.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname Purchase + * @Description + * @Date 2023/5/29 10:00 + * @Author PoffyZhang + */ +@ApiModel(value = "采购对象", description = "采购对象") +@Data +@AllArgsConstructor +public class PurchaseVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("标段名称") + private String bidName; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人 工号") + private String createBy; + + @ApiModelProperty("修改人 工号") + private String updateBy; + + @ApiModelProperty("供应商") + private String supplier; + + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + + @ApiModelProperty("供应商社会信用代码") + private String supplierSocialCreditCode; + + @ApiModelProperty("采购方式 1公开招标 2自行采购") + private String purchaseMethod; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + private LocalDateTime transactionTime; + + @ApiModelProperty("代理机构") + private String agency; + + @ApiModelProperty("代理机构社会统一信用代码") + private String purchaseSocialCreditCode; + + @ApiModelProperty("投标文件") + private String biddingDoc; + + @ApiModelProperty("招标文件") + private String bidDoc; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("预算执行确认书编号") + private String budgetExecConfirmNo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewCheckInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewCheckInfoVO.java new file mode 100644 index 0000000..2fe8149 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewCheckInfoVO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import com.wflow.enums.ReviewChecklistResultEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @Classname ReviewCheckInfoVO + * @Description + * @Date 2023/11/08 10:00 + * @Author PoffyZhang + */ +@ApiModel(value = "ReviewCheckInfoVO", description = "ReviewCheckInfoVO") +@Data +@AllArgsConstructor +public class ReviewCheckInfoVO { + + @ApiModelProperty("审批人名") + private String username; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("员工号") + private String employeeCode; + + @ApiModelProperty("结果编号") + private Integer result; + + @ApiModelProperty("结果描述") + private String resultName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewChecklistApproveVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewChecklistApproveVO.java new file mode 100644 index 0000000..ef6701c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ReviewChecklistApproveVO.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname ReviewChecklistApproveVO + * @Description + * @Date 2023/11/07 15:35 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ReviewChecklistApproveVO", description = "") +public class ReviewChecklistApproveVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("审批人") + private String createBy; + + @ApiModelProperty("审批时间") + private LocalDateTime createOn; + + @ApiModelProperty("审批人ID") + private Long createById; + + @ApiModelProperty("审批人code") + private String createByCode; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("子标题") + private String subTitle; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("对应页码") + private String corrPageNum; + + @ApiModelProperty("否决情形") + private String rejectionSituation; + + @ApiModelProperty("响应情况") + private String responseSituation; + + @ApiModelProperty("评审意见") + private String reviewComments; + + @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") + private Integer reviewResult; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java new file mode 100644 index 0000000..1f0787e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IConstrctionSuggestionsService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java new file mode 100644 index 0000000..d3e0235 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.Contract; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IContractService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IDeclaredStatisticsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IDeclaredStatisticsService.java new file mode 100644 index 0000000..86bf24b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IDeclaredStatisticsService.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface IDeclaredStatisticsService { + + DeclaredProjectStatisticsPO getOrgStatistics(String organizationCode, Integer year); + + DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/INdPiotTasksService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/INdPiotTasksService.java new file mode 100644 index 0000000..912e43c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/INdPiotTasksService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.NdPiotTasks; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface INdPiotTasksService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IOperationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IOperationService.java new file mode 100644 index 0000000..4f8e3b1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IOperationService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.Operation; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IOperationService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPaymentPlanService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPaymentPlanService.java new file mode 100644 index 0000000..4d29b10 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPaymentPlanService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IPaymentPlanService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java new file mode 100644 index 0000000..07b8b7f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IPreInsAcceptancePersonService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IProjectDraftService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IProjectDraftService.java new file mode 100644 index 0000000..cd9eccd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IProjectDraftService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface IProjectDraftService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java new file mode 100644 index 0000000..02ce5ee --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IPurchaseService extends IService { + + default List listByProjectId(Long projectId) { + return list(Wrappers.lambdaQuery(Purchase.class) + .eq(Purchase::getProjectId, projectId)); + } + + default List listByProjectIds(List projectIds) { + return list(Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId, projectIds)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IReviewChecklistApproveService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IReviewChecklistApproveService.java new file mode 100644 index 0000000..c496947 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IReviewChecklistApproveService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; + +/** + *

+ * 服务类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +public interface IReviewChecklistApproveService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IrsApplicationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IrsApplicationService.java new file mode 100644 index 0000000..cb22bab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IrsApplicationService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.IrsApplication; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +public interface IrsApplicationService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java new file mode 100644 index 0000000..be94bd2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.ConstructionSuggestionsMapper; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; +import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class ConstructionSuggestionsServiceImpl extends ServiceImpl + implements IConstrctionSuggestionsService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ContractServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ContractServiceImpl.java new file mode 100644 index 0000000..a99c741 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ContractServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.ContractMapper; +import com.hz.pm.api.projectdeclared.model.entity.Contract; +import com.hz.pm.api.projectdeclared.service.IContractService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class ContractServiceImpl extends ServiceImpl + implements IContractService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java new file mode 100644 index 0000000..bda7334 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.hz.pm.api.projectdeclared.mapper.DeclaredStatisticsMapper; +import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; +import com.hz.pm.api.projectdeclared.service.IDeclaredStatisticsService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +@AllArgsConstructor +public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService { + + private final DeclaredStatisticsMapper declaredStatisticsMapper; + + /** + * 根据userId 去查询 申报项目统计 根据单位 + * @param orgCode + * @return + */ + @Override + public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode,Integer year) { + return declaredStatisticsMapper.getOrgStatistics(orgCode,year); + } + + /** + * 根据userId 去查询 申报项目统计 根据区域 + * @param regionCode + * @return + */ + @Override + public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year) { + return declaredStatisticsMapper.getRegionStatistics(regionCode,year); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/IrsApplicationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/IrsApplicationServiceImpl.java new file mode 100644 index 0000000..e4a1879 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/IrsApplicationServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.IrsApplicationMapper; +import com.hz.pm.api.projectdeclared.model.entity.IrsApplication; +import com.hz.pm.api.projectdeclared.service.IrsApplicationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class IrsApplicationServiceImpl extends ServiceImpl + implements IrsApplicationService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/NdPiotTasksServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/NdPiotTasksServiceImpl.java new file mode 100644 index 0000000..78f67c1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/NdPiotTasksServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.NdPiotTasksMapper; +import com.hz.pm.api.projectdeclared.model.entity.NdPiotTasks; +import com.hz.pm.api.projectdeclared.service.INdPiotTasksService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class NdPiotTasksServiceImpl extends ServiceImpl + implements INdPiotTasksService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/OperationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/OperationServiceImpl.java new file mode 100644 index 0000000..42f1d61 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/OperationServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.OperationMapper; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class OperationServiceImpl extends ServiceImpl + implements IOperationService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PaymentPlanServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PaymentPlanServiceImpl.java new file mode 100644 index 0000000..b837202 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PaymentPlanServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.PaymentPlanMapper; +import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; +import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class PaymentPlanServiceImpl extends ServiceImpl + implements IPaymentPlanService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java new file mode 100644 index 0000000..d4891b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.PreInsAcceptancePersonMapper; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; +import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class PreInsAcceptancePersonServiceImpl extends ServiceImpl + implements IPreInsAcceptancePersonService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ProjectDraftServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ProjectDraftServiceImpl.java new file mode 100644 index 0000000..088dd90 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ProjectDraftServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; +import com.hz.pm.api.projectdeclared.mapper.ProjectDraftMapper; +import com.hz.pm.api.projectdeclared.service.IProjectDraftService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class ProjectDraftServiceImpl extends ServiceImpl + implements IProjectDraftService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseServiceImpl.java new file mode 100644 index 0000000..51b1bf8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.PurchaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-05 + */ +@Service +public class PurchaseServiceImpl extends ServiceImpl + implements IPurchaseService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java new file mode 100644 index 0000000..4cb371f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; +import com.hz.pm.api.projectlib.mapper.ReviewChecklistApproveMapper; +import com.hz.pm.api.projectdeclared.service.IReviewChecklistApproveService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +@Service +public class ReviewChecklistApproveServiceImpl extends ServiceImpl + implements IReviewChecklistApproveService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java new file mode 100644 index 0000000..27f35f4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -0,0 +1,149 @@ +package com.hz.pm.api.projectdeclared.utils; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.model.dto.*; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; +import com.hz.pm.api.projectdeclared.contants.ProjectCodeContant; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectCollection; +import com.hz.pm.api.projectlib.service.IProjectService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 生成项目编号工具类 + * + * @author CMM + * @since 2023/04/04 14:13 + */ +@Component +public class GenerateProjectCodeUtil { + + @Autowired + private IProjectService projectService; + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + + @Autowired + private IGovOperationProjectBaseinfoService operationProjectBaseinfoService; + + public String generateProjectCode(ProjectDTO project){ + // 获取所属行政区划代码(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 = project.getProjectType(); + // 16-20 项目序号00001 + String currentCode = areaCode + year + projectType; + // 16-20 项目序号00001 + //要查询 两边的项目序号 + Long max = getMaxProjectCode(currentCode); + // 生成20位的项目编号 + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); + } + + public String generateProjectCode(ProjectCollection project){ + // 获取所属行政区划代码(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 + String currentCode = areaCode + year + projectType; + // 16-20 项目序号00001 + //要查询 最大的项目编号 + Long max = getMaxProjectCode(currentCode); + // 生成20位的项目编号 + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); + } + + public String generateProjectCode(GovBizProjectSaveDTO dto) { + // 获取所属行政区划代码(9位) + GovBizProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); + GovBizProjectApplyDTO apply = dto.getApply(); + + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); + VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); + + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + // 获取建设年度 (10-13) + String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() + : String.valueOf(LocalDateTime.now().getYear()); + // 14-15 项目类型 + String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : + BizProjectContant.ProjectCollection.IS_EFFECTIVE; + String currentCode = areaCode + year + projectType; + // 16-20 项目序号00001 + //要查询 最大的项目编号 + Long max = getMaxProjectCode(currentCode); + // 生成20位的项目编号 + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); + } + + public String generateProjectCode(GovOperationProjectSaveDTO dto) { + // 获取所属行政区划代码(9位) + GovOperationProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); + GovBizProjectApplyDTO apply = dto.getApply(); + + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); + VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); + + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + // 获取建设年度 (10-13) + String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() + : String.valueOf(LocalDateTime.now().getYear()); + // 14-15 项目类型 + String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : + BizProjectContant.ProjectCollection.IS_EFFECTIVE; + String currentCode = areaCode + year + projectType; + // 16-20 项目序号00001 + //要查询 最大的项目编号 + Long max = getMaxProjectCode(currentCode); + // 生成20位的项目编号 + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); + } + private Long getMaxProjectCode(String currentCode) { + Long max = 0L; + GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .like(GovBizProjectBaseinfo::getBaseProjId, currentCode) + .orderByDesc(GovBizProjectBaseinfo::getBaseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ + max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); + } + GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) + .orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ + Long operationMax = Long.valueOf(operationBaseMax.getBaseProjId().substring(operationBaseMax.getBaseProjId().length() - 5)); + max = Math.max(max,operationMax); + } + Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) + .like(Project::getProjectCode, currentCode) + .orderByDesc(Project::getProjectCode) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())){ + Long projectMaxCode = Long.valueOf(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5)); + max = Math.max(max,projectMaxCode); + } + max = max + 1; + return max; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java new file mode 100644 index 0000000..be51d4b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.projectdeclared.utils; + +import com.google.common.collect.Maps; +import com.hz.pm.api.projectdeclared.manage.*; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.Map; +import java.util.function.Function; + +/** + * @Classname ReSubmitProcessMap + * @Description 项目调整 重新提交时的 事件函数MAP + * @Date 2023/2/15 11:19 + * @Author PoffyZhang + */ +@Component +public class ReStartProcessMapUtil { + @Autowired + private DeclaredProjectManage declaredProjectManage; + + @Autowired + private ConstructionPlanManage constructionPlanManage; + + @Autowired + private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; + + @Autowired + private ReviewByProvincialDeptManage provincialDeptManage; + + @Autowired + private FinalAcceptanceManage finalAcceptanceManage; + + public Map> reStartProcessMap = Maps.newHashMap(); + /** + * 初始化业务分派逻辑,代替了if-else部分 + * key: 枚举 状态值 + * value: lambda表达式,最终会获取发起实例的函数 + */ + public ReStartProcessMapUtil(){ + //重新项目申报 + reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + dto->declaredProjectManage.reStartTheProcess(dto)); + //建设方案 + reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), + dto->constructionPlanManage.restartTheProcess(dto)); + //预审方案 + reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + dto->prequalificationDeclaredProjectManage.restartTheProcess(dto)); + //省级联审 + reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + dto->provincialDeptManage.restartTheProcess(dto)); + //终审 + reStartProcessMap.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), + dto->finalAcceptanceManage.restartProcess(dto)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ImportTemplateConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ImportTemplateConstant.java new file mode 100644 index 0000000..2c750e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ImportTemplateConstant.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.projectlib.constant; + +import com.hz.pm.api.projectlib.enumeration.ProjectLibFlagEnum; + +import java.util.*; + + +/** + *

+ * ImportTemplateEnumConstant + *

+ * + * @author WendyYang + * @since 20:11 2022/11/4 + */ +public class ImportTemplateConstant { + + public static final List ANNUAL_PLAN_COL_LIST = Arrays.asList("序号","项目id","项目名称","建设内容","建设依据","建设性质","建设起止年限(填写到月)", "总投资", "自有资金","年度投资额","政府投资-本级财政","政府投资-上级补助资金","银行贷款","其他","一季度","二季度","三季度","四季度","建设单位","项目联系人","项目分管领导","备注"); + + private static final Map> IMPORT_TEMPLATE_MAP; + + static { + IMPORT_TEMPLATE_MAP = new HashMap<>(ProjectLibFlagEnum.values().length); + IMPORT_TEMPLATE_MAP.put(ProjectLibFlagEnum.ANNUAL_PLAN, ANNUAL_PLAN_COL_LIST); + } + + public static List getTemplateTitle(ProjectLibFlagEnum template) { + return IMPORT_TEMPLATE_MAP.getOrDefault(template, Collections.emptyList()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ProjectConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ProjectConstant.java new file mode 100644 index 0000000..cdf9144 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/constant/ProjectConstant.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.projectlib.constant; + +/** + * @Classname ProjectConstant + * @Description + * @Date 2023/7/21 14:13 + * @Author PoffyZhang + */ +public interface ProjectConstant { + + class ProjectLib{ + public static final String PROJECT_BASIC = "basic"; + public static final String PROJECT_CONSTRUCT = "construct"; + + public static final String CHANGES_KEY = "changes"; + + public static final String PROCESS_KEY = "process"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java new file mode 100644 index 0000000..6d958d9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java @@ -0,0 +1,93 @@ +package com.hz.pm.api.projectlib.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectlib.enumeration.ProjectLibFlagEnum; +import com.hz.pm.api.projectlib.manage.AnnualPlanLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq; +import com.hz.pm.api.projectlib.model.req.ProjectIdReq; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; +import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * AnnualPlanController + *

+ * + * @author WendyYang + * @since 14:07 2023/2/11 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "年度计划库") +@RequestMapping("/api/v1/annualPlan") +public class AnnualPlanController { + + private final AnnualPlanLibManage annualPlanLibManage; + + @GetMapping("/list") + @ApiOperation("年度计划库列表") + public PageVo annualPlanLibList(ProjectListReq req) { + return annualPlanLibManage.annulPlanLibList(req); + } + + @PostMapping("/startProjectDeclared") + @ApiOperation("开启项目申报") + @WebLog("开启项目申报") + public void startProjectDeclared(@RequestBody @Valid StartProjectDeclareReq req) { + annualPlanLibManage.startProjectDeclared(req); + } + + @PostMapping("/projectApproved") + @ApiOperation("立项批复") + @WebLog("立项批复") + public void projectApproved(@RequestBody @Valid ProjectApprovedReq req) throws Exception { + annualPlanLibManage.projectApproved(req); + } + + @PostMapping("/suspendAnnualPlan") + @ApiOperation("暂缓年度计划") + @WebLog("暂缓年度计划") + public void suspendAnnualPlan(@RequestBody @Valid ProjectIdReq req) throws Exception { + annualPlanLibManage.suspendAnnualPlan(req); + } + + @PostMapping("/importAnnualPlan") + @ApiOperation("导入年度计划") + @WebLog("导入年度计划") + public void importAnnualPlan(@RequestParam("importFlag") ProjectLibFlagEnum importFlag, MultipartFile file) { + annualPlanLibManage.importAnnualPlan(importFlag,file); + } + + @PostMapping("/modify") + @ApiOperation("年度计划编辑") + @WebLog("年度计划编辑") + public void modify(@RequestBody ProjectDTO req) { + annualPlanLibManage.updateAnnualPlan(req); + } + + @PostMapping("/exportList") + @ApiOperation("项目(增补)库列表导出") + @WebLog("项目(增补)库列表导出") + public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response) { + annualPlanLibManage.exportList(param, response); + } + + @PostMapping("/exportModifyList") + @ApiOperation("项目(增补)库编辑表导出") + @WebLog("项目(增补)库编辑表导出") + public void exportModifyList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response) { + annualPlanLibManage.exportModifyList(param, response); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectApplicationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectApplicationController.java new file mode 100644 index 0000000..b6af4d1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectApplicationController.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.projectlib.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectlib.manage.ApplicationManage; +import com.hz.pm.api.projectlib.model.dto.ApplicationAppCodeSaveDTO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; + +/** + * @Classname ProjectApplicationController + * @Description + * @Date 2023/6/27 11:32 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "项目应用控制器") +@RequestMapping("/api/v1/application") +public class ProjectApplicationController { + + private final ApplicationManage applicationManage; + + @GetMapping("/get-report/{appCode}") + @ApiOperation("获取应用 试运行报告") + @WebLog("获取应用 试运行报告") + public String getReport(@PathVariable String appCode) { + return applicationManage.getReport(appCode); + } + + @PostMapping("/save-appcode") + @ApiOperation("保存应用注册的appCode") + @WebLog("保存应用注册的appCode") + public String saveAppCode(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { + return applicationManage.saveAppCode(dto); + } + + @GetMapping("/to-register-app-project-list") + @ApiOperation("待应用预注册的项目应用列表") + public PageVo toRegisterAppProjectLibList(ProjectListReq req) { + return applicationManage.toRegisterAppProjectLibList(req); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectCollectionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectCollectionController.java new file mode 100644 index 0000000..8cea1d1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectCollectionController.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.projectlib.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectlib.manage.ProjectCollectionManage; +import com.hz.pm.api.projectlib.model.dto.ProjectCollectionSaveDTO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectCollectionVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * @Classname ProjectCollectionController + * @Description + * @Date 2023/6/25 9:11 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "项目归集控制器") +@RequestMapping("/api/v1/project-collection") +public class ProjectCollectionController { + + private final ProjectCollectionManage collectionManage; + + @GetMapping("/list") + @ApiOperation("项目归集列表") + public PageVo list(ProjectListReq req) { + return collectionManage.list(req); + } + + @GetMapping("/detail/{id}") + @ApiOperation("项目归集详情") + public ProjectCollectionVO detail(@PathVariable Long id) { + return collectionManage.detail(id); + } + + @PostMapping("/save") + @ApiOperation("项目归集保存") + @WebLog("项目归集保存") + public String save(@Valid @RequestBody ProjectCollectionSaveDTO dto) { + return collectionManage.save(dto); + } + + @PostMapping("/delete/{id}") + @ApiOperation("项目归集删除") + @WebLog("项目归集删除") + public String delete(@PathVariable Long id) { + return collectionManage.delete(id); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java new file mode 100644 index 0000000..e96615c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java @@ -0,0 +1,119 @@ +package com.hz.pm.api.projectlib.controller; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.req.ProjectApplicationListReq; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * ProjectLibController + *

+ * + * @author WendyYang + * @since 17:30 2023/2/1 + */ +@RestController +@RequestMapping("/api/v1/project/lib") +@AllArgsConstructor +@Api(tags = "项目库") +public class ProjectLibController { + + private final ProjectLibManage projectLibManage; + + private final UserInfoHelper userInfoHelper; + + @GetMapping("/list") + @ApiOperation("项目库列表") + public PageVo projectLibList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectLibManage.projectLibListWithPermission(req,user); + } + + @GetMapping("/all-list") + @ApiOperation("包含申报项目列表和项目归集列表") + public PageVo projectAllList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectLibManage.projectAllListWithPermission(req,user); + } + + @GetMapping("/lib-list") + @ApiOperation("包含申报项目列表和项目归集(运维项目)列表") + public PageVo libList(ProjectListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectLibManage.libListWithPermission(req,user); + } + + @GetMapping("/history-list/{id}") + @ApiOperation("项目历史版本列表") + public JSONObject historyProjects(@PathVariable Long id) { + return projectLibManage.historyProjects(id); + } + + @GetMapping("/change-record/{id}") + @ApiOperation("查看项目变更记录") + public JSONObject changeRecord(@PathVariable Long id) { + return projectLibManage.changeRecord(id); + } + + @GetMapping("/application/list") + @ApiOperation("应用列表") + public PageVo applicationList(ProjectApplicationListReq req) { + return projectLibManage.applicationList(req); + } + + @GetMapping("/prePlan/{id}") + @ApiOperation("获取项目初步方案详情") + public ProjectDetailVO constructDetail (@PathVariable Long id){ + return projectLibManage.getPrePlanProjectDetail(id); + } + + @GetMapping("/{id}") + @ApiOperation("获取项目详情") + public ProjectDetailVO detail (@PathVariable Long id){ + return projectLibManage.getProjectDetail(id); + } + + @GetMapping("/convert-to-collection/{projectCode}") + @ApiOperation("申报项目转化为项目归集") + public GovBizProjectDetailVO convertToCollection(@PathVariable String projectCode){ + return projectLibManage.convertToCollection(projectCode); + } + + @GetMapping("/detail/{projectCode}") + @ApiOperation("获取项目详情(编号)") + public ProjectDetailVO detailProjectCode (@PathVariable String projectCode){ + return projectLibManage.detailProjectCode(projectCode); + } + + @GetMapping("/processSchedule/{projectId}") + @ApiOperation("项目库申报项目当前进度详情") + public List processScheduleDetail(@PathVariable("projectId") Long projectId){ + return projectLibManage.processScheduleDetail(projectId); + } + + @PostMapping("/exportList") + @ApiOperation("项目库列表导出") + @WebLog("项目库列表导出") + public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response){ + projectLibManage.exportList(param,response); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java new file mode 100644 index 0000000..0639db9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -0,0 +1,98 @@ +package com.hz.pm.api.projectlib.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.projectlib.manage.ProjectRenewalFundManage; +import com.hz.pm.api.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.model.vo.ProjectRenewalFundDeclarationVO; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; + +/** + *

+ * 续建项目资金申请表 前端控制器 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@RestController +@RequestMapping("/api/v1/project/renewal") +@AllArgsConstructor +@Api(tags = "续建项目资金库") +public class ProjectRenewalFundDeclarationController { + private final ProjectRenewalFundManage projectRenewalFundManage; + + private final UserInfoHelper userInfoHelper; + + @GetMapping("/list") + @ApiOperation("项目续建资金库") + public PageVo list(ProjectRenewalListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectRenewalFundManage.list(req,user); + } + + @GetMapping("/project-list") + @ApiOperation("项目续建资金库能关联的项目列表") + public PageVo projectlist(ProjectRenewalListReq req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectRenewalFundManage.projectlist(req,user); + } + + @GetMapping("/{id}") + @ApiOperation("项目续建资金详情") + @WebLog("项目续建资金详情") + public ProjectRenewalFundDeclarationVO detail (@PathVariable Long id){ + return projectRenewalFundManage.detail(id); + } + + @PostMapping("/declared") + @ApiOperation("项目续建资金申请") + @WebLog("项目续建资金申请") + public Long declared (@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto){ + return projectRenewalFundManage.declared(dto); + } + + @PostMapping("/audit") + @ApiOperation("续建项目审核") + @WebLog("续建项目审核") + public Long audit(@Validated @RequestBody ProjectRenewalAuditReq param){ + return projectRenewalFundManage.audit(param); + } + + @DeleteMapping("/delete/{projectRenewalId}") + @ApiOperation("续建项目删除") + @WebLog("续建项目删除") + public Long delete(@PathVariable("projectRenewalId") Long projectRenewalId){ + return projectRenewalFundManage.delete(projectRenewalId); + } + + @GetMapping("/export") + @ApiOperation("项目库续建项目列表导出") + @WebLog("项目库续建项目列表导出") + public void exportList(ProjectRenewalListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportList); + } + + @GetMapping("/exportRenewalDeclare") + @ApiOperation("申报管理续建项目资金申报列表导出") + @WebLog("申报管理续建项目资金申报列表导出") + public void exportRenewalDeclareList(ProjectRenewalListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportRenewalDeclareList); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/BizDomainEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/BizDomainEnum.java new file mode 100644 index 0000000..2c4df78 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/BizDomainEnum.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.projectlib.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 综合业务领域枚举 + * + * @return + * @author CMM + * @since 2023/03/16 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum BizDomainEnum { + /** + * 项目类型 + */ + PARTY_GOV_ORG_OVERALL(1, "党政机关整体智治"), + DIG_GOV(2, "数字政府"), + DIG_ECO(3, "数字经济"), + DIG_SOC(4, "数字社会"), + DIG_LAW(5, "数字法治"), + ALL_INTEL_PUB_DATA_PLAT(6, "一体化智能化公共数据平台"), + DIG_CUL(7, "数字文化"), + GRA_WISE(8, "基层智治"); + + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (BizDomainEnum t : BizDomainEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/CloudTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/CloudTypeEnum.java new file mode 100644 index 0000000..5a7e49a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/CloudTypeEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectlib.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 云类型枚举 + * + * @return + * @author CMM + * @since 2023/03/16 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum CloudTypeEnum { + /** + * 云类型 + */ + GOV_CLOUD_NON_LETTER(1, "政务云(非信创)"), + GOV_CLOUD_LETTER(2, "数字政府"), + OTHER(3,"其他"); + + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (CloudTypeEnum t : CloudTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/FourSystemEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/FourSystemEnum.java new file mode 100644 index 0000000..781b32f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/FourSystemEnum.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectlib.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 四大体系枚举 + * + * @return + * @author CMM + * @since 2023/03/16 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum FourSystemEnum { + /** + * 项目类型 + */ + BUSINESS_APPLICATION(1, "业务应用"), + APPLICATION_SUPPORT(2, "应用支撑"), + DATA_RESOURCES(3, "数据资源"), + INFRASTRUCTURE(4, "基础设施"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (FourSystemEnum t : FourSystemEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/InstTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/InstTypeEnum.java new file mode 100644 index 0000000..c1120d5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/InstTypeEnum.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.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 InstTypeEnum { + /** + * 流程实例类型 + */ + UNIT_INNER_AUDIT(1, "单位内部审批流程"), + PRELIMINARY_PREVIEW(2, "项目预审审批流程"), + DEPT_UNITED_REVIEW(3,"部门联合审批流程"), + CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"), + PROJECT_FINAL_INSPECTION(5,"验收申报审批流程"), + + APPLY_DELAY(6,"申请延期审批流程"), + + APPLY_BORROW(7,"申请借阅审批流程"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (InstTypeEnum t : InstTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static InstTypeEnum getByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (InstTypeEnum t : InstTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectLibFlagEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectLibFlagEnum.java new file mode 100644 index 0000000..429b108 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectLibFlagEnum.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.projectlib.enumeration; + +import lombok.Getter; + +/** + *

+ * 项目库标志枚举 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Getter +public enum ProjectLibFlagEnum { + + /** + * 项目库标志枚举 + */ + + ANNUAL_PLAN("年度计划库"), + ANNUAL_PLAN_SUPPLEMENT("年度计划增补库"); + + private final String value; + + ProjectLibFlagEnum(String value) { + this.value = value; + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java new file mode 100644 index 0000000..fcb9a91 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.projectlib.enumeration; + + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * ProjectRenewalApprovalStatusEnum + *

+ * + * @author Poffy + * @since 16:54 2023/2/11 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectRenewalApprovalStatusEnum { + /** + * 续建项目 审核状态 + * 审核中 + * 通过 + * 不通过 + */ + PENDING(1,"审核中"), + PASS(2,"通过"), + NOT_PASS(3,"不通过"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static ProjectRenewalApprovalStatusEnum match(String name) { + if (StringUtils.isBlank(name)) { + return null; + } + for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { + if (name.equals(t.name())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectStatusEnum.java new file mode 100644 index 0000000..644f09a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectStatusEnum.java @@ -0,0 +1,97 @@ +package com.hz.pm.api.projectlib.enumeration; + +import com.hz.pm.api.gov.enumeration.GovProjectStatusEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import java.util.Objects; + +/** + *

+ * ProjectStatusEnum + *

+ * + * @author Poffy + * @since 16:54 2023/2/11 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectStatusEnum { + /** + * 项目阶段:未立项 + */ + NOT_APPROVED(10000, "未立项",null), + UNDER_INTERNAL_AUDIT(10001, "单位内部审核中",null), + UNDER_INTERNAL_AUDIT_NOT_PASS(10002, "单位内部审核不通过",null), + PENDING_PREQUALIFICATION(10003, "待预审",null), + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS(10004, "省级部门联审中",null), + + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS(10018, "省级部门联审通过",null), + THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED(10005, "省级部门联审不通过",null), + PRE_APPLYING(10006, "预审中",null), + PREQUALIFICATION_FAILED(10007, "预审不通过",null), + DEPARTMENT_JOINT_REVIEW(10008, "部门联审中",null), + DEPARTMENT_JOINT_REVIEW_FAILED(10009, "部门联审不通过",null), + IN_THE_ANNUAL_PLAN(10010, "年度计划中",null), + BE_SUSPENDED(10011, "被暂缓",null), + SCHEME_UNDER_REVIEW(10012, "方案评审中",GovProjectStatusEnum.APPROVAL), + SCHEME_REVIEW_FAILED(10013, "方案评审不通过",null), + TO_BE_APPROVED(10014, "待立项批复",GovProjectStatusEnum.PENDING), + TO_BE_DECLARED(10015, "待申报",null), + PLAN_TO_BE_DECLARED(10016, "方案待申报",null), + PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态",null), + PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态",null), + APPROVED_AFTER_CHOICE(10020, "立项批复后选择态",null), + TO_BE_APP_REGISTER(10021, "待应用注册",null), + /** + * 项目阶段:已立项 + */ + PROJECT_APPROVED(20000, "已立项",null), + TO_BE_PURCHASED(20001, "待采购",GovProjectStatusEnum.APPROVED), + UNDER_CONSTRUCTION(20002, "建设中",null), + TO_BE_FINALLY_INSPECTED(20003, "待终验",GovProjectStatusEnum.HAS_PRE_INS), + FINAL_ACCEPTANCE_IS_UNDER_REVIEW(20004, "终验审核中",null), + FINAL_ACCEPTANCE_REVIEW_FAILED(20005, "终验审核不通过",null), + OPERATION(20006, "待开工",GovProjectStatusEnum.PURCHASED), + /** + * 项目阶段:已归档 + */ + ARCHIVED(30000, "已归档",null), + ACCEPTED(30001, "已验收",GovProjectStatusEnum.HAS_FINAL_INS); + + private Integer code; + private String desc; + + private GovProjectStatusEnum collectionStatus; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectStatusEnum t : ProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static ProjectStatusEnum match(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (ProjectStatusEnum t : ProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public boolean eq(int code) { + return this.getCode().equals(code); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeEnum.java new file mode 100644 index 0000000..8e0e029 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeEnum.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * ProjectTypeEnum + *

+ * + * @author Poffy + * @since 16:56 2023/2/11 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectTypeEnum { + /** + * 项目类型 + */ + BUILD(1, "建设"), + DEV_OPS(2, "运维"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectTypeEnum t : ProjectTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeNewEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeNewEnum.java new file mode 100644 index 0000000..73acffb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/ProjectTypeNewEnum.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * ProjectTypeNewEnum + *

+ * + * @author Poffy + * @since 16:56 2023/2/11 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectTypeNewEnum { + /** + * 项目类型 + */ + FIRST_BUILD("01", "首次建设"), + SJ_BUILD("02", "迭代升级"), + SZ_BUILD("03", "结转建设"), + NEW_OPERA("04", "新运维"), + XU_OPERA("05", "续运维"); + + private String code; + private String desc; + + public static String getDesc(String code) { + if (StringUtils.isBlank(code)) { + return StringUtils.EMPTY; + } + for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static ProjectTypeNewEnum match(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningFlowTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningFlowTypeEnum.java new file mode 100644 index 0000000..4a594d4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningFlowTypeEnum.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.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(),"declareManage/planDeclaration/preExaminationDeclare"), + PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"), + DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode(),"declareManage/procurementRecord/purchaseResults"), + CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/acceptanceApply/initialInspectionRecord"), + PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); + + private Integer code; + private String desc; + + //对应的 待提交时的项目状态 + private Integer projectStutas; + + private String path; + + 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/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningNoticeTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningNoticeTypeEnum.java new file mode 100644 index 0000000..1be7de3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningNoticeTypeEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 预警提醒类型枚举 + * @author ZPF + * @since 2023/10/31 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum WarningNoticeTypeEnum { + /** + * 预警提醒类型枚举 + */ + CONTACT(1, "项目联系人"), + RESPONSIBLE(2, "项目负责人"); + + private Integer code; + private String desc; + + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static WarningNoticeTypeEnum getByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningOperationTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningOperationTypeEnum.java new file mode 100644 index 0000000..99e32c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/enumeration/WarningOperationTypeEnum.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.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(),"declareManage/acceptanceApply/initialInspectionRecord"), + ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); + + private Integer code; + private String desc; + + //对应的 待提交时的项目状态 + private Integer projectStutas; + + private String path; + + 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/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java new file mode 100644 index 0000000..97c0c3e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.projectlib.handle; + +import com.wflow.workflow.bean.vo.ProcessDetailVO; + +import java.util.List; + +/** + * 流程业务抽象处理类 + * + * @author CMM + * @since 2023/02/24 14:22 + */ + +public abstract class AbstractProcessBusinessHandle { + /** + * 构造,子类必须实现 + */ + public AbstractProcessBusinessHandle(){} + + /** + * 抽象的,所有具体处理者应该实现的处理逻辑 + * @param projectId + * @param processSchedule + * @return void + * @author CMM + * @since 2023/02/27 9:01 + */ + abstract void businessHandle(Long projectId, List processSchedule); + + abstract Integer getOrder(); + + abstract void setOrder(Integer order); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java new file mode 100644 index 0000000..773dfa1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java @@ -0,0 +1,125 @@ +package com.hz.pm.api.projectlib.handle; + +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.hz.pm.api.common.constant.CommonConst; + +import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; + +/** + * 年度计划处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(6) +@Component +public class AnnualPlanHandle extends AbstractProcessBusinessHandle { + private final INdProjectStatusChangeService projectStatusChangeService; + private final IProjectService projectService; + + private Integer order = 6; + + /** + * 项目状态为:年度计划中之前的状态 + */ + private static final List ANNUAL_PLAN_LIST_STATUS = Arrays.asList( + NOT_APPROVED, + UNDER_INTERNAL_AUDIT, + UNDER_INTERNAL_AUDIT_NOT_PASS, + PENDING_PREQUALIFICATION, + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, + THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, + PRE_APPLYING, + PREQUALIFICATION_FAILED, + DEPARTMENT_JOINT_REVIEW, + DEPARTMENT_JOINT_REVIEW_FAILED + ); + + public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + this.projectStatusChangeService = projectStatusChangeService; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + // 根据项目状态判断年度计划是否开始 + Project project = projectService.getById(projectId); + Integer status = project.getStatus(); + List fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); + + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + + // 项目状态为年度计划中之前的状态 + if (fieldList.contains(status)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); + processSchedule.add(processDetailVO); + return; + } + + // 项目状态为年度计划中 + if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ + // 根据部门联审通过的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectStatusChange)){ + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } + } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { + // 根据年度计划暂缓的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectStatusChange)){ + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } + } else { + // 根据开启方案申报的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectStatusChange)){ + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + } + processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ArchivedHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ArchivedHandle.java new file mode 100644 index 0000000..8340409 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ArchivedHandle.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.projectlib.handle; + + +import java.util.List; +import java.util.Objects; + +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; + +/** + * 归档处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(12) +@Component +public class ArchivedHandle extends AbstractProcessBusinessHandle { + private final IProjectService projectService; + private final INdProjectStatusChangeService projectStatusChangeService; + + private Integer order = 12; + + public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ + this.projectService = projectService; + this.projectStatusChangeService = projectStatusChangeService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + Project project = projectService.getById(projectId); + Integer status = project.getStage(); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + // 根据项目阶段判断是否已归档 + // 项目阶段不为已归档 + if (!ProjectStatusEnum.ARCHIVED.getCode().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.ARCHIVED); + processSchedule.add(processDetailVO); + return; + } + // 项目阶段为已归档 + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + // 根据项目终验获取归档时间 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectStatusChange)){ + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setProcessName(CommonConst.ARCHIVED); + } + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java new file mode 100644 index 0000000..7a31b19 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java @@ -0,0 +1,127 @@ +package com.hz.pm.api.projectlib.handle; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; + +/** + * 建设方案评审处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(7) +@Component +public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle { + + private final IProjectInstService projectInstService; + private final ProcessInstanceService processInstanceService; + private final BuildUserUtils buildUserUtils; + private final ProjectVersionUtil projectVersionUtil; + private final IProjectService projectService; + + private Integer order = 7; + + public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + this.buildUserUtils = buildUserUtils; + this.projectVersionUtil = projectVersionUtil; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + Project project = projectService.getById(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + // 根据项目ID查询出建设方案评审流程的流程状态 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectIds) + .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .orderByDesc(ProjectInst::getCreatOn) + .last(BizConst.LIMIT_1)); + ProcessProgressVo instanceDetail = null; + // 未找到当前版本项目的建设方案审核流程且当前项目版本号大于1(是被驳回重新申报的项目) + if (Objects.isNull(projectInst)) { + if (project.getVersion() > CommonConst.VERSION_ONE ){ + // 获取上个版本的信息 + instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW); + } + }else { + String instCode = projectInst.getInstCode(); + instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + } + if (Objects.isNull(instanceDetail)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); + processSchedule.add(processDetailVO); + return; + } + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + + // 装配节点审核人员信息 + List progressInfo = instanceDetail.getProgressInfo(); + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + // 根据流程处理详情获取流程完成时间 + if (StepStatusEnum.contains(processDetailVO.getStepStatus(), + Lists.newArrayList(StepStatusEnum.REJECTED, + StepStatusEnum.COMPLETED))) { + ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); + processDetailVO.setFinishTime(finishTime); + } + }else { + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); + processDetailVO.setFinishTime(finishTime); + } + processDetailVO.setProcessProgressVo(instanceDetail); + processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java new file mode 100644 index 0000000..7fd6505 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java @@ -0,0 +1,119 @@ +package com.hz.pm.api.projectlib.handle; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; + +/** + * 部门联审审核处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(5) +@Component +public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { + + private final IProjectInstService projectInstService; + + private final IProjectService projectService; + private final ProcessInstanceService processInstanceService; + private final BuildUserUtils buildUserUtils; + private final ProjectVersionUtil projectVersionUtil; + + private Integer order = 5; + + public DeptUnitedReviewHandle(IProjectInstService projectInstService,IProjectService projectService + , ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, + ProjectVersionUtil projectVersionUtil){ + this.projectInstService = projectInstService; + this.projectService = projectService; + this.processInstanceService = processInstanceService; + this.buildUserUtils = buildUserUtils; + this.projectVersionUtil = projectVersionUtil; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(projectId); + + // 根据项目ID查询出部门联审流程的流程状态 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectIds) + .eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .orderByDesc(ProjectInst::getCreatOn) + .last(BizConst.LIMIT_1)); + if (Objects.isNull(projectInst)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); + processSchedule.add(processDetailVO); + return; + } + String instCode = projectInst.getInstCode(); + ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + // 装配节点审核人员信息 + List progressInfo = instanceDetail.getProgressInfo(); + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + // 根据流程处理详情获取流程完成时间 + if (StepStatusEnum.contains(processDetailVO.getStepStatus(), + Lists.newArrayList(StepStatusEnum.REJECTED, + StepStatusEnum.COMPLETED))) { + ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); + processDetailVO.setFinishTime(finishTime); + } + }else { + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); + processDetailVO.setFinishTime(finishTime); + } + processDetailVO.setProcessProgressVo(instanceDetail); + processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java new file mode 100644 index 0000000..42736c2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java @@ -0,0 +1,129 @@ +package com.hz.pm.api.projectlib.handle; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * 项目预审处理 + * + * @author CMM + * @since 2023/02/27 10:09 + */ +@Order(4) +@Component +public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { + + private final IProjectInstService projectInstService; + private final ProcessInstanceService processInstanceService; + private final BuildUserUtils buildUserUtils; + private final ProjectVersionUtil projectVersionUtil; + private final IProjectService projectService; + + private Integer order = 4; + + public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) { + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + this.buildUserUtils = buildUserUtils; + this.projectVersionUtil = projectVersionUtil; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + Project project = projectService.getById(projectId); + + if (Objects.isNull(project)){ + throw new BizException("当前项目不存在!"); + } + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(projectId); + // 根据项目ID查询项目预审流程的流程状态 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectIds) + .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .orderByDesc(ProjectInst::getCreatOn) + .last("limit 1")); + ProcessProgressVo instanceDetail = null; + // 未找到当前版本项目的预审审核流程且当前项目版本号大于1(是被驳回重新申报的项目或者建设方案申报的项目) + if (Objects.isNull(projectInst)) { + if (project.getVersion() > CommonConst.VERSION_ONE){ + // 获取上个版本的信息 + instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.PRELIMINARY_PREVIEW); + } + }else { + String instCode = projectInst.getInstCode(); + instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + } + if (Objects.isNull(instanceDetail)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); + processSchedule.add(processDetailVO); + return; + } + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + + // 装配节点审核人员信息 + List progressInfo = instanceDetail.getProgressInfo(); + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + // 根据流程处理详情获取流程完成时间 + if (StepStatusEnum.contains(processDetailVO.getStepStatus(), + Lists.newArrayList(StepStatusEnum.REJECTED, + StepStatusEnum.COMPLETED))) { + ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); + processDetailVO.setFinishTime(finishTime); + } + }else { + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); + processDetailVO.setFinishTime(finishTime); + } + processDetailVO.setProcessProgressVo(instanceDetail); + processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java new file mode 100644 index 0000000..2a1303c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -0,0 +1,106 @@ +package com.hz.pm.api.projectlib.handle; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.bean.entity.WflowModels; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.service.ProcessModelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 流程执行链 + * + * @author CMM + * @since 2023/02/26 21:36 + */ +@Component +public class ProcessExecuteChainHandle { + + @Autowired + private IProjectService projectService; + + @Autowired + private ProcessModelService processModelService; + + /** + * 具体处理者的集合 + */ + private List processBusinessHandles; + + public ProcessExecuteChainHandle(List processBusinessHandles) { + this.processBusinessHandles = processBusinessHandles; + } + + /** + * 遍历处理链,通过前缀判断能否处理逻辑,如果不能继续遍历 + * @param projectId + * @return void + * @author CMM + * @since 2023/02/26 + */ + public List handle(Long projectId, List processSchedule){ + Project project = projectService.getById(projectId); + + List handles = Lists.newArrayList(); + for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { + if(Objects.nonNull(project) && RegionContant.LS_LQ_CODE.equals(project.getAreaCode())) { + if(processBusinessHandle instanceof AnnualPlanHandle){ + processBusinessHandle.setOrder(7); + }else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ + processBusinessHandle.setOrder(6); + } + }else{ + if(processBusinessHandle instanceof AnnualPlanHandle){ + processBusinessHandle.setOrder(6); + }else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ + processBusinessHandle.setOrder(7); + } + } + + //建设方案 + if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, project.getAreaCode()) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(model)){ + if(!model.getIsStop()){ + handles.add(processBusinessHandle); + } + } + }else if(processBusinessHandle instanceof ProvinceUnitedReviewHandle){ + //省级联审 + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + handles.add(processBusinessHandle); + } + }else{ + handles.add(processBusinessHandle); + } + } + + handles = handles.stream() + .sorted(Comparator.comparing(AbstractProcessBusinessHandle::getOrder)) + .collect(Collectors.toList()); + if (handles.size() > 0) { + for (AbstractProcessBusinessHandle processBusinessHandle : handles) { + processBusinessHandle.businessHandle(projectId, processSchedule); + } + return processSchedule; + } + return Collections.emptyList(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java new file mode 100644 index 0000000..507c5d3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java @@ -0,0 +1,125 @@ +package com.hz.pm.api.projectlib.handle; + +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.manage.AnnualPlanLibManage; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectService; + +import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; + +/** + * 立项批复处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(8) +@Component +public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { + private final INdProjectStatusChangeService projectStatusChangeService; + private final IProjectService projectService; + private final AnnualPlanLibManage annualPlanLibManage; + + private Integer order = 8; + + /** + * 项目状态为:待立项批复之前的状态 + */ + private static final List PROJECT_APPROVAL_LIST_STATUS = Arrays.asList( + NOT_APPROVED, + UNDER_INTERNAL_AUDIT, + UNDER_INTERNAL_AUDIT_NOT_PASS, + PENDING_PREQUALIFICATION, + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, + JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, + THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, + PRE_APPLYING, + PREQUALIFICATION_FAILED, + DEPARTMENT_JOINT_REVIEW, + DEPARTMENT_JOINT_REVIEW_FAILED, + IN_THE_ANNUAL_PLAN, + BE_SUSPENDED, + SCHEME_UNDER_REVIEW, + SCHEME_REVIEW_FAILED, + TO_BE_DECLARED, + PLAN_TO_BE_DECLARED + ); + + public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + this.annualPlanLibManage = annualPlanLibManage; + this.projectStatusChangeService = projectStatusChangeService; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + + Project project = projectService.getNewProject(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + Integer status = project.getStatus(); + if(Objects.isNull(status)){ + return; + } + + // 项目状态为待立项批复之前的状态 + if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); + processSchedule.add(processDetailVO); + return; + } + + // 当前项目状态为待立项批复 + if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ + // 根据建设方案评审通过的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + + } else { + // 取 状态机 改变状态时间 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PROJECT_APPROVAL.name()) + .last(BizConst.LIMIT_1)); + if (Objects.nonNull(projectStatusChange)) { + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + } + processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectDeclareHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectDeclareHandle.java new file mode 100644 index 0000000..a231375 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectDeclareHandle.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.projectlib.handle; + +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 项目申报处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ + +@Order(1) +@Component +public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { + + private final IProjectService projectService; + + public ProjectDeclareHandle(IProjectService projectService){ + this.projectService = projectService; + } + + private Integer order = 1; + + @Override + void businessHandle(Long projectId, List processSchedule) { + // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + // 项目库中查出申报完成时间 + Project project = projectService.getById(projectId); + LocalDateTime createOn = project.getCreateOn(); + processDetailVO.setFinishTime(createOn); + processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java new file mode 100644 index 0000000..9a2f692 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java @@ -0,0 +1,117 @@ +package com.hz.pm.api.projectlib.handle; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.CommonConst; + + +/** + * 项目终验处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(11) +@Component +public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { + private final IProjectInstService projectInstService; + private final ProcessInstanceService processInstanceService; + private final BuildUserUtils buildUserUtils; + + private final IProjectService projectService; + + private Integer order = 11; + public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, + BuildUserUtils buildUserUtils,IProjectService projectService){ + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + this.buildUserUtils = buildUserUtils; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + Project project = projectService.getById(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + // 根据项目ID查询出项目终验流程的流程状态 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectIds) + .eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .orderByDesc(ProjectInst::getCreatOn) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(projectInst)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); + processSchedule.add(processDetailVO); + return; + } + + String instCode = projectInst.getInstCode(); + ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + String status = instanceDetail.getStatus(); + // 项目状态不在待终验之后的状态 + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + + // 装配节点审核人员信息 + List progressInfo = instanceDetail.getProgressInfo(); + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + // 根据流程处理详情获取流程完成时间 + if (StepStatusEnum.contains(processDetailVO.getStepStatus(), + Lists.newArrayList(StepStatusEnum.REJECTED, + StepStatusEnum.COMPLETED))) { + ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); + processDetailVO.setFinishTime(finishTime); + } + }else { + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); + processDetailVO.setFinishTime(finishTime); + } + processDetailVO.setProcessProgressVo(instanceDetail); + processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPreliminaryInspectionHandle.java new file mode 100644 index 0000000..3be2926 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -0,0 +1,101 @@ +package com.hz.pm.api.projectlib.handle; + +import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.hz.pm.api.common.constant.BizConst; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectService; + +/** + * 项目初验处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(10) +@Component +public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessHandle { + private final INdProjectStatusChangeService projectStatusChangeService; + private final IProjectService projectService; + + private Integer order = 10; + + /** + * 项目状态为:建设中及之后的状态 + */ + private static final List PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS = Arrays.asList( + UNDER_CONSTRUCTION, + TO_BE_FINALLY_INSPECTED, + FINAL_ACCEPTANCE_IS_UNDER_REVIEW, + FINAL_ACCEPTANCE_REVIEW_FAILED, + ARCHIVED, + ACCEPTED + ); + + public ProjectPreliminaryInspectionHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + this.projectStatusChangeService = projectStatusChangeService; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + // 根据项目状态是否在建设中及之后的状态判断项目初验是否开始 + List fieldList = CollUtils.fieldList(PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS, ProjectStatusEnum::getCode); + Project project = projectService.getNewProject(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + Integer status = project.getStatus(); + // 项目状态不在建设中及之后的状态 + if (!fieldList.contains(status)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); + processSchedule.add(processDetailVO); + return; + } + // 项目状态为建设中或之后的状态 + if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus())){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + }else { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + // 根据初验备案的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(projectStatusChange)){ + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + } + } + processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java new file mode 100644 index 0000000..0ce555e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java @@ -0,0 +1,110 @@ +package com.hz.pm.api.projectlib.handle; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Objects; + +/** + * 省级联审审核处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(3) +@Component +public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { + private final IProjectService projectService; + private final INdProjectStatusChangeService projectStatusChangeService; + + private Integer order = 3; + + public ProvinceUnitedReviewHandle(IProjectService projectService, + INdProjectStatusChangeService projectStatusChangeService){ + this.projectService = projectService; + this.projectStatusChangeService = projectStatusChangeService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + + //查询项目 + Project project = projectService.getNewProject(projectId); + List allVersionProjectId = projectService.getAllVersionProjectId(projectId); + + // 根据项目ID查询出部门联审流程的流程状态 + if (Objects.isNull(project)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); + processSchedule.add(processDetailVO); + return; + } + + Integer status = project.getStatus(); + if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + ProjectStatusChange startChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectId) + .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) + .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()).orderByDesc(ProjectStatusChange::getCreateOn) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(startChange)){ + processDetailVO.setFinishTime(startChange.getCreateOn()); + } + } else if(status.compareTo(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) > 0){ + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + ProjectStatusChange passChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectId) + .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) + .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(passChange)){ + processDetailVO.setFinishTime(passChange.getCreateOn()); + } + }else if(status.compareTo(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()) > 0){ + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + ProjectStatusChange rejectChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectId) + .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) + .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(rejectChange)){ + processDetailVO.setFinishTime(rejectChange.getCreateOn()); + } + }else{ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); + processSchedule.add(processDetailVO); + return; + } +// processDetailVO.setProcessProgressVo(project.getSjlsResult()); + processDetailVO.setContent(project.getSjlsResult()); + processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/TenderPurchaseHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/TenderPurchaseHandle.java new file mode 100644 index 0000000..528caff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/TenderPurchaseHandle.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.projectlib.handle; + +import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; + +import java.util.*; +import java.util.stream.Collectors; + +import com.hz.pm.api.common.constant.BizConst; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.enums.StepStatusEnum; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectService; + +/** + * 招标采购处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(9) +@Component +public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { + private final INdProjectStatusChangeService projectStatusChangeService; + private final IProjectService projectService; + + private Integer order = 9; + + /** + * 项目状态为:建设中及之后的状态 + */ + private static final List TENDER_PURCHASE_LIST_STATUS = Arrays.asList( + UNDER_CONSTRUCTION, + TO_BE_FINALLY_INSPECTED, + FINAL_ACCEPTANCE_IS_UNDER_REVIEW, + FINAL_ACCEPTANCE_REVIEW_FAILED, + ARCHIVED, + ACCEPTED + ); + + public TenderPurchaseHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + this.projectStatusChangeService = projectStatusChangeService; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + // 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 + Project project = projectService.getNewProject(projectId); + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + Integer status = project.getStatus(); + // 未进行立项批复 + if (Objects.isNull(project.getApprovalDate())){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); + processSchedule.add(processDetailVO); + return; + } + List fieldList = CollUtils.fieldList(TENDER_PURCHASE_LIST_STATUS, ProjectStatusEnum::getCode); + // 进行了立项批复且项目状态是待采购 + if (ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus())){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + }else if (fieldList.contains(status)){ + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + // 根据采购备案的时间获取 + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1)); + processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); + } + processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java new file mode 100644 index 0000000..841eb06 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java @@ -0,0 +1,139 @@ +package com.hz.pm.api.projectlib.handle; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; + +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * 单位内部审核处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Order(2) +@Component +public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { + + private final IProjectInstService projectInstService; + + private final ProcessInstanceService processInstanceService; + private final BuildUserUtils buildUserUtils; + private final ProjectVersionUtil projectVersionUtil; + private final IProjectService projectService; + + private Integer order = 2; + + public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + this.buildUserUtils = buildUserUtils; + this.projectVersionUtil = projectVersionUtil; + this.projectService = projectService; + } + + @Override + void businessHandle(Long projectId, List processSchedule) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + Project project = projectService.getById(projectId); + List allVersionProjectIds = projectService.getAllVersionProjectId(project); + // 根据项目ID查询出单位内部审核流程的流程状态 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectIds) + .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .orderByDesc(ProjectInst::getCreatOn) + .last(BizConst.LIMIT_1)); + ProcessProgressVo instanceDetail = null; + + // 未找到当前版本项目的单位内部审核流程且当前项目版本号大于1(是被驳回重新申报的项目) + // 注意:已经在项目库中的项目,一定是单位内部审核已经开始的项目 + if (Objects.isNull(projectInst)) { + if (project.getVersion() > CommonConst.VERSION_ONE){ + // 获取上个版本的信息 + instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId, InstTypeEnum.UNIT_INNER_AUDIT); + } + }else { + String instCode = projectInst.getInstCode(); + instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + } + if (Objects.isNull(instanceDetail)){ + throw new BizException("未获取到单位内部审核流程详情!"); + } + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + + // 装配节点审核人员信息 + List progressInfo = instanceDetail.getProgressInfo(); + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + // 根据流程处理详情获取流程完成时间 + if (StepStatusEnum.contains(processDetailVO.getStepStatus(), + Lists.newArrayList(StepStatusEnum.REJECTED, + StepStatusEnum.COMPLETED))) { + // 如果是驳回,获取流程信息时可能 + ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); + processDetailVO.setFinishTime(finishTime); + } + }else { + LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); + processDetailVO.setFinishTime(finishTime); + } + processDetailVO.setProcessProgressVo(instanceDetail); + processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); + processSchedule.add(processDetailVO); + } + + @Override + Integer getOrder() { + return order; + } + + @Override + void setOrder(Integer order) { + this.order = order; + } + + private void buildUser(List progressInfo, Map userMap) { + for (ProgressNode progressNode : progressInfo) { + progressNode.setUser(userMap.get(progressNode.getUserId())); + if (CollUtil.isNotEmpty(progressNode.getChildren())) { + buildUser(progressNode.getChildren(), userMap); + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java new file mode 100644 index 0000000..dac29c1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.projectlib.helper; + +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; + +import cn.hutool.core.collection.CollUtil; + +import java.util.List; +import java.util.Map; + +/** + *

+ * ProjectHelper + *

+ * + * @author WendyYang + * @since 14:15 2023/2/11 + */ +public class ProjectHelper { + + /** + * 通用项目查询 + * + * @param req 查询条件 + * @return / + **/ + public static LambdaQueryWrapper projectQuery(ProjectListReq req) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode()) + .eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) + .like(req.getProjectName() != null, Project::getProjectName, req.getProjectName()) + .eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType()) + .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) + .eq(req.getStage() != null, Project::getStage, req.getStage()) + .eq(req.getStatus() != null, Project::getStatus, req.getStatus()) + // 申报金额 + .ge(req.getDeclareAmountMin() != null, Project::getDeclareAmount, req.getDeclareAmountMin()) + .le(req.getDeclareAmountMax() != null, Project::getDeclareAmount, req.getDeclareAmountMax()) + // 申报时间 + .ge(req.getCreateOnMin() != null, Project::getCreateOn, req.getCreateOnMin()) + .le(req.getCreateOnMax() != null, Project::getCreateOn, req.getCreateOnMax()) + // 批复金额 + .ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin()) + .le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax()) + + .like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg()) + .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .eq(req.getSuperOrgCode() != null, Project::getSuperOrgCode, req.getSuperOrgCode()) + .eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment()) + //状态 阶段 list + .in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList()) + .in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList()) + //实例code + .in(CollUtil.isNotEmpty(req.getInstCodes()),Project::getInstCode,req.getInstCodes()) + //已添加评价计划的项目code + .notIn(CollUtil.isNotEmpty(req.getProjectCodes()),Project::getProjectCode,req.getProjectCodes()) + .orderByDesc(Project::getUpdateOn); + return query; + } + + /** + * 转换VO + * @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); + return appVo; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectRenewwalFundHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectRenewwalFundHelper.java new file mode 100644 index 0000000..304379f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectRenewwalFundHelper.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.projectlib.helper; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; + +import java.util.List; +import java.util.Map; + +/** + *

+ * ProjectRenewwalFundHelper + *

+ * + * @author ZPF + * @since 14:15 2023/11/16 + */ +public class ProjectRenewwalFundHelper { + + /** + * 通用项目查询 + * + * @param req 查询条件 + * @return / + **/ + public static LambdaQueryWrapper projectQuery(ProjectRenewalListReq req) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode()) + .eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) + .like(req.getProjectName() != null, Project::getProjectName, req.getProjectName()) + .eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType()) + .eq(req.getStage() != null, Project::getStage, req.getStage()) + .eq(req.getStatus() != null, Project::getStatus, req.getStatus()) + + //状态 阶段 list + .in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList()) + .in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList()) + .orderByDesc(Project::getUpdateOn); + return query; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java new file mode 100644 index 0000000..3be4714 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -0,0 +1,493 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +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.fastjson.JSON; +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.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.entity.ExcelExportWriter; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.utils.DataScopeUtil; +import com.hz.pm.api.projectlib.enumeration.ProjectLibFlagEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.dto.AnnualLibExportDTO; +import com.hz.pm.api.projectlib.model.dto.AnnualLibImportDTO; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq; +import com.hz.pm.api.projectlib.model.req.ProjectIdReq; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; +import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.ss.usermodel.Workbook; +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.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; +import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; + +/** + *

+ * AnnualPlanLibManage + *

+ * + * @author WendyYang + * @since 14:09 2023/2/11 + */ +@Component +@AllArgsConstructor +@Slf4j +public class AnnualPlanLibManage { + + private final IProjectService projectService; + + private final IProjectApplicationService applicationService; + private final StateMachineUtils stateMachine; + private final UserInfoHelper userInfoHelper; + private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; + + /** + * 年度计划查询状态 + */ + private static final List ANNUAL_PLAN_LIST_STATUS = + Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED, + PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION, + TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED); + + public PageVo annulPlanLibList(ProjectListReq req) { + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + Integer isTemporaryAugment = req.getIsTemporaryAugment(); + if (Objects.isNull(isTemporaryAugment)) { + throw new BizException("请传入是否临时增补标志!"); + } + query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); + query.eq(Project::getNewest, Boolean.TRUE); + query.orderByDesc(Project::getAnnualPlanAddTime); + query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); + // 数据权限 + buildProjectLibPermission(query); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + PageVo result = PageVo.of(new ArrayList<>(), total); + page.getRecords().forEach(w -> { + AnnualPlanListItemVO item = new AnnualPlanListItemVO(); + item.setProjectId(w.getId()); + item.setProjectId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectYear(w.getProjectYear()); + item.setProjectType(w.getProjectType()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setBuildOrg(w.getBuildOrgName()); + item.setCreateOn(w.getCreateOn()); + item.setApprovalAmount(w.getApprovalAmount()); + item.setIsStartDeclaredProject(!IN_THE_ANNUAL_PLAN.eq(w.getStatus())); + result.getRecords().add(item); + }); + return result; + } + + @Transactional(rollbackFor = Exception.class) + public void startProjectDeclared(StartProjectDeclareReq req) { + List projects = projectService.listByIds(req.getProjectIds()); + projects.forEach(w -> { + if (!IN_THE_ANNUAL_PLAN.eq(w.getStatus())) { + throw BizException.wrap("开启方案申报失败"); + } + }); + projects.forEach(project -> { + try { + stateMachine.pass(project); + } catch (Exception e) { + throw new BizException("开启方案申报失败"); + } + }); + projectService.updateBatchById(projects); + } + + @Transactional(rollbackFor = Exception.class) + public void projectApproved(ProjectApprovedReq req) { + 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); + //立项批复总投资 + project.setApprovalAmount(req.getApprovedAmount()); + //立项批复预算 + project.setApprovalBudget(req.getApprovalBudget()); + 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){ + if (Objects.nonNull(req.getApprovedDate()) && Objects.nonNull(req.getBuildCycle())) { + return req.getApprovedDate().plusMonths(req.getBuildCycle()); + } + return null; + } + + @Transactional(rollbackFor = Exception.class) + public void suspendAnnualPlan(ProjectIdReq req) { + Project project = projectService.getById(req.getProjectId()); + stateMachine.reject(project); + projectService.updateById(project); + } + + public void updateAnnualPlan(ProjectDTO req) { + Project project = BeanUtil.copyProperties(req, Project.class); + projectService.updateById(project); + } + + public void exportList(ProjectListReq param, HttpServletResponse response) { + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); + Integer isTemporaryAugment = param.getIsTemporaryAugment(); + if (Objects.isNull(isTemporaryAugment)) { + throw new BizException("请传入是否临时增补标志!"); + } + param.setIsTemporaryAugment(isTemporaryAugment); + param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + query.eq(Project::getNewest, Boolean.TRUE); + query.orderByDesc(Project::getAnnualPlanAddTime); + List projects = projectService.list(query); + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + String fileName = null; + if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { + fileName = "年度计划库列表"; + } else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { + fileName = "年度计划增补库列表"; + } + excelExportWriter.setFileName(fileName); + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + // 表体行数据集合 + List> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects); + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + } + + /** + * build 项目的角色权限到req + * + * @param query + */ + public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + return user; + } + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + // 普通用户 只能看到自己单位去申报的 + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + break; + case COMPANY_MANAGER: + // 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + break; + case SUPER_ADMIN: + // 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + break; + case REGION_MANAGER: + // 区域管理员 看到自己区域的项目 + query.eq(Project::getAreaCode, user.getRegionCode()); + break; + default: + // 没有权限的话 就让它查不到 + query.eq(Project::getId, "NULL"); + break; + } + return user; + } + + @Transactional(rollbackFor = Exception.class) + public void importAnnualPlan(ProjectLibFlagEnum importFlag, MultipartFile file) { + Long userId = LoginUserUtil.getUserId(); + ImportParams params = new ImportParams(); + // 标题行数 + params.setTitleRows(2); + // 从第几行开始,因为第一、二个大标题被上面的参数给占了,所以不是5 + params.setHeadRows(3); + // 表格数量 + params.setSheetNum(2); + List list = null; + try { + list = ExcelImportUtil.importExcel(file.getInputStream(), AnnualLibImportDTO.class, params); + } catch (Exception e) { + throw new BizException(e.getMessage()); + } + // 筛选出导入的新建项目 + List newList = + list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); + List projectList = newList.stream().map(n -> { + Project project = new Project(); + assemblyProjectInfo(n, project); + // 根据传入标志判断是否临时增补 + if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)) { + project.setIsTemporaryAugment(CommonEnum.NO.getCode()); + } else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)) { + project.setIsTemporaryAugment(CommonEnum.YES.getCode()); + } + project.setCreateBy(userId); + project.setUpdateBy(userId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + return project; + }).collect(Collectors.toList()); + // 保存到项目库中 + projectService.saveOrUpdateBatch(projectList); + + // 筛选出导入的续建项目 + List continuedList = list.stream() + .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); + List renewalFundDeclarationList = continuedList.stream().map(c -> { + ProjectRenewalFundDeclaration renewalFundDeclaration = new ProjectRenewalFundDeclaration(); + BeanUtils.copyProperties(c, renewalFundDeclaration); + renewalFundDeclaration.setAnnualPaymentAmount(c.getAnnualPlanAmount()); + renewalFundDeclaration.setOtherAmount(c.getDeclareOtherAmount()); + renewalFundDeclaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); + renewalFundDeclaration.setCreateOn(LocalDateTime.now()); + renewalFundDeclaration.setUpdateOn(LocalDateTime.now()); + return renewalFundDeclaration; + }).collect(Collectors.toList()); + // 保存到续建项目资金库中 + projectRenewalFundDeclarationService.saveBatch(renewalFundDeclarationList); + } + + private void assemblyProjectInfo(AnnualLibImportDTO data, Project project) { + Long projectId = data.getProjectId(); + // 从项目库中先查询出对应的项目ID的项目 + Project projectInfo = projectService.getById(projectId); + if (Objects.nonNull(projectInfo)){ + BeanUtils.copyProperties(projectInfo,project); + }else { + // 新增的年度计划库项目 + throw new BizException("项目库中不存在项目ID为:" + projectId + "的项目"); + } + project.setId(data.getProjectId()); + project.setProjectName(data.getProjectName()); + project.setProjectIntroduction(data.getProjectIntroduction()); + // 建设依据忽略 + project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); + String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); + if (CollectionUtils.isEmpty(Arrays.asList(dataArr))) { + throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!"); + } + project.setBeginTime(dataArr[0].trim()); + project.setEndTime(dataArr[1].trim()); + project.setDeclareAmount(data.getDeclaredAmount()); + project.setAnnualPlanAmount(data.getAnnualPlanAmount()); + project.setDeclareHaveAmount(data.getDeclareHaveAmount()); + project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); + project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); + project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); + project.setDeclareOtherAmount(data.getDeclareOtherAmount()); + project.setEngineeringSpeedOne(data.getFirstQuarter()); + project.setEngineeringSpeedTwo(data.getSecondQuarter()); + project.setEngineeringSpeedThree(data.getThirdQuarter()); + project.setEngineeringSpeedFour(data.getFourthQuarter()); + project.setBuildOrgName(data.getBuildUnitName()); + project.setContactName(data.getContactName()); + project.setResponsibleMan(data.getResponsibleMan()); + project.setProjectRemarks(data.getProjectRemarks()); + } + + public void exportModifyList(ProjectListReq param, HttpServletResponse response) { + int year = LocalDateTime.now().getYear(); + Integer isTemporaryAugment = param.getIsTemporaryAugment(); + if (Objects.isNull(isTemporaryAugment)) { + throw new BizException("请传入是否临时增补标志!"); + } + param.setIsTemporaryAugment(isTemporaryAugment); + String fileName = null; + // 设置excel的文件名称和是否增补 + if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { + fileName = "丽水市" + year + "年数字化项目年度计划库编辑表"; + } else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { + fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; + } + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); + query.orderByDesc(Project::getAnnualPlanAddTime); + query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); + // 数据权限 + buildProjectLibPermission(query); + List projects = projectService.list(query); + List list = projects.stream().map(p -> { + AnnualLibExportDTO dto = new AnnualLibExportDTO(); + BeanUtils.copyProperties(p, dto); + String beginTime = p.getBeginTime(); + String begin = beginTime.replace(StrPool.DASH, CommonConst.YEAR); + begin = begin + CommonConst.MONTH; + String endTime = p.getEndTime(); + String end = endTime.replace(StrPool.DASH, CommonConst.YEAR); + end = end + CommonConst.MONTH; + String buildCycle = begin + CommonConst.ZHI + end; + dto.setBuildCycle(buildCycle); + dto.setProjectId(p.getId()); + dto.setDeclaredAmount(p.getDeclareAmount()); + dto.setBuildUnitName(p.getBuildOrgName()); + String buildBasis = p.getBuildBasis(); + List fileArray = JSON.parseArray(buildBasis, JSONObject.class); + List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.TITLE) + + StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); + String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + dto.setBuildBasis(basis); + if (CommonEnum.YES.getCode().equals(p.getIsFirst())) { + dto.setIsFirst(CommonConst.NEW_CONSTRUCTION); + } else if (CommonEnum.NO.getCode().equals(p.getIsFirst())) { + dto.setIsFirst(CommonConst.CONTINUED_CONSTRUCTION); + } + dto.setFirstQuarter(p.getEngineeringSpeedOne()); + dto.setSecondQuarter(p.getEngineeringSpeedTwo()); + dto.setThirdQuarter(p.getEngineeringSpeedThree()); + dto.setFourthQuarter(p.getEngineeringSpeedFour()); + return dto; + }).collect(Collectors.toList()); + + int count = 0; + for (AnnualLibExportDTO annualLibExportDTO : list) { + count++; + annualLibExportDTO.setSerialNumber(count); + } + + // 获取本地目录的年度计划编辑表Excel模板 + File directory = new File(""); + String templateName = "丽水市" + year + "年数字化项目年度计划编辑表"; + String templatePath = + directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; + TemplateExportParams temp = new TemplateExportParams(templatePath); + temp.setSheetNum(new Integer[] {0, 1}); + temp.setSheetName(new String[] {"实施类(新建)", "实施类(续建)"}); + Map map = new HashMap<>(4); + map.put("mapList", list); + map.put("mapList1", Lists.newArrayList()); + Workbook workbook = ExcelExportUtil.exportExcel(temp, map); + if (CollUtil.isEmpty(list)) { + // 输出空模板 + // 获取本地目录的年度计划编辑表空Excel模板 + String emptyTemplate = "丽水市" + year + "年数字化项目年度计划编辑表(空)"; + try { + InputStream templateInputStream = + this.getClass().getClassLoader().getResourceAsStream("template" + File.separator + emptyTemplate + ".xls"); + + OutputStream outputStream = response.getOutputStream(); + // 设置要下载的文件的名称 + response.setHeader("Content-disposition", "attachment;fileName=" + new String(templateName.getBytes("UTF-8"),"ISO8859-1")); + // 设置文件的MIME类型 + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + + byte[] b = new byte[2048]; + int len; + while ((len = templateInputStream.read(b)) != -1) { + outputStream.write(b, 0, len); + } + templateInputStream.close(); + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + throw new BizException("读取模板失败!"); + } + return; + } + if (workbook == null){ + throw new BizException("读取编辑表模板失败!"); + } + // 重置响应对象 + response.reset(); + try { + response.setHeader("Content-disposition", + "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expires", 0); + // 写出数据输出流到页面 + try { + OutputStream output = response.getOutputStream(); + BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output); + workbook.write(bufferedOutPut); + bufferedOutPut.flush(); + bufferedOutPut.close(); + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java new file mode 100644 index 0000000..ca3f8a6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java @@ -0,0 +1,179 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.ApiResponse; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.util.HmacAuthUtil; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.dto.ApplicationAppCodeSaveDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +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.*; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +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; + +/** + *

+ * ApplicationManage + *

+ * + * @author ZPF + * @since 14:19 2023/2/1 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ApplicationManage { + + @Value("${irs.app-report.url}") + private String url; + + @Value("${irs.app-report.appKey}") + private String appKey; + + @Value("${irs.app-report.appScret}") + private String appScret; + + private final IProjectApplicationService applicationService; + + private final IProjectService projectService; + + /** + * 保存 appCode + * @param dto + * @return + */ + public String saveAppCode(ApplicationAppCodeSaveDTO dto) { + Long userId = LoginUserUtil.getUserId(); + ProjectApplication app = applicationService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(app)).throwMessage("该应用不存在"); + + app.setAppCode(dto.getAppCode()); + app.setUpdateOn(LocalDateTime.now()); + app.setUpdateBy(userId); + if(applicationService.updateById(app)){ + return BizConst.SAVE_SUCCESS; + } + return BizConst.SAVE_FAIL; + } + + /** + * 获取试运行报告 + * @param appCode + * @return + */ + public String getReport(String appCode) { + String method = HttpMethod.GET.name(); + String appUrl = url + "?appCode=" + appCode; + + Map header = HmacAuthUtil.generateHeader(appUrl, method, appKey, appScret); + //请求头 + HttpHeaders headers = new HttpHeaders(); + + for(Map.Entry entry : header.entrySet()){ + headers.add(entry.getKey(), entry.getValue()); + } + //封装请求头 + HttpEntity> formEntity = new HttpEntity>(headers); + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class); + + log.info("forEntity:",JSON.toJSONString(forEntity)); + log.info("body:",forEntity.getBody()); + ApiResponse body = forEntity.getBody(); + + if(!body.getCode().equals(HttpStatus.OK.value())){ + throw new BizException(body.getMessage()); + } + + Object data = body.getData(); + if(Objects.nonNull(data)){ + JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data)); + JSONArray resourceList = dataJson.getJSONArray("resourceList"); + if(CollUtil.isNotEmpty(resourceList)){ + JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0))); + if(StringUtils.isBlank(resource.getString("reportOss"))){ + //暂时没有 appCode 所以先返回测试数据 + return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D"; + }else{ + return resource.getString("reportOss"); + } + } + } + throw new BizException("获取报告失败!"); + } + + /** + * 查询 待注册的 + * @param req + * @return + */ + public PageVo toRegisterAppProjectLibList(ProjectListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + //建设单位 就是当前人的单位 + String orgCode = user.getEmpPosUnitCode(); + Page page = req.page(); + projectService.page(page,Wrappers.lambdaQuery(Project.class) + .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) + .eq(Project::getStatus, ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()) + .eq(Project::getBuildOrgCode,orgCode)); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List projectCodes = page.getRecords().stream().map(Project::getProjectCode).collect(Collectors.toList()); + //要去查询应用 此阶段 必定是 建设方案后的 所以直接查 建设方案的应用 + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getProjectCode, projectCodes) + .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); + Map> appMap = apps.stream().collect(Collectors.groupingBy(ProjectApplication::getProjectCode)); + List res = page.getRecords().stream().map(p -> { + ProjectDetailVO vo = BeanUtil.copyProperties(p,ProjectDetailVO.class); + if(appMap.containsKey(p.getProjectCode())){ + List projectApplications = appMap.get(p.getProjectCode()); + vo.setProjectApplications(convert(projectApplications)); + } + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + private List convert(List projectApplications) { + if(CollUtil.isNotEmpty(projectApplications)){ + return projectApplications.stream() + .map(a -> BeanUtil.copyProperties(a,ProjectApplicationVO.class)) + .collect(Collectors.toList()); + } + return Collections.emptyList(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java new file mode 100644 index 0000000..cc18421 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java @@ -0,0 +1,146 @@ +package com.hz.pm.api.projectlib.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.model.dto.ProjectCollectionSaveDTO; +import com.hz.pm.api.projectlib.model.entity.ProjectCollection; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectCollectionVO; +import com.hz.pm.api.projectlib.service.IProjectCollectionService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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 ProjectCollectionManage + * @Description + * @Date 2023/6/25 9:13 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class ProjectCollectionManage { + + private final IProjectCollectionService collectionService; + + private final RegionCacheHelper regionCacheHelper; + + private final GenerateProjectCodeUtil generateProjectCodeUtil; + + /** + * 项目归集 + * @param req + * @return + */ + public PageVo list(ProjectListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String buildOrgCode = req.getBuildOrgCode(); + //如果是超管 可以看所有 + if(user.getSuperAdmin()){ + buildOrgCode = null; + } + + Page page = req.page(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) + .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), ProjectCollection::getBuildOrg, req.getBuildOrg()) + .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); + //处理 行政区域 + if(StringUtils.isNotBlank(req.getRegionCode())){ + List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); + + if(CollUtil.isNotEmpty(regions)){ + wrapper.in(ProjectCollection::getAreaCode,regions.stream().map(RegionDTO::getRegionCode).collect(Collectors.toList())); + } + } + + collectionService.page(page,wrapper); + + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(record -> { + ProjectCollectionVO vo = BeanUtil.copyProperties(record, ProjectCollectionVO.class); + vo.setArea(regionCacheHelper.getDisplayName(record.getAreaCode(), RegionConst.RL_COUNTY)); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 项目归集详情 + * @param id + * @return + */ + public ProjectCollectionVO detail(Long id) { + ProjectCollection projectCollection = collectionService.getById(id); + + return BeanUtil.copyProperties(projectCollection,ProjectCollectionVO.class); + } + + /** + * 保存 + * @param dto + * @return + */ + public String save(ProjectCollectionSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + ProjectCollection projectCollection = BeanUtil.copyProperties(dto,ProjectCollection.class); + if(Objects.nonNull(dto.getId())){ + ProjectCollection old = collectionService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); + projectCollection.setId(dto.getId()); + }else{ + projectCollection.setProjectCode(generateProjectCodeUtil.generateProjectCode(projectCollection)); + projectCollection.setCreateBy(user.getUsername()); + projectCollection.setCreateOn(LocalDateTime.now()); + } + + projectCollection.setUpdateBy(user.getUsername()); + projectCollection.setUpdateOn(LocalDateTime.now()); + if(collectionService.saveOrUpdate(projectCollection)){ + return BizConst.SAVE_SUCCESS; + } + return BizConst.SAVE_FAIL; + } + + /** + * 删除 + * @param id + * @return + */ + public String delete(Long id) { + ProjectCollection projectCollection = collectionService.getById(id); + + VUtils.isTrue(Objects.isNull(projectCollection)).throwMessage("该项目归集不存在 删除失败"); + + if(collectionService.removeById(id)){ + return "删除成功"; + } + return "删除失败"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java new file mode 100644 index 0000000..fd3037b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -0,0 +1,1708 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.collection.CollUtil; +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; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.File; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.compare.CompareUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.entity.ExcelExportWriter; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.dashboard.handle.ApplicationHandler; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.utils.DataScopeUtil; +import com.hz.pm.api.expert.model.entity.ExpertReview; +import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; +import com.hz.pm.api.expert.service.IExpertReviewService; +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; +import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; +import com.hz.pm.api.gov.utils.ProjectConvertUtil; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.model.entity.Tag; +import com.hz.pm.api.portrait.model.vo.TagVO; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.portrait.service.ITagService; +import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; +import com.hz.pm.api.projectdeclared.model.entity.*; +import com.hz.pm.api.projectdeclared.model.vo.*; +import com.hz.pm.api.projectdeclared.service.*; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.constant.ProjectConstant; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.*; +import com.hz.pm.api.projectlib.model.po.ProjectPO; +import com.hz.pm.api.projectlib.model.req.ProjectApplicationListReq; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.AnnualAmountVO; +import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.service.*; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; +import com.hz.pm.api.safety.model.vo.PersonSafetyInfoVO; +import com.hz.pm.api.safety.model.vo.SafetyMonitorVO; +import com.hz.pm.api.safety.model.vo.SupplierSafetyQualificationVO; +import com.hz.pm.api.safety.service.IPersonSafetyInfoService; +import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; +import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; +import com.hz.pm.api.todocenter.service.ITodoService; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.TaskService; +import org.flowable.task.api.Task; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * ProjectLibManage + *

+ * + * @author WendyYang + * @since 14:19 2023/2/1 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProjectLibManage { + + private final IProjectService projectService; + private final IProjectApplicationService applicationService; + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; + private final ProcessExecuteChainHandle processExecuteHandle; + private final RegionCacheHelper regionCacheHelper; + private final FileService fileService; + private final IProjectApplicationService projectApplicationService; + private final GenerateProjectCodeUtil generateProjectCodeUtil; + private final IProjectInstService projectInstService; + private final StateMachineUtils stateMachineUtils; + private final INdProjectDelayApplyService projectDelayApplyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; + private final IDingOrganizationService dingOrganizationService; + private final IContractService contractService; + private final IPurchaseService purchaseService; + private final IPreInsAcceptancePersonService acceptancePersonService; + private final IPaymentPlanService paymentPlanService; + 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; + + private final ApplicationHandler applicationHandler; + + private final TaskService taskService; + + private final UserInfoHelper userInfoHelper; + + private final IExpertReviewService expertReviewService; + + public PageVo projectLibList(ProjectListReq req) { + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + query.eq(Project::getNewest, Boolean.TRUE); + Page page = projectService.page(req.page(), query); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + // + List projectCodes = page.getRecords().stream() + .map(Project::getProjectCode).collect(Collectors.toList()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projectCodes)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .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()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + 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, page.getTotal()); + } + + public PageVo projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + user = buildProjectLibPermission(query, user); + //项目查最新 + query.eq(Project::getNewest, Boolean.TRUE); + Page page = projectService.page(req.page(), query); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + 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; + + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projectCodes)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .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()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && 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, page.getTotal()); + } + + /** + * 项目列表带当前审批人(工作流的) + * @param req + * @param user + * @return + */ + public PageVo projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) { + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + user = buildProjectLibPermission(query, user); + //项目查最新 + query.eq(Project::getNewest, Boolean.TRUE); + Page page = projectService.page(req.page(), query); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set instCodes = page.getRecords().stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode())) + .map(Project::getInstCode).collect(Collectors.toSet()); + List tasks = taskService.createTaskQuery() + .processInstanceIdIn(instCodes) + .orderByTaskCreateTime() + .asc() + .list(); + Map> map = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(tasks)){ + map = tasks.stream() + .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + userMap = searchUser(tasks,userInfoHelper); + } + + List records = Lists.newArrayList(); + for(Project w : page.getRecords()){ + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + item.setCanPreDeclared(Boolean.TRUE); + } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setPrePlanProjectId(w.getPrePlanProjectId()); + records.add(item); + } + return PageVo.of(records, page.getTotal()); + } + + private List buildApproveUsers(String instCode, Map> map, + Map userMap) { + if(map.containsKey(instCode)){ + List tasks = map.get(instCode); + return tasks.stream().map(task -> userMap.get(task.getAssignee())) + .filter(Objects::nonNull).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + private Map searchUser(List tasks, UserInfoHelper userInfoHelper) { + if(CollUtil.isEmpty(tasks)){ + return Collections.emptyMap(); + } + List users = userInfoHelper.getUserFullInfoByEmployeeCodes( + tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); + if(CollUtil.isNotEmpty(users)){ + Set employeeSet = Sets.newHashSet(); + return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors + .toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); + } + return Collections.emptyMap(); + } + + /** + * 项目申报和项目归集的并集 + * @param req + * @param user + * @return + */ + public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { + req = buildProjectLibPermission(req,user); + Page page = projectService.pageAllWithPermission(req.page(), req); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set projectCodes = page.getRecords().stream() + .map(ProjectPO::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; + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projectCodes)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .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()); + item.setFromType(w.getFromType()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && 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, page.getTotal()); + } + + public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { + req = buildProjectLibPermission(req,user); + Page page = projectService.pagelibWithPermission(req.page(), req); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set projectCodes = page.getRecords().stream() + .map(ProjectPO::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; + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projectCodes)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .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()); + item.setFromType(w.getFromType()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && 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, page.getTotal()); + } + + public PageVo listWithPermissionWorkbentch(ProjectListReq req, + UserFullInfoDTO user) { + req = buildProjectLibPermission(req,user); + Page page = projectService.pagelibWithPermission(req.page(), req); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set instCodes = page.getRecords().stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode())) + .map(ProjectPO::getInstCode).collect(Collectors.toSet()); + List tasks = taskService.createTaskQuery() + .processInstanceIdIn(instCodes) + .orderByTaskCreateTime() + .asc() + .list(); + Map> map = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(tasks)){ + map = tasks.stream() + .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + userMap = searchUser(tasks,userInfoHelper); + } + + List records = Lists.newArrayList(); + for(ProjectPO w : page.getRecords()){ + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + item.setCanPreDeclared(Boolean.TRUE); + } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setPrePlanProjectId(w.getPrePlanProjectId()); + records.add(item); + } + return PageVo.of(records, page.getTotal()); + } + + public static BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { + BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; + for(ProjectRenewalFundDeclaration prf : prfs){ + res = res.add(prf.getAnnualPaymentAmount()); + } + return res; + } + + public static List convertAccmulate(ProjectPO 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; + } + + public static 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.hz.pm.api.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; + } + return getProjectDetailLogic(projectInfo); + } + + public ProjectDetailVO detailProjectCode(String projectCode) { + // 查询最新的项目申报信息 + Project projectInfo = projectService.getProjectByCode(projectCode); + if (Objects.isNull(projectInfo)) { + return null; + } + return getProjectDetailLogic(projectInfo); + } + + /** + * @param projectId 项目详情 不查询最新版本 + * @return com.hz.pm.api.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; + } + return getProjectDetailLogic(projectInfo); + } + + private ProjectDetailVO getProjectDetailLogic(Project projectInfo) { + 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(projectInfo.getId()); + vo.setProcess(todoService.getProcessDetail(req)); + + List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); + + //查询采购备案 + List purchases = purchaseService.listByProjectIds(allVersionProjectId); + vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); + + //查询合同备案 + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectCode, projectInfo.getProjectCode()) + .last(BizConst.LIMIT_1)); + ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); + vo.setContract(contractVO); + List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .eq(PaymentPlan::getProjectCode, projectInfo.getProjectCode()) + .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)); + + //查询终验信息 + vo.setFinalIrsApps(applicationHandler.generateIrsApp(projectInfo.getProjectCode())); + + //查询年度投资金额 要是已验收的项目 + 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())); + } + //专家评审 其它建议 -> 建设方案的会议 + ExpertReview finalReview = expertReviewService.getFinalReview(projectInfo.getProjectCode(), + ReviewTemplateTypeEnum.CONSTRUCTION_SCHEME_REVIEW.getCode()); + + if(Objects.nonNull(finalReview)){ + vo.setProposeAttach(finalReview.getOtherAdvice()); + vo.setBaseReviewResults(finalReview.getReviewResult()); + } + return vo; + } + + + /** + * 申报新项目时 保存项目信息和其它相关联的信息 + * + * @param projectDto + * @param instanceId + * @param employeeCode + * @return + */ + public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, + String employeeCode) { + Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE); + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); + projectInstService.save(projectInst); + return project; + } + + + /** + * 建设方案申报项目时 保存项目信息和其它相关联的信息 + * + * @param projectDto + * @param instanceId + * @param employeeCode + * @param oldProject + * @return + */ + public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, + String employeeCode, Project oldProject) { + + Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject); + // 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表 + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Project.class); + updateWrapper.set(Project::getStage, null) + .set(Project::getStatus, null) + .eq(Project::getId, oldProject.getId()); + projectService.update(updateWrapper); + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()); + projectInstService.save(projectInst); + return project; + } + + /** + * 申报新项目时 保存项目信息和其它相关联的信息 + * + * @param projectDto + * @param instanceId + * @param employeeCode + * @return + */ + public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, + String employeeCode,Boolean isContruct) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + Project project = new Project(); + //为空 代表是新申报的 + if (Objects.isNull(projectDto.getId())) { + BeanUtils.copyProperties(projectDto, project); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + project.setInstCode(instanceId); + project.setSponsor(employeeCode); + String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); + project.setProjectCode(projectCode); + if(projectService.save(project)){ + saveApplication(projectDto,project,null); + } + } else { + //否则是重新提交的 新生成一个新版本的项目 + project = newProjectWithVersion(projectDto,isContruct); + if (Objects.nonNull(project)) { + project.setInstCode(instanceId); + project.setSponsor(employeeCode); + projectService.updateById(project); + } + } + return project; + } catch (Exception e) { + log.error("项目信息入库错误 " + e); + throw new BusinessException("项目信息入库错误 :" + e); + } + } + + /** + * 建设方案申报项目时 保存项目信息和其它相关联的信息 + * + * @param projectDto + * @param instanceId + * @param employeeCode + * @param oldProject + * @return + */ + public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId, + String employeeCode, Project oldProject) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + Project project = new Project(); + //为空 代表是新申报的 + if (Objects.isNull(projectDto.getId())) { + BeanUtils.copyProperties(projectDto, project); + // 被撤回重新申报的项目,项目ID要置空 + project.setId(null); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + project.setInstCode(instanceId); + project.setSponsor(employeeCode); + // 项目编号不变,版本号加1 + project.setProjectCode(oldProject.getProjectCode()); + project.setVersion(oldProject.getVersion() + 1); + // 标记为建设方案申报 + project.setIsConstruct(Boolean.TRUE); + project.setIsBackReject(Boolean.FALSE); + // 保存初步方案项目ID + if (Boolean.TRUE.equals(oldProject.getIsConstruct())) { + // 重新提交 + project.setPrePlanProjectId(oldProject.getPrePlanProjectId()); + } else { + project.setPrePlanProjectId(oldProject.getId()); + } + if(projectService.save(project)){ + saveApplication(projectDto,project,Boolean.TRUE); + + // 将旧的项目版本置为不是最新 + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + } + + } else { + //否则是被驳回,重新提交的 新生成一个新版本的项目 + project = newProjectWithVersion(projectDto,Boolean.TRUE); + if (Objects.nonNull(project)) { + project.setInstCode(instanceId); + project.setSponsor(employeeCode); + projectService.updateById(project); + } + } + return project; + } catch (Exception e) { + log.error("项目信息入库错误 " + e); + throw new BusinessException("项目信息入库错误 :" + e); + } + } + + + /** + * 在其它项目阶段 保存项目信息和其它相关联的信息 + * + * @param projectDto + * @return + */ + public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + return newProjectWithVersion(projectDto,isContruct); + } catch (Exception e) { + log.error("项目信息入库错误 " + e); + throw new BusinessException("项目信息入库错误 :" + e); + } + } + + /** + * 重新提交工作流时 舍弃在原有项目修改 + * 新增一个新的项目 新的版本号 + */ + public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) { + Project oldProject = projectService.getById(projecDto.getId()); + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + project.setIsBackReject(Boolean.FALSE); + stateMachineUtils.pass(project); + projectService.save(project); + + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + saveApplication(projecDto,project,isContruct); + + return project; + } + + public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { + Project oldProject = projectService.getById(projecDto.getId()); + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + //都是在驳回 重新提交时用的 + project.setIsBackReject(Boolean.FALSE); + if (Objects.nonNull(stageCode)) { + project.setStage(stageCode); + } + if (Objects.nonNull(statusCode)) { + project.setStatus(statusCode); + } + + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + + if (projectService.save(project)) { + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + //app + saveApplication(projecDto,project,isConstruct); + } + + return project; + } + + public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) { + Project oldProject = projectService.getById(projecDto.getId()); + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + + if (projectService.save(project)) { + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(instType); + projectInstService.save(projectInst); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + //app + saveApplication(projecDto,project,isConstruct); + } + + return project; + } + + public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) { + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + + if (projectService.save(project)) { + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(instType); + projectInstService.save(projectInst); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + saveApplication(project,oldProject,null); + } + + return project; + } + + public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) { + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + // 标识保存的项目信息是否为建设方案申报项目 + project.setIsConstruct(Boolean.TRUE); + project.setIsBackReject(isBackReject); + //终验材料 + project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); + stateMachineUtils.pass(project); + + oldProject.setIsBackReject(isBackReject); + projectService.updateById(oldProject); + + if (projectService.save(project)) { + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(instType); + projectInstService.save(projectInst); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + //APP + saveApplication(project,oldProject,Boolean.TRUE); + } + + return project; + } + + public Project saveConstructProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + // 标识保存的项目信息是否为建设方案申报项目 + project.setIsConstruct(Boolean.FALSE); + stateMachineUtils.pass(project); + + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + + if (projectService.save(project)) { + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(instType); + projectInstService.save(projectInst); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + saveApplication(project,oldProject,Boolean.TRUE); + } + + return project; + } + + /** + * 获取项目初步方案详情 + * + * @param projectId + * @return com.hz.pm.api.projectlib.model.vo.ProjectDetailVO + * @author CMM + * @since 2023/07/12 11:43 + */ + public ProjectDetailVO getPrePlanProjectDetail(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, Boolean.FALSE) + .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); + + Optional.ofNullable(applications).ifPresent(apps -> + vo.setProjectApplications(CollUtils.convert(apps, + ProjectHelper::convertVO) + )); + + return vo; + } + + public List processScheduleDetail(Long projectId) { + List processDetailVOS = new ArrayList<>(); + return processExecuteHandle.handle(projectId, processDetailVOS); + } + + private boolean checkCanRead(Set subOrgSet, Project project) { + // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 + HashSet borrowProjectIdSet = new HashSet<>(); + List applyBorrowProjectIdList = projectApplyBorrowService + .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) + .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); + return applyBorrowProjectIdList.contains(project.getId()); + } + + private Set getSubOrgList(String empPosUnitCode) { + HashSet orgSet = new HashSet<>(); + // 先将自己加入子集 + orgSet.add(empPosUnitCode); + Set subOrgList = dingOrganizationService + .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) + .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); + // 遍历子集 + for (String orgCode : subOrgList) { + orgSet.addAll(getSubOrgList(orgCode)); + } + return orgSet; + } + + + public void exportList(ProjectListReq param, HttpServletResponse response) { + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + query.eq(Project::getNewest, Boolean.TRUE); + List projects = projectService.list(query); + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + + String fileName = "项目库列表"; + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + // 表体行数据集合 + List> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects); + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + } + + /** + * build 项目的角色权限到req + * + * @param query + */ + public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + return user; + } + + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 只能看到自己单位去申报的 + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + break; + case COMPANY_MANAGER: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()).or(q2 -> + q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) + .eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) + .eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); + break; + case SUPER_ADMIN: + //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + break; + case REGION_MANAGER: + //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 + if (RegionConst.RC_LS.equals(user.getRegionCode())) { + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + RegionConst.RL_CITY); + query.in(Project::getAreaCode, regionCodes); + } else { + query.eq(Project::getAreaCode, user.getRegionCode()); + } + break; + case VISITOR: + //访客可以看全市的 + break; + case DASHBOARD: + break; + default: + //没有权限的话 就让它查不到 + query.eq(Project::getId, 0L); + break; + } + return user; + } + + public ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) { + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + return req; + } + + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 只能看到自己单位去申报的 + req.setUserType("normal"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case COMPANY_MANAGER: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + req.setUserType("org"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case SUPER_ADMIN: + //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + break; + case REGION_MANAGER: + //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 + if (RegionConst.RC_LS.equals(user.getRegionCode())) { + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + RegionConst.RL_CITY); + req.setRegionCodes(regionCodes); + } else { + req.setUserRegionCode(user.getRegionCode()); + } + req.setUserType("region"); + break; + case VISITOR: + //访客可以看全市的 + break; + case DASHBOARD: + break; + default: + //没有权限的话 就让它查不到 + req.setId(0L); + break; + } + return req; + } + + public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { + + // 更新项目流程实例ID + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + + // 保存延期申请信息和申请延期前项目建设周期和验收时间 + ProjectDelayApply projectDelayApply = new ProjectDelayApply(); + projectDelayApply.setDelayTime(dto.getDelayedMonth()); + projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); + projectDelayApply.setDelayApplyReason(dto.getDelayedReason()); + projectDelayApply.setProjectId(project.getId()); + projectDelayApply.setInstanceId(instanceId); + projectDelayApply.setCreateBy(LoginUserUtil.getUserId()); + projectDelayApply.setCreateOn(LocalDateTime.now()); + projectDelayApply.setUpdateBy(LoginUserUtil.getUserId()); + projectDelayApply.setUpdateOn(LocalDateTime.now()); + projectDelayApplyService.save(projectDelayApply); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setInstType(InstTypeEnum.APPLY_DELAY.getCode()); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInstService.save(projectInst); + } + + public void saveProjectByApplyBorrow(Project project, UserFullInfoDTO user, String instanceId) { + // 更新项目流程实例ID + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + + // 保存项目借阅信息 + ProjectApplyBorrow projectApplyBorrow = new ProjectApplyBorrow(); + projectApplyBorrow.setProjectId(project.getId()); + projectApplyBorrow.setApplyBorrowEmployeeCode(user.getEmployeeCode()); + projectApplyBorrow.setApplyBorrowEmpPosUnitCode(user.getEmpPosUnitCode()); + projectApplyBorrow.setInstanceId(instanceId); + projectApplyBorrow.setCreateOn(LocalDateTime.now()); + projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); + projectApplyBorrow.setUpdateOn(LocalDateTime.now()); + projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); + projectApplyBorrow.setIsSuccess(Boolean.FALSE); + projectApplyBorrowService.save(projectApplyBorrow); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setInstType(InstTypeEnum.APPLY_BORROW.getCode()); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInstService.save(projectInst); + } + + /** + * 应用列表 + * + * @param req + * @return + */ + public PageVo applicationList(ProjectApplicationListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .eq(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()); + + if (StringUtils.isNotBlank(req.getApplicationName())) { + wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName()) + .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName()))); + } + wrapper.orderByDesc(ProjectApplication::getUpdateOn); + projectApplicationService.page(page, wrapper); + + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + private List convertPersons(List acceptancePersons) { + if (CollUtil.isEmpty(acceptancePersons)) { + return Collections.emptyList(); + } + + return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); + } + + private List convertPayments(List payments, BigDecimal totalAmount) { + if (CollUtil.isEmpty(payments)) { + return Collections.emptyList(); + } + return payments.stream().map(p -> { + PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); + vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" + : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) + .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); + return vo; + }) + .collect(Collectors.toList()); + } + + /** + * 历史版本 项目列表 + * + * @param id + * @return + */ + public JSONObject historyProjects(Long id) { + JSONObject res = new JSONObject(); + Project project = projectService.getById(id); + + if (Objects.isNull(project)) { + return res; + } + + //只查 当前版本 和历史被驳回|退回的版本 + List historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, project.getProjectCode()) + .and(q1->q1.eq(Project::getNewest, Boolean.TRUE) + .or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE))) + .orderByDesc(Project::getCreateOn)); + + if (CollUtil.isEmpty(historyProjects)) { + return res; + } + + List basicProjects = historyProjects.stream() + .map(p -> this.getProjectDetailThisVersion(p.getId())) + .filter(p -> Objects.isNull(p.getIsConstruct()) || !p.getIsConstruct()) + .collect(Collectors.toList()); + List constructProjects = historyProjects.stream() + .map(p -> this.getProjectDetailThisVersion(p.getId())) + .filter(p -> Objects.nonNull(p.getIsConstruct()) && p.getIsConstruct()) + .collect(Collectors.toList()); + res.put(ProjectConstant.ProjectLib.PROJECT_BASIC, basicProjects); + res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT, constructProjects); + return res; + } + + /** + * 查看 项目的 变更记录(驳回 重新发起的 和上个版本的变更字段) + * + * @param projectId + * @return + */ + public JSONObject changeRecord(Long projectId) { + JSONObject res = new JSONObject(); + + //1.先判断下 项目存不存在 + Project project = projectService.getById(projectId); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); + + + //2.要判断 项目在当前状态 有没有被驳回和退回过 + //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 + Boolean isChangeRecord = todoService.isChangeRecord(projectId); + if (!isChangeRecord) { + return res; + } + + //3. 去对比 当前版本和上个版本 的字段对比 + String projectCode = project.getProjectCode(); + List twoVersions = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode) + .orderByDesc(Project::getVersion) + .last("limit 2")); + if (CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2) { + return res; + } + + Project lastProject = twoVersions.get(1); + Project thisProject = twoVersions.get(0); + res.put(ProjectConstant.ProjectLib.CHANGES_KEY, + new CompareUtils().compareToJson(thisProject, lastProject, null)); + ProcessDetailReq req = new ProcessDetailReq(); + req.setProjectId(lastProject.getId()); + req.setInstanceId(lastProject.getInstCode()); + res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req)); + return res; + } + + 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.forEach(app -> { + Long oldAppId = app.getId(); + app.setProjectVersion(project.getVersion()); + app.setProjectId(project.getId()); + app.setId(null); + if(Objects.nonNull(isConstruct)){ + app.setIsConstruct(isConstruct); + } + 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; + //采取批量删除 批量添加的方式 + Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; + //删除当前版本的app 一般情况是没有 保险起见 + List applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, version)); + if (CollUtil.isNotEmpty(applications)) { + projectApplicationService.removeBatchByIds(applications); + } + + if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { + Project finalProject = project; + projectDto.getApplicationList().forEach(application -> { + ProjectApplication projectApplication = new ProjectApplication(); + BeanUtils.copyProperties(application, projectApplication); + projectApplication.setId(null); + projectApplication.setProjectId(finalProject.getId()); + projectApplication.setProjectCode(finalProject.getProjectCode()); + projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); + projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); + projectApplication.setProjectVersion(version); + projectApplication.setIsConstruct(isConstruct); + if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ + projectApplication.setApplicationName(null); + } + + boolean result = projectApplicationService.save(projectApplication); + // 保存应用关联的核心业务 + List coreBusinessList = application.getCoreBusinessList(); + Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; + if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ + for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { + ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); + BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); + projectCoreBusinessIndicators.setId(null); + projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); + projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); + projectCoreBusinessIndicators.setCreateBy(user.getUsername()); + projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); + } + } + }); + } + } + + /** + * 申报项目转化为 项目归集 + * @param projectCode + * @return + */ + public GovBizProjectDetailVO convertToCollection(String projectCode) { + ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode); + return ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java new file mode 100644 index 0000000..3859ffb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -0,0 +1,653 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.EasyExcel; +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.google.common.collect.Lists; +import com.google.common.collect.Maps; +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.ExcelExportStyle; +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.utils.DataScopeUtil; +import com.hz.pm.api.gov.model.entity.GovBizProjectApply; +import com.hz.pm.api.gov.model.entity.GovBizProjectApprove; +import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; +import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo; +import com.hz.pm.api.gov.service.IGovBizProjectApplyService; +import com.hz.pm.api.gov.service.IGovBizProjectApproveService; +import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; +import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.model.entity.Tag; +import com.hz.pm.api.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; +import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; +import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; +import com.hz.pm.api.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.helper.ProjectRenewwalFundHelper; +import com.hz.pm.api.projectlib.model.dto.ProjectRenewalExportDTO; +import com.hz.pm.api.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; +import com.hz.pm.api.projectlib.model.vo.AnnualAmountVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.projectlib.model.vo.ProjectRenewalFundDeclarationVO; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * ProjectRenewalFundManage + *

+ * + * @author ZPF + * @since 14:19 2023/2/15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProjectRenewalFundManage { + + private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; + + private final IProjectService projectService; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; + + private final IGovBizProjectApplyService applyService; + + private final IGovBizProjectApproveService approveService; + + private final RegionCacheHelper regionCacheHelper; + + private final IPaymentPlanService paymentPlanService; + + /** + * 项目续建资金库列表 分页 + * @param req + * @return + */ + public PageVo list(ProjectRenewalListReq req, UserFullInfoDTO user) { + Page page = req.page(); + req = buildProjectLibPermission(req,user); + projectRenewalFundDeclarationService.pageSql(page, req); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectRenewalFundDeclarationVO item = new ProjectRenewalFundDeclarationVO(); + BeanUtils.copyProperties(w,item); + return item; + }); + return PageVo.of(records, total); + } + + public PageVo projectlist(ProjectRenewalListReq req, UserFullInfoDTO user) { + LambdaQueryWrapper query = ProjectRenewwalFundHelper.projectQuery(req); + //项目查最新 + query.eq(Project::getNewest, Boolean.TRUE); + //自己单位 + query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + //立项批复后 都可以 + query.gt(Project::getStatus,ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); + Page page = projectService.page(req.page(), query); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set projectCodes = page.getRecords().stream() + .map(Project::getProjectCode).collect(Collectors.toSet()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(projectCodes)){ + List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .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()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + item.setCanPreDeclared(Boolean.TRUE); + } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setPrePlanProjectId(w.getPrePlanProjectId()); + if(finalRenewalMap.containsKey(item.getId())){ + List prfs = finalRenewalMap.get(item.getId()); + item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(w.getAnnualPlanAmount(),prfs)); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,prfs)); + }else{ + item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,Collections.emptyList())); + } + return item; + }); + return PageVo.of(records, page.getTotal()); + } + + /** + * @param id + * @author ZPF + * @since 2023/02/15 11:15 + */ + public ProjectRenewalFundDeclarationVO detail(Long id) { + // 查询项目申报信息 + ProjectRenewalFundDeclaration renewal = projectRenewalFundDeclarationService.getById(id); + if(Objects.isNull(renewal)){ + return null; + } + ProjectRenewalFundDeclarationVO vo = new ProjectRenewalFundDeclarationVO(); + BeanUtils.copyProperties(renewal, vo); + // 查询项目信息 + Project project = projectService.getProjectByCode(renewal.getProjectCode()); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, renewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, renewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, renewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, renewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(project)){ + vo.setApprovalAmount(project.getApprovalAmount()); + vo.setProjectName(project.getProjectName()); + vo.setProjectType(project.getProjectType()); + vo.setStage(project.getStage()); + vo.setStatus(project.getStatus()); + vo.setBuildOrgName(project.getBuildOrgName()); + vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(project.getId()) + .projectCode(project.getProjectCode()) + .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()) + .projectCode(project.getProjectCode()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + }else if(Objects.nonNull(baseinfo)){ + if(Objects.nonNull(approve)){ + vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); + } + vo.setProjectName(baseinfo.getBaseProjName()); + vo.setProjectType(baseinfo.getBaseProjType()); +// vo.setStage(project.getStage()); + vo.setStatus(StringUtils.isNotBlank(baseinfo.getBaseProjSetProg()) ? + Integer.parseInt(baseinfo.getBaseProjSetProg()) : null); + vo.setBuildOrgName(baseinfo.getBaseBuildDeprt()); + vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(baseinfo.getId()) + .projectCode(baseinfo.getBaseProjId()) + .projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) + .annualAmount(apply.getBaseProjDeclAmount()) + .build()); + List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) + .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(baseinfo.getId()) + .projectCode(baseinfo.getBaseProjId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + }else if(Objects.nonNull(operationBaseinfo)){ + if(Objects.nonNull(approve)){ + vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); + } + vo.setProjectName(operationBaseinfo.getBaseProjName()); + vo.setProjectType(operationBaseinfo.getBaseProjType()); +// vo.setStage(project.getStage()); + vo.setStatus(StringUtils.isNotBlank(operationBaseinfo.getBaseProjSetProg()) ? + Integer.parseInt(operationBaseinfo.getBaseProjSetProg()) : null); + vo.setBuildOrgName(operationBaseinfo.getBaseBuildDeprt()); + vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(operationBaseinfo.getId()) + .projectCode(operationBaseinfo.getBaseProjId()) + .projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) + .annualAmount(apply.getBaseProjDeclAmount()) + .build()); + List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) + .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(operationBaseinfo.getId()) + .projectCode(operationBaseinfo.getBaseProjId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + } + return vo; + } + + /** + * 申报 + * @param dto + * @return + */ + public Long declared(ProjectRenewalFundDeclarationDTO dto) { + Integer projectYear = dto.getProjectYear(); + //要判断 项目id 是否 以及状态是 已验收 + String projectCode = dto.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectCode)); + ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); + //如果是重新申报 + if(Objects.nonNull(dto.getId())){ + 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); + + //有2个条件要判断 续建资金 + //1. 如果有审核中的 是不能继续申请的 + long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) + .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::getProjectCode, projectCode) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) + .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) + .last(BizConst.LIMIT_1)); + //如果没有续建资金信息 就要比 当前项目的年度要大 + if(Objects.isNull(lastRenewalFund)){ + if(Objects.nonNull(project)){ + VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + }else if(Objects.nonNull(apply)){ + VUtils.isTrue(StringUtils.isBlank(apply.getBaseProjSetYear()) || + Integer.parseInt(apply.getBaseProjSetYear()) >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + } + }else{ + VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + } + + //判断金额 +// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); + + declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); + if(Objects.nonNull(project)){ + declaration.setRegionCode(project.getAreaCode()); + declaration.setOrgCode(project.getBuildOrgCode()); + }else if(Objects.nonNull(baseinfo)){ + declaration.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + declaration.setOrgCode(baseinfo.getBaseBuildDeprtDing()); + }else if(Objects.nonNull(operationBaseinfo)){ + declaration.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + declaration.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); + } + + if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){ + throw new BusinessException(String.format("申报失败 【%s】",dto.getId())); + } + return declaration.getId(); + } + + //判断金额 + private void checkPaymentAmount(String projectCode, Integer projectYear, BigDecimal annualPlanAmount) { + //判断金额问题 + //1 是否有该年度的合同支付计划 + List paymentPlans = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .eq(PaymentPlan::getProjectCode, projectCode) + .orderByAsc(PaymentPlan::getPaymentTime)); + VUtils.isTrue(CollUtil.isEmpty(paymentPlans)).throwMessage("未有所选年度的支付计划,无法提交"); + Boolean hasYearPlan = Boolean.FALSE; + + for(PaymentPlan plan : paymentPlans){ + if(Objects.isNull(plan.getPaymentTime())){ + continue; + } + int year = plan.getPaymentTime().getYear(); + if(Objects.nonNull(year) && projectYear.equals(year)){ + hasYearPlan = Boolean.TRUE; + }else if(Objects.nonNull(year) && projectYear.compareTo(year) > 0){ + //2 如果有 这一年前的实际支付金额有没有填 + VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) + .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); + } + } + VUtils.isTrue(!hasYearPlan).throwMessage("未有所选年度的支付计划,无法提交"); + + //3. 算出 所能申报的最大金额 + //3.1 算出 申报年 以及 之前的所有合同计划金额 + BigDecimal planSum = BigDecimal.ZERO; + Optional planSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) && + (c.getPaymentTime().getYear() - projectYear) <= 0) + .map(c -> Objects.nonNull(c.getPaymentAmount()) ? c.getPaymentAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add); + if(planSumOp.isPresent()){ + planSum = planSumOp.get(); + } + BigDecimal actualPlanSum = BigDecimal.ZERO; + Optional actualPlanSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) && + (c.getPaymentTime().getYear() - projectYear) < 0) + .map(c -> Objects.nonNull(c.getActualPaymentAmount()) ? c.getActualPaymentAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add); + if(actualPlanSumOp.isPresent()){ + actualPlanSum = actualPlanSumOp.get(); + } + BigDecimal maxAmount = planSum.subtract(actualPlanSum); + VUtils.isTrue(annualPlanAmount.compareTo(maxAmount) > 0).throwMessage("所填年度支付金额 超出 最大限额"); + } + + + /** + * 续建项目审核 + * @param param + * @return + */ + public Long audit(ProjectRenewalAuditReq param) { + Long projectRenewalId = param.getProjectRenewalId(); + ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); + VUtils.isTrue(Objects.isNull(projectRenewal)).throwMessage("该续建信息不存在!"); + Project project = projectService.getProjectByCode(projectRenewal.getProjectCode()); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectRenewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projectRenewal.getProjectCode()) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage("关联的项目已经被删除!"); + if (Boolean.TRUE.equals(param.getResult())){ + projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PASS.name()); + }else { + String auditOpinion = param.getAuditOpinion(); + if (StrUtil.isBlank(auditOpinion)){ + throw new BizException("审核意见不能为空"); + } + projectRenewal.setAuditOpinion(auditOpinion); + projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.NOT_PASS.name()); + } + if(Objects.nonNull(project)){ + projectRenewal.setRegionCode(project.getAreaCode()); + projectRenewal.setOrgCode(project.getBuildOrgCode()); + }else if(Objects.nonNull(baseinfo)){ + projectRenewal.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + projectRenewal.setOrgCode(baseinfo.getBaseBuildDeprtDing()); + }else if(Objects.nonNull(operationBaseinfo)){ + projectRenewal.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + projectRenewal.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); + } + projectRenewal.setAuditOpinion(param.getAuditOpinion()); + projectRenewal.setUpdateOn(LocalDateTime.now()); + projectRenewalFundDeclarationService.updateById(projectRenewal); + return projectRenewal.getId(); + } + + /** + * 续建项目删除 + * @param projectRenewalId + * @return + */ + public Long delete(Long projectRenewalId) { + ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); + projectRenewal.setDeleted(true); + projectRenewal.setUpdateOn(LocalDateTime.now()); + projectRenewalFundDeclarationService.updateById(projectRenewal); + return projectRenewal.getId(); + } + + public void exportList(HttpServletResponse response, ProjectRenewalListReq param) { + + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); + Page page = param.page(); + projectRenewalFundDeclarationService.pageSql(page, param); + List records = page.getRecords(); + + List collect = records.stream().map(r -> { + ProjectRenewalExportDTO exportDTO = new ProjectRenewalExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + if (ProjectRenewalApprovalStatusEnum.PENDING.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PENDING.getDesc()); + } else if (ProjectRenewalApprovalStatusEnum.PASS.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PASS.getDesc()); + } else if (ProjectRenewalApprovalStatusEnum.NOT_PASS.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.NOT_PASS.getDesc()); + } + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + return exportDTO; + }).collect(Collectors.toList()); + + for (int i = 0; i < collect.size(); i++) { + collect.get(i).setSerialNumber(i + 1); + } + + + String fileName = "续建项目资金库列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ProjectRenewalExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportRenewalDeclareList(HttpServletResponse response, ProjectRenewalListReq param) { + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); + Page page = param.page(); + projectRenewalFundDeclarationService.pageSql(page, param); + List records = page.getRecords(); + + List collect = records.stream().map(r -> { + ProjectRenewalDeclareExportDTO exportDTO = new ProjectRenewalDeclareExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); + if (ProjectRenewalApprovalStatusEnum.PENDING.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PENDING.getDesc()); + } else if (ProjectRenewalApprovalStatusEnum.PASS.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PASS.getDesc()); + } else if (ProjectRenewalApprovalStatusEnum.NOT_PASS.name().equals(r.getApprovalStatus())) { + exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.NOT_PASS.getDesc()); + } + String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); + exportDTO.setCreateOn(createOnStr); + return exportDTO; + }).collect(Collectors.toList()); + + for (int i = 0; i < collect.size(); i++) { + collect.get(i).setSerialNumber(i + 1); + } + + String fileName = "续建项目资金申报列表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ProjectRenewalDeclareExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public ProjectRenewalListReq buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + return req; + } + + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 只能看到自己单位去申报的 + req.setUserType("normal"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case COMPANY_MANAGER: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + req.setUserType("org"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case SUPER_ADMIN: + //超级管理员 也只能看本单位的 + req.setUserType("org"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case REGION_MANAGER: + //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 + if (RegionConst.RC_LS.equals(user.getRegionCode())) { + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + RegionConst.RL_CITY); + req.setRegionCodes(regionCodes); + } else { + req.setUserRegionCode(user.getRegionCode()); + } + req.setUserType("region"); + break; + case VISITOR: + //访客可以看全市的 + break; + case DASHBOARD: + break; + default: + //没有权限的话 就让它查不到 + req.setId(0L); + break; + } + return req; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.java new file mode 100644 index 0000000..357dc39 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 项目延期申请记录表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +public interface NdProjectDelayApplyMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.xml new file mode 100644 index 0000000..d9906cb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectDelayApplyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.java new file mode 100644 index 0000000..5a690b5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-02-27 + */ +public interface NdProjectStatusChangeMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.xml new file mode 100644 index 0000000..76f9de8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/NdProjectStatusChangeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.java new file mode 100644 index 0000000..fa3d16c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +public interface ProjectApplicationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.xml new file mode 100644 index 0000000..c29f255 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectApplicationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.java new file mode 100644 index 0000000..6f80c8a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectlib.model.entity.ProjectCollection; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +public interface ProjectCollectionMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.xml new file mode 100644 index 0000000..1f6011a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectCollectionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.java new file mode 100644 index 0000000..91af495 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +public interface ProjectInstMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.xml new file mode 100644 index 0000000..2de1ec8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectInstMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.java new file mode 100644 index 0000000..e344974 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectlib.model.po.ProjectPO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-03 + */ +public interface ProjectMapper extends BaseMapper { + + Page pageAllWithPermission(Page page, @Param("req") ProjectListReq req); + + Page pagelibWithPermission(Page page, @Param("req") ProjectListReq req); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml new file mode 100644 index 0000000..defa0af --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml @@ -0,0 +1,506 @@ + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java new file mode 100644 index 0000000..46ddfc7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 续建项目资金申请表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +public interface ProjectRenewalFundDeclarationMapper extends BaseMapper { + + Page pageSql(Page page,@Param("param") ProjectRenewalListReq req); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml new file mode 100644 index 0000000..00bb3cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml @@ -0,0 +1,83 @@ + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ReviewChecklistApproveMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ReviewChecklistApproveMapper.java new file mode 100644 index 0000000..4182377 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ReviewChecklistApproveMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +public interface ReviewChecklistApproveMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibExportDTO.java new file mode 100644 index 0000000..54dfb70 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibExportDTO.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.projectlib.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + *

+ * AnnualLibImportDTO + *

+ * + * @author WendyYang + * @since 13:46 2023/2/13 + */ +@Data +public class AnnualLibExportDTO { + + @NotNull(message = "年度投资额不能为空") + @Excel(name = "年度投资额",groupName = "2023年计划") + private BigDecimal annualPlanAmount; + + @NotNull(message = "自由资金不能为空") + @Excel(name = "自有资金",groupName = "资金来源") + private BigDecimal declareHaveAmount; + @Excel(name = "政府投资-本级财政资金") + @NotNull(message = "政府投资-本级财政不能为空") + private BigDecimal declareGovOwnFinanceAmount; + @Excel(name = "政府投资-上级补助资金") + @NotNull(message = "政府投资-上级补助资金不能为空") + private BigDecimal declareGovSuperiorFinanceAmount; + @Excel(name = "银行贷款") + @NotNull(message = "银行贷款不能为空") + private BigDecimal declareBankLendingAmount; + @Excel(name = "其他") + @NotNull(message = "其他不能为空") + private BigDecimal declareOtherAmount; + + @Excel(name = "一季度",groupName = "进度和支付计划") + @NotBlank(message = "一季度不能为空") + private String firstQuarter; + @Excel(name = "二季度") + @NotBlank(message = "二季度不能为空") + private String secondQuarter; + @Excel(name = "三季度") + @NotBlank(message = "三季度不能为空") + private String thirdQuarter; + @Excel(name = "四季度") + @NotBlank(message = "四季度不能为空") + private String fourthQuarter; + + @NotNull(message = "序号不能为空") + @Excel(name = "序号") + private Integer serialNumber; + + @Excel(name = "项目id") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @Excel(name = "项目名称") + @NotBlank(message = "项目名称不能为空") + private String projectName; + + @NotBlank(message = "建设内容不能为空") + @Excel(name = "建设内容") + private String projectIntroduction; + + @NotBlank(message = "建设依据不能为空") + @Excel(name = "建设依据") + private String buildBasis; + + @Excel(name = "建设性质") + @NotBlank(message = "建设性质不能为空") + private String isFirst; + + @Excel(name = "建设起止年限(填写到月)") + @NotBlank(message = "建设起止年限不能为空") + private String buildCycle; + + @NotBlank(message = "总投资不能为空") + @Excel(name = "总投资") + private BigDecimal declaredAmount; + + @Excel(name = "建设单位") + @NotBlank(message = "建设单位不能为空") + private String buildUnitName; + + @Excel(name = "项目联系人") + @NotBlank(message = "项目联系人不能为空") + private String contactName; + + @Excel(name = "项目分管领导") + @NotBlank(message = "项目分管领导不能为空") + private String responsibleMan; + + @Excel(name = "备注") + private String projectRemarks; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java new file mode 100644 index 0000000..6ecb3f8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java @@ -0,0 +1,122 @@ +package com.hz.pm.api.projectlib.model.dto; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + *

+ * AnnualLibImportDTO + *

+ * + * @author WendyYang + * @since 13:46 2023/2/13 + */ +@Data +public class AnnualLibImportDTO { + + @Excel(name = "项目进展",groupName = "到2022年底完成情况") + @NotNull(message = "项目进展不能为空") + private String projectProgress; + @Excel(name = "累计投资") + @NotNull(message = "累计投资不能为空") + private BigDecimal cumulativeInvest; + + @NotNull(message = "年度投资额不能为空") + @Excel(name = "年度投资额",groupName = "2023年计划") + private BigDecimal annualPlanAmount; + + @NotNull(message = "自由资金不能为空") + @Excel(name = "自有资金",groupName = "资金来源") + private BigDecimal declareHaveAmount; + @Excel(name = "政府投资-本级财政资金") + @NotNull(message = "政府投资-本级财政不能为空") + private BigDecimal declareGovOwnFinanceAmount; + @Excel(name = "政府投资-上级补助资金") + @NotNull(message = "政府投资-上级补助资金不能为空") + private BigDecimal declareGovSuperiorFinanceAmount; + @Excel(name = "银行贷款") + @NotNull(message = "银行贷款不能为空") + private BigDecimal declareBankLendingAmount; + @Excel(name = "国家、省补助",groupName = "资金来源") + @NotNull(message = "国家、省补助不能为空") + private BigDecimal govSuperiorFinanceAmount; + @Excel(name = "地方财政统筹") + @NotNull(message = "地方财政统筹不能为空") + private BigDecimal govOwnFinanceAmount; + @Excel(name = "建设单位自筹") + @NotNull(message = "建设单位自筹不能为空") + private BigDecimal haveAmount; + @Excel(name = "其他") + @NotNull(message = "其他不能为空") + private BigDecimal declareOtherAmount; + + @Excel(name = "一季度",groupName = "进度和支付计划") + @NotBlank(message = "一季度不能为空") + private String firstQuarter; + @Excel(name = "二季度") + @NotBlank(message = "二季度不能为空") + private String secondQuarter; + @Excel(name = "三季度") + @NotBlank(message = "三季度不能为空") + private String thirdQuarter; + @Excel(name = "四季度") + @NotBlank(message = "四季度不能为空") + private String fourthQuarter; + + @NotNull(message = "序号不能为空") + @Excel(name = "序号") + private Integer serialNumber; + + @Excel(name = "项目id") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @Excel(name = "项目名称") + @NotBlank(message = "项目名称不能为空") + private String projectName; + + @NotBlank(message = "建设内容不能为空") + @Excel(name = "建设内容") + private String projectIntroduction; + + @NotBlank(message = "建设依据不能为空") + @Excel(name = "建设依据") + private String buildBasis; + + @Excel(name = "建设性质") + @NotBlank(message = "建设性质不能为空") + private String isFirst; + + @Excel(name = "建设周期") + @NotBlank(message = "建设周期不能为空") + private String constructionCycle; + + @Excel(name = "建设起止年限(填写到月)") + @NotBlank(message = "建设起止年限不能为空") + private String buildCycle; + + @NotBlank(message = "总投资不能为空") + @Excel(name = "总投资") + private BigDecimal declaredAmount; + + @Excel(name = "建设单位") + @NotBlank(message = "建设单位不能为空") + private String buildUnitName; + + @Excel(name = "项目联系人") + @NotBlank(message = "项目联系人不能为空") + private String contactName; + + @Excel(name = "项目分管领导") + @NotBlank(message = "项目分管领导不能为空") + private String responsibleMan; + + @Excel(name = "备注") + private String projectRemarks; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ApplicationAppCodeSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ApplicationAppCodeSaveDTO.java new file mode 100644 index 0000000..4db681d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ApplicationAppCodeSaveDTO.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.projectlib.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 项目应用保存appCode + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectApplicationSaveDTO", description = "项目应用保存appCode") +public class ApplicationAppCodeSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用的id") + @NotNull(message = "应用id必填") + private Long id; + + @ApiModelProperty("应用编码") + @NotBlank(message = "请输入应用编码") + private String appCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApplicationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApplicationDTO.java new file mode 100644 index 0000000..27b031d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApplicationDTO.java @@ -0,0 +1,175 @@ +package com.hz.pm.api.projectlib.model.dto; + +import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; +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; + +/** + *

+ * 项目应用表 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +@ApiModel(value = "NdProjectApplication对象", description = "") +@Data +public class ProjectApplicationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("是否初次建设 0否 1是") + private Integer isFirst; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("关联IRS现有应用") + private String relatedExistsApplication; + + @ApiModelProperty("关联IRS现有应用-IRS应用编码") + private String relatedExistsApplicationCode; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") + private Integer buildLevel; + + @ApiModelProperty("是否统建应用 0:否 1:是") + private Integer isUniteBuild; + + @ApiModelProperty("统建类型 1:全省统建 2:全市统建") + private Integer unionBuildKind; + + @ApiModelProperty("是否数改系统 0:否 1:是") + private Integer isDigitalModification; + + @ApiModelProperty("数改系统") + private String digitalModification; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; + + @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") + private Integer isAccountAppName; + + @ApiModelProperty("一本账应用名称") + private String accountAppName; + + @ApiModelProperty("领域大脑一本账") + private String domainBrainAccount; + + @ApiModelProperty("是否业务协同 0:否 1:是") + private Integer isBizCooperate; + + @ApiModelProperty("业务协同描述") + private String bizCooperateInfo; + + @ApiModelProperty("使用范围") + private String usesRangeRemark; + + @ApiModelProperty("应用简介") + private String applicationSummary; + + @ApiModelProperty("应用备注") + private String applicationRemark; + + @ApiModelProperty("应用总投资测算明细-文件") + private String applicationEstimateFile; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; + + @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") + private Integer nationalItSpec; + + @ApiModelProperty("是否使用政务云资源 0否 1是") + private Integer useGovCloud; + + @ApiModelProperty("云资源类型") + private String cloudsType; + + @ApiModelProperty("云资源基础规格") + private String cloudsFoundationSpecifications; + + @ApiModelProperty("云资源台数") + private Integer cloudsNumber; + + @ApiModelProperty("云资源用户描述") + private String cloudsDescription; + + @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") + private Integer netEnv; + + @ApiModelProperty("是否使用公共数据 0否 1是") + private Integer useCommonData; + + @ApiModelProperty("数据名称") + private String dataName; + + @ApiModelProperty("是否使用公共组件 0否 1是") + private Integer useCommonComponent; + + @ApiModelProperty("使用的公共组件名称") + private String commonComponents; + + @ApiModelProperty("是否产生公共组件 0否 1是") + private Integer produceCommonComponent; + + @ApiModelProperty("预计产生组件名称") + private String produceCommonComponents; + + @ApiModelProperty("试点任务名称") + private String pilotTasksName; + + @ApiModelProperty("试点任务编号") + private String pilotTasksCode; + + @ApiModelProperty("所属重大应用名称") + private String importantTaskName; + + @ApiModelProperty("所属重大应用编号") + private String importantTaskCode; + + @ApiModelProperty("所属子场景应用名称") + private String subSceneApplicationName; + + @ApiModelProperty("试点文件") + private String experimentsFile; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("应用编码") + private String appCode; + + @ApiModelProperty("核心业务列表") + private List coreBusinessList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectCollectionSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectCollectionSaveDTO.java new file mode 100644 index 0000000..babeffa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -0,0 +1,166 @@ +package com.hz.pm.api.projectlib.model.dto; + +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectCollectionSaveDTO", description = "项目归集对象保存") +public class ProjectCollectionSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("建设单位名称") + private String buildOrg; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + + @ApiModelProperty("预算来源") + private Integer budgetSource; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + 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; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java new file mode 100644 index 0000000..7803c32 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java @@ -0,0 +1,379 @@ +package com.hz.pm.api.projectlib.model.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * + *

+ * + * @author zpf + * @since 2023-02-03 + */ +@Data +@ApiModel(value = "NdProjectDto", description = "") +public class ProjectDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("如果是通过草稿箱提交的 要传下草稿id") + private Long draftId; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") + private Integer bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + private Integer isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + @ApiModelProperty("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("项目应用实例") + private List applicationList; + + @ApiModelProperty("流程状态") + private Integer processStatus; + + @ApiModelProperty("项目发起人 员工code") + private String sponsor; + + @ApiModelProperty("预审发起人 员工code") + private String preStartUserId; + + @ApiModelProperty("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + + @ApiModelProperty("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("终验材料") + private String finalAcceptanceMaterials; + + private Map dynamicForm; + + //P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级 + private String baseLowestLevel; + + //01评审中;02待立项;03已驳回;04已立项;05已采购;06已初验;07已终验;00已终止 + private String baseProjSetProg; + + //P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级 + private String baseProjConsClass; + + //01政策、法规,02规划或决策部署,03上级下达任务,04领导批示,05单位核心业务或单位职能,00其他,多个时用中文;分割 + private String baseProjBasis; + + @ApiModelProperty("项目类型 01首次建设;02迭代升级;03结转建设;04新运维;05续运维") + private String baseProjType; + + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject = Boolean.FALSE; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("咨询公司") + private String consultancy; + + @ApiModelProperty("是否开启评审清单") + private Boolean isReviewChecklist; + + @ApiModelProperty("评审清单") + private String reviewChecklist; + + @ApiModelProperty("是否推送省里") + private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalExportDTO.java new file mode 100644 index 0000000..b4f3003 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalExportDTO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectlib.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目续建列表导出实体 + * + * @author CMM + * @since 2023/02/21 15:03 + */ +@Data +public class ProjectRenewalExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty(value = "序号",index = 0) + private Integer serialNumber; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申报单位") + private String buildOrgName; + + @ExcelProperty("项目类型") + private String projectTypeName; + + @ExcelProperty("预算年度") + private Integer projectYear; + + @ExcelProperty("年度支付金额(万元)") + private BigDecimal annualPaymentAmount; + + @ExcelProperty("状态") + private String approvalStatusName; + + @ExcelProperty("创建时间") + private String createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java new file mode 100644 index 0000000..e4ff4e5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.projectlib.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 续建项目资金申请 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@ApiModel(value = "NdProjectRenewalFundDeclarationDTO", description = "续建项目资金申请表") +@Data +public class ProjectRenewalFundDeclarationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("关联项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目年份") + private Integer projectYear; + + @ApiModelProperty("年度支付金额") + private BigDecimal annualPaymentAmount; + + @ApiModelProperty("自有资金") + private BigDecimal haveAmount; + + @ApiModelProperty("政府投资 本级财务金额") + private BigDecimal govOwnFinanceAmount; + + @ApiModelProperty("政府投资 上级财务金额") + private BigDecimal govSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款金额") + private BigDecimal bankLendingAmount; + + @ApiModelProperty("其它金额") + private BigDecimal otherAmount; + + @ApiModelProperty("单位code") + private String orgCode; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("是否删除 false未删 true已删") + private Boolean deleted; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java new file mode 100644 index 0000000..53a3d98 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java @@ -0,0 +1,92 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; + +import java.util.*; + +/** + * @author CMM + * @since 2023/04/17 18:26 + */ +@Data +public class AnalysisEventMonitor extends AnalysisEventListener> { + + private final List records = new ArrayList<>(); + + /** + * 存储Key + */ + Map key = new HashMap<>(); + /** + * keyList + */ + List keyList = new ArrayList<>(); + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + super.onException(exception, context); + throw BizException.wrap("导入年度计划解析失败"); + } + + @Override + public void invokeHeadMap(Map headMap, AnalysisContext context) { + Set integerSet = headMap.keySet(); + for (Integer integer : integerSet) { + keyList.add(headMap.get(integer)); + } + key.putAll(headMap); + } + + @Override + public void invoke(Map integerStringMap, AnalysisContext context) { + //Project project = new Project(); + //project.setId(data.getProjectId()); + //project.setProjectName(data.getProjectName()); + //project.setProjectIntroduction(data.getProjectIntroduction()); + //// 建设依据忽略 + //project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); + //String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); + //project.setBeginTime(dataArr[0].trim()); + //project.setEndTime(dataArr[1].trim()); + //project.setDeclareAmount(data.getDeclaredAmount()); + //project.setAnnualPlanAmount(data.getAnnualPlanAmount()); + //project.setDeclareHaveAmount(data.getDeclareHaveAmount()); + //project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); + //project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); + //project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); + //project.setDeclareOtherAmount(data.getDeclareOtherAmount()); + //project.setEngineeringSpeedOne(data.getFirstQuarter()); + //project.setEngineeringSpeedTwo(data.getSecondQuarter()); + //project.setEngineeringSpeedThree(data.getThirdQuarter()); + //project.setEngineeringSpeedFour(data.getFourthQuarter()); + //project.setBuildOrgName(data.getBuildUnitName()); + //project.setContactName(data.getContactName()); + //project.setResponsibleMan(data.getResponsibleMan()); + //project.setProjectRemarks(data.getProjectRemarks()); + //records.add(project); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + //if (records.isEmpty()) { + // throw BizException.wrap("导入年度计划为空"); + //} + //List projectIds = CollUtils.fieldList(records, Project::getId); + //long count = projectService.count(Wrappers.lambdaQuery(Project.class) + // .in(Project::getId, projectIds)); + //if (count != records.size()) { + // throw BizException.wrap("请确保所有项目都存在"); + //} + //projectService.updateBatchById(records); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java new file mode 100644 index 0000000..9098bca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java @@ -0,0 +1,580 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.hz.pm.api.common.compare.Compare; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目b + *

+ * + * @author WendyYang + * @since 2023-02-03 + */ +@Data +@TableName("nd_project") +@ApiModel(value = "NdProject对象", description = "") +public class Project implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("所属地区编号") + @Compare("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + @Compare("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + @Compare("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("是否临时增补 0:否 1:是") + @Compare("是否临时增补") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + @Compare("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + @Compare("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + @Compare("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + @Compare("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + @Compare("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + @Compare("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + @Compare("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + @Compare("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + @Compare("是否首次新建") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + @Compare("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + @Compare("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + @Compare("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + @Compare("四大体系") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + @Compare("是否数字化改革项目") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") + @Compare("综合业务领域") + private Integer bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + @Compare("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("发改编码") + @Compare("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + @Compare("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + @Compare("是否上云") + private Integer isCloud; + + @ApiModelProperty("云类型") + @Compare("云类型") + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + @Compare("等保级别") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + @Compare("是否密评") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + @Compare("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + @Compare("资金申报情况-申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + @Compare("资金申报情况-自有金额") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + @Compare("资金申报情况-政府投资-本级财政资金") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + @Compare("资金申报情况-政府投资-上级补助资金") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + @Compare("银行贷款") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + @Compare("其它资金") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + @Compare("资金分配情况-软件开发") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + @Compare("资金分配情况-云资源、硬件购置") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + @Compare("资金分配情况-第三方服务") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + @Compare("年度支付计划-年度支付计划") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + @Compare("年度支付计划-自有金额") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + @Compare("年度支付计划-政府投资-本级财政资金") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + @Compare("年度支付计划-政府投资-上级补助资金") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + @Compare("年度支付计划-银行贷款") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + @Compare("年度支付计划-其它资金") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复总投资(万元)") + @Compare("立项批复总投资") + private BigDecimal approvalAmount; + + @ApiModelProperty("立项批复总预算(万元)") + @Compare("立项批复总预算") + private BigDecimal approvalBudget; + + @ApiModelProperty("年度计划添加时间") + @Compare("年度计划添加时间") + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + @Compare("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + @Compare("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + @Compare("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + @Compare("安全投入-金额") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + @Compare("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + @Compare("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + @Compare("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + @Compare("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + @Compare("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + @Compare("是否包含应用") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + @Compare("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + @Compare("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + @Compare("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + @Compare("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + @Compare("核心业务-是否开启核心业务模块") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + @Compare("安全投入-是否开启安全投入模块") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + @Compare("工程形象进度-是否开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + @Compare("附件-是否开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + @Compare("备注-是否开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + @Compare("年度支付计划-是否开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + @Compare("一地创新全省共享项目-是否开启") + private Boolean isInnovateWholeProvinceShare; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + + @ApiModelProperty("流程实例编号") + private String instCode; + + @ApiModelProperty("安全投入-模块信息") + @Compare("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + @Compare("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + @Compare("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + @Compare("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("原始建设周期(月)") + @Compare("建设周期(月)") + private Integer originBuildCycle; + + @ApiModelProperty("建设方案文件") + @Compare("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复建设方案文件") + @Compare("立项批复建设方案文件") + private String approvedConstructionPlanFile; + + @ApiModelProperty("立项批复文件") + @Compare("立项批复文件") + private String approvedFile; + + @ApiModelProperty("立项批复时间") + @Compare("立项批复时间") + private LocalDateTime approvalDate; + + @ApiModelProperty("批复金额") + @Compare("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + @Compare("是否有上级条线主管部门") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级条线主管部门") + @Compare("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + @Compare("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + @Compare("是否有主管部门") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + @Compare("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + @Compare("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + @ApiModelProperty("前端所需验证字段") + @Compare("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("流程状态") + @Compare("流程状态") + private Integer processStatus; + + @ApiModelProperty("动态表单 json") + @Compare("动态表单 json") + private String dynamicForm; + + @ApiModelProperty("项目发起人 员工code") + @Compare("项目发起人 员工code") + private String sponsor; + + @ApiModelProperty("预审发起人 员工code") + @Compare("预审发起人 员工code") + private String preStartUserId; + + @ApiModelProperty("上级条线单位审核意见") + @Compare("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("项目预审申请单文件ID") + @Compare("项目预审申请单文件ID") + private Long pretrialFileId; + + @ApiModelProperty("项目预审申请单文件名") + @Compare("项目预审申请单文件名") + private String pretrialFileName; + + @ApiModelProperty("项目建设方案申请单文件ID") + @Compare("项目建设方案申请单文件ID") + private Long constructFileId; + + @ApiModelProperty("项目建设方案申请单文件名") + @Compare("项目建设方案申请单文件名") + private String constructFileName; + + @ApiModelProperty("21位项目编号") + @Compare("项目编号") + private String projectCode; + + @ApiModelProperty("项目申报书") + @Compare("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("省级联审 审批结果") + private String sjlsResult; + + @ApiModelProperty("版本号") + private Integer version; + + @ApiModelProperty("是否是最新版本") + private Boolean newest; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + private LocalDateTime transactionTime; + + @ApiModelProperty("交货时间") + private LocalDateTime deliveryTime; + + @ApiModelProperty("初验材料") + @Compare("初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("终验材料") + @Compare("终验材料") + private String finalAcceptanceMaterials; + + @ApiModelProperty("合同总金额") + @Compare("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("计划验收时间(有可能是延期后的)") + private LocalDateTime planAcceptanceTime; + + @ApiModelProperty("原本计划验收时间") + private LocalDateTime originPlanAcceptanceTime; + + @ApiModelProperty("延期月份数") + private Integer applyDelayMonths; + + @ApiModelProperty("申请延期佐证材料") + private String applyDelayFile; + + @ApiModelProperty("申请延期理由") + private String applyDelayReason; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") + private String countryHigherSealAuditOpinion; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") + private String countryHigherSealAuditDate; + + @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") + private String countryHigherSealNo; + + @ApiModelProperty("区县预审本级主管单位盖章审核意见") + private String countrySealAuditOpinion; + + @ApiModelProperty("区县预审本级主管单位盖章审核日期") + private String countrySealAuditDate; + + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; + + @ApiModelProperty("建议项目总投资") + private BigDecimal proposeTotalInvest; + + @ApiModelProperty("建议年度预算") + private BigDecimal proposeAnnualBudget; + + @ApiModelProperty("建议评审意见附件") + private String proposeAttachFiles; + + @ApiModelProperty("咨询公司") + private String consultancy; + + @ApiModelProperty("是否开启评审清单") + private Boolean isReviewChecklist; + + @ApiModelProperty("评审清单") + private String reviewChecklist; + + @ApiModelProperty("是否完成清单合并") + private Boolean reviewCheckFinish; + + @ApiModelProperty("是否推送省里") + private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java new file mode 100644 index 0000000..d2f4a98 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java @@ -0,0 +1,193 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目应用表 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +@TableName("nd_project_application") +@ApiModel(value = "NdProjectApplication对象", description = "") +@Data +public class ProjectApplication implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("应用编码") + private String appCode; + + @ApiModelProperty("是否初次建设 0否 1是") + private Integer isFirst; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("删除时间") + private LocalDateTime deleteOn; + + @ApiModelProperty("关联IRS现有应用") + private String relatedExistsApplication; + + @ApiModelProperty("关联IRS现有应用-IRS应用编码") + private String relatedExistsApplicationCode; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") + private Integer buildLevel; + + @ApiModelProperty("是否统建应用 0:否 1:是") + private Integer isUniteBuild; + + @ApiModelProperty("统建类型 1:全省统建 2:全市统建") + private Integer unionBuildKind; + + @ApiModelProperty("是否数改系统 0:否 1:是") + private Integer isDigitalModification; + + @ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") + private String digitalModification; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; + + @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") + private Integer isAccountAppName; + + @ApiModelProperty("一本账应用名称") + private String accountAppName; + + @ApiModelProperty("领域大脑一本账") + private String domainBrainAccount; + + @ApiModelProperty("是否业务协同 0:否 1:是") + private Integer isBizCooperate; + + @ApiModelProperty("业务协同描述") + private String bizCooperateInfo; + + @ApiModelProperty("使用范围") + private String usesRangeRemark; + + @ApiModelProperty("应用简介") + private String applicationSummary; + + @ApiModelProperty("应用备注") + private String applicationRemark; + + @ApiModelProperty("应用总投资测算明细-文件") + private String applicationEstimateFile; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; + + @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") + private Integer nationalItSpec; + + @ApiModelProperty("是否使用政务云资源 0否 1是") + private Integer useGovCloud; + + @ApiModelProperty("云资源类型") + private String cloudsType; + + @ApiModelProperty("云资源基础规格") + private String cloudsFoundationSpecifications; + + @ApiModelProperty("云资源台数") + private Integer cloudsNumber; + + @ApiModelProperty("云资源用户描述") + private String cloudsDescription; + + @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") + private Integer netEnv; + + @ApiModelProperty("是否使用公共数据 0否 1是") + private Integer useCommonData; + + @ApiModelProperty("数据名称") + private String dataName; + + @ApiModelProperty("是否使用公共组件 0否 1是") + private Integer useCommonComponent; + + @ApiModelProperty("使用的公共组件名称") + private String commonComponents; + + @ApiModelProperty("是否产生公共组件 0否 1是") + private Integer produceCommonComponent; + + @ApiModelProperty("预计产生组件名称") + private String produceCommonComponents; + + @ApiModelProperty("试点任务名称") + private String pilotTasksName; + + @ApiModelProperty("试点任务编号") + private String pilotTasksCode; + + @ApiModelProperty("所属重大应用名称") + private String importantTaskName; + + @ApiModelProperty("所属重大应用编号") + private String importantTaskCode; + + @ApiModelProperty("所属子场景应用名称") + private String subSceneApplicationName; + + @ApiModelProperty("试点文件") + private String experimentsFile; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + + private Long createBy; + + private Long updateBy; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目版本") + private Integer projectVersion; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("应用核心业务") + private Boolean coreBusinessList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectCollection.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectCollection.java new file mode 100644 index 0000000..b031b72 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectCollection.java @@ -0,0 +1,161 @@ +package com.hz.pm.api.projectlib.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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@TableName("nd_project_collection") +@ApiModel(value = "NdProject_collection", description = "项目归集对象") +public class ProjectCollection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrg; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + + @ApiModelProperty("预算来源") + private Integer budgetSource; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("本级主管部门名称") + private String superOrg; + + @ApiModelProperty("本级主管部门Code") + private String superOrgCode; + + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectDelayApply.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectDelayApply.java new file mode 100644 index 0000000..c04135a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectDelayApply.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目延期申请记录表 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +@Data +@TableName("nd_project_delay_apply") +@ApiModel(value = "NdProjectDelayApply对象", description = "项目延期申请记录表") +public class ProjectDelayApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("延期时间(几个月)") + private Integer delayTime; + + @ApiModelProperty("延期申请佐证材料") + private String delayApplyFile; + + @ApiModelProperty("延期申请理由") + private String delayApplyReason; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新人") + private Long updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("延期申请实例ID") + private String instanceId; + + @ApiModelProperty("是否审批成功") + private Boolean success; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java new file mode 100644 index 0000000..7537377 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +@TableName("nd_project_inst") +@Data +@ApiModel(value = "NdProjectInst对象", description = "") +public class ProjectInst implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("实例ID") + private String instCode; + + @ApiModelProperty("实例类型 1单位内部审批流程 2项目预审审批流程 3部门联合审批流程 4建设方案审批流程 5验收申报审批流程") + private Integer instType; + + @ApiModelProperty("创建时间") + private LocalDateTime creatOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectRenewalFundDeclaration.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectRenewalFundDeclaration.java new file mode 100644 index 0000000..4b6a685 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectRenewalFundDeclaration.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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 WendyYang + * @since 2023-02-15 + */ +@TableName("nd_project_renewal_fund_declaration") +@ApiModel(value = "NdProjectRenewalFundDeclaration对象", description = "续建项目资金申请表") +@Data +public class ProjectRenewalFundDeclaration implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("关联项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目年份") + private Integer projectYear; + + @ApiModelProperty("年度支付金额") + private BigDecimal annualPaymentAmount; + + @ApiModelProperty("自有资金") + private BigDecimal haveAmount; + + @ApiModelProperty("政府投资 本级财务金额") + private BigDecimal govOwnFinanceAmount; + + @ApiModelProperty("政府投资 上级财务金额") + private BigDecimal govSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款金额") + private BigDecimal bankLendingAmount; + + @ApiModelProperty("其它金额") + private BigDecimal otherAmount; + + @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") + private String approvalStatus; + + @ApiModelProperty("单位code") + private String orgCode; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("是否删除 false未删 true已删") + private Boolean deleted; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java new file mode 100644 index 0000000..b9154ba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-02-27 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_project_status_change") +@ApiModel(value = "NdProjectStatusChange对象", description = "") +public class ProjectStatusChange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("状态机执行前的项目状态") + private Integer beforeStatus; + + @ApiModelProperty("状态机执行后的项目状态") + private Integer afterStatus; + + @ApiModelProperty("状态变更对应的事件") + private String event; + + @ApiModelProperty("状态变更发生的时间") + private LocalDateTime createOn; + + @ApiModelProperty("项目code") + private String projectCode; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java new file mode 100644 index 0000000..0beb067 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java @@ -0,0 +1,547 @@ +package com.hz.pm.api.projectlib.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import com.hz.pm.api.common.compare.Compare; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 项目所有并集 + *

+ * + * @author ZPF + * @since 2023-09-26 + */ +@Data +@ApiModel(value = "NdProject对象", description = "") +public class ProjectPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("来源 1申报项目 2项目归集") + private String fromType; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("所属地区编号") + @Compare("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + @Compare("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + @Compare("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("是否临时增补 0:否 1:是") + @Compare("是否临时增补") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + @Compare("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + @Compare("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + @Compare("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + @Compare("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + @Compare("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + @Compare("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + @Compare("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + @Compare("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + @Compare("是否首次新建") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + @Compare("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + @Compare("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + @Compare("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + @Compare("四大体系") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + @Compare("是否数字化改革项目") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") + @Compare("综合业务领域") + private Integer bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + @Compare("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("发改编码") + @Compare("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + @Compare("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + @Compare("是否上云") + private Integer isCloud; + + @ApiModelProperty("云类型") + @Compare("云类型") + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + @Compare("等保级别") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + @Compare("是否密评") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + @Compare("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + @Compare("资金申报情况-申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + @Compare("资金申报情况-自有金额") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + @Compare("资金申报情况-政府投资-本级财政资金") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + @Compare("资金申报情况-政府投资-上级补助资金") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + @Compare("银行贷款") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + @Compare("其它资金") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + @Compare("资金分配情况-软件开发") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + @Compare("资金分配情况-云资源、硬件购置") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + @Compare("资金分配情况-第三方服务") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + @Compare("年度支付计划-年度支付计划") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + @Compare("年度支付计划-自有金额") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + @Compare("年度支付计划-政府投资-本级财政资金") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + @Compare("年度支付计划-政府投资-上级补助资金") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + @Compare("年度支付计划-银行贷款") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + @Compare("年度支付计划-其它资金") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复总投资(万元)") + @Compare("立项批复总投资") + private BigDecimal approvalAmount; + + @ApiModelProperty("立项批复总预算(万元)") + @Compare("立项批复总预算") + private BigDecimal approvalBudget; + + @ApiModelProperty("年度计划添加时间") + @Compare("年度计划添加时间") + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + @Compare("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + @Compare("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + @Compare("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + @Compare("安全投入-金额") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + @Compare("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-佐证材料") + @Compare("附件-佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + @Compare("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + @Compare("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + @Compare("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + @Compare("是否包含应用") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + @Compare("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + @Compare("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + @Compare("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + @Compare("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + @Compare("核心业务-是否开启核心业务模块") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + @Compare("安全投入-是否开启安全投入模块") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + @Compare("工程形象进度-是否开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + @Compare("附件-是否开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + @Compare("备注-是否开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + @Compare("年度支付计划-是否开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + @Compare("一地创新全省共享项目-是否开启") + private Boolean isInnovateWholeProvinceShare; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + + @ApiModelProperty("流程实例编号") + private String instCode; + + @ApiModelProperty("安全投入-模块信息") + @Compare("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + @Compare("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + @Compare("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + @Compare("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("原始建设周期(月)") + @Compare("建设周期(月)") + private Integer originBuildCycle; + + @ApiModelProperty("建设方案文件") + @Compare("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复建设方案文件") + @Compare("立项批复建设方案文件") + private String approvedConstructionPlanFile; + + @ApiModelProperty("立项批复文件") + @Compare("立项批复文件") + private String approvedFile; + + @ApiModelProperty("立项批复时间") + @Compare("立项批复时间") + private LocalDateTime approvalDate; + + @ApiModelProperty("批复金额") + @Compare("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + @Compare("是否有上级条线主管部门") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级条线主管部门") + @Compare("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + @Compare("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + @Compare("是否有主管部门") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + @Compare("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + @Compare("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + @ApiModelProperty("前端所需验证字段") + @Compare("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("流程状态") + @Compare("流程状态") + private Integer processStatus; + + @ApiModelProperty("动态表单 json") + @Compare("动态表单 json") + private String dynamicForm; + + @ApiModelProperty("项目发起人 员工code") + @Compare("项目发起人 员工code") + private String sponsor; + + @ApiModelProperty("预审发起人 员工code") + @Compare("预审发起人 员工code") + private String preStartUserId; + + @ApiModelProperty("上级条线单位审核意见") + @Compare("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("项目预审申请单文件ID") + @Compare("项目预审申请单文件ID") + private Long pretrialFileId; + + @ApiModelProperty("项目预审申请单文件名") + @Compare("项目预审申请单文件名") + private String pretrialFileName; + + @ApiModelProperty("项目建设方案申请单文件ID") + @Compare("项目建设方案申请单文件ID") + private Long constructFileId; + + @ApiModelProperty("项目建设方案申请单文件名") + @Compare("项目建设方案申请单文件名") + private String constructFileName; + + @ApiModelProperty("21位项目编号") + @Compare("项目编号") + private String projectCode; + + @ApiModelProperty("项目申报书") + @Compare("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("省级联审 审批结果") + private String sjlsResult; + + @ApiModelProperty("版本号") + private Integer version; + + @ApiModelProperty("是否是最新版本") + private Boolean newest; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + private LocalDateTime transactionTime; + + @ApiModelProperty("交货时间") + private LocalDateTime deliveryTime; + + @ApiModelProperty("初验材料") + @Compare("初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("终验材料") + @Compare("终验材料") + private String finalAcceptanceMaterials; + + @ApiModelProperty("合同总金额") + @Compare("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("计划验收时间(有可能是延期后的)") + private LocalDateTime planAcceptanceTime; + + @ApiModelProperty("原本计划验收时间") + private LocalDateTime originPlanAcceptanceTime; + + @ApiModelProperty("延期月份数") + private Integer applyDelayMonths; + + @ApiModelProperty("申请延期佐证材料") + private String applyDelayFile; + + @ApiModelProperty("申请延期理由") + private String applyDelayReason; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") + private String countryHigherSealAuditOpinion; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") + private String countryHigherSealAuditDate; + + @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") + private String countryHigherSealNo; + + @ApiModelProperty("区县预审本级主管单位盖章审核意见") + private String countrySealAuditOpinion; + + @ApiModelProperty("区县预审本级主管单位盖章审核日期") + private String countrySealAuditDate; + + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java new file mode 100644 index 0000000..383dcc6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java @@ -0,0 +1,85 @@ +package com.hz.pm.api.projectlib.model.po; + +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.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 续建项目资金申请表 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@ApiModel(value = "NdProjectRenewalFundDeclarationPO", description = "续建项目资金申请表") +@Data +public class ProjectRenewalFundDeclarationPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("关联项目ID") + private Long projectId; + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目年份") + private Integer projectYear; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("年度支付金额") + private BigDecimal annualPaymentAmount; + + @ApiModelProperty("自有资金") + private BigDecimal haveAmount; + + @ApiModelProperty("政府投资 本级财务金额") + private BigDecimal govOwnFinanceAmount; + + @ApiModelProperty("政府投资 上级财务金额") + private BigDecimal govSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款金额") + private BigDecimal bankLendingAmount; + + @ApiModelProperty("其它金额") + private BigDecimal otherAmount; + + @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") + private String approvalStatus; + + @ApiModelProperty("单位code") + private String orgCode; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("是否删除 false未删 true已删") + private Boolean deleted; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApplicationListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApplicationListReq.java new file mode 100644 index 0000000..de6c1b3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApplicationListReq.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.projectlib.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * ProjectLibListReq + *

+ * + * @author ZPF + * @since 14:35 2023/2/1 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("应用列表查询") +@EqualsAndHashCode(callSuper = true) +public class ProjectApplicationListReq extends PagePo { + + @ApiModelProperty("申报单位code") + private String buildOrgCode; + + @ApiModelProperty("申报单位名") + private String buildOrgName; + + @ApiModelProperty("应用名") + private String applicationName; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java new file mode 100644 index 0000000..ee2007e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.projectlib.model.req; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * 立项批复参数类 + *

+ * + * @author WendyYang + * @since 20:04 2023/2/12 + */ +@Data +@ApiModel("立项批复参数类") +public class ProjectApprovedReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("批复总投资") + @NotNull(message = "批复总投资不能为空") + @DecimalMax(value = "999999999.99", message = "批复总投资无效") + @DecimalMin(value = "0.01", message = "批复总投资无效") + private BigDecimal approvedAmount; + + @ApiModelProperty("批复总预算") + @NotNull(message = "批复总预算不能为空") + @DecimalMax(value = "999999999.99", message = "批复总预算无效") + @DecimalMin(value = "0.01", message = "批复总预算无效") + private BigDecimal approvalBudget; + + + @NotNull(message = "批复时间不能为空") + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("批复时间") + private LocalDateTime approvedDate; + + @ApiModelProperty("建设周期") + @NotNull(message = "建设周期不能为空") + @Range(min = 1, max = 99999, message = "建设周期无效") + private Integer buildCycle; + + @ApiModelProperty("批复文件ID") + @NotNull(message = "批复文件不能为空") + private Long approvedFileId; + + @ApiModelProperty("建设方案文件ID") + @NotNull(message = "建设方案不能为空") + private Long buildPlanFileId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectIdReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectIdReq.java new file mode 100644 index 0000000..054d02b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectIdReq.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.projectlib.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * ProjectIdReq + *

+ * + * @author WendyYang + * @since 09:32 2023/2/13 + */ +@Data +public class ProjectIdReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java new file mode 100644 index 0000000..afc231f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java @@ -0,0 +1,120 @@ +package com.hz.pm.api.projectlib.model.req; + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.common.enumeration.ExportOptionEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.List; + +/** + *

+ * ProjectLibListReq + *

+ * + * @author WendyYang + * @since 14:35 2023/2/1 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("项目列表查询") +@EqualsAndHashCode(callSuper = true) +public class ProjectListReq extends PagePo { + + private Long id; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("区域编码") + private String areaCode; + + @ApiModelProperty("区域等级") + private Integer regionLevel = 3; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("申报单位code") + private String buildOrgCode; + + @ApiModelProperty("申报单位名") + private String buildOrgName; + + @ApiModelProperty("主管单位code") + private String superOrgCode; + + @ApiModelProperty("项目类型 老的 1建设2运维") + private Integer oldProjectType; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmountMin; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmountMax; + + @ApiModelProperty("批复金额") + private BigDecimal approveAmountMin; + + @ApiModelProperty("批复金额") + private BigDecimal approveAmountMax; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMin; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMax; + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目阶段 多个") + private List stageList; + + @ApiModelProperty("项目状态 多个") + private List statusList; + + @ApiModelProperty("实例code 多个") + private List instCodes; + + @ApiModelProperty("项目code 多个") + private List projectCodes; + + @ApiModelProperty("导出选项") + private List exportOptionList; + + private String userType; + private String userValue; + + private Collection regionCodes; + + @ApiModelProperty("区域编码") + private String userRegionCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java new file mode 100644 index 0000000..55f6e17 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.projectlib.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.Max; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * 续建项目审核请求实体 + * + * @author CMM + * @since 2023/02/21 13:43 + */ +@Data +@ApiModel("续建项目审核请求参数") +public class ProjectRenewalAuditReq { + + @NotNull + @ApiModelProperty("续建项目ID") + private Long projectRenewalId; + + @NotNull(message = "审核结果不能为空") + @ApiModelProperty("审核结果") + private Boolean result; + + @ApiModelProperty("审核意见") + @Length(max = 200) + private String auditOpinion; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalListReq.java new file mode 100644 index 0000000..6bba830 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalListReq.java @@ -0,0 +1,76 @@ +package com.hz.pm.api.projectlib.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; +import java.util.Collection; +import java.util.List; + +/** + *

+ * ProjectRenewalListReq + *

+ * + * @author zpf + * @since 14:35 2023/2/15 + */ +@Data +@ApiModel("项目续建资金库列表查询") +@EqualsAndHashCode(callSuper = true) +public class ProjectRenewalListReq extends PagePo { + + private Long id; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("预算年度") + private Integer year; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("单位code") + private String orgCode; + + @ApiModelProperty("项目阶段 多个") + private List stageList; + + @ApiModelProperty("项目状态 多个") + private List statusList; + + @ApiModelProperty("审核状态") + private String approvalStatus; + + private String userType; + private String userValue; + + private Collection regionCodes; + + @ApiModelProperty("区域编码") + private String userRegionCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/StartProjectDeclareReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/StartProjectDeclareReq.java new file mode 100644 index 0000000..d77aca6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/StartProjectDeclareReq.java @@ -0,0 +1,25 @@ +package com.hz.pm.api.projectlib.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + *

+ * StartProjectDeclareReq + *

+ * + * @author WendyYang + * @since 17:47 2023/2/11 + */ +@Data +public class StartProjectDeclareReq { + + @ApiModelProperty("项目ID") + @NotEmpty(message = "项目ID不能为空") + private List projectIds; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualAmountVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualAmountVO.java new file mode 100644 index 0000000..a107e16 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualAmountVO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @Classname AnnualAmountVO + * @Description + * @Date 2023/2/17 13:37 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AnnualAmountVO { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目Code") + private String projectCode; + + @ApiModelProperty("年份") + private Integer projectYear; + + @ApiModelProperty("年度投资资金") + private BigDecimal annualAmount; + + @ApiModelProperty("自有资金") + private BigDecimal haveAmount; + + @ApiModelProperty("政府投资 本级财务金额") + private BigDecimal govOwnFinanceAmount; + + @ApiModelProperty("政府投资 上级财务金额") + private BigDecimal govSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款金额") + private BigDecimal bankLendingAmount; + + @ApiModelProperty("其它金额") + private BigDecimal otherAmount; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanListItemVO.java new file mode 100644 index 0000000..71a0d1c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanListItemVO.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * AnnualPlanListItemVO + *

+ * + * @author WendyYang + * @since 15:19 2023/2/11 + */ +@Data +public class AnnualPlanListItemVO { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("建设单位") + private String buildOrg; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("立项批复金额") + private BigDecimal approvalAmount; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("项目是否开起方案申报") + private Boolean isStartDeclaredProject; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectApplicationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectApplicationVO.java new file mode 100644 index 0000000..84f2c86 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectApplicationVO.java @@ -0,0 +1,188 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.hz.pm.api.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; + +/** + *

+ * 项目应用表 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +@ApiModel(value = "NdProjectApplicationVO", description = "") +@Data +public class ProjectApplicationVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("应用编码") + private String appCode; + + @ApiModelProperty("是否初次建设 0否 1是") + private Integer isFirst; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("删除时间") + private LocalDateTime deleteOn; + + @ApiModelProperty("关联IRS现有应用") + private String relatedExistsApplication; + + @ApiModelProperty("关联IRS现有应用-IRS应用编码") + private String relatedExistsApplicationCode; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") + private Integer buildLevel; + + @ApiModelProperty("是否统建应用 0:否 1:是") + private Integer isUniteBuild; + + @ApiModelProperty("统建类型 1:全省统建 2:全市统建") + private Integer unionBuildKind; + + @ApiModelProperty("是否数改系统 0:否 1:是") + private Integer isDigitalModification; + + @ApiModelProperty("数改系统") + private String digitalModification; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; + + @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") + private Integer isAccountAppName; + + @ApiModelProperty("一本账应用名称") + private String accountAppName; + + @ApiModelProperty("领域大脑一本账") + private String domainBrainAccount; + + @ApiModelProperty("是否业务协同 0:否 1:是") + private Integer isBizCooperate; + + @ApiModelProperty("业务协同描述") + private String bizCooperateInfo; + + @ApiModelProperty("使用范围") + private String usesRangeRemark; + + @ApiModelProperty("应用简介") + private String applicationSummary; + + @ApiModelProperty("应用备注") + private String applicationRemark; + + @ApiModelProperty("应用总投资测算明细-文件") + private String applicationEstimateFile; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; + + @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") + private Integer nationalItSpec; + + @ApiModelProperty("是否使用政务云资源 0否 1是") + private Integer useGovCloud; + + @ApiModelProperty("云资源类型") + private String cloudsType; + + @ApiModelProperty("云资源基础规格") + private String cloudsFoundationSpecifications; + + @ApiModelProperty("云资源台数") + private Integer cloudsNumber; + + @ApiModelProperty("云资源用户描述") + private String cloudsDescription; + + @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") + private Integer netEnv; + + @ApiModelProperty("是否使用公共数据 0否 1是") + private Integer useCommonData; + + @ApiModelProperty("数据名称") + private String dataName; + + @ApiModelProperty("是否使用公共组件 0否 1是") + private Integer useCommonComponent; + + @ApiModelProperty("使用的公共组件名称") + private String commonComponents; + + @ApiModelProperty("是否产生公共组件 0否 1是") + private Integer produceCommonComponent; + + @ApiModelProperty("预计产生组件名称") + private String produceCommonComponents; + + @ApiModelProperty("试点任务名称") + private String pilotTasksName; + + @ApiModelProperty("试点任务编号") + private String pilotTasksCode; + + @ApiModelProperty("所属重大应用名称") + private String importantTaskName; + + @ApiModelProperty("所属重大应用编号") + private String importantTaskCode; + + @ApiModelProperty("所属子场景应用名称") + private String subSceneApplicationName; + + @ApiModelProperty("试点文件") + private String experimentsFile; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目版本") + private Integer projectVersion; + + @ApiModelProperty("应用核心业务") + private List coreBusinessList; + + private Long createBy; + + private Long updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectCollectionVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectCollectionVO.java new file mode 100644 index 0000000..2479bfe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectCollectionVO.java @@ -0,0 +1,171 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectCollectionVO", description = "项目归集对象") +public class ProjectCollectionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrg; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + + @ApiModelProperty("预算来源") + private Integer budgetSource; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + 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; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java new file mode 100644 index 0000000..f529f35 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java @@ -0,0 +1,567 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.annotation.JSONField; +import com.ningdatech.basic.util.NdDateUtils; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO; +import com.hz.pm.api.portrait.model.vo.TagVO; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.OperationVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsAcceptancePersonVO; +import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.safety.model.vo.SafetyMonitorVO; +import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * ProjectLibListItemVO + *

+ * + * @author WendyYang + * @since 15:13 2023/2/1 + */ +@Data +@ApiModel("项目详情") +public class ProjectDetailVO { + + @ApiModelProperty("来源 1申报项目 2项目归集") + private String fromType; + + @ApiModelProperty("应用ID") + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("'历年项目编码'") + private String baseHistorProjId; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("历年项目年度") + private String baseHistorProjYear; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private Integer isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("建设单位浙政钉ID") + private String buildOrgZheJiangGovDingId; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("是否省级 1省级 2非省级") + private Integer baseProvManDeprtType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起始时间") + private String beginTime; + + @ApiModelProperty("项目建设终止时间") + private String endTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private Integer fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private Integer isDigitalReform; + + @ApiModelProperty("综合业务领域") + private Integer bizDomain; + + @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("建设层级") + private String buildLevel; + + @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") + @Compare("贯通层级") + private String lowestLevel; + + @ApiModelProperty("立项依据") + private String buildBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("是否上云 0:否 1:是") + private Integer isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("立项批复总预算(万元)") + @Compare("立项批复总预算") + private BigDecimal approvalBudget; + + private LocalDateTime annualPlanAddTime; + + @ApiModelProperty("核心业务-核心业务模块") + private String coreBusiness; + + @ApiModelProperty("安全投入-投入项") + private String safetyInputTitle; + + @ApiModelProperty("安全投入-内容描述") + private String safetyInputDescribe; + + @ApiModelProperty("安全投入-金额(万元)") + private BigDecimal safetyInputAmount; + + @ApiModelProperty("附件-初步方案") + private String preliminaryPlanFile; + + @ApiModelProperty("附件-延期佐证材料") + private String supportingMaterialsFile; + + @ApiModelProperty("附件-项目总投资测算明细") + private String calculationTotalInvestmentFile; + + @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") + private String mainResponsibilitiesApplicantFile; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("是否包含应用 0:否 1:是") + private Integer includeApplication; + + @ApiModelProperty("工程形象进度-第一季度") + private String engineeringSpeedOne; + + @ApiModelProperty("工程形象进度-第二季度") + private String engineeringSpeedTwo; + + @ApiModelProperty("工程形象进度-第三季度") + private String engineeringSpeedThree; + + @ApiModelProperty("工程形象进度-第四季度") + private String engineeringSpeedFour; + + @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") + private Boolean isOpenCoreBusiness; + + @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") + private Boolean isOpenSafetyInput; + + @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") + private Boolean isEngineeringSpeed; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + @ApiModelProperty("安全投入-模块信息") + private String safetyInputModular; + + @ApiModelProperty("项目申报pdf") + private String projectPdf; + + @ApiModelProperty("立项申报pdf") + private String declarationPdf; + + @ApiModelProperty("建设周期(月)") + private String buildCycle; + + @ApiModelProperty("建设方案文件") + private String constructionPlanFile; + + @ApiModelProperty("立项批复建设方案文件") + private String approvedConstructionPlanFile; + + @ApiModelProperty("立项批复建设方案文件名") + private String approvedConstructionPlanFileName; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("立项批复文件名") + private String approvedFileName; + + @ApiModelProperty("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; + + @ApiModelProperty("立项批复时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime approvalDate; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + private Integer isHigherSuperOrg; + + @ApiModelProperty("上级主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + + @ApiModelProperty("是否有主管部门 0没有 1有") + private Integer isSuperOrg; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + @ApiModelProperty("前端所需验证字段") + private String allApplicationsDone; + + @ApiModelProperty("项目应用") + private List projectApplications; + + @ApiModelProperty("动态form") + private Map dynamicForm; + + @ApiModelProperty("年度投资金额详情") + private List annualAccumulateAmountList; + + @ApiModelProperty("项目发起人 员工code") + private String sponsor; + + @ApiModelProperty("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + private String projectTypeName; + + @ApiModelProperty("项目预审申请单文件ID") + private Long pretrialFileId; + + @ApiModelProperty("项目预审申请单文件名") + private String pretrialFileName; + + @ApiModelProperty("项目建设方案申请单文件ID") + private Long constructFileId; + + @ApiModelProperty("项目建设方案申请单文件名") + private String constructFileName; + + @ApiModelProperty("21位项目编号") + private String projectCode; + + @ApiModelProperty("项目申报书") + private String projectApplicationForm; + + @ApiModelProperty("省级联审 审批结果") + private String sjlsResult; + + @ApiModelProperty("版本号") + private Integer version; + + @ApiModelProperty("是否是最新版本") + private Boolean newest; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime transactionTime; + + @ApiModelProperty("交货时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime deliveryTime; + + @ApiModelProperty("初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("终验材料") + private String finalAcceptanceMaterials; + + @ApiModelProperty("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("合同信息") + private ContractVO contract; + + @ApiModelProperty("采购信息") + private List purchases; + + @ApiModelProperty("初审人员") + private List acceptancePersons; + + @ApiModelProperty("实施信息") + private OperationVO operation; + + @ApiModelProperty("版本号str") + private String versionStr; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") + private String countrySealAuditOpinion; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") + private String countrySealAuditDate; + + @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") + private String countrySealNo; + + @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 = "当前版本"; + return this.versionStr; + } + this.versionStr = "v" + NdDateUtils.format(this.createOn, "yyyyMMddHHmmss"); + return this.versionStr; + } + + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } + + public void buildDynamicForm(String dynamicFormStr) { + if (StringUtils.isNotBlank(dynamicFormStr) && BizUtils.getJSONType(dynamicFormStr)) { + 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; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("可研报告") + private String baseResearchReportFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; + + @ApiModelProperty("主管单位统一社会信用代码") + @Compare("主管单位统一社会信用代码") + private String superOrgCreditCode; + + @ApiModelProperty("终验信息 IRS档案") + private List finalIrsApps; + + @ApiModelProperty("建议项目总投资") + private BigDecimal proposeTotalInvest; + + @ApiModelProperty("建议年度预算") + private BigDecimal proposeAnnualBudget; + + @ApiModelProperty("建议评审意见附件") + private String proposeAttachFiles; + + @ApiModelProperty("专家评审意见") + private String proposeAttach; + + @ApiModelProperty("专家评审结果") + private Integer baseReviewResults; + + @ApiModelProperty("咨询公司") + private String consultancy; + + @ApiModelProperty("是否开启评审清单") + private Boolean isReviewChecklist; + + @ApiModelProperty("评审清单") + private String reviewChecklist; + + @ApiModelProperty("是否开启评审清单") + private Boolean reviewCheckFinish; + + @ApiModelProperty("是否推送省里") + private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java new file mode 100644 index 0000000..1d7e58f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java @@ -0,0 +1,187 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.portrait.model.vo.TagVO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +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; + +/** + *

+ * ProjectLibListItemVO + *

+ * + * @author WendyYang + * @since 15:13 2023/2/1 + */ +@Data +@Builder +@ApiModel("项目库列表视图") +public class ProjectLibListItemVO { + + @Tolerate + public ProjectLibListItemVO() { + } + + @ApiModelProperty("来源 1申报项目 2项目归集") + private String fromType; + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("区域") + private String area; + + @ApiModelProperty("区域Code") + private String areaCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("批复金额") + private BigDecimal approvedAmount; + + @ApiModelProperty("立项批复时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime approvalDate; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("申报年度") + private Integer projectYear; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("业务领域") + private Integer bizDomain; + + @ApiModelProperty("流程状态") + private Integer processStatus; + + @ApiModelProperty("实例code") + private String instCode; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String buildOrgCode; + + private String projectTypeName; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime transactionTime; + + @ApiModelProperty("交货时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime deliveryTime; + + @ApiModelProperty("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("建设周期 月") + private Integer buildCycle; + + @ApiModelProperty("计划验收时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime planAcceptanceTime; + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } + + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime updateOn; + + @ApiModelProperty("能否被预审申报") + private Boolean canPreDeclared = Boolean.FALSE; + + @ApiModelProperty("是否有上级条线主管部门 0没有 1有") + private Integer isHigherSuperOrg; + + @ApiModelProperty("是否可以申请延期") + private Boolean canDelayApply = Boolean.TRUE; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + + @ApiModelProperty("标签") + private List tags; + + //预审申报时候 需不需要上传上级条线意见文件 + private Boolean needUploadSuperLineFile; + + @ApiModelProperty("当前审批人") + private List approveUsers; + + @ApiModelProperty("年度投资金额总额") + private BigDecimal annualAccumulateAmount; + private List annualAccumulateAmountList; + public Boolean getNeedUploadSuperLineFile() { + UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); + //要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审 + if (Objects.nonNull(userInfoDetail) && userInfoDetail.getIsMunicipalOrg() + && Objects.nonNull(this.isHigherSuperOrg) + && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(this.status) + && CommonEnum.YES.getCode().equals(this.isHigherSuperOrg)) { + this.needUploadSuperLineFile = Boolean.TRUE; + return this.needUploadSuperLineFile; + } + this.needUploadSuperLineFile = null; + return this.needUploadSuperLineFile; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java new file mode 100644 index 0000000..eba931b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java @@ -0,0 +1,106 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + *

+ * 续建项目资金申请表 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@ApiModel(value = "NdProjectRenewalFundDeclarationVO", description = "续建项目资金申请表") +@Data +public class ProjectRenewalFundDeclarationVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("项目年份") + private Integer projectYear; + + @ApiModelProperty("年度支付金额") + private BigDecimal annualPaymentAmount; + + @ApiModelProperty("自有资金") + private BigDecimal haveAmount; + + @ApiModelProperty("政府投资 本级财务金额") + private BigDecimal govOwnFinanceAmount; + + @ApiModelProperty("政府投资 上级财务金额") + private BigDecimal govSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款金额") + private BigDecimal bankLendingAmount; + + @ApiModelProperty("其它金额") + private BigDecimal otherAmount; + + @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") + private String approvalStatus; + + @ApiModelProperty("是否删除 false未删 true已删") + private Boolean deleted; + + @ApiModelProperty("单位code") + private String orgCode; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("立项批复资金") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("关联项目名字") + private String projectName; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + private String projectType; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("年度投资金额详情") + private List annualAccumulateAmountList; + + public String getProjectTypeName(){ + if(Objects.nonNull(this.projectType)){ + return ProjectTypeNewEnum.getDesc(this.projectType); + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectReviewCheckListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectReviewCheckListItemVO.java new file mode 100644 index 0000000..8cf8f45 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectReviewCheckListItemVO.java @@ -0,0 +1,147 @@ +package com.hz.pm.api.projectlib.model.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hz.pm.api.common.compare.Compare; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +/** + *

+ * ProjectReviewCheckListItemVO + *

+ * + * @author ZPF + * @since 15:13 2023/11/07 + */ +@Data +@Builder +@ApiModel("项目库审查列表视图") +public class ProjectReviewCheckListItemVO { + + @Tolerate + public ProjectReviewCheckListItemVO() { + } + + @ApiModelProperty("来源 1申报项目 2项目归集") + private String fromType; + + @ApiModelProperty("项目ID") + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("区域") + private String area; + + @ApiModelProperty("区域Code") + private String areaCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("批复金额") + private BigDecimal approvedAmount; + + @ApiModelProperty("立项批复时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime approvalDate; + + @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") + @Compare("项目类型") + private String projectType; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("申报年度") + private Integer projectYear; + + @ApiModelProperty("申报单位") + private String buildOrg; + + @ApiModelProperty("业务领域") + private Integer bizDomain; + + @ApiModelProperty("流程状态") + private Integer processStatus; + + @ApiModelProperty("实例code") + private String instCode; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String buildOrgCode; + + private String projectTypeName; + + @ApiModelProperty("成交金额") + private BigDecimal transactionAmount; + + @ApiModelProperty("成交时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime transactionTime; + + @ApiModelProperty("交货时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime deliveryTime; + + @ApiModelProperty("合同总金额") + private BigDecimal contractAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("建设周期 月") + private Integer buildCycle; + + @ApiModelProperty("计划验收时间") + @JSONField(format = "yyyy-MM-dd") + private LocalDateTime planAcceptanceTime; + + @ApiModelProperty("是否完成评审清单合并") + private Boolean reviewCheckFinish; + + @ApiModelProperty("当前人 是否审批") + private Boolean approved = Boolean.FALSE; + + @ApiModelProperty("未审批人员") + private String reviewCheckNotApprove; + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } + + @ApiModelProperty("已核查人数 7/7") + private String verifiedHumans; + + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectDelayApplyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectDelayApplyService.java new file mode 100644 index 0000000..52f08e0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectDelayApplyService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 项目延期申请记录表 服务类 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +public interface INdProjectDelayApplyService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java new file mode 100644 index 0000000..420f094 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-02-27 + */ +public interface INdProjectStatusChangeService extends IService { + + ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java new file mode 100644 index 0000000..605c937 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +public interface IProjectApplicationService extends IService { + + List getApplicationsByProject(Project project); + + void saveApplication(Project project,Project oldProject,Boolean isConstruct); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectCollectionService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectCollectionService.java new file mode 100644 index 0000000..59525fb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectCollectionService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectlib.model.entity.ProjectCollection; + +/** + *

+ * 服务类 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +public interface IProjectCollectionService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java new file mode 100644 index 0000000..9d7b9f9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +public interface IProjectInstService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectRenewalFundDeclarationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectRenewalFundDeclarationService.java new file mode 100644 index 0000000..2c1c1dc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectRenewalFundDeclarationService.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; + +/** + *

+ * 续建项目资金申请表 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +public interface IProjectRenewalFundDeclarationService extends IService { + + Page pageSql(Page page, ProjectRenewalListReq req); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java new file mode 100644 index 0000000..02f0bf3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.projectlib.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectlib.model.po.ProjectPO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2023-02-03 + */ +public interface IProjectService extends IService { + + public List getAllVersionProjectId(Project project); + + public List getAllVersionProjectId(Long projectId); + + Project getNewProject(Long projectId); + + Project getNewConstructProject(Long projectId); + + Project getProjectByCode(String projectCode); + + Page pageAllWithPermission(Page page, ProjectListReq req); + + Page pagelibWithPermission(Page page, ProjectListReq req); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java new file mode 100644 index 0000000..fdce1ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.hz.pm.api.projectlib.mapper.NdProjectDelayApplyMapper; +import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 项目延期申请记录表 服务实现类 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +@Service +public class NdProjectDelayApplyServiceImpl extends ServiceImpl implements INdProjectDelayApplyService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java new file mode 100644 index 0000000..335b543 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.mapper.NdProjectStatusChangeMapper; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-02-27 + */ +@Service +public class NdProjectStatusChangeServiceImpl extends ServiceImpl implements INdProjectStatusChangeService { + + @Override + public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getEvent, event) + .eq(ProjectStatusChange::getProjectId, projectId) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1); + return getOne(query); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectApplicationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectApplicationServiceImpl.java new file mode 100644 index 0000000..adafbfd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectApplicationServiceImpl.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.projectlib.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.mapper.ProjectApplicationMapper; +import com.hz.pm.api.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; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +@Service +@Slf4j +@AllArgsConstructor +public class ProjectApplicationServiceImpl extends ServiceImpl + implements IProjectApplicationService { + + private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; + + @Override + public List getApplicationsByProject(Project project) { + List apps = this.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, project.getProjectCode())); + return apps; + } + + @Override + public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { + List 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/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectCollectionServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectCollectionServiceImpl.java new file mode 100644 index 0000000..984b651 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectCollectionServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectlib.mapper.ProjectCollectionMapper; +import com.hz.pm.api.projectlib.model.entity.ProjectCollection; +import com.hz.pm.api.projectlib.service.IProjectCollectionService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +@Service +public class ProjectCollectionServiceImpl extends ServiceImpl + implements IProjectCollectionService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectInstServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectInstServiceImpl.java new file mode 100644 index 0000000..47395f8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectInstServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.mapper.ProjectInstMapper; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +@Service +public class ProjectInstServiceImpl extends ServiceImpl implements IProjectInstService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java new file mode 100644 index 0000000..b41edff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.mapper.ProjectRenewalFundDeclarationMapper; +import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; +import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 续建项目资金申请表 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-15 + */ +@Service +@RequiredArgsConstructor +public class ProjectRenewalFundDeclarationServiceImpl extends + ServiceImpl implements IProjectRenewalFundDeclarationService { + + private final ProjectRenewalFundDeclarationMapper mapper; + @Override + public Page pageSql(Page page, ProjectRenewalListReq req) { + return mapper.pageSql(page,req); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java new file mode 100644 index 0000000..70df031 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java @@ -0,0 +1,121 @@ +package com.hz.pm.api.projectlib.service.impl; + +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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.mapper.ProjectMapper; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.po.ProjectPO; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-03 + */ +@Service +@RequiredArgsConstructor +public class ProjectServiceImpl extends ServiceImpl implements IProjectService { + + private final ProjectMapper projectMapper; + + @Override + public List getAllVersionProjectId(Project project) { + //查出 项目code + String projectCode = project.getProjectCode(); + + List projects = list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + + if(CollUtil.isEmpty(projects)){ + return Collections.emptyList(); + } + + return projects.stream().map(Project::getId).collect(Collectors.toList()); + } + + @Override + public List getAllVersionProjectId(Long projectId) { + Project project = getById(projectId); + + if(Objects.isNull(project)){ + return null; + } + + return getAllVersionProjectId(project); + } + + @Override + public Project getNewProject(Long projectId) { + Project project = getById(projectId); + + if(Objects.isNull(project)){ + return null; + } + + String projectCode = project.getProjectCode(); + + LambdaQueryWrapper last = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getProjectCode, projectCode) + .last(BizConst.LIMIT_1); + Project newest = getOne(last); + + return newest; + } + + @Override + public Project getNewConstructProject(Long projectId) { + Project project = getById(projectId); + + if(Objects.isNull(project)){ + return null; + } + + String projectCode = project.getProjectCode(); + + LambdaQueryWrapper last = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getProjectCode, projectCode) + .eq(Project::getIsConstruct, Boolean.TRUE) + .last(BizConst.LIMIT_1); + Project newest = getOne(last); + + return newest; + } + + @Override + public Project getProjectByCode(String projectCode) { + Project project = this.getOne(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode) + .eq(Project::getNewest,Boolean.TRUE) + .last(BizConst.LIMIT_1)); + return project; + } + + @Override + public Page pageAllWithPermission(Page page, ProjectListReq req) { + return projectMapper.pageAllWithPermission(page,req); + } + + @Override + public Page pagelibWithPermission(Page page, ProjectListReq req) { + return projectMapper.pagelibWithPermission(page,req); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/utils/ProjectVersionUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/utils/ProjectVersionUtil.java new file mode 100644 index 0000000..bc318bf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/utils/ProjectVersionUtil.java @@ -0,0 +1,87 @@ +package com.hz.pm.api.projectlib.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.CollUtils; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessHandlerEnum; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import liquibase.pro.packaged.I; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 根据项目版本获取流程详情工具类 + * + * @author CMM + * @since 2023/04/20 09:57 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ProjectVersionUtil { + + private final IProjectService projectService; + private final ProcessInstanceService processInstanceService; + private final IProjectInstService projectInstService; + + /** + * 根据最新的项目ID获取临近项目版本的审核记录信息 + * @param projectId + * @return + */ + public ProcessProgressVo getPreVerProcessInfo(Long projectId, InstTypeEnum instTypeEnum){ + Project project = projectService.getById(projectId); + if (Objects.isNull(project)){ + throw new BizException("当前项目不存在!"); + } + String projectCode = project.getProjectCode(); + if (StringUtils.isEmpty(projectCode)){ + throw new BizException("当前项目编号为空!"); + } + // 获取相同项目编号的项目 + List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + if (projectList.size() < CommonConst.VERSION_SIZE){ + throw new BizException("未发现该项目的历史版本!"); + } + + // 获取之前版本的项目 + for (Project preProject : projectList) { + // 从项目流程实例关联表中查出实例详情 + List projectInstList = projectInstService + .list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, preProject.getId()) + .eq(ProjectInst::getInstType, instTypeEnum.getCode())); + if (CollUtil.isNotEmpty(projectInstList)) { + List processProgressVoList = projectInstList.stream() + .map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) + .collect(Collectors.toList()); + // 筛选出上个版本该类型审核流程通过的流程详情 + List instanceDetailList = processProgressVoList.stream() + .filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(instanceDetailList)) { + // 获取最后一个流程详情 + return instanceDetailList.get(instanceDetailList.size() - 1); + } + } + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/contants/ProvincialContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/contants/ProvincialContant.java new file mode 100644 index 0000000..4b41855 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/contants/ProvincialContant.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.provincial.contants; + +/** + * @Classname ProvincialContant + * @Description + * @Date 2023/9/6 9:16 + * @Author PoffyZhang + */ +public interface ProvincialContant { + + class OssUpload { + public static final String OSS_UPLOAD_URL = "https://pms.zj.gov.cn/prometheus-zhejiang_file_service/api/v1/file/uploadFile"; + public static final String MEDIA_TYPE = "multipart/form-data"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java new file mode 100644 index 0000000..efadfd8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.provincial.controller; + +import com.hz.pm.api.projectdeclared.manage.ReviewByProvincialDeptManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.provincial.model.res.SjApiResponse; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.io.IOException; +import java.io.InputStream; + +/** + * @Classname TestController + * @Description + * @Date 2023/3/2 15:08 + * @Author PoffyZhang + */ +@RestController +@RequestMapping("/api/v1/test") +@Api(tags = "测试省局接口") +public class TestController { + + @Autowired + private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + @Autowired + private ReviewByProvincialDeptManage provincialDeptManage; + + @GetMapping("/push") + @ApiOperation("测试推送") + private Boolean push(@Valid @RequestParam Long projectId){ + Project project = new Project(); + project.setId(projectId); + return provincialDeptManage.startTheProcess(project); + } + + @GetMapping("/detail") + @ApiOperation("测试获取详情") + private SjApiResponse detail(@RequestParam String projectId){ + return joinReviewProvincialBureauService.processInfo(projectId); + } + + @GetMapping("/path") + @ApiOperation("测试获取详情") + private String path() throws IOException { +// String template = ResourceUtil.getResource("template").getPath(); +// return template; + + InputStream in = this.getClass().getResourceAsStream("/template/simsun.ttc"); + StringBuilder sb = new StringBuilder(); + int n; + while ((n=in.read())!=-1){ + sb.append((char)n); + System.out.print((char)n); + } + + return sb.toString(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/enumeration/ProjectProvincialAuditStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/enumeration/ProjectProvincialAuditStatusEnum.java new file mode 100644 index 0000000..7bb30f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/enumeration/ProjectProvincialAuditStatusEnum.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.provincial.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @Classname ProjectProvincialAuditStatusEnum + * @Description + * @Date 2023/3/16 11:04 + * @Author PoffyZhang + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum ProjectProvincialAuditStatusEnum { + /** + * 省级联审的状态 + */ + NOT_AUDIT(0,"未审核"), + AUDITING(1,"审核中"), + SUCCESS(2,"审核通过"), + FAIL(3,"审核不通过"), + WITHDRAW(4,"被撤回"), + BACK(5,"退回地市"); + + private Integer code; + private String desc; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/manage/ProvincialManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/manage/ProvincialManage.java new file mode 100644 index 0000000..43c3e31 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/manage/ProvincialManage.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.provincial.manage; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.common.util.CommonInputStreamResource; +import com.hz.pm.api.provincial.contants.ProvincialContant; +import com.hz.pm.api.provincial.model.res.OssApiData; +import com.hz.pm.api.provincial.model.res.OssApiResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; +import java.io.ByteArrayInputStream; +import java.util.Objects; + +/** + * @Classname ProvincialManage + * @Description + * @Date 2023/9/6 9:08 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProvincialManage { + + public static String uploadToOss(byte[] fileBytes,String fileName) { + String url = ProvincialContant.OssUpload.OSS_UPLOAD_URL; + MultiValueMap params = new LinkedMultiValueMap<>(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes); + CommonInputStreamResource commonInputStreamResource = new CommonInputStreamResource(inputStream, fileBytes.length, fileName); + params.add("file", commonInputStreamResource); + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType(ProvincialContant.OssUpload.MEDIA_TYPE); + headers.setContentType(type); + HttpEntity formEntity = new HttpEntity(params, headers); + ResponseEntity res = restTemplate.postForEntity(url, formEntity, OssApiResponse.class); + log.info("oss res :{}", res); + OssApiResponse body = res.getBody(); + if(Objects.isNull(body)){ + throw new BizException("上传省局oss请求失败"); + } + + if(HttpStatus.OK.value() != body.getRespCode()){ + throw new BizException("上传省局oss失败:" + body.getRespMsg()); + } + + OssApiData ossApiData = JSON.parseObject(JSON.toJSONString(body.getData()), OssApiData.class); + + return ossApiData.getAccessUrl(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/FileDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/FileDTO.java new file mode 100644 index 0000000..c6a55cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/FileDTO.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.provincial.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname FileDTO + * @Description + * @Date 2023/4/13 9:55 + * @Author PoffyZhang + */ +@Data +public class FileDTO { + + @ApiModelProperty("文件id") + private String fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("url") + private String accessUrl; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProcessCommentDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProcessCommentDTO.java new file mode 100644 index 0000000..b6b4ef1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProcessCommentDTO.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.provincial.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + * @Classname ProcessCommentDTO + * @Description + * @Date 2023/3/2 15:25 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProcessCommentDTO", description = "省局返回流程审核详情") +public class ProcessCommentDTO { + + @ApiModelProperty("任务id") + private String taskId; + + @ApiModelProperty("comment") + private String comment; + + @ApiModelProperty("流程步骤") + private String stepName; + + @ApiModelProperty("审批状态") + private String status; + + @ApiModelProperty("审批人") + private String label; + + @ApiModelProperty("时间") + private String approverTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvinceApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvinceApiResponse.java new file mode 100644 index 0000000..8a13d1c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvinceApiResponse.java @@ -0,0 +1,121 @@ +package com.hz.pm.api.provincial.model.dto; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiStatus; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * ApiResponse - 统一的接口返回值封装 + *

+ * + * @author WendyYang + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class ProvinceApiResponse implements Serializable { + private static final long serialVersionUID = 532384723325394156L; + + public static final int SUCCESS_CODE = 200; + + public static final String SUCCESS_MSG = "success"; + + public static final int ERROR_CODE = 500; + + public static final String ERROR_MSG = "Internal server error"; + + /** + * 状态码 + */ + private Integer code; + + /** + * 返回内容 + */ + private String message; + private String msg; + + /** + * 返回数据 + */ + private T data; + + /** + * 全参构造函数 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + */ + private ProvinceApiResponse(Integer code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 构造一个自定义的API返回 + * + * @param code 状态码 + * @param message 返回内容 + * @param data 返回数据 + * @return ApiResponse + */ + public static ProvinceApiResponse of(Integer code, String message, T data) { + return new ProvinceApiResponse(code, message, data); + } + + /** + * 构造一个成功且不带数据的API返回 + * + * @return ApiResponse + */ + public static ProvinceApiResponse ofSuccess() { + return ofSuccess(null); + } + + /** + * 构造一个成功且带数据的API返回 + * + * @param data 返回数据 + * @return ApiResponse + */ + public static ProvinceApiResponse ofSuccess(T data) { + return ofStatus(Status.OK, data); + } + + /** + * 构造一个成功且自定义消息的API返回 + * + * @param message 返回内容 + * @return ApiResponse + */ + public static ProvinceApiResponse ofMessage(String message) { + return of(Status.OK.getCode(), message, null); + } + + /** + * 构造一个有状态的API返回 + * + * @param status 状态 {@link Status} + * @return ApiResponse + */ + public static ProvinceApiResponse ofStatus(ApiStatus status) { + return ofStatus(status, null); + } + + /** + * 构造一个有状态且带数据的API返回 + * + * @param status 状态 {@link Status} + * @param data 返回数据 + * @return ApiResponse + */ + public static ProvinceApiResponse ofStatus(ApiStatus status, T data) { + return of(status.getCode(), status.getReasonPhrase(), data); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialApplicationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialApplicationDTO.java new file mode 100644 index 0000000..875eb11 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialApplicationDTO.java @@ -0,0 +1,105 @@ +package com.hz.pm.api.provincial.model.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname ProvincialApplicationDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProvincialApplicationDTO", description = "") +public class ProvincialApplicationDTO implements Serializable { + + + //云 信息 + private List clouds; + //是否初次建设 1是 2不是 + private Integer isFirst; + //应用名称 + private String applicationName; + //关联 关联的IRS应用code + private String applicationCode; + //关联的IRS应用name + private String relatedExistsApplication; + //1: '办公类系统',2: '业务应用类系统',3: '门户网站',4: '宣传微博/微信公众号',5: '硬件类系统',6: '工具类系统',99: '其他' + private Integer applicationType; + //建设层级 1:国家 2:省级 3:市级 4:县(市、区) + private Integer buildLevel; + //是否统建 0:否 1:是 + private Integer isUniteBuild; + //统建类型 1:全省统建 2:全市统建 + private Integer unionBuildKind; + //应用简介 + private String applicationSummary; + //应用备注 + private String applicationRemark; + //应用总投资测算明细 + private String applicationEstimateFile; + //是否数改系统 0:否 1:是 + private Integer isFiveDomain; + //1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔 + private String fiveDomain; + //业务领域 + private String bizDomain; + //否涉及业务协同 0:否 1:是 + private Integer isBizCooperate; + //协同单位111111 + private String cooperativeUnit; + //用户范围 0: '机关事业单位人员','0-1': '跨部门跨系统','0-2': '系统内地方各级','0-3': '本部门本级','0-4': '处室内部','0-6': '主管处室内部','0-5': '其他',1: '企业', 2: '社会公众',3: '其他' 多个用英文,分隔 + private String userRange; + //是否使用政务云资源 1使用 + private Integer useGovCloud; + //是否符合国家信息技术应用创新相关规范 0:否 1:是 + private Integer nationalITSpec; + //网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机 + private String netEnv; + //等保级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer secrecyGrade; + //密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer passwordGrade; + //是否是S2 0:否 1:是 + private Integer isS2; + //一本账应用名称 + private String accountAppName; + //领域”大脑”一本帐名称 + private String brainAccountAppName; + //是否使用公共数据 + private Integer useCommonData; + //使用的公共数据名称 + private String dataName; + //使用公共组件的名称 + private String commonComponents; + //是否使用公共组件 + private Integer useCommonComponent; + //是否产生公共组件 + private Integer isProduceCommonComponent; + //产生的组件名称 + private String produceCommonComponent; + //发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' + private String publishSide; + + @Builder + @Data + @JsonIgnoreProperties(value = { "handler"}) + public static class Cloud implements Serializable { + //云资源台数 11 + private Integer cloudNums; + //云资源类型 云服务器(ECS) + private String cloudType; + //云资源规格 1核8G + private String cloudBasicSpec; + //云资源描述 + private String cloudUseDescription; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialProjectDTO.java new file mode 100644 index 0000000..bdc1cf3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/dto/ProvincialProjectDTO.java @@ -0,0 +1,134 @@ +package com.hz.pm.api.provincial.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Classname ProvincialProjectDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ProvincialProjectDTO", description = "") +public class ProvincialProjectDTO implements Serializable { + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("数字化改革系统 可以多选 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台',8: '基层智治'") + private String digitalReform; + + @ApiModelProperty("业务主管单位浙政钉code,多个单位用英文;组成字符串。数据通过接口-查询省本级业务主管单位获取对应数据") + private String operationManageUnit; + + @ApiModelProperty("重大项目名称") + private String projectName; + + @ApiModelProperty("重大项目code 21位") + private String projectId; + + @ApiModelProperty("项目类型 1新建 2续建") + private Integer projectType; + + @ApiModelProperty("项目总投资(万元)") + private BigDecimal totalMoney; + + @ApiModelProperty("项目年度预算(万元)") + private BigDecimal yearBudget; + + @ApiModelProperty("自有资金,政府投资-本级财政资金,政府投资-上级补助资金") + private String budgetFrom; + + @ApiModelProperty("预算年度 2023") + private String year; + + @ApiModelProperty("财政code 32") + private String financialCode; + + @ApiModelProperty("发改code 23") + private String developCode; + + @ApiModelProperty("开始时间 比如2022-11-18") + private String beginTime; + + @ApiModelProperty("结束时间 比如2022-12-13") + private String endTime; + + @ApiModelProperty("立项依据1111") + private String buildBasis; + + @ApiModelProperty("立项依据材料 [{\"fileId\":\"\"}]") + private String buildBasisFile; + + @ApiModelProperty("项目概述") + private String projectSummary; + + @ApiModelProperty("负责人") + private String responsibleMan; + + @ApiModelProperty("联系人联系方式") + private String responsibleManPhone; + + @ApiModelProperty("联系人") + private String contactName; + + @ApiModelProperty("联系人联系方式") + private String contactPhone; + + @ApiModelProperty("建设单位 比如财政局") + private String buildUnit; + + @ApiModelProperty("建设单位浙政钉code") + private String buildUnitCode; + + @ApiModelProperty("主管单位") + private String superUnit; + + @ApiModelProperty("主管单位浙政钉code") + private String superUnitCode; + + @ApiModelProperty("可研报告文件") + private String researchReport; + + @ApiModelProperty("项目申报书") + private String projectApplyFile; + + @ApiModelProperty("项目总投资测算明细") + private String projectEstimateFile; + + @ApiModelProperty("申报单位主要职责") + private String unitThreePlan; + + @ApiModelProperty("其他附件") + private String otherFile; + + @ApiModelProperty("项目备注111") + private String projectRemark; + + @ApiModelProperty("是否有效 1有效 2无效 3撤回") + private Integer isEffective; + + @ApiModelProperty("是否包含应用 1包含") + private Integer includeApplication; + + @ApiModelProperty("app信息") + private List applicationInfo; + + @ApiModelProperty("条线单位 先写死") + private String lineManageUnit; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java new file mode 100644 index 0000000..383e5b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.provincial.model.res; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiStatus; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * OssApiResponse - + *

+ * + * @author ZPF + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class OssApiData implements Serializable { + + private String fileId; + + private String fileName; + + private String accessUrl; + + private Long fileSize; + + private String uploadUserCode; + + private String ossObject; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java new file mode 100644 index 0000000..c1fde78 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java @@ -0,0 +1,120 @@ +package com.hz.pm.api.provincial.model.res; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiStatus; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * OssApiResponse - + *

+ * + * @author ZPF + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class OssApiResponse implements Serializable { + private static final long serialVersionUID = 1L; + + public static final int SUCCESS_CODE = 200; + + public static final String SUCCESS_MSG = "成功"; + + public static final int ERROR_CODE = 500; + + public static final String ERROR_MSG = "Internal server error"; + + /** + * 状态码 + */ + private Integer respCode; + + /** + * 返回描述 + */ + private String respMsg; + + /** + * 返回数据 + */ + private T data; + + /** + * 全参构造函数 + * + * @param respCode 状态码 + * @param respMsg 返回内容 + * @param data 返回数据 + */ + private OssApiResponse(Integer respCode, String respMsg, T data) { + this.respCode = respCode; + this.respMsg = respMsg; + this.data = data; + } + + /** + * 构造一个自定义的API返回 + * + * @param respCode 状态码 + * @param respMsg 返回内容 + * @param data 返回数据 + * @return ApiResponse + */ + public static OssApiResponse of(Integer respCode, String respMsg, T data) { + return new OssApiResponse(respCode, respMsg, data); + } + + /** + * 构造一个成功且不带数据的API返回 + * + * @return ApiResponse + */ + public static OssApiResponse ofSuccess() { + return ofSuccess(null); + } + + /** + * 构造一个成功且带数据的API返回 + * + * @param data 返回数据 + * @return ApiResponse + */ + public static OssApiResponse ofSuccess(T data) { + return ofStatus(Status.OK, data); + } + + /** + * 构造一个成功且自定义消息的API返回 + * + * @param msg 返回内容 + * @return ApiResponse + */ + public static OssApiResponse ofMessage(String msg) { + return of(Status.OK.getCode(), msg, null); + } + + /** + * 构造一个有状态的API返回 + * + * @param status 状态 {@link Status} + * @return ApiResponse + */ + public static OssApiResponse ofStatus(ApiStatus status) { + return ofStatus(status, null); + } + + /** + * 构造一个有状态且带数据的API返回 + * + * @param status 状态 {@link Status} + * @param data 返回数据 + * @return ApiResponse + */ + public static OssApiResponse ofStatus(ApiStatus status, T data) { + return of(status.getCode(), status.getReasonPhrase(), data); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProcessCommentRes.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProcessCommentRes.java new file mode 100644 index 0000000..c4e9fb5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProcessCommentRes.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.provincial.model.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname ProcessCommentDTO + * @Description + * @Date 2023/3/2 15:25 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProcessCommentRes", description = "省局返回流程审核详情") +@AllArgsConstructor +@NoArgsConstructor +public class ProcessCommentRes { + + @ApiModelProperty("任务id") + private String taskId; + + @ApiModelProperty("comment") + private String comment; + + @ApiModelProperty("流程步骤") + private String stepName; + + @ApiModelProperty("节点ID") + private String nodeId; + + @ApiModelProperty("审批状态") + private String status; + + @ApiModelProperty("审批人") + private String label; + + @ApiModelProperty("时间") + private String approverTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialApplicationRes.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialApplicationRes.java new file mode 100644 index 0000000..d82bd4c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialApplicationRes.java @@ -0,0 +1,108 @@ +package com.hz.pm.api.provincial.model.res; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname ProvincialApplicationDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@ApiModel(value = "ProvincialApplicationRes", description = "") +@NoArgsConstructor +@AllArgsConstructor +public class ProvincialApplicationRes implements Serializable { + + + //云 信息 + private List clouds; + //是否初次建设 1是 2不是 + private Integer isFirst; + //应用名称 + private String applicationName; + //关联 关联的IRS应用code + private String applicationCode; + //关联的IRS应用name + private String relatedExistsApplication; + //1: '办公类系统',2: '业务应用类系统',3: '门户网站',4: '宣传微博/微信公众号',5: '硬件类系统',6: '工具类系统',99: '其他' + private Integer applicationType; + //建设层级 1:国家 2:省级 3:市级 4:县(市、区) + private Integer buildLevel; + //是否统建 0:否 1:是 + private Integer isUniteBuild; + //统建类型 1:全省统建 2:全市统建 + private Integer unionBuildKind; + //应用简介 + private String applicationSummary; + //应用备注 + private String applicationRemark; + //应用总投资测算明细 + private String applicationEstimateFile; + //是否数改系统 0:否 1:是 + private Integer isFiveDomain; + //1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔 + private String fiveDomain; + //业务领域 + private String bizDomain; + //否涉及业务协同 0:否 1:是 + private Integer isBizCooperate; + //协同单位111111 + private String cooperativeUnit; + //用户范围 0: '机关事业单位人员','0-1': '跨部门跨系统','0-2': '系统内地方各级','0-3': '本部门本级','0-4': '处室内部','0-6': '主管处室内部','0-5': '其他',1: '企业', 2: '社会公众',3: '其他' 多个用英文,分隔 + private String userRange; + //是否使用政务云资源 1使用 + private Integer useGovCloud; + //是否符合国家信息技术应用创新相关规范 0:否 1:是 + private Integer nationalITSpec; + //网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机 + private String netEnv; + //等保级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer secrecyGrade; + //密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级 + private Integer passwordGrade; + //是否是S2 0:否 1:是 + private Integer isS2; + //一本账应用名称 + private String accountAppName; + //领域”大脑”一本帐名称 + private String brainAccountAppName; + //是否使用公共数据 + private Integer useCommonData; + //使用的公共数据名称 + private String dataName; + //使用公共组件的名称 + private String commonComponents; + //是否使用公共组件 + private Integer useCommonComponent; + //是否产生公共组件 + private Integer isProduceCommonComponent; + //产生的组件名称 + private String produceCommonComponent; + //发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' + private String publishSide; + + @Builder + @JsonIgnoreProperties(value = { "handler"}) + @NoArgsConstructor + @AllArgsConstructor + public static class Cloud implements Serializable { + //云资源台数 11 + private Integer cloudNums; + //云资源类型 云服务器(ECS) + private String cloudType; + //云资源规格 1核8G + private String cloudBasicSpec; + //云资源描述 + private String cloudUseDescription; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java new file mode 100644 index 0000000..19027a4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java @@ -0,0 +1,132 @@ +package com.hz.pm.api.provincial.model.res; + +import com.hz.pm.api.provincial.model.dto.ProvincialApplicationDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Classname ProvincialProjectDTO + * @Description + * @Date 2023/3/2 10:06 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ProvincialProjectDTO", description = "") +public class ProvincialProjectRes implements Serializable { + + @ApiModelProperty("项目审核结果 1审核中 2审核通过 3审核不通过") + private Integer projectStatus; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("重大项目名称") + private String projectName; + + @ApiModelProperty("重大项目code 21位") + private String projectId; + + @ApiModelProperty("项目类型 1新建 2续建") + private Integer projectType; + + @ApiModelProperty("项目总投资(万元)") + private BigDecimal totalMoney; + + @ApiModelProperty("项目年度预算(万元)") + private BigDecimal yearBudget; + + @ApiModelProperty("自有资金,政府投资-本级财政资金,政府投资-上级补助资金") + private String budgetFrom; + + @ApiModelProperty("预算年度 2023") + private String year; + + @ApiModelProperty("财政code 32") + private String financialCode; + + @ApiModelProperty("发改code 23") + private String developCode; + + @ApiModelProperty("开始时间 比如2022-11-18") + private String beginTime; + + @ApiModelProperty("结束时间 比如2022-12-13") + private String endTime; + + @ApiModelProperty("立项依据1111") + private String buildBasis; + + @ApiModelProperty("立项依据材料 [{\"fileId\":\"\"}]") + private String buildBasisFile; + + @ApiModelProperty("项目概述") + private String projectSummary; + + @ApiModelProperty("负责人") + private String responsibleMan; + + @ApiModelProperty("联系人联系方式") + private String responsibleManPhone; + + @ApiModelProperty("联系人") + private String contactName; + + @ApiModelProperty("联系人联系方式") + private String contactPhone; + + @ApiModelProperty("建设单位 比如财政局") + private String buildUnit; + + @ApiModelProperty("建设单位浙政钉code") + private String buildUnitCode; + + @ApiModelProperty("主管单位") + private String superUnit; + + @ApiModelProperty("主管单位浙政钉code") + private String superUnitCode; + + @ApiModelProperty("可研报告文件") + private String researchReport; + + @ApiModelProperty("项目申报书") + private String projectApplyFile; + + @ApiModelProperty("项目总投资测算明细") + private String projectEstimateFile; + + @ApiModelProperty("申报单位主要职责") + private String unitThreePlan; + + @ApiModelProperty("其他附件") + private String otherFile; + + @ApiModelProperty("项目备注111") + private String projectRemark; + + @ApiModelProperty("是否有效 1有效 2无效 3撤回") + private Integer isEffective; + + @ApiModelProperty("是否包含应用 1包含") + private Integer includeApplication; + + @ApiModelProperty("app信息") + private List applicationInfo; + + @ApiModelProperty("审核信息") + private List processComment; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java new file mode 100644 index 0000000..5c3ea1c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java @@ -0,0 +1,120 @@ +package com.hz.pm.api.provincial.model.res; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiStatus; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * ApiResponse - 省局统一的接口返回值封装 + *

+ * + * @author ZPF + * @since 14:29 2022/9/29 + */ +@Data +@NoArgsConstructor +public class SjApiResponse implements Serializable { + private static final long serialVersionUID = 532384723325394156L; + + public static final int SUCCESS_CODE = 200; + + public static final String SUCCESS_MSG = "success"; + + public static final int ERROR_CODE = 500; + + public static final String ERROR_MSG = "Internal server error"; + + /** + * 状态码 + */ + private Integer code; + + /** + * 返回内容 + */ + private String msg; + + /** + * 返回数据 + */ + private T data; + + /** + * 全参构造函数 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 返回数据 + */ + private SjApiResponse(Integer code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + /** + * 构造一个自定义的API返回 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 返回数据 + * @return ApiResponse + */ + public static SjApiResponse of(Integer code, String msg, T data) { + return new SjApiResponse(code, msg, data); + } + + /** + * 构造一个成功且不带数据的API返回 + * + * @return ApiResponse + */ + public static SjApiResponse ofSuccess() { + return ofSuccess(null); + } + + /** + * 构造一个成功且带数据的API返回 + * + * @param data 返回数据 + * @return ApiResponse + */ + public static SjApiResponse ofSuccess(T data) { + return ofStatus(Status.OK, data); + } + + /** + * 构造一个成功且自定义消息的API返回 + * + * @param msg 返回内容 + * @return ApiResponse + */ + public static SjApiResponse ofMessage(String msg) { + return of(Status.OK.getCode(), msg, null); + } + + /** + * 构造一个有状态的API返回 + * + * @param status 状态 {@link Status} + * @return ApiResponse + */ + public static SjApiResponse ofStatus(ApiStatus status) { + return ofStatus(status, null); + } + + /** + * 构造一个有状态且带数据的API返回 + * + * @param status 状态 {@link Status} + * @param data 返回数据 + * @return ApiResponse + */ + public static SjApiResponse ofStatus(ApiStatus status, T data) { + return of(status.getCode(), status.getReasonPhrase(), data); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/IJoinReviewProvincialBureauService.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/IJoinReviewProvincialBureauService.java new file mode 100644 index 0000000..7aed3db --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/IJoinReviewProvincialBureauService.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.provincial.service; + +import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; +import com.hz.pm.api.provincial.model.dto.ProvincialProjectDTO; +import com.hz.pm.api.provincial.model.res.SjApiResponse; + +import java.security.NoSuchAlgorithmException; +import java.util.List; + +/** + * @Classname JointReviewProvincialBureauService + * @Description 省局联审接口 + * @Date 2023/3/2 9:29 + * @Author PoffyZhang + */ +public interface IJoinReviewProvincialBureauService { + + /** + * 推送/保存 重大接口到 省局联审 + * @return + */ + Boolean pushImportProject(ProvincialProjectDTO project); + + + /** + * 查看 本区域 省局联审 的项目审核详情 + * @return + */ + SjApiResponse processInfo(String projectId); + + /** + * 查询省级主管单位列表 + * @return + */ + List searchGovUnits(); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java new file mode 100644 index 0000000..04e3302 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java @@ -0,0 +1,213 @@ +package com.hz.pm.api.provincial.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.MD5; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; +import com.ningdatech.irs.contants.IrsContant; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.common.config.ProvincialProperties; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; +import com.hz.pm.api.provincial.model.dto.ProvinceApiResponse; +import com.hz.pm.api.provincial.model.dto.ProvincialProjectDTO; +import com.hz.pm.api.provincial.model.res.SjApiResponse; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +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.MediaType; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname JointReviewProvincialBureauService + * @Description 省局联审接口 + * @Date 2023/3/2 9:29 + * @Author PoffyZhang + */ +@Service +@Slf4j +public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvincialBureauService { + + @Autowired + private ProvincialProperties provincialProperties; + + @Autowired + private RestTemplate restTemplate; + + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + @Value("${irs.province-gov.url}") + private String govUrl; + + @Value("${irs.province-gov.appSecret}") + private String govAppSecret; + + @Value("${irs.province-gov.appKey}") + private String govAppKey; + + @Value("${irs.province-gov.interfaceName}") + private String interfaceName; + + /** + * 推送/保存 重大接口到 省局联审 + * @return + */ + @Override + public Boolean pushImportProject(ProvincialProjectDTO project){ + Long timeStamp = System.currentTimeMillis()/1000; + String url = provincialProperties.getHost() + provincialProperties.getPushUrl() + + "?timestamp=" + timeStamp; + log.info("省局推送联审url {}",url); + ResponseEntity responseEntity = null; + + String signature = getSha256(timeStamp,provincialProperties.getPushUrl(), + HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); + + //发送post请求 + RequestEntity requestEntity = RequestEntity + .post(url) + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .header("X-Hmac-Auth-Key",provincialProperties.getKey()) + .header("X-Hmac-Auth-Signature",signature) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .body(project); + + log.info("省局联审 提交 :{}", requestEntity); + log.info("省局联审 提交body :{}", JSON.toJSONString(requestEntity.getBody())); + try { + responseEntity = restTemplate.exchange(requestEntity, ProvinceApiResponse.class); + log.info("省局联审 响应 :{}",responseEntity); + if(responseEntity.getBody().getCode().equals(200)){ + return Boolean.TRUE; + } + } catch (Exception e) { + log.error("[省局联审] http request error", e); + } + + return Boolean.FALSE; + } + + /** + * 获取流程审批详情 + * @param projectId + * @return + */ + @Override + public SjApiResponse processInfo(String projectId) { + Long timeStamp = System.currentTimeMillis()/1000; + String url = provincialProperties.getHost() + provincialProperties.getDetailUrl() + + "?timestamp=" + timeStamp; + + log.info("省局获取审核详情 url {}",url); + ResponseEntity responseEntity = null; + + String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), + HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); + + JSONObject jsonBaby = new JSONObject(); + jsonBaby.put("projectId",projectId); + log.info("请求体 :{}",jsonBaby); + //发送post请求 + RequestEntity requestEntity = RequestEntity + .post(url) + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .header("X-Hmac-Auth-Key",provincialProperties.getKey()) + .header("X-Hmac-Auth-Signature",signature) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .body(jsonBaby); //也可以是DTO + + try { + responseEntity = restTemplate.exchange(requestEntity,SjApiResponse.class); + log.info("获取审批详情 响应 :{}",responseEntity); + } catch (Exception e) { + log.error("[省局获取审核详情] http request error", e); + } + + return responseEntity.getBody(); + } + + @Override + public List searchGovUnits() { + Long timeStamp = System.currentTimeMillis(); + Long timeSeconds = System.currentTimeMillis()/1000; + String appSecret = govAppSecret; + String appKey = govAppKey; + String method = HttpMethod.POST.name(); + String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); + String sign = MD5.create().digestHex(appKey + secret + timeStamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + + String authSignature = getSha256(timeSeconds,provincialProperties.getDomainUrl(), HttpMethod.POST.name(), + provincialProperties.getKey(),provincialProperties.getSecret()); + String url = govUrl + "?appKey=" + appKey + + "×tamp=" + timeSeconds + "&sign=" + sign + + "&authKey=" + provincialProperties.getKey() + "&authSignature=" + authSignature + + "&requestTime=" + timeStamp; + log.info("gov search url :{}",url); + ResponseEntity forEntity = restTemplate.postForEntity(url,null, JSONObject.class, Maps.newHashMap()); + JSONObject body = forEntity.getBody(); + log.info("seach response :{}",body); + if(Objects.isNull(body)){ + return Collections.emptyList(); + } + String code = body.getString(IrsContant.RefreshToken.RESPONSE_KEY_CODE); + if(IrsContant.RefreshToken.SUCESS_CODE.equals(code)){ + JSONObject datas = body.getJSONObject(IrsContant.RefreshToken.RESPONSE_KEY_DATAS); + + if(Objects.isNull(datas)){ + return Collections.emptyList(); + } + JSONArray jsonArray = datas.getJSONArray(BizConst.RESPONSE_KEY_DATA); + if(CollUtil.isEmpty(jsonArray)){ + return Collections.emptyList(); + } + return jsonArray.stream().map(j -> { + JSONObject json = JSON.parseObject(JSON.toJSONString(j)); + ProvincialGovBusinessStripVO vo = new ProvincialGovBusinessStripVO(); + vo.setBusinessStripCode(json.getString(BizConst.ORG_CODE)); + vo.setBusinessStripName(json.getString(BizConst.ORG_NAME)); + return vo; + }).collect(Collectors.toList()); + } + + return Collections.emptyList(); + } + + private static String getSha256(Long timeStamp,String url,String method,String key,String secret){ + String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key; + log.info("加密message :{}",bytesToSign); + String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); + log.info("加密结果 :{}",res); + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java new file mode 100644 index 0000000..473f519 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.provincial.utils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; + +/** + * @Classname FileUtil + * @Description + * @Date 2023/9/6 9:09 + * @Author PoffyZhang + */ +public class FileUtil { + public static byte[] getBytesByFile(File file) { + try { + FileInputStream fis = new FileInputStream(file); + ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); + byte[] b = new byte[1000]; + int n; + while ((n = fis.read(b)) != -1) { + bos.write(b, 0, n); + } + fis.close(); + byte[] data = bos.toByteArray(); + bos.close(); + return data; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/controller/SafetyRiskController.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/controller/SafetyRiskController.java new file mode 100644 index 0000000..b37f565 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/controller/SafetyRiskController.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.safety.controller; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.safety.manage.SafetyRiskManage; +import com.hz.pm.api.safety.model.dto.PersonSafetyInfoDTO; +import com.hz.pm.api.safety.model.dto.SupplierSafetyQualificationDTO; +import com.hz.pm.api.safety.model.vo.ProjectMonitorVO; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java new file mode 100644 index 0000000..adc37e6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java @@ -0,0 +1,243 @@ +package com.hz.pm.api.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.safety.model.dto.PersonSafetyInfoDTO; +import com.hz.pm.api.safety.model.dto.SupplierSafetyQualificationDTO; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; +import com.hz.pm.api.safety.model.vo.*; +import com.hz.pm.api.safety.service.IPersonSafetyInfoService; +import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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; + + private final IProjectApplicationService applicationService; + + /** + * 列表 + * @param req + * @return + */ + public PageVo personMonitorList(ProjectListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .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())); + } + + List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, project.getVersion())); + + EqualProtectionVO equalProtectionVO = new EqualProtectionVO(); + + if(CollUtil.isNotEmpty(apps)){ + Integer maxPassWordGrade = 0; + Integer maxSecerecyGrade = 0; + for(ProjectApplication app : apps) { + maxPassWordGrade = Math.max(maxPassWordGrade,app.getPasswordGrade()); + maxSecerecyGrade = Math.max(maxSecerecyGrade,app.getSecrecyGrade()); + } + + equalProtectionVO.setPasswordGrade(maxPassWordGrade); + equalProtectionVO.setSecrecyGrade(maxSecerecyGrade); + } + + vo.setEqualProtection(equalProtectionVO); + + 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 BizConst.SAVE_SUCCESS + 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 BizConst.SAVE_SUCCESS + sucessNum + "条"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/PersonSafetyInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/PersonSafetyInfoMapper.java new file mode 100644 index 0000000..315db9c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/PersonSafetyInfoMapper.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.safety.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface PersonSafetyInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/SupplierSafetyQualificationMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/SupplierSafetyQualificationMapper.java new file mode 100644 index 0000000..58e3365 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/mapper/SupplierSafetyQualificationMapper.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.safety.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface SupplierSafetyQualificationMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/PersonSafetyInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/PersonSafetyInfoDTO.java new file mode 100644 index 0000000..7b60f38 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/PersonSafetyInfoDTO.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("联系方式") + private String contactInfo; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/SupplierSafetyQualificationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/SupplierSafetyQualificationDTO.java new file mode 100644 index 0000000..2e26002 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/dto/SupplierSafetyQualificationDTO.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("供应商名称") + private String supplierName; + + @ApiModelProperty("厂商人员名称") + private String username; + + @ApiModelProperty("联系方式") + private String contactInfo; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/PersonSafetyInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/PersonSafetyInfo.java new file mode 100644 index 0000000..0aad0ab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/PersonSafetyInfo.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("联系方式") + private String contactInfo; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/SupplierSafetyQualification.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/SupplierSafetyQualification.java new file mode 100644 index 0000000..e0fd952 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/entity/SupplierSafetyQualification.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("供应商名称") + private String supplierName; + + @ApiModelProperty("厂商人员名称") + private String username; + + @ApiModelProperty("联系方式") + private String contactInfo; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java new file mode 100644 index 0000000..5c87cad --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.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 = "等保详情", description = "等保详情") +public class EqualProtectionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/PersonSafetyInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/PersonSafetyInfoVO.java new file mode 100644 index 0000000..d3feb4e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/PersonSafetyInfoVO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("联系方式") + private String contactInfo; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/ProjectMonitorVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/ProjectMonitorVO.java new file mode 100644 index 0000000..798975a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/ProjectMonitorVO.java @@ -0,0 +1,78 @@ +package com.hz.pm.api.safety.model.vo; + +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SafetyMonitorVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SafetyMonitorVO.java new file mode 100644 index 0000000..6c4d2a1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SafetyMonitorVO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("等保详情") + private EqualProtectionVO equalProtection; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SupplierSafetyQualificationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SupplierSafetyQualificationVO.java new file mode 100644 index 0000000..3ce6747 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/SupplierSafetyQualificationVO.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.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; + + @ApiModelProperty("供应商名称") + private String supplierName; + + @ApiModelProperty("厂商人员名称") + private String username; + + @ApiModelProperty("联系方式") + private String contactInfo; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/IPersonSafetyInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/IPersonSafetyInfoService.java new file mode 100644 index 0000000..e23a82d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/IPersonSafetyInfoService.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.safety.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; + +/** + * @Classname IPersonSafetyInfoService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface IPersonSafetyInfoService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/ISupplierSafetyQualificationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/ISupplierSafetyQualificationService.java new file mode 100644 index 0000000..fbfd62d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/ISupplierSafetyQualificationService.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.safety.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; + +/** + * @Classname ISupplierSafetyQulificationService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface ISupplierSafetyQualificationService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/PersonSafetyInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/PersonSafetyInfoServiceImpl.java new file mode 100644 index 0000000..c631b5e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/PersonSafetyInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.safety.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.safety.mapper.PersonSafetyInfoMapper; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/SupplierSafetyQualificationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/SupplierSafetyQualificationServiceImpl.java new file mode 100644 index 0000000..c50694d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/service/impl/SupplierSafetyQualificationServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.safety.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.safety.mapper.SupplierSafetyQualificationMapper; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java new file mode 100644 index 0000000..1602eb8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.scheduler.contants; + +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; + +/** + * @author PoffyZhang + * @Classname TaskContant + * @Description + * @Date 2023/1/18 11:00 + */ +public interface TaskContant { + + class Host { + public static final String HOST_ZPF = "LAPTOP-NQGEQP03"; + public static final String HOST_CMM2 = "DESKTOP-KN1L6HL"; + public static final String HOST_CMM = "LAPTOP-PCISPN2O"; + + public static final String HOST_207 = "iZbp13nwyvib53j4j1p2xoZ"; + } + + class Wflow { + public static final String DEFAULT_FORM_NAME = "丽水申报项目表单"; + + public static final String[] DEFAULT_PROCESS_LIST = {"单位内部审批流程","项目预审审批流程","部门联合审批流程","建设方案审批流程","验收申报审批流程"}; + + public static final Integer[] DEFAULT_PROCESS_TYPE_LIST = { + ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode(), + ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode(), + ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode(), + ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode(), + ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode(), + ProjectProcessStageEnum.APPLY_DELAY.getCode(), + ProjectProcessStageEnum.APPLY_BORROW.getCode() + }; + + public static final Integer[] APPLY_PROCESS_TYPE_LIST = { + ProjectProcessStageEnum.APPLY_DELAY.getCode(), + ProjectProcessStageEnum.APPLY_BORROW.getCode() + }; + } + + class ProvinceReview{ + public static final String END_NODE_ID = "结束"; + + public static final String END_STEP = "流程结束"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java new file mode 100644 index 0000000..d5053cf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java @@ -0,0 +1,122 @@ +package com.hz.pm.api.scheduler.listener; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.wflow.bean.entity.WflowCcTasks; +import com.wflow.service.WflowCcTasksService; +import com.wflow.workflow.notify.event.CcTaskEvent; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.HistoryService; +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.Duration; +import java.util.List; +import java.util.Objects; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.CC_MSG_TEMPLATE; + +/** + * 抄送事件 事件监听 + * + * @author ZPF + * @return + * @since 2023/04/14 14:19 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CcTaskListener { + private final IProjectInstService projectInstService; + + private final HistoryService historyService; + private final IProjectService projectService; + private final NoticeManage noticeManage; + + private final WflowCcTasksService ccTasksService; + + private final CachePlusOps cachePlusOps; + + private final UserInfoHelper userInfoHelper; + + private static final String DUP_KEY = "ccTasks"; + private static final String NODE = "node:"; + + @Async + @EventListener + public void onApplicationEvent(CcTaskEvent event) throws InterruptedException { + log.info("进入抄送人任务 事件监听!{}", JSON.toJSONString(event)); + String instCode = event.getInstCode(); + String processDefinitionId = event.getProcessDefinitionId(); + String nodeId = event.getNodeId(); + String taskId = event.getTaskId(); + + //这里 redis 处理一下 1分钟处理同一 nodeId 一次 + if (cachePlusOps.get(NODE + nodeId + DUP_KEY) != null) { + log.info("一分钟只能处理该nodeId一次!{}", nodeId); + return; + } + + //1分钟 + CacheKey key = new CacheKey(); + key.setKey(NODE + nodeId + DUP_KEY); + key.setExpire(Duration.ofMinutes(1)); + cachePlusOps.set(key, nodeId); + + //睡3秒 让数据库 生成抄送数据先 + Thread.sleep(3000); + + log.info("instCode :{},nodeId :{}",instCode, nodeId); + //1.去查找 项目实例关系表 + List tasks = ccTasksService.list(Wrappers.lambdaQuery(WflowCcTasks.class) + .eq(WflowCcTasks::getInstanceId, instCode) + .eq(WflowCcTasks::getNodeId, nodeId)); + + if (Objects.isNull(tasks)) { + return; + } + + log.info("tasks :{}",tasks.size()); + + //有可能 一个节点 有多个用户抄送 + tasks.stream().forEach(task -> { + log.info("cc tasks :{}",JSON.toJSONString(tasks)); + + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instCode) + .singleResult(); + + log.info("instance :{}",JSON.toJSONString(instance)); + + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode) + .last(BizConst.LIMIT_1)); + + log.info("projectInst :{}",JSON.toJSONString(projectInst)); + + if(Objects.isNull(projectInst) || Objects.isNull(instance)){ + return; + } + Long projectId = projectInst.getProjectId(); + Project project = projectService.getNewProject(projectId); + + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(task.getUserId()); + + //发送消息 + noticeManage.sendNotice(task.getUserId(),Objects.nonNull(user)? user.getUserId() : 93L,project,instance.getProcessDefinitionName(), + CC_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_CC); + }); + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java new file mode 100644 index 0000000..75139b2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java @@ -0,0 +1,132 @@ +package com.hz.pm.api.scheduler.listener; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.manage.EarlyWarningManage; +import com.hz.pm.api.sys.service.IProjectEarlyWarningService; +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; +import java.util.stream.Collectors; + +/** + * 预警规则触发 + * + * @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; + + private final IProjectEarlyWarningService projectEarlyWarningService; + + @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(); + Integer noticeType = event.getNoticeType(); + Integer overTimeout = event.getOverTimeout(); + + //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; + } + + //项目 预警信息 + projectEarlyWarningService.earlyWarning(project, + WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType); + + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + //这一批员工要通知的员工号 + String batchEmployees = hais.stream().map(HistoricActivityInstance::getAssignee) + .collect(Collectors.joining(StrPool.COMMA)); + for(HistoricActivityInstance hai : hais){ + String employeeCode = hai.getAssignee(); + String taskId = hai.getTaskId(); + String path = "toDoCenter/handleDuringExamine?instanceId=" + + instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,overTimeout, pi.getInstType(), + hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() + ,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, + path,batchEmployees,nodeId); + } + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java new file mode 100644 index 0000000..fdc8c3b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -0,0 +1,257 @@ +package com.hz.pm.api.scheduler.listener; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.manage.HandlerManage; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.notify.event.ProcessEndEvent; +import com.wflow.workflow.service.ProcessInstanceService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.task.api.Task; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE2; + +/** + * 工作流开始 结束监听 自动审批的话 会漏掉 调用状态机 + * + * @author ZPF + * @return + * @since 2023/04/14 14:19 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ProcessEndListener { + private final TaskService taskService; + private final HistoryService historyService; + private final IProjectInstService projectInstService; + + private final IProjectService projectService; + + private final ProcessInstanceService processInstanceService; + + private final HandlerManage handlerManage; + + private final IProjectStagingService projectStagingService; + + private final NoticeManage noticeManage; + + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + private final IProjectApplicationService projectApplicationService; + + private final FileService fileService; + + @Value("${spring.profiles.active}") + private String active; + + @Async + @EventListener + public void onApplicationEvent(ProcessEndEvent event) { + log.info("进入工作流结束的 事件监听!{}", event.getInstCode()); + String instCode = event.getInstCode(); + + log.info("instCode:{}", instCode); + + //休息3秒 + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + //1.去查找 项目实例关系表 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(projectInst)) { + return; + } + + List tasks = taskService.createTaskQuery() + .processInstanceId(instCode) + .active() + .list(); + + List historyTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(instCode) + .unfinished() + .list(); + + //已经没有任务了 + if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { + List historyTasksFinished = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(instCode) + .finished() + .list(); + + Long projectId = projectInst.getProjectId(); + Project project = projectService.getNewProject(projectId); + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instCode).singleResult(); + //通过审核后 所处理的逻辑 + afterPassTodo(project,instance); + } + } + + /** + * 审核通过后 所处理的逻辑 + * @param declaredProject + * @param instance + */ + public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ + Long userId = 110L; + // 获取流程通过后的流程实例 + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instance.getId()) + .singleResult(); + // 获取当前流程实例类型 + String instanceId = newInstance.getId(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId) + .last(BizConst.LIMIT_1)); + Integer instType = projectInst.getInstType(); + InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); + if (Objects.isNull(instTypeEnum)){ + throw new BizException("当前审批流类型不存在,流程类型code:" + instType); + } + + // 获取流程通过后当前流程详情 + ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); + // 获取流程通过后当前审核人信息,向其发送工作通知 + // 会签/或签会有多个审核人 + List currentEmployeeCodeList = Lists.newArrayList(); + List newProgressInfo = newInstanceDetail.getProgressInfo(); + ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); + + // 说明当前节点是子流程节点 + if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { + List children = currentNode.getChildren(); + // 获取子流程当前审核人节点 + ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); + // 获取节点ID相同地审核节点 + List nodeList = children.stream() + .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); + currentEmployeeCodeList.addAll(userIdList); + } else { + List nodeList = newProgressInfo.stream() + .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); + currentEmployeeCodeList.addAll(userIdList); + } + + // 流程通过后,判断当前登录用户是不是最后一个审核人 + // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 + // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 + if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { + // 如果是申请延期和申请借阅审批流程,不走状态机 + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + switch (instTypeEnum) { + case APPLY_DELAY: + // 保存延期申请记录,更新项目建设周期和计划验收时间 + handlerManage.updateProjectDelayApplyInfo(declaredProject,instanceId); + break; + case APPLY_BORROW: + // 更新申请借阅状态为成功 + handlerManage.updateProjectApplyBorrowInfo(declaredProject,instanceId); + break; + default: + throw new BizException("传入实例类型错误: " + instTypeEnum); + } + }else { + switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { + // 当前项目状态是预审中 + case PRE_APPLYING: + //先修改项目状态 + handlerManage.updatePassProjectStatus(userId, declaredProject); + //然后入库暂存库 + projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); + break; + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + //如果是 区县 并且 500万及以上要推送省局重大项目 + if (!StateMachineUtils.isCityProject(declaredProject) && + StateMachineUtils.judgeDeclareAmount(declaredProject, + ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { + try { + List applications = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, declaredProject.getId())); + joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); + handlerManage.updatePassProjectStatus(userId, declaredProject); + break; + } catch (Exception e) { + log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); + log.error("区县推送省级联审失败:" + e); + } + } + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + handlerManage.updatePassProjectStatus(userId, declaredProject); + break; + default: + throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); + } + } + //发送消息 + noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); + } else { + // 若有下一个审核人(当前节点的用户),会签/或签会有多个 + // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 + // 获取发送浙政钉工作通知必要信息 + for (String currentEmployeeCode : currentEmployeeCodeList) { + if (Objects.isNull(currentEmployeeCode)) { + throw new BizException("审核人信息不存在!"); + } + //发送消息 + noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); + } + } + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java new file mode 100644 index 0000000..44c02f7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java @@ -0,0 +1,89 @@ +package com.hz.pm.api.scheduler.listener; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.wflow.workflow.notify.event.ProcessStartEvent; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; +import org.flowable.task.api.Task; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * 工作流开始 事件监听 + * + * @author ZPF + * @return + * @since 2023/04/14 14:19 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ProcessStartListener { + private final TaskService taskService; + private final HistoryService historyService; + private final IProjectInstService projectInstService; + + private final IProjectService projectService; + + private final StateMachineUtils stateMachineUtils; + + @Async + @EventListener + public void onApplicationEvent(ProcessStartEvent event) { + log.info("进入工作流开始 事件监听!{}", event.getInstCode()); + String instCode = event.getInstCode(); + + log.info("instCode:{}", instCode); + + //休息3秒 + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + //1.去查找 项目实例关系表 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(projectInst)) { + return; + } + + List tasks = taskService.createTaskQuery() + .processInstanceId(instCode) + .active() + .list(); + + List historyTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(instCode) + .finished() + .list(); + + //如果 是没有审批任务的话 就需要 去调用状态机 进入下一个阶段 + if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { + //如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机 + Long projectId = projectInst.getProjectId(); + Project project = projectService.getNewProject(projectId); + stateMachineUtils.pass(project); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + } + } +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java new file mode 100644 index 0000000..ae6e3d0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.date.StopWatch; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.ding.task.EmployeeBatchGetTask; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.util.List; + +/** + * @author liuxinxin + * @date 2023/1/12 上午9:53 + * 批量获取/更新部门信息任务 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class BatchUpdateEmployeeTask { + + @Value("${hostname}") + private String HOST_NAME; + + private final EmployeeBatchGetTask employeeBatchGetTask; + private final IDingOrganizationService organizationService; + + @Scheduled(cron = "0 45 1 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + return; + } + + log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + // 1.查出浙政钉 所有单位 + List units = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + ))); + + log.info("需要更新的 单位数量为 {}",units.size()); + + for(DingOrganization organization : units){ + log.info("当前单位是 {}",organization.getOrganizationName()); + employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode()); + } + + stopWatch.stop(); + log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务结束 {}s", stopWatch.getTotalTimeSeconds()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateOrganizationTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateOrganizationTask.java new file mode 100644 index 0000000..3e86bac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateOrganizationTask.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.scheduler.task; + +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2023/1/12 上午9:53 + * 批量获取/更新部门信息任务 + */ +@Component +public class BatchUpdateOrganizationTask { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java new file mode 100644 index 0000000..fab0f2a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java @@ -0,0 +1,118 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.http.HttpStatus; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.provincial.model.res.ProcessCommentRes; +import com.hz.pm.api.provincial.model.res.ProvincialProjectRes; +import com.hz.pm.api.provincial.model.res.SjApiResponse; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import com.hz.pm.api.scheduler.contants.TaskContant; +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.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @Classname CheckProvincialReviewResultTask + * @Description 去获取省级联审结果任务 + * @Date 2023/3/16 10:12 + * @Author PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CheckProvincialReviewResultTask { + + private final IJoinReviewProvincialBureauService reviewProvincialBureauService; + + private final IProjectService projectService; + private final StateMachineUtils stateMachineUtils; + + @Value("${hostname}") + private String HOST_NAME; + + @Value("${spring.profiles.active}") + private String active; + + @Scheduled(cron = "0 */1 * * * ?") + public void statusFlow() throws UnknownHostException { + if(BizConst.DEV.equals(active)){ + log.info("测试环境 省局 接口 暂时关闭"); + return; + } + // + if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + //1. 定时取 省级部门联审中的项目 去取项目 + List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) + .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) + .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) + .eq(Project::getAreaCode, RegionConst.RC_LS) + .eq(Project::getNewest,Boolean.TRUE) + .orderByAsc(Project::getCreateOn)); + + log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); + if(CollUtil.isEmpty(projectList)){ + log.info("没有正在省级联审中的项目!"); + return; + } + + //遍历 + for(Project project: projectList){ + try{ + SjApiResponse apiResponse = reviewProvincialBureauService.processInfo(project.getProjectCode()); + log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse); + if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){ + log.info("项目 【{}】 去获取省局联审结果失败",project.getId()); + continue; + } + ProvincialProjectRes projectRes = JSON.parseObject(JSON.toJSONString(apiResponse.getData()), + ProvincialProjectRes.class); + + if(CollUtil.isNotEmpty(projectRes.getProcessComment())){ + List processComments = projectRes.getProcessComment(); + log.info("此项目 【{}】 返回了审批信息",projectRes.getProjectId()); + //取到最后一个审批元素 + ProcessCommentRes lastProcessComment = processComments.get(processComments.size() - 1); + //最后一个 节点 nodeId 是结束 说明已经批完 + if(StringUtils.isNotBlank(lastProcessComment.getStepName()) && + TaskContant.ProvinceReview.END_STEP.equals(lastProcessComment.getStepName())){ + //在省级联审 才调状态机 否则 只改变 联审结果 + if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals( + project.getStatus())){ + stateMachineUtils.pass(project); + } + log.info("已经审批完成 进入下一状态"); + } + project.setUpdateOn(LocalDateTime.now()); + //保存审核结果 + project.setSjlsResult(CollUtil.isNotEmpty(projectRes.getProcessComment()) + ? JSON.toJSONString(projectRes.getProcessComment()) : StringUtils.EMPTY); + projectService.updateById(project); + }else{ + log.info("此项目 【{}】 还没有审批信息",projectRes.getProjectId()); + } + }catch (Exception e){ + log.error("项目审核信息获取异常 projectId:【" + project.getId() + "】 异常内容:" + e.getMessage()); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java new file mode 100644 index 0000000..05f33de --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -0,0 +1,975 @@ +package com.hz.pm.api.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.google.common.collect.Lists; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.statemachine.contants.RegionContant; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.model.entity.CockpitStats; +import com.hz.pm.api.dashboard.model.po.SecrecyPasswordGradePO; +import com.hz.pm.api.dashboard.service.ICockpitStatsService; +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.gov.enumeration.GovProjectStatusEnum; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertTagService; +import com.hz.pm.api.meta.service.IMetaTagService; +import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; +import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author ZPF + * @Class CockpitStatsStatisticsTask + * 驾驶舱 统计 每日任务 + * @since 2023/08/31 18:16 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class CockpitStatsStatisticsTask { + + @Value("${hostname}") + public String HOST; + + @Value("${spring.profiles.active}") + public String active; + + @Autowired + private ICockpitStatsService cockpitStatsService; + + @Autowired + private RegionCacheHelper regionCacheHelper; + + @Autowired + private IProjectService projectService; + + @Autowired + private IProjectInstService projectInstService; + + @Autowired + private IExpertUserFullInfoService expertUserFullInfoService; + + @Autowired + private IPerformanceAppraisalProjectService performanceAppraisalProjectService; + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + + @Autowired + private IGovBizProjectApplyService applyService; + + @Autowired + private HistoryService historyService; + + @Autowired + private IGovBizProjectApproveService approveService; + + @Autowired + private IGovBizProjectProcureService procureService; + + @Autowired + private IGovBizProjectCimplementService cimplementService; + + @Autowired + private IEarlyWarningRecordsService earlyWarningRecordsService; + + @Autowired + private IExpertIntentionWorkRegionService expertIntentionWorkRegionService; + + private List years = Lists.newArrayList(2021,2022,2023,2024,2025); + + private final IMetaTagService metaTagService; + + private final IExpertTagService expertTagService; + + /** + * 定义统计 驾驶舱数据 每天3点开始执行一次 + * + */ + @Scheduled(cron = "0 0 3 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + if(BizConst.PRE.equals(active)){ + log.info("预发环境不用同步!"); + return; + } + + log.info("驾驶舱数据统计任务开始====="); + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List res = Lists.newArrayList(); + //1.根据2个维度来统计 区域和分年 + //1.总的 + res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, + DashboardConstant.CockpitStats.TOTAL,DashboardConstant.CockpitStats.NONE_YEAR)); + for(Integer year : years){ + res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, + DashboardConstant.CockpitStats.TOTAL,year)); + } + + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); + for(RegionDTO regionDto : regions){ + res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), + DashboardConstant.CockpitStats.NONE_YEAR)); + for(Integer year : years){ + res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),year)); + } + } + + //如果结果不为空 就删除之前的 插入最新的数据 + if(CollUtil.isNotEmpty(res)){ + //计算增长率 + computeRates(res); + List list = cockpitStatsService.list(); + List ids = list.stream().map(CockpitStats::getId).collect(Collectors.toList()); + cockpitStatsService.removeByIds(ids); + cockpitStatsService.saveBatch(res); + } + + stopWatch.stop(); + log.info("驾驶舱数据统计任务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + private void computeRates(List res) { + Map map = res.stream().collect(Collectors.toMap(r -> r.getRegionCode() + r.getYear(), r -> r)); + for(CockpitStats cockpitStats : res){ + if(Objects.isNull(cockpitStats.getYear())){ + continue; + } + //算增长率 + //去年的数据 用于算 增长比例 + if(cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)){ + Integer thisYear = LocalDateTime.now().getYear(); + CockpitStats thisYearData = map.get(cockpitStats.getRegionCode() + thisYear); + CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (thisYear - 1)); + buidMonitorRise(cockpitStats,thisYearData,lastYearData); + }else{ + CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (cockpitStats.getYear() - 1)); + buidMonitorRise(cockpitStats,cockpitStats,lastYearData); + } + } + + } + + /** + * 统计的具体逻辑 + * @param regionCode + * @param regionName + * @param year + * @return + */ + private CockpitStats statisticsData(String regionCode, String regionName, Integer year) { + CockpitStats cockpitStats = new CockpitStats(); + cockpitStats.setRegionCode(regionCode); + cockpitStats.setRegionName(regionName); + cockpitStats.setYear(year); + + //申报项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + Project::getAreaCode, regionCode) + .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + Project::getProjectYear, year) + .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + Project::getProjectYear, years)); + + //项目归集 + List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + GovBizProjectApply::getBaseProjSetYear, year) + .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + GovBizProjectApply::getBaseProjSetYear, years)); + List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) + .collect(Collectors.toList()); + + List baseInfos = Lists.newArrayList(); + if(CollUtil.isNotEmpty(yearProjIds)){ + baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE) + .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); + } + + List approves = Lists.newArrayList(); + List applies = Lists.newArrayList(); + List procures = Lists.newArrayList(); + List cimplements = Lists.newArrayList(); + if(CollUtil.isNotEmpty(baseInfos)){ + List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); + approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId, baseProjIds)); + + applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId, baseProjIds)); + + procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId, baseProjIds)); + + cimplements = cimplementService.list(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .in(GovBizProjectCimplement::getBaseProjId, baseProjIds)); + } + + //1.项目监测 + //1.1 超期在建项目 + Integer overdueConstructionProjectsNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getPlanAcceptanceTime()) && + p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0 && + Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setMonitorOverdueConstructionProjectsNum(overdueConstructionProjectsNum); + //1.2 环节滞后项目 + cockpitStats.setMonitorLaggingProjectsNum(computeLagging(projects)); + + //1.3预审驳回项目 + Integer preFailed = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setMonitorRejectedPreReviewProjectsNum(preFailed); + + //1.4 建设方案评审失败 + Integer constructionFailed = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setMonitorRejectedApproveProjectsNum(constructionFailed); + //1.5 验收不达标 + cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0); + + //1.6 总申报金额 + Double totalDeclaredAmount = projects.stream().mapToDouble(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount().doubleValue() : 0.0).sum(); + cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount)); + //1.7 总安全投入 + Double totalSafytyAmount = projects.stream().mapToDouble(p -> { + if(Objects.nonNull(p.getSafetyInputDescribe())){ + final Double[] total = {0.0}; + try{ + JSONArray array = JSON.parseArray(p.getSafetyInputDescribe()); + array.forEach(j -> { + JSONObject json = JSON.parseObject(JSON.toJSONString(j)); + Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); + total[0] += safetyInputAmount; + }); + }catch (Exception e){ + + } + return total[0]; + } + return 0.0; + }).sum(); + cockpitStats.setMonitorSafetyInputAmount(BigDecimal.valueOf(totalSafytyAmount)); + + //1.8等保密评 + SecrecyPasswordGradePO secrecyPasswordGradePo = cockpitStatsService.getSecrecyPasswordGrade(regionCode, year); + + Integer guijiSecerecyGrade1 = 0; + Integer guijiSecerecyGrade2 = 0; + Integer guijiSecerecyGrade3 = 0; + Integer guijiSecerecyGrade4 = 0; + Integer guijiSecerecyGrade5 = 0; + //项目归集 评审信息 + for (GovBizProjectApprove approve : approves){ + String equalProtectionLevel = approve.getEqualProtectionLevel(); + if(StringUtils.isNotBlank(equalProtectionLevel)){ + switch (equalProtectionLevel){ + case "01": + guijiSecerecyGrade1++; + break; + case "02": + guijiSecerecyGrade2++; + break; + case "03": + guijiSecerecyGrade3++; + break; + case "04": + guijiSecerecyGrade4++; + break; + case "05": + guijiSecerecyGrade5++; + break; + default: + break; + } + } + } + + Integer passwordGradeNumGov = 0; + for (GovBizProjectCimplement cimplement : cimplements){ + if(StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ + passwordGradeNumGov ++; + } + } + + if(Objects.nonNull(secrecyPasswordGradePo)){ + cockpitStats.setMonitorSecrecyGrade1Num(secrecyPasswordGradePo.getMonitorSecrecyGrade1Num() + guijiSecerecyGrade1); + cockpitStats.setMonitorSecrecyGrade2Num(secrecyPasswordGradePo.getMonitorSecrecyGrade2Num() + guijiSecerecyGrade2); + cockpitStats.setMonitorSecrecyGrade3Num(secrecyPasswordGradePo.getMonitorSecrecyGrade3Num() + guijiSecerecyGrade3); + cockpitStats.setMonitorSecrecyGrade4Num(secrecyPasswordGradePo.getMonitorSecrecyGrade4Num() + guijiSecerecyGrade4); + cockpitStats.setMonitorSecrecyGrade5Num(secrecyPasswordGradePo.getMonitorSecrecyGrade5Num() + guijiSecerecyGrade5); + cockpitStats.setMonitorPasswordGrade1Num(secrecyPasswordGradePo.getMonitorPasswordGrade1Num() + passwordGradeNumGov); + cockpitStats.setMonitorPasswordGrade2Num(secrecyPasswordGradePo.getMonitorPasswordGrade2Num()); + cockpitStats.setMonitorPasswordGrade3Num(secrecyPasswordGradePo.getMonitorPasswordGrade3Num()); + cockpitStats.setMonitorPasswordGrade4Num(secrecyPasswordGradePo.getMonitorPasswordGrade4Num()); + cockpitStats.setMonitorPasswordGrade5Num(secrecyPasswordGradePo.getMonitorPasswordGrade5Num()); + }else{ + cockpitStats.setMonitorSecrecyGrade1Num(guijiSecerecyGrade1); + cockpitStats.setMonitorSecrecyGrade2Num(guijiSecerecyGrade2); + cockpitStats.setMonitorSecrecyGrade3Num(guijiSecerecyGrade3); + cockpitStats.setMonitorSecrecyGrade4Num(guijiSecerecyGrade4); + cockpitStats.setMonitorSecrecyGrade5Num(guijiSecerecyGrade5); + cockpitStats.setMonitorPasswordGrade1Num(passwordGradeNumGov); + } + + //2.专家统计 + List lsRegionCodes = RegionConst.LS_ARR; + List intentions = expertIntentionWorkRegionService.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + ExpertIntentionWorkRegion::getRegionCode, regionCode) + .in(StringUtils.isBlank(regionCode) || DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + ExpertIntentionWorkRegion::getRegionCode, lsRegionCodes)); + + List experts = Lists.newArrayList(); + if(CollUtil.isNotEmpty(intentions)){ + List userIds = intentions.stream().map(ExpertIntentionWorkRegion::getUserId) + .collect(Collectors.toList()); + experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .in(ExpertUserFullInfo::getUserId, userIds) + .eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); + } + + List goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); + Map> tagMap = goodAt.stream() + .collect(Collectors.groupingBy(ExpertTag::getUserId)); + + String networkCode = DashboardConstant.Expert.NETWORK_CODE; + String xinchuangCode = DashboardConstant.Expert.XINCHUANG_CODE; + String fanganCode = DashboardConstant.Expert.FANGAN_CODE; + String jishuCode = DashboardConstant.Expert.JISHU_CODE; + String dangzhengCode = DashboardConstant.Expert.DANGZHENG_CODE; + String ruanyingCode = DashboardConstant.Expert.RUANYING_CODE; + String caiwuCode = DashboardConstant.Expert.CAIWU_CODE; + List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, + dangzhengCode,ruanyingCode,caiwuCode); + + cockpitStats.setExpertTotalNum(experts.size()); + Integer financialNum = 0; + Integer networkSecurityNum = 0; + Integer xinchuangNum = 0; + Integer planRationalityNum = 0; + Integer promotionInfoTechnologyNum = 0; + Integer partyGovInfoNum = 0; + Integer softHardPricingNum = 0; + Integer technicalFeasibilityAssessmentNum = 0; + Integer specialExpertNum = 0; + for(ExpertUserFullInfo e : experts){ + if(tagMap.containsKey(e.getUserId())){ + List expertTags = tagMap.get(e.getUserId()); + Boolean isContain = Boolean.FALSE; + for(ExpertTag expertTag : expertTags){ + if(expertTag.getTagCode().equals(networkCode)){ + networkSecurityNum++; + } + if(expertTag.getTagCode().equals(caiwuCode)){ + financialNum ++; + } + if(expertTag.getTagCode().equals(xinchuangCode)){ + xinchuangNum ++; + } + if(expertTag.getTagCode().equals(fanganCode)){ + planRationalityNum++; + } + if(expertTag.getTagCode().equals(jishuCode)){ + technicalFeasibilityAssessmentNum ++; + } + if(expertTag.getTagCode().equals(dangzhengCode)){ + partyGovInfoNum ++; + } + if(expertTag.getTagCode().equals(ruanyingCode)){ + softHardPricingNum ++; + } + if(specialTags.contains(expertTag.getTagCode())){ + isContain = Boolean.TRUE; + } + } + if(isContain){ + specialExpertNum ++; + } + } + } + //财务专家 + cockpitStats.setExpertFinancialNum(financialNum); + //网络安全 + cockpitStats.setExpertNetworkSecurityNum(networkSecurityNum); + cockpitStats.setExpertXinchuangNum(xinchuangNum); + cockpitStats.setExpertPlanRationalityNum(planRationalityNum); + cockpitStats.setExpertPromotionInfoTechnologyNum(promotionInfoTechnologyNum); + cockpitStats.setExpertPartyGovInfoNum(partyGovInfoNum); + cockpitStats.setExpertSoftHardPricingNum(softHardPricingNum); + cockpitStats.setExpertTechnicalFeasibilityAssessmentNum(technicalFeasibilityAssessmentNum); + cockpitStats.setSpecialExpertNum(specialExpertNum); + + //3.顶部数据 + //3.1 计划项目数(申报项目:完成年度计划的项目总数 + // 项目归集:评审中、待立项、已立项、已采购、已初验、已终验项目总和) + Integer planProjectNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer planProjectNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && + //排除 已驳回 已终止 + (!Lists.newArrayList(GovProjectStatusEnum.REJECTED.getCode(), + GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setTopPlanProjectsNum(planProjectNum + planProjectNumGov); + + //3.2 批复项目数(申报项目:完成立项批复流程项目总数 项目归集:已立项、已采购、已初验、已终验项目总和) + Integer approvalNumDeclared = projects.stream().filter(p -> { + if(Objects.nonNull(p.getApprovalAmount())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer approvalNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), + GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode(), + GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + + BigDecimal approvalAmount = projects.stream().filter(p -> { + if(Objects.nonNull(p.getApprovalAmount())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).map(Project::getApprovalAmount).reduce(BigDecimal::add).get(); + + BigDecimal approvalAmountGov = approves.stream().filter(a -> { + if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).map(GovBizProjectApprove::getBaseInitialReviewTotalMoney).reduce(BigDecimal::add).get(); + + cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); + cockpitStats.setTopApprovalProjectsAmount(approvalAmount.add(approvalAmountGov)); + //3.3 平均建设周期 + OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), + applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { + try { + Integer buildCycle = Integer.valueOf(c); + return buildCycle; + } catch (Exception e) { + return 0; + } + }).average(); + Double average = od.isPresent() ? od.getAsDouble() : 0.0; + cockpitStats.setTopAverageConstructionPeriod(average.intValue()); + //3.4 在建项目数 采购备案后的项目 + Integer contructionNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.TO_BE_PURCHASED.getCode()) >= 0 + && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer contructionNumGov = baseInfos.stream().filter(b -> { + if(Objects.nonNull(b.getBaseProjSetProg()) && + Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setTopOngoingProjectsNum(contructionNum + contructionNumGov); + + //4.地图 只要放总数 取的时候 会有逻辑(也要取项目归集) + cockpitStats.setProjectsTotal(projects.size() + baseInfos.size()); + + //5.下面项目状态数 + //5.1 计划(申报项目:项目预审完成到年度计划未完成 项目归集:评审中) + Integer inPlanNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) > 0 && + p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer inPlanNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setProjectsTotalPlan(inPlanNum + inPlanNumGov); + + //5.2 处于申报(申报项目:年度计划完成到建设方案审批第一个节点审批未通过前 项目归集:待立项) + Integer inApplyNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + (ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) || + (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && + searchSechmeReviewFlow(p.getProjectCode())))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer inApplyNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setProjectsTotalApply(inApplyNum + inApplyNumGov); + + //5.3 处于审批 (申报项目:建设方案审批第一个节点审批通过到立项批复未完成 项目归集:已立项) + Integer inApproveNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(p.getStatus()) || + p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 || + (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && + searchSechmeReviewedFlow(p.getProjectCode())))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer inApproveNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setProjectsTotalApprove(inApproveNum + inApproveNumGov); + + //5.4 建设 (申报项目:立项批复完成到项目初验未完成 项目归集:已采购) + Integer inConstructionNum = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + (p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 && + p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) < 0) || + //如果在建设中 那么初验材料为空代表 初验未完成 + (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && + StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + Integer inConstructionNumGov = baseInfos.stream().filter(p -> { + if(Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setProjectsTotalConstruction(inConstructionNum + inConstructionNumGov); + + //5.5 验收 (申报项目:项目初验完成到项目终验未完成 项目归集:已初验) + List inAccpetProjects = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) > 0 && + p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0 || + //如果在建设中 那么初验材料不为空代表 初验完成 + (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && + StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + List inAccpetProjectsGov = baseInfos.stream().filter(b -> { + if(Objects.nonNull(b.getBaseProjSetProg()) && + b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + cockpitStats.setProjectsTotalAccept(inAccpetProjects.size() + inAccpetProjectsGov.size()); + + //5.6 运维(申报项目:项目验收完成后且项目未注销 项目归集:已终验) + List inOperationProjects = projects.stream().filter(p -> { + if(Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + Integer inOperationProjectsGov = baseInfos.stream().filter(b -> { + if(Objects.nonNull(b.getBaseProjSetProg()) && + b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()).size(); + cockpitStats.setProjectsTotalOperation(inOperationProjects.size() + inOperationProjectsGov); + + //5.7 绩效(申报项目:项目验收完成后且未完成绩效自评 项目归集:无) + List inAccpetCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + List performances = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(CollUtil.isNotEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, inAccpetCodes) + .in(CollUtil.isEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) + .eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE) + .isNull(PerformanceAppraisalProject::getReAppraisalTotalScore) + ); + cockpitStats.setProjectsTotalPerformance(performances.size()); + cockpitStats.setProjectsTotalLogOff(0); + + //6.项目效益 + cockpitStats.setExcellentBestAppNum(0); + cockpitStats.setExcellentMajorAppNum(0); + cockpitStats.setExcellentCrossLevelSharingNum(0); + cockpitStats.setExcellentMajorAppNum(0); + + //7.2驳回节约资金 + List rejectPreProjects = projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + BigDecimal rejectPreSum = rejectPreProjects.stream().map(p -> { + if (Objects.nonNull(p.getDeclareAmount())) { + return p.getDeclareAmount(); + } + return BigDecimal.ZERO; + }).reduce(BigDecimal::add).get(); + cockpitStats.setRejectSavingsFunds(rejectPreSum); + + //7.3 柱状图 + //7.3.1 申报状态的3个资金 +// projects.stream() + //首先完成年度计划 并且未注销的项目 + List normalProjects = projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.BE_SUSPENDED.getCode()) > 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); + + //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) + final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; + normalProjects.stream().map(p -> { + BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? + p.getDeclareAmount() : BigDecimal.ZERO; + return declareAmount; + }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); + final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; + applies.stream().map(g -> { + BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; + return totalAmount; + }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); + BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); + cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); + + //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) + final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; + normalProjects.stream().map(p -> { + BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; + return declareAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); + final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; + approves.stream().map(p -> { + BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; + return expertTotalMoney; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); + BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); + cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); + //申报的差额 + BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); + cockpitStats.setDifferenceApprove(subtractApprove); + + //批复的申报金额(申报项目:建设方案申报金额 项目归集:建议总投资) + cockpitStats.setDeclaredAmountApproval(approvalAmountApproveTotal); + + //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) + final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; + normalProjects.stream().map(p -> { + BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; + return proposeTotalInvest; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); + final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; + approves.stream().map(p -> { + BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; + return reviewTotalMoney; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); + BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); + cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); + + //批复的差额 + BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); + cockpitStats.setDifferenceApproval(subtractApproval); + + //合同的申报金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) + cockpitStats.setDeclaredAmountContract(approvalAmountApprovalTotal); + + //合同的批复金额(申报项目:成交金额 项目归集:成交金额) + final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; + normalProjects.stream().map(p -> { + BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; + return transactionAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); + final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; + procures.stream().map(p -> { + BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? + p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; + return purchaseAmount; + }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); + BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); + cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); + + //合同的差额 + BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); + cockpitStats.setDifferenceContract(subtractContract); + + //7 核减资金 + cockpitStats.setReduceFundsTotal(subtractApprove.add(subtractApproval).add(subtractContract)); + + //8 产出数据 + cockpitStats.setProduceAppNum(0); + cockpitStats.setProduceDataNum(0); + cockpitStats.setProduceComponentNum(0); + cockpitStats.setProduceBrainElementsNum(0); + + //9.绩效 + List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + Map projectMap = projects.stream().filter(p -> Objects.nonNull(p.getProjectCode())).collect(Collectors.toMap(Project::getProjectCode, Project::getProjectName)); + if(CollUtil.isNotEmpty(projectCodes)){ + List performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getProjectCode, projectCodes)); + List verified = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + + List start5 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start4 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start3 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start2 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start1 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.ZERO) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + cockpitStats.setPerformanceTotal(performanceAll.size()); + cockpitStats.setPerformanceReviewedTotal(verified.size()); + cockpitStats.setPerformanceTobeReviewTotal(performanceAll.size() - verified.size()); + + cockpitStats.setPerformanceTop1Score(BigDecimal.valueOf(start1.size())); + cockpitStats.setPerformanceTop2Score(BigDecimal.valueOf(start2.size())); + cockpitStats.setPerformanceTop3Score(BigDecimal.valueOf(start3.size())); + cockpitStats.setPerformanceTop4Score(BigDecimal.valueOf(start4.size())); + cockpitStats.setPerformanceTop5Score(BigDecimal.valueOf(start5.size())); + } + + return cockpitStats; + } + + /** + * 建设方案申报了 但未开始审核的项目 + * @param projectCode + * @return + */ + private boolean searchSechmeReviewFlow(String projectCode) { + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + return Boolean.FALSE; + } + List allVersionProjectId = projectService.getAllVersionProjectId(project); + ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectId) + .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(pi)){ + return Boolean.FALSE; + } + String instCode = pi.getInstCode(); + List finished = historyService.createHistoricActivityInstanceQuery() + .finished() + .processInstanceId(instCode) + .orderByHistoricActivityInstanceEndTime() + .asc() + .list(); + List unfinished = historyService.createHistoricActivityInstanceQuery() + .unfinished() + .processInstanceId(instCode) + .orderByHistoricActivityInstanceStartTime() + .asc() + .list(); + //已经完成的没有 未完成的有 则可计算 + if(CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + //已经开始审批 + private boolean searchSechmeReviewedFlow(String projectCode) { + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + return Boolean.FALSE; + } + List allVersionProjectId = projectService.getAllVersionProjectId(project); + ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, allVersionProjectId) + .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(pi)){ + return Boolean.FALSE; + } + String instCode = pi.getInstCode(); + List finished = historyService.createHistoricActivityInstanceQuery() + .finished() + .processInstanceId(instCode) + .orderByHistoricActivityInstanceEndTime() + .asc() + .list(); + //已经完成的 则可计算 + if(CollUtil.isNotEmpty(finished)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + /** + * 计算环节滞后项目 + * @param projects + * @return + */ + private Integer computeLagging(List projects) { + List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + Map map = projects.stream().collect(Collectors.toMap(p -> p.getProjectCode(), p -> p)); + List records = Lists.newArrayList(); + if(CollUtil.isNotEmpty(projectCodes)){ + records = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .in(WflowEarlyWarningRecords::getProjectCode, projectCodes)); + } + return records.stream().mapToInt(r -> { + if(!map.containsKey(r.getProjectCode())){ + return 0; + } + Project project = map.get(r.getProjectCode()); + //如果状态 相等 说明预警了 但是没处理 +1 + if(Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && + project.getStatus().equals(r.getProjectStatus())){ + return 1; + } + return 0; + }).sum(); + } + + private void buidMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { + if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){ + return; + } + cockpitStats.setMonitorOverdueConstructionProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(), + lastYearData.getMonitorOverdueConstructionProjectsNum())); + cockpitStats.setMonitorLaggingProjectsRise(BizUtils.computeRise(thisYearData.getMonitorLaggingProjectsNum(), + lastYearData.getMonitorLaggingProjectsNum())); + cockpitStats.setMonitorRejectedApproveProjectsRise(BizUtils.computeRise(thisYearData.getMonitorRejectedApproveProjectsNum(), + lastYearData.getMonitorRejectedApproveProjectsNum())); + cockpitStats.setMonitorRejectedPreReviewProjectsRise(BizUtils.computeRise(thisYearData.getMonitorRejectedPreReviewProjectsNum(), + lastYearData.getMonitorRejectedPreReviewProjectsNum())); + cockpitStats.setMonitorAcceptConditionsNotStandardsRise(BizUtils.computeRise(thisYearData.getMonitorAcceptConditionsNotStandardsNum(), + lastYearData.getMonitorAcceptConditionsNotStandardsNum())); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java new file mode 100644 index 0000000..ed62a20 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java @@ -0,0 +1,133 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.file.FileReader; +import cn.hutool.core.io.file.FileWriter; +import cn.hutool.core.lang.UUID; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.log.mapper.OptLogMapper; +import com.ningdatech.log.model.domain.OptLog; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.organization.mapper.DingEmployeeInfoMapper; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.scheduler.task.model.CommonLog; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import lombok.RequiredArgsConstructor; +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.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * 通用日志写入任务 + * @author liushuai + */ +@Component +@RequiredArgsConstructor +public class CommonLogTask { + private final OptLogMapper optLogMapper; + private final IUserInfoService userInfoService; + private final DingEmployeeInfoMapper dingEmployeeInfoMapper; + /** + * 日志记录文件位置 + */ + private final static String LOG_RECORD_ADDRESS = "/opt/log/"; + private final static String LOG_ID_FILE = "logId.txt"; + private final static String LOG_FILE = "common_log_"; + + @Value("${hostname}") + private String HOST_NAME; + + @Scheduled(fixedDelay = 120000) + public void writeLog() throws UnknownHostException { + // + if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + return; + } + //获取记录ID文件 + boolean idFileExist = FileUtil.exist(LOG_RECORD_ADDRESS + LOG_ID_FILE); + if (!idFileExist){ + FileUtil.touch(LOG_RECORD_ADDRESS + LOG_ID_FILE); + } + FileReader fileReader = new FileReader(LOG_RECORD_ADDRESS + LOG_ID_FILE); + String result = fileReader.readString(); + long startLogId = 0L; + if (StringUtils.isNotBlank(result)){ + startLogId = Long.parseLong(result); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(OptLog.class).gt(OptLog::getId,startLogId); + //查询日志 + List logList = optLogMapper.selectList(query); + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + if (CollectionUtil.isNotEmpty(logList)){ + for (OptLog optLog : logList){ + CommonLog commonLog = new CommonLog(); + UserInfo userInfo = userInfoService.getById(optLog.getCreateBy()); + if (userInfo == null){ + continue; + } + String employeeCode = userInfo.getEmployeeCode(); + if (StringUtils.isNotBlank(employeeCode)){ + DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper() + .eq(DingEmployeeInfo::getEmployeeCode,employeeCode) + .last(BizConst.LIMIT_1)); + if (dingEmployeeInfo != null){ + commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId())); + } + }else { + commonLog.setUserId(String.valueOf(userInfo.getId())); + } + commonLog.setUserRole("政府工作人员"); + commonLog.setAreaCode(userInfo.getRegionCode() + RegionConst.NINE_CODE_LAST); + String description = optLog.getDescription(); + if ("用户登录".equals(description)){ + commonLog.setActionType(1); + }else if (description.contains("退出登录")){ + commonLog.setActionType(2); + }else { + commonLog.setActionType(3); + } + String actionId = UUID.randomUUID().toString(); + commonLog.setActionId(actionId); + commonLog.setActionTime(df.format(optLog.getStartTime())); + commonLog.setActionDuration(optLog.getConsumingTime()); + commonLog.setActionStatus(0); + commonLog.setAppCode("A331101453557202109017383"); + //判断当天日志文件是否存在 + DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd"); + String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log"; + boolean fileExist = FileUtil.exist(fileName); + if (!fileExist){ + //不存在则创建当天日志文件 + FileUtil.touch(fileName); + } + //写入通用规则 + FileWriter writer = new FileWriter(fileName); + writer.append(JSONUtil.toJsonStr(commonLog)); + writer.append("\n"); + if (commonLog.getActionType() == 3){ + CommonLog commonLogEnd = new CommonLog(); + BeanUtil.copyProperties(commonLog,commonLogEnd); + commonLogEnd.setActionType(4); + writer.append(JSONUtil.toJsonStr(commonLogEnd)); + writer.append("\n"); + } + } + //记录最后一个节点位置 + FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_ID_FILE); + writer.write(String.valueOf(logList.get(logList.size() - 1).getId())); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java new file mode 100644 index 0000000..58383e9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -0,0 +1,566 @@ +package com.hz.pm.api.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.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.projectdeclared.model.entity.Contract; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +import com.hz.pm.api.projectdeclared.service.IContractService; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import com.hz.pm.api.projectlib.enumeration.*; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.manage.EarlyWarningManage; +import com.hz.pm.api.sys.manage.RoleManage; +import com.hz.pm.api.sys.service.IProjectEarlyWarningService; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.service.IUserInfoService; +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; + + private final IUserInfoService userInfoService; + + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; + + private final RoleManage roleManage; + + private final IProjectEarlyWarningService projectEarlyWarningService; + + @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 adventContent = warning.getAdventContent(); + 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"); + String notice = rJson.getString("notice"); + Integer adventTime = rJson.getInteger("adventTime"); + if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ + log.info("规则数据 错误 :{}",rJson); + return; + } + + if(StringUtils.isBlank(notice)){ + log.info("取不到提醒人配置 : " + rJson); + return; + } + + WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); + if(Objects.isNull(flowTypeEnum)){ + log.info("匹配不到 业务类型"); + return; + } + String path = flowTypeEnum.getPath(); + + //得出 对应待提交的项目状态 + 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)); + + Map> noticeMap = Maps.newHashMap(); + //需要发通知的项目 + 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; + } + } + } + + List noticeTypes = Lists.newArrayList(); + if(Objects.nonNull(time) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); + } + if(Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); + } + if(CollUtil.isNotEmpty(noticeTypes)){ + noticeMap.put(p.getProjectCode(),noticeTypes); + //项目 填报预警 + projectEarlyWarningService.earlyWarning(p, + WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeTypes); + 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 username = null; + String mobile = null; + //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 + List batchEmployees = Lists.newArrayList(); + if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ + String employeeCode = null; + username = needToWaringProject.getContactName(); + mobile = needToWaringProject.getContactPhone(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ + String employeeCode = null; + username = needToWaringProject.getResponsibleMan(); + mobile = needToWaringProject.getResponsibleManMobile(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + if(CollUtil.isNotEmpty(batchEmployees)){ + String batchEmployeesStr = batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)); + if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ + List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); + for(Integer noticeType : noticeTypes) { + for (String employeeCode : batchEmployees) { + earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, + adventTime,time, biz, + needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, + WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr, + null); + } + } + } + } + } + }); + } + } + } + + 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 adventContent = warning.getAdventContent(); + 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 adventTime = rJson.getInteger("adventTime"); + Integer biz = rJson.getInteger("biz"); + String notice = rJson.getString("notice"); + if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ + log.info("规则数据 错误 :{}",rJson); + return; + } + + WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); + if(Objects.isNull(operationTypeEnum)){ + log.info("匹配不到 业务类型"); + return; + } + + //得出 对应待提交的项目状态 + Integer projectStutas = operationTypeEnum.getProjectStutas(); + String path = operationTypeEnum.getPath(); + 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)); + Map> noticeMap = Maps.newHashMap(); + //需要发通知的项目 + 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()); + + List noticeTypes = Lists.newArrayList(); + if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ + //初验 + if(Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); + } + if(Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); + } + }else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ + //终验 + if(Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); + } + if(Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); + } + } + if(CollUtil.isNotEmpty(noticeTypes)){ + noticeMap.put(p.getProjectCode(),noticeTypes); + //项目 运维预警 + projectEarlyWarningService.earlyWarning(p, + WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); + 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){ + //去预警通知 + List batchEmployees = Lists.newArrayList(); + + if(StringUtils.isBlank(notice)){ + String sponsor = needToWaringProject.getSponsor(); + batchEmployees.add(sponsor); + }else{ + //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 + + if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ + String employeeCode = null; + String username = needToWaringProject.getContactName(); + String mobile = needToWaringProject.getContactPhone(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ + String employeeCode = null; + String username = needToWaringProject.getResponsibleMan(); + String mobile = needToWaringProject.getResponsibleManMobile(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + } + + if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ + List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); + for(Integer noticeType : noticeTypes){ + for (String employeeCode : batchEmployees) { + earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, + adventTime,time,biz, + needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, + WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path, + batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null); + } + } + } + + } + }); + } + } + } + + stopWatch.stop(); + log.info("=========== 预警实施超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } + + /** + * 续建项目资金 超时未审批定时器 + * @throws UnknownHostException + */ + @Scheduled(cron = "20 0/2 * * * ?") + public void doEarlyWarningRenewalFund() 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.RENEWAL_FUND.getCode())); + for(WflowEarlyWarning warning : warnings){ + //2. 取出rule的数据 + if(!warning.getIsOpen()){ + log.info(warning.getId() + " 此规则关闭了"); + continue; + } + + String noticeMethod = warning.getNoticeMethod(); + String noticeContent = warning.getNoticeContent(); + String adventContent = warning.getAdventContent(); + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + 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 adventTime = rJson.getInteger("adventTime"); + if((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)){ + log.info("规则数据 错误 :{}",rJson); + return; + } + + //得出 对应待提交的续建项目区域信息 + String areaCode = warning.getAreaCode(); + //测试先用分钟 + //查询 所有这个区域的项目 未提交的项目 + List needNextProjects = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getRegionCode, areaCode) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); + + Map> noticeTypeMap = Maps.newHashMap(); + //需要发通知的项目 + List needToWaringProjects = needNextProjects.stream() + .filter(p -> { + //超时未审批 + List noticeTypes = Lists.newArrayList(); + if(Objects.nonNull(time) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); + } + if(Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 + noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); + } + if(CollUtil.isNotEmpty(noticeTypes)){ + noticeTypeMap.put(p.getProjectCode(),noticeTypes); + //项目 运维预警 + projectEarlyWarningService.earlyWarning(p.getProjectCode(), + WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); + 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(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ + String path = "projectStoreManage/renewalProjectAsscess?projectRenewalId=" + needToWaringProject.getId(); + Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); + //去预警通知 发给区管 + List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode()); + String employeesStr = users.stream().map(UserInfo::getEmployeeCode) + .collect(Collectors.joining(StrPool.COMMA)); + for(UserInfo user : users){ + if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){ + List noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode()); + for(Integer noticeType : noticeTypes){ + earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, + adventTime,time,null, + needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, + WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); + } + } + + } + } + }); + } + } + } + + stopWatch.stop(); + log.info("=========== 预警续建资金项目 超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningProjectTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningProjectTask.java new file mode 100644 index 0000000..9ddbbf4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningProjectTask.java @@ -0,0 +1,333 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Sets; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; +import com.hz.pm.api.projectlib.enumeration.WarningFlowTypeEnum; +import com.hz.pm.api.projectlib.enumeration.WarningOperationTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.enumeration.ProjectEarlyWarningStatusEnum; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; +import com.hz.pm.api.sys.service.IProjectEarlyWarningService; +import com.wflow.enums.WarningRuleTypeEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.TaskService; +import org.flowable.task.api.Task; +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.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author ZPF + * @date 2023/8/3 上午9:53 + * 预警填报 超时任务 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class EarlyWarningProjectTask { + + private final IProjectService projectService; + + private final IProjectEarlyWarningService projectEarlyWarningService; + + private final IEarlyWarningRecordsService earlyWarningRecordsService; + + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; + + private final TaskService taskService; + + @Value("${hostname}") + private String HOST_NAME; + + @Scheduled(fixedDelay = 6000 * 120) + public void doEarlyWarningDeclared() throws UnknownHostException { + if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + return; + } + + log.info("=========== 预警项目维度任务开始 ========"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE)); + + if(CollUtil.isEmpty(projects)){ + log.info("系统没有项目 退出任务"); + stopWatch.stop(); + log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + return; + } + + Set projectSet = Sets.newHashSet(); + Map projectMap = projects.stream().filter(p -> projectSet.add(p.getProjectCode())) + .collect(Collectors.toMap(Project::getProjectCode, p -> p)); + List warnings = projectEarlyWarningService.list(); + List warningProjectCodes = warnings.stream().map(ProjectEarlyWarning::getProjectCode) + .collect(Collectors.toList()); + + //1.先补全 异常项目管理中 不存在的项目 + List toAdd = projects.stream() + .filter(p -> { + if(CollUtil.isEmpty(warningProjectCodes)){ + return Boolean.TRUE; + } + if(!warningProjectCodes.contains(p.getProjectCode())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }) + .map(p -> { + ProjectEarlyWarning earlyWarning = new ProjectEarlyWarning(); + earlyWarning.setAreaCode(p.getAreaCode()); + earlyWarning.setBuildOrgCode(p.getBuildOrgCode()); + earlyWarning.setProjectCode(p.getProjectCode()); + earlyWarning.setCreateOn(LocalDateTime.now()); + earlyWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); + earlyWarning.setRuleType(null); + return earlyWarning; + }) + .collect(Collectors.toList()); + + if(CollUtil.isNotEmpty(toAdd)){ + projectEarlyWarningService.saveBatch(toAdd); + } + + //2.删除 已经不存在的项目 + List toRemove = warnings.stream() + .filter(w -> !projectMap.containsKey(w.getProjectCode())) + .collect(Collectors.toList()); + if(CollUtil.isNotEmpty(toRemove)){ + List removeIds = toRemove.stream().map(ProjectEarlyWarning::getId) + .collect(Collectors.toList()); + projectEarlyWarningService.removeBatchByIds(removeIds); + } + + //3.去查询 各个报警 是否已经正常 + List trueWarnings = warnings.stream().filter(w -> Objects.nonNull(w.getNormal()) && !w.getNormal()).collect(Collectors.toList()); + if(CollUtil.isEmpty(trueWarnings)){ + log.info("没有异常的项目 要去查询"); + stopWatch.stop(); + log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + return; + } + checkNormal(trueWarnings); + + stopWatch.stop(); + log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } + + //3.去查询 各个报警 是否已经正常 + private void checkNormal(List trueWarnings) { + //3.1 预警预警 如果正常了 要改会正常 + List processWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getProcessWarning()) + && w.getProcessWarning()) + .collect(Collectors.toList()); + checkProcessWarning(processWarning); + + //3.2 填报预警 如果正常了 要改会正常 + List declaredWarning = trueWarnings.stream().filter(w -> + Objects.nonNull(w.getDeclaredWarning()) + && w.getDeclaredWarning()) + .collect(Collectors.toList()); + checkDeclaredWarning(declaredWarning); + + //3.3 实施预警 如果正常了 要改会正常 + List operationWarning = trueWarnings.stream().filter(w -> + Objects.nonNull(w.getOperationWarning()) + && w.getOperationWarning()) + .collect(Collectors.toList()); + checkOperationWarning(operationWarning); + + //3.4 续建资金预警 如果正常了 要改回正常 + List renewalFundWarning = trueWarnings.stream().filter(w -> + Objects.nonNull(w.getRenewalFundWarning()) + && w.getRenewalFundWarning()) + .collect(Collectors.toList()); + checkRenewalFundWarning(renewalFundWarning); + } + + private void checkRenewalFundWarning(List renewalFundWarnings) { + if(CollUtil.isEmpty(renewalFundWarnings)){ + return; + } + + for(ProjectEarlyWarning renewalFundWarning : renewalFundWarnings){ + String projectCode = renewalFundWarning.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + continue; + } + + WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) + .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) + .orderByDesc(WflowEarlyWarningRecords::getWarningTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(record)){ + continue; + } + //借用了NODEID 其实 是续建id + String nodeId = record.getNodeId(); + ProjectRenewalFundDeclaration renewalFund = renewalFundDeclarationService.getById(nodeId); + if(Objects.isNull(renewalFund)){ + continue; + } + String approvalStatus = renewalFund.getApprovalStatus(); + ProjectRenewalApprovalStatusEnum match = ProjectRenewalApprovalStatusEnum + .match(approvalStatus); + if(Objects.nonNull(match)){ + //如果是已经审批 + if(match.name().equals(ProjectRenewalApprovalStatusEnum.PASS.name())){ + renewalFundWarning.setRenewalFundWarning(Boolean.FALSE); + //其它三种 都没有 说明已经正常了 + if(!renewalFundWarning.getProcessWarning() && + !renewalFundWarning.getDeclaredWarning() && + !renewalFundWarning.getOperationWarning()){ + renewalFundWarning.setNormal(Boolean.TRUE); + renewalFundWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); + } + projectEarlyWarningService.updateById(renewalFundWarning); + } + } + } + } + + private void checkOperationWarning(List operationWarnings) { + if(CollUtil.isEmpty(operationWarnings)){ + return; + } + + for( ProjectEarlyWarning operationWarning : operationWarnings){ + String projectCode = operationWarning.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + continue; + } + WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) + .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) + .orderByDesc(WflowEarlyWarningRecords::getWarningTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(record)){ + continue; + } + Integer biz = record.getBiz(); + WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); + if(Objects.isNull(operationTypeEnum)){ + continue; + } + Integer projectStutas = operationTypeEnum.getProjectStutas(); + //已经不是这个状态了 说明已经被提交了 + if(!projectStutas.equals(project.getStatus())){ + operationWarning.setOperationWarning(Boolean.FALSE); + //其它三种 都没有 说明已经正常了 + if(!operationWarning.getProcessWarning() && + !operationWarning.getDeclaredWarning() && + !operationWarning.getRenewalFundWarning()){ + operationWarning.setNormal(Boolean.TRUE); + operationWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); + } + projectEarlyWarningService.updateById(operationWarning); + } + } + } + + private void checkDeclaredWarning(List declaredWarnings) { + if(CollUtil.isEmpty(declaredWarnings)){ + return; + } + for( ProjectEarlyWarning declaredWarning : declaredWarnings){ + String projectCode = declaredWarning.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + continue; + } + WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) + .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode()) + .orderByDesc(WflowEarlyWarningRecords::getWarningTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(record)){ + continue; + } + Integer biz = record.getBiz(); + WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); + if(Objects.isNull(flowTypeEnum)){ + continue; + } + Integer projectStutas = flowTypeEnum.getProjectStutas(); + //已经不是这个状态了 说明已经被提交了 + if(!projectStutas.equals(project.getStatus())){ + declaredWarning.setDeclaredWarning(Boolean.FALSE); + //其它三种 都没有 说明已经正常了 + if(!declaredWarning.getProcessWarning() && + !declaredWarning.getOperationWarning() && + !declaredWarning.getRenewalFundWarning()){ + declaredWarning.setNormal(Boolean.TRUE); + declaredWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); + } + projectEarlyWarningService.updateById(declaredWarning); + } + } + } + + /** + * 流程 查看 是否已经处理过 + * @param processWarnings + */ + private void checkProcessWarning(List processWarnings) { + if(CollUtil.isEmpty(processWarnings)){ + return; + } + for( ProjectEarlyWarning processWarning : processWarnings){ + String projectCode = processWarning.getProjectCode(); + WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) + .orderByDesc(WflowEarlyWarningRecords::getWarningTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(record)){ + continue; + } + String nodeId = record.getNodeId(); + if(StringUtils.isBlank(nodeId)){ + continue; + } + List tasks = taskService.createTaskQuery() + .taskDefinitionKey(nodeId) + .list(); + if(CollUtil.isEmpty(tasks)){ + //说明 已经审批通过了 + processWarning.setProcessWarning(Boolean.FALSE); + //其它三种 都没有 说明已经正常了 + if(!processWarning.getDeclaredWarning() && + !processWarning.getOperationWarning() && + !processWarning.getRenewalFundWarning()){ + processWarning.setNormal(Boolean.TRUE); + processWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); + } + projectEarlyWarningService.updateById(processWarning); + } + } + + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java new file mode 100644 index 0000000..81d16a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java @@ -0,0 +1,106 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.scheduler.contants.TaskContant; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.service.IRegionService; +import com.wflow.bean.dto.WflowModelHistorysInsertDto; +import com.wflow.bean.entity.WflowForms; +import com.wflow.bean.entity.WflowModels; +import com.wflow.workflow.bean.process.ProcessNode; +import com.wflow.workflow.service.ProcessModelService; +import com.wflow.workflow.service.WflowFormsService; +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.LocalDateTime; +import java.util.*; + +/** + * @author ZPF + * @description + * @since 2023/1/18 08:54 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class InitProcessTask { + + private final IRegionService regionService; + + private final ProcessModelService processModelService; + + private final WflowFormsService formsService; + + private final RegionCacheHelper regionCacheHelper; + + @Value("${hostname}") + private String HOST_NAME; + + @Scheduled(cron = "0 45 18 12 6 ?") + public void doTask() throws UnknownHostException { + if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + // 1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + + if (CollUtil.isEmpty(regions)) { + throw new BizException("丽水地区数据为空 任务结束!"); + } + + for (RegionDTO region : regions) { + log.info("当前初始化的是 【{}】 流程配置", region.getRegionName()); + + Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; + for (Integer processType : processTypeList) { + String formName = ProjectProcessStageEnum.getDesc(processType); + WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); + + models.setGroupId(1); + models.setProcessDefId("pd" + IdUtil.objectId()); + models.setFormName(formName); + models.setProcessType(processType); + models.setRegionCode(region.getRegionCode()); + String process = + "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; + ProcessNode processNode = JSON.parseObject(process, ProcessNode.class); + models.setProcess(processNode); + models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); + models.setFormItems("[]"); + + String formId = processModelService.insertProcess(models); + if (StringUtils.isNotBlank(formId)) { + // 初始的流程在部署表也存一份,用来查询 + if (StringUtils.isNotBlank(processModelService.deployProcess(formId, null))) { + log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功", region.getRegionName(), formName); + } else { + log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败", region.getRegionName(), formName); + } + } else { + log.info("当前区域 【{}】流程名[{}] 流程数据保存失败", region.getRegionName(), formName); + } + } + } + + stopWatch.stop(); + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s", stopWatch.getTotalTimeSeconds()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java new file mode 100644 index 0000000..580c373 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java @@ -0,0 +1,105 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.scheduler.contants.TaskContant; +import com.hz.pm.api.staging.contants.StagingContant; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.staging.utils.ProjectStatusFlowMapUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +/** + * @Classname ProjectStatusFlowTask + * @Description + * @Date 2023/2/20 10:12 + * @Author PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ProjectStatusFlowTask { + + private final IProjectStagingService projectStagingService; + + private final IProjectService projectService; + + private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; + + @Value("${hostname}") + private String HOST_NAME; + + @Scheduled(cron = "0 */1 * * * ?") + public void statusFlow() throws UnknownHostException { + // + if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + //1. 定时取 项目暂存表的数据 去进行状态继续流转 + List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) + .eq(ProjectStaging::getDead,Boolean.FALSE) + .le(ProjectStaging::getNextTime, LocalDateTime.now()) + .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(ProjectStaging::getProjectId)); + + log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); + if(CollUtil.isEmpty(stagingList)){ + log.info("没有需要状态流转的项目!"); + return; + } + + //遍历 + for(ProjectStaging projectStaging : stagingList){ + try{ + Project project = projectService.getById(projectStaging.getProjectId()); + if(Objects.isNull(project)){ + log.info("此项目 【{}】 不存在",projectStaging.getProjectId()); + continue; + } + + //2. 用函数map 定位到 状态流转的函数 + Map> reStartProcessMap = + projectStatusFlowMapUtil.statusFlowFunctionMap; + + if(!reStartProcessMap.containsKey(project.getStatus())){ + log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数",projectStaging.getProjectId(),project.getStatus()); + continue; + } + + Function functionMap = reStartProcessMap.get(project.getStatus()); + //执行对应的函数 + if(functionMap.apply(project)){ + //执行成功了 删除暂存的数据 + projectStagingService.removeById(projectStaging); + } + }catch (Exception e){ + log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e.getMessage()); + }finally { + //增加重试的次数 和下次扫描时间 + projectStagingService.addRetryTimes(projectStaging); + } + } + } + } + +// @Scheduled(cron = "0 */1 * * * ?") + public void nonUserFinishFlowToNext() throws UnknownHostException { + //测试暂时用自己HOST + if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { + + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java new file mode 100644 index 0000000..f0c3d89 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java @@ -0,0 +1,490 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; +import com.hz.pm.api.gov.model.vo.GovBizProjectListVO; +import com.hz.pm.api.gov.model.vo.GovOperationProjectBaseinfoVO; +import com.hz.pm.api.gov.model.vo.GovOperationProjectDetailVO; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.gov.utils.ProjectConvertUtil; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +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.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * @author ZPF + * @since 2023/08/31 18:16 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SynProjectCollectionTask { + + @Value("${hostname}") + public String HOST; + + @Value("${spring.profiles.active}") + public String active; + + @Autowired + private GovProjectCollectionManage collectionManage; + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + @Autowired + private IGovBizProjectApplyService applyService; + @Autowired + private IGovBizProjectApproveService approveService; + + @Autowired + private IGovBizProjectCimplementService cimplementService; + + @Autowired + private IGovBizProjectMimplementService mimplementService; + + @Autowired + private IGovBizProjectProcureService procureService; + + @Autowired + private IProjectService projectService; + + @Autowired + private ProjectLibManage projectLibManage; + + @Autowired + private FileService fileService; + + private final Integer PAGE_NUMBER = 1; + + /** + * 前置机每天晚上10点自动清空,第二天早上6点获取数据 + * 定时同步前置机数据 每天1点开始执行一次 + * + */ + @Scheduled(cron = "0 0 1 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + if(BizConst.PRE.equals(active)){ + log.info("预发环境不用同步!"); + return; + } + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + log.info("数据同步任务开始之前 先删除前置机上的所有数据"); + collectionManage.deleteAll(); + + //全量项目归集 + ProjectListReq req = new ProjectListReq(); + Long count = collectionManage.count(req) + collectionManage.operationCount(req); + if(count == 0L){ + log.info("本次同步无数据"); + return; + } + req.setPageNumber(PAGE_NUMBER); + req.setPageSize(count.intValue()); + PageVo projectCollectionPage = collectionManage.list(req); + + log.info("projectCollections size :{}",projectCollectionPage.getTotal()); + + for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){ + GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId()); + collectionManage.pushProjectVo(projectDetail); + } + + //2.运维备案项目 + PageVo operationList = collectionManage.operationList(req); + log.info("operation list size :{}",operationList.getTotal()); + for(GovBizProjectListVO vo : operationList.getRecords()){ + GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId()); + GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo(); + if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) || + Boolean.FALSE.equals(baseinfo.getPush())){ + log.info("此运维项目不用推送:" + vo.getBaseProjId()); + } + collectionManage.pushProjectVo(operationDetail); + } + + //3.申报项目 需要推送的项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getPush,Boolean.TRUE)); + log.info("projects need push size :{}",projects.size()); + for(Project project : projects){ + ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode()); + GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); + if(Objects.nonNull(vo)){ + collectionManage.pushProjectVo(vo); + } + } + + stopWatch.stop(); + log.info("数据同步任务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + /** + * 把库存的项目归集里 没有转换PDF文件的 都转换一遍 存入数据库 + */ + public void stagingConvertPdf(String projId) { + log.info("项目归集库存转换PDF任务开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projId)); + if(Objects.nonNull(base)){ + //开始转换PDF + convertPdfVo(projId); + } + + stopWatch.stop(); + log.info("项目归集库存转换PDF任务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + public void stagingConvertPdf2(String projId) { + log.info("项目归集库存转换PDF任务2开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + ProjectListReq req = new ProjectListReq(); + req.setPageNumber(1); + req.setPageSize(BizConst.MAX_EXPORT_COUNT); + List projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) + .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) + .isNotNull(GovBizProjectApprove::getApprovalFile) + .isNull(GovBizProjectApprove::getApprovalFilePdf)); + + if(CollUtil.isEmpty(projects)){ + log.info("没有项目归集 任务终止"); + return; + } + + for(GovBizProjectApprove project : projects){ + String baseProjId = project.getBaseProjId(); + //开始转换PDF + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(approve)){ + return; + } + if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ + StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); + approve.setApprovalFilePdf(sj.toString()); + } + } + + stopWatch.stop(); + log.info("项目归集库存转换PDF任务2结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + public void stagingConvertPdf3(String projId) { + log.info("项目归集库存转换PDF任务3开始====="); + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + ProjectListReq req = new ProjectListReq(); + req.setPageNumber(1); + req.setPageSize(BizConst.MAX_EXPORT_COUNT); + List approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) + .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) + .isNotNull(GovBizProjectApprove::getApprovalFile) + .isNull(GovBizProjectApprove::getApprovalFilePdf)); + + if(CollUtil.isEmpty(approves)){ + log.info("没有项目归集 审批信息 立项文件 任务终止"); + return; + } + + for(GovBizProjectApprove approve : approves){ + //开始转换PDF + convertPdfVo(approve.getBaseProjId()); + } + + stopWatch.stop(); + log.info("项目归集库存转换PDF任务3结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + //开始转换PDF + private void convertPdfVo(String baseProjId) { + convertPdfApply(baseProjId); + convertPdfApprove(baseProjId); + convertPdfCimplement(baseProjId); + convertPdfMimplement(baseProjId); + convertPdfAProcure(baseProjId); + } + + private void convertPdfApply(String baseProjId) { + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(apply)){ + return; + } + if(StringUtils.isBlank(apply.getBaseProjApplyFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjApplyFile())){ + StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjApplyFile()); + apply.setBaseProjApplyFilePdf(sj.toString()); + } + if(StringUtils.isBlank(apply.getBaseProjBasisFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjBasisFile())){ + StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjBasisFile()); + apply.setBaseProjBasisFilePdf(sj.toString()); + } + if(StringUtils.isBlank(apply.getBaseProjOtherFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjOtherFile())){ + StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjOtherFile()); + apply.setBaseProjOtherFilePdf(sj.toString()); + } + if(StringUtils.isBlank(apply.getBaseResearchReportFilePdf()) && StringUtils.isNotBlank(apply.getBaseResearchReportFile())){ + StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseResearchReportFile()); + apply.setBaseResearchReportFilePdf(sj.toString()); + } + if(StringUtils.isBlank(apply.getBaseOperatMaintenFilePdf()) && StringUtils.isNotBlank(apply.getBaseOperatMaintenFile())){ + StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseOperatMaintenFile()); + apply.setBaseOperatMaintenFilePdf(sj.toString()); + } + applyService.updateById(apply); + } + + private void convertPdfApprove(String baseProjId) { + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(approve)){ + return; + } + if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ + StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); + approve.setApprovalFilePdf(sj.toString()); + } + if(StringUtils.isBlank(approve.getPreliminaryDesignFilePdf()) && StringUtils.isNotBlank(approve.getPreliminaryDesignFile())){ + StringJoiner sj = collectionManage.convertAndUpload(approve.getPreliminaryDesignFile()); + approve.setPreliminaryDesignFilePdf(sj.toString()); + } + if(StringUtils.isBlank(approve.getBaseReviewCommentsFilePdf()) && StringUtils.isNotBlank(approve.getBaseReviewCommentsFile())){ + StringJoiner sj = collectionManage.convertAndUpload(approve.getBaseReviewCommentsFile()); + approve.setBaseReviewCommentsFilePdf(sj.toString()); + } + approveService.updateById(approve); + } + + private void convertPdfCimplement(String baseProjId) { + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(cimplement)){ + return; + } + if(StringUtils.isBlank(cimplement.getBaseCheckFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseCheckFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseCheckFile()); + cimplement.setBaseCheckFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChanFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChanFile()); + cimplement.setBaseChanFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseChangeFormFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChangeFormFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChangeFormFile()); + cimplement.setBaseChangeFormFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseUserConsFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseUserConsFile()); + cimplement.setBaseUserConsFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEstaSummFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEstaSummFile()); + cimplement.setBaseEstaSummFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEngineerPostpoFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEngineerPostpoFile()); + cimplement.setBaseEngineerPostpoFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(cimplement.getBasePasswAssessFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBasePasswAssessFile()); + cimplement.setBasePasswAssessFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile()); + cimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseFinanlAuditFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinanlAuditFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinanlAuditFile()); + cimplement.setBaseFinanlAuditFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseInitialOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInitialOpinionFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInitialOpinionFile()); + cimplement.setBaseInitialOpinionFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile()); + cimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseSummReportFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseSummReportFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseSummReportFile()); + cimplement.setBaseSummReportFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinalExpertOpinionFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinalExpertOpinionFile()); + cimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseIrsTestRunFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseIrsTestRunFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseIrsTestRunFile()); + cimplement.setBaseIrsTestRunFilePdf(sj.toString()); + } + if(StringUtils.isBlank(cimplement.getBaseInforLevelFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ + StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInforLevelFile()); + cimplement.setBaseInforLevelFilePdf(sj.toString()); + } + cimplementService.updateById(cimplement); + } + + private void convertPdfMimplement(String baseProjId) { + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(mimplement)){ + return; + } + if(StringUtils.isBlank(mimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseChanFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseChanFile()); + mimplement.setBaseChanFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseUserConsFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseUserConsFile()); + mimplement.setBaseUserConsFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEstaSummFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEstaSummFile()); + mimplement.setBaseEstaSummFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerPostpoFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerPostpoFile()); + mimplement.setBaseEngineerPostpoFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(mimplement.getBasePasswAssessFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBasePasswAssessFile()); + mimplement.setBasePasswAssessFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile()); + mimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile()); + mimplement.setBaseThirdAcceptFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseFinalExpertOpinionFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseFinalExpertOpinionFile()); + mimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseEngineerAlterFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerAlterFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerAlterFile()); + mimplement.setBaseEngineerAlterFilePdf(sj.toString()); + } + if(StringUtils.isBlank(mimplement.getBaseOperatMaintenSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseOperatMaintenSummFile())){ + StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseOperatMaintenSummFile()); + mimplement.setBaseOperatMaintenSummFilePdf(sj.toString()); + } + mimplementService.updateById(mimplement); + } + + private void convertPdfAProcure(String baseProjId) { + List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + for(GovBizProjectProcure procure : procures){ + if(StringUtils.isBlank(procure.getPurchaseContractPdf()) && StringUtils.isNotBlank(procure.getPurchaseContract())){ + StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseContract()); + procure.setPurchaseContractPdf(sj.toString()); + } + if(StringUtils.isBlank(procure.getPurchaseFilePdf()) && StringUtils.isNotBlank(procure.getPurchaseFile())){ + StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseFile()); + procure.setPurchaseFilePdf(sj.toString()); + } + if(StringUtils.isBlank(procure.getBiddingFilePdf()) && StringUtils.isNotBlank(procure.getBiddingFile())){ + StringJoiner sj = collectionManage.convertAndUpload(procure.getBiddingFile()); + procure.setBiddingFilePdf(sj.toString()); + } + procureService.updateById(procure); + } + } + + public void doTaskSingle(List projectCodes) { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + log.info("数据同步任务 指定项目编号 :{}",projectCodes); + + if(CollUtil.isEmpty(projectCodes)){ + throw new BizException("不能为空!"); + } + + //全量项目归集 + ProjectListReq req = new ProjectListReq(); + req.setPageNumber(PAGE_NUMBER); + req.setPageSize(1000); + PageVo projectCollectionPage = collectionManage.list(req); + + log.info("projectCollections size :{}",projectCollectionPage.getTotal()); + + for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){ + GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId()); + collectionManage.pushProjectVo(projectDetail); + } + + //2.运维备案项目 + PageVo operationList = collectionManage.operationList(req); + log.info("operation list size :{}",operationList.getTotal()); + for(GovBizProjectListVO vo : operationList.getRecords()){ + GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId()); + GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo(); + if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) || + Boolean.FALSE.equals(baseinfo.getPush())){ + log.info("此运维项目不用推送:" + vo.getBaseProjId()); + } + collectionManage.pushProjectVo(operationDetail); + } + + //3.申报项目 需要推送的项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getPush,Boolean.TRUE) + .in(Project::getProjectCode,projectCodes)); + log.info("projects need push size :{}",projects.size()); + for(Project project : projects){ + ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode()); + GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); + if(Objects.nonNull(vo)){ + collectionManage.pushProjectVo(vo); + } + } + + stopWatch.stop(); + log.info("数据同步任务 指定项目编号 结束====={}s",stopWatch.getTotalTimeSeconds()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCoreBizTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCoreBizTask.java new file mode 100644 index 0000000..f8a7e45 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCoreBizTask.java @@ -0,0 +1,251 @@ +package com.hz.pm.api.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.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.irs.manage.ProjectIrsManage; +import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; +import com.hz.pm.api.irs.service.IProjectCoreBizService; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.projectdeclared.contants.ProjectCodeContant; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +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.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author ZPF + * @since 2023/09/13 18:16 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SynProjectCoreBizTask { + + @Value("${hostname}") + public String HOST; + + @Value("${spring.profiles.active}") + public String active; + + @Autowired + private IProjectCoreBizService projectCoreBizService; + + @Autowired + private IDingOrganizationService organizationService; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private ProjectIrsManage projectIrsManage; + + private final Integer MAX_PAGE_SIZE = 1000; + + /** + * 前置机每天晚上10点自动清空,第二天早上6点获取数据 + * 定时同步前置机数据 每天1点开始执行一次 不按照单位 + * + */ +// @Scheduled(cron = "0 0 2 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + + log.info("同步项目核心业务开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE + , DingOrganizationContant.GOV_TEMPORARY))); + + log.info("总共需要同步 orgs size :{}",orgs.size()); + + syncCoreBiz(orgs); + stopWatch.stop(); + log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + public void doTask(String orgCode) throws UnknownHostException { + log.info("同步项目核心业务开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE + , DingOrganizationContant.GOV_TEMPORARY)) + .eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode)); + + log.info("总共需要同步 orgs size :{}",orgs.size()); + + syncCoreBiz(orgs); + + stopWatch.stop(); + log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + private void syncCoreBiz(List orgs) { + for(DingOrganization organization : orgs){ + GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); + + log.info("core biz result : {}",JSON.toJSONString(dingResult)); + + if(dingResult.isSuccess()){ + DingOrgInfoDTO data = dingResult.getData(); + String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); + if(StringUtils.isNotBlank(unifiedSocialCreditCode)){ + organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); + organizationService.updateById(organization); + } + + //去请求IRS接口 + JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1); + + JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); + if(CollUtil.isNotEmpty(jsonArray)){ + jsonArray.forEach(j -> { + JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); + ProjectCoreBiz coreBiz = new ProjectCoreBiz(); + // + Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); + String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); + String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); + String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); + String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); + String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); + ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) + .eq(ProjectCoreBiz::getIrsId, irsId) + .last(BizConst.LIMIT_1)); + + if(Objects.nonNull(old)){ + coreBiz.setId(old.getId()); + }else{ + coreBiz.setCreateOn(LocalDateTime.now()); + } + coreBiz.setUpdateOn(LocalDateTime.now()); + coreBiz.setIrsId(irsId); + coreBiz.setMatterName(matterName); + coreBiz.setOrgCode(dingCode); + coreBiz.setOrgName(orgName); + coreBiz.setUserState(userState); + coreBiz.setAreaName(areaName); + coreBiz.setMatterCode(irsId.toString()); + projectCoreBizService.saveOrUpdate(coreBiz); + coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId())); + projectCoreBizService.updateById(coreBiz); + }); + } + } + } + } + + private void syncCoreBiz() { + Map map = organizationService.list().stream().distinct().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); + + Integer currentSize = MAX_PAGE_SIZE; + Integer page = 1; + while (currentSize.equals(MAX_PAGE_SIZE)) { + //去请求IRS接口 + JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, null, MAX_PAGE_SIZE, page); + + JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); + + if(Objects.isNull(jsonArray)){ + return; + } + + currentSize = jsonArray.size(); + if (CollUtil.isNotEmpty(jsonArray)) { + if (currentSize.equals(MAX_PAGE_SIZE)) { + page++; + } + jsonArray.forEach(j -> { + JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); + ProjectCoreBiz coreBiz = new ProjectCoreBiz(); + // + Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); + String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); + String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); + String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); + String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); + String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); + ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) + .eq(ProjectCoreBiz::getIrsId, irsId) + .last(BizConst.LIMIT_1)); + + if (Objects.nonNull(old)) { + coreBiz.setId(old.getId()); + } else { + coreBiz.setCreateOn(LocalDateTime.now()); + } + + if(map.containsKey(dingCode)){ + DingOrganization organization = map.get(dingCode); + + String unifiedSocialCreditCode = organization.getUnifiedSocialCreditCode(); + if(StringUtils.isBlank(unifiedSocialCreditCode)){ + GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); + + log.info("ding org result : {}",JSON.toJSONString(dingResult)); + + if(dingResult.isSuccess()){ + DingOrgInfoDTO data = dingResult.getData(); + unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); + organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); + organizationService.updateById(organization); + } + } + + coreBiz.setUpdateOn(LocalDateTime.now()); + coreBiz.setIrsId(irsId); + coreBiz.setMatterName(matterName); + coreBiz.setOrgCode(dingCode); + coreBiz.setOrgName(orgName); + coreBiz.setUserState(userState); + coreBiz.setAreaName(areaName); + coreBiz.setMatterCode(irsId.toString()); + projectCoreBizService.saveOrUpdate(coreBiz); + coreBiz.setMatterCode(genirate(unifiedSocialCreditCode, coreBiz.getId())); + projectCoreBizService.updateById(coreBiz); + } + }); + } + } + } + + /** + * 生成 编号 + * @param unifiedSocialCreditCode + * @param id + * @return + */ + private String genirate(String unifiedSocialCreditCode, Long id) { + String formatId = String.format(ProjectCodeContant.SHUZI_4, id); + return unifiedSocialCreditCode + formatId; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProvinceOrgTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProvinceOrgTask.java new file mode 100644 index 0000000..a689e93 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProvinceOrgTask.java @@ -0,0 +1,93 @@ +package com.hz.pm.api.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.organization.model.entity.ProvincialGovBusinessStrip; +import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; +import com.hz.pm.api.organization.service.IProvincialGovBusinessStripService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +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.util.List; +import java.util.stream.Collectors; + +/** + * @author ZPF + * @since 2023/08/31 18:16 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SynProvinceOrgTask { + + @Value("${hostname}") + public String HOST; + + @Value("${spring.profiles.active}") + public String active; + + @Autowired + private IProvincialGovBusinessStripService provincialGovBusinessStripService; + + @Autowired + private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + /** + * + */ + @Scheduled(cron = "0 0 3 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + log.info("同步省局升级单位数据任务开始====={}s",stopWatch.getTotalTimeSeconds()); + + List res = Lists.newArrayList(); + for(int i = 0;i < 10;i++){ + res = joinReviewProvincialBureauService.searchGovUnits(); + if(CollUtil.isNotEmpty(res)){ + log.info("请求到了数据 :{}",res.size()); + break; + } + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + if(CollUtil.isEmpty(res)){ + log.info("一直都没请求到数据 任务结束"); + return; + } + + + log.info("数据同步任务开始之前 先删除前置机上的所有数据"); + provincialGovBusinessStripService.remove(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class)); + + List saves = res.stream().map(r -> { + ProvincialGovBusinessStrip strip = new ProvincialGovBusinessStrip(); + strip.setBusinessStripCode(r.getBusinessStripCode()); + strip.setBusinessStripName(r.getBusinessStripName()); + return strip; + }).collect(Collectors.toList()); + provincialGovBusinessStripService.saveBatch(saves); + + stopWatch.stop(); + log.info("同步省局升级单位数据任务结束====={}s",stopWatch.getTotalTimeSeconds()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/WorkNoticeFlowTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/WorkNoticeFlowTask.java new file mode 100644 index 0000000..4799021 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/WorkNoticeFlowTask.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.scheduler.task; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.util.List; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.zwdd.client.ZwddClient; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.scheduler.contants.TaskContant; +import com.hz.pm.api.staging.contants.StagingContant; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 发送工作通知定时任务 + * @return + * @author CMM + * @since 2023/02/28 21:23 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class WorkNoticeFlowTask { + + private final INdWorkNoticeStagingService workNoticeStagingService; + private final ZwddClient zwddClient; + + @Value("${hostname}") + private String HOST_NAME; + + @Scheduled(cron = "0 */1 * * * ?") + public void statusFlow() throws UnknownHostException { + //测试暂时用自己电脑HOST + if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + //1. 定时取 工作通知暂存表的数据进行发送 + List stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) + .eq(WorkNoticeStaging::getDead, Boolean.FALSE) + .le(WorkNoticeStaging::getNextTime, LocalDateTime.now()) + .le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(WorkNoticeStaging::getId)); + + log.info("需要发送的工作通知 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); + if(CollUtil.isEmpty(stagingList)){ + log.info("没有需要发送的工作通知!"); + return; + } + //遍历 + for(WorkNoticeStaging workNoticeStaging : stagingList){ + try{ + WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); + BeanUtils.copyProperties(workNoticeStaging,workNoticeInfo); + String receiverUserId = workNoticeInfo.getReceiverUserId(); + String bizMsgId = workNoticeInfo.getBizMsgId(); + String msg = workNoticeInfo.getMsg(); + GenericResult result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg); + if (result.isSuccess()){ + //执行成功了 删除暂存的数据 + workNoticeStagingService.removeById(workNoticeStaging); + } + }catch (Exception e){ + log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e); + }finally { + //增加重试的次数 和下次扫描时间 + workNoticeStagingService.addRetryTimes(workNoticeStaging); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/model/CommonLog.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/model/CommonLog.java new file mode 100644 index 0000000..74ead5f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/model/CommonLog.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.scheduler.task.model; + +import lombok.Data; + +@Data +public class CommonLog { + /** + * 用户id + */ + private String userId; + /** + * 用户角色(群众、企业、政府工作人员、第三方) + */ + private String userRole; + /** + * 地区编码 + */ + private String areaCode; + /** + * 操作类型(1-登录 2-离开 3-办事开始 4-办事结束) + */ + private Integer actionType; + /** + * 操作标识 + */ + private String actionId; + /** + * 操作时间 + */ + private String actionTime; + /** + * 操作时长 + */ + private Long actionDuration; + /** + * 操作状态(0-成功 1-失败) + */ + private Integer actionStatus; + /** + * 应用编码 + */ + private String appCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java new file mode 100644 index 0000000..3c013a0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.scheduler.utils; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Calendar; +import java.util.Date; +import java.util.Objects; + +/** + * @Classname DateUtil + * @Description + * @Date 2023/8/31 15:36 + * @Author PoffyZhang + */ +public class DateUtil { + + public static Date getTodayTime(int hour){ + // 获取当前日期时间 + Calendar calendar = Calendar.getInstance(); + + // 将时间设置为凌晨 + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + + // 获取凌晨时间 + Date date = calendar.getTime(); + return date; + } + + public static LocalDateTime convertDateToLocal(Date date){ + if(Objects.isNull(date)){ + return null; + } + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/controller/NdCompanySignatureController.java b/hz-pm-api/src/main/java/com/hz/pm/api/signature/controller/NdCompanySignatureController.java new file mode 100644 index 0000000..705cb67 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/controller/NdCompanySignatureController.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.signature.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +@Controller +@RequestMapping("/pmapi.signature/nd-company-signature") +public class NdCompanySignatureController { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/entity/CompanySignature.java b/hz-pm-api/src/main/java/com/hz/pm/api/signature/entity/CompanySignature.java new file mode 100644 index 0000000..968a1e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/entity/CompanySignature.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.signature.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +@TableName("nd_company_signature") +@Data +@ApiModel(value = "NdCompanySignature对象", description = "") +public class CompanySignature implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private String sealSn; + + private String organizationCode; + + private LocalDateTime createOn; + + private Long createBy; + + private LocalDateTime updateOn; + + private Long updateBy; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.java new file mode 100644 index 0000000..5132c47 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.signature.mapper; + +import com.hz.pm.api.signature.entity.CompanySignature; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +public interface CompanySignatureMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.xml new file mode 100644 index 0000000..a2bd686 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/mapper/CompanySignatureMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/ICompanySignatureService.java b/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/ICompanySignatureService.java new file mode 100644 index 0000000..862f495 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/ICompanySignatureService.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.signature.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.signature.entity.CompanySignature; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +public interface ICompanySignatureService extends IService { + + CompanySignature getByOrganizationCode(String orgCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/impl/CompanySignatureServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/impl/CompanySignatureServiceImpl.java new file mode 100644 index 0000000..9ecd845 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/signature/service/impl/CompanySignatureServiceImpl.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.signature.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.signature.entity.CompanySignature; +import com.hz.pm.api.signature.mapper.CompanySignatureMapper; +import com.hz.pm.api.signature.service.ICompanySignatureService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-10 + */ +@Service +public class CompanySignatureServiceImpl extends ServiceImpl implements ICompanySignatureService { + + @Override + public CompanySignature getByOrganizationCode(String orgCode) { + if (StringUtils.isBlank(orgCode)) { + return null; + } + return this.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, orgCode)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/DatePattern.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/DatePattern.java new file mode 100644 index 0000000..488d03a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/DatePattern.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.sms.constant; + +/** + *

+ * DatePattern + *

+ * + * @author WendyYang + * @since 09:28 2022/5/10 + */ +public interface DatePattern { + + String TIME_ZONE = "GMT+8"; + + String T = "'T'"; + String GMT = "XXX"; + + String YMD_HMS = "yyyy-MM-dd HH:mm:ss"; + + String YMD_HMS_1 = "yyyyMMddHHmmss"; + + String YMD_HMS_S = "yyyy-MM-dd HH:mm:ss.SSS"; + + String YMD = "yyyy-MM-dd"; + String YMD_0 = "yyyy/MM/dd"; + String YMD_1 = "yyyyMMdd"; + String HMS = "HH:mm:ss"; + String HMS_0 = "HH/mm/ss"; + String HMS_1 = "HHmmss"; + + String YMD_HMS_GMT = YMD + T + HMS + GMT; + + String EEE = "EEE"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VerificationCodeType.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VerificationCodeType.java new file mode 100644 index 0000000..fdf0cea --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VerificationCodeType.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.sms.constant; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.stream.Stream; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:50 + */ + +@Getter +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(value = "VerificationCodeType", description = "验证码类型") +public enum VerificationCodeType { + + /** + * 用户登陆 + */ + LOGIN("用户登录", 1, 5, 10), + + /** + * 社会专家注册 + */ + EXPERT_REGISTER("社会专家注册", 1, 5, 10); + + @ApiModelProperty(value = "描述") + private String desc; + + @ApiModelProperty(value = "发送间隔(单位:分钟)") + private Integer sendInterval; + + @ApiModelProperty(value = "过期时间(单位:分钟)") + private Integer expireTime; + + /** + * 小于等于0则不限制次数,超出次数限制则锁定验证码发送 + */ + @ApiModelProperty(value = "每日发送次数") + private Integer sendTimesByDay; + + + public static VerificationCodeType match(String val, VerificationCodeType def) { + return Stream.of(values()).filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); + } + + public static VerificationCodeType get(String val) { + return match(val, null); + } + + public boolean eq(VerificationCodeType val) { + return val != null && this.name().equals(val.name()); + } + + @ApiModelProperty(value = "编码") + public String getCode() { + return this.name(); + } + + public static VerificationCodeType of(String key) { + for (VerificationCodeType statusEnum : VerificationCodeType.values()) { + if (statusEnum.name().equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal VerificationCodeType = %s", key)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java new file mode 100644 index 0000000..cb10245 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.sms.constant; + +/** + *

+ * VoiceSmsTemplateConst + *

+ * + * @author WendyYang + * @since 15:10 2023/3/30 + */ +public interface VoiceSmsTemplateConst { + + /** + * 短信登陆验证码 + */ + String SMS_COMMON_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + + /** + * 社会专家报名 + */ + String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + + /** + * 专家电话通知语音模版 + */ + String OFFLINE_TEMPLATE = "尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请按 1,拒绝参加请按 2。请您选择"; + + /** + * 专家同意参加短信通知模板 + */ + String EXPERT_AGREE_ATTEND_TEMPLATE = ""; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java new file mode 100644 index 0000000..c9f691d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.sms.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.manage.SmsManage; +import com.hz.pm.api.sms.model.po.ReqVerificationCodePO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:40 + */ +@Slf4j +@RestController +@RequestMapping("/api/v1/verification") +@Api(tags = "验证码相关接口") +@RequiredArgsConstructor +public class VerificationCodeController { + + + private final SmsManage smsManage; + + /** + * 通用的发送验证码功能 + * 一个系统可能有很多地方需要发送验证码(注册、找回密码等) + * 每增加一个场景{@link VerificationCodeType}就需要增加一个枚举值 + */ + @ApiOperation(value = "发送验证码", notes = "发送验证码") + @PostMapping(value = "/send") + @WebLog("发送验证码") + public void send(@Validated @RequestBody ReqVerificationCodePO request) { + smsManage.sendVerificationCode(request); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/helper/VerifyCodeCheckHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/helper/VerifyCodeCheckHelper.java new file mode 100644 index 0000000..f3e6611 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/helper/VerifyCodeCheckHelper.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sms.helper; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.model.dto.VerifyCodeCacheDTO; +import com.hz.pm.api.sms.utils.SmsRedisKeyUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/8/16 上午11:43 + */ +@Component +@RequiredArgsConstructor +public class VerifyCodeCheckHelper { + + private final CachePlusOps cachePlusOps; + + /** + * 对某种类型的验证码进行校验 + * @param type + * @param mobile + * @param verificationCode + * @return + */ + public boolean verification(VerificationCodeType type, String mobile, String verificationCode) { + if (StringUtils.isBlank(mobile) || Objects.isNull(type)) { + return false; + } + String key = SmsRedisKeyUtils.smsCodeVerifyKey(type, mobile); + Object cacheObj = cachePlusOps.get(key); + if (Objects.isNull(cacheObj)) { + return false; + } + VerifyCodeCacheDTO cache = (VerifyCodeCacheDTO) cacheObj; + return verificationCode.trim().equals(cache.getCode()); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java new file mode 100644 index 0000000..51eeedc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java @@ -0,0 +1,108 @@ +package com.hz.pm.api.sms.manage; + +import cn.hutool.core.util.PhoneUtil; +import cn.hutool.core.util.RandomUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.constant.VoiceSmsTemplateConst; +import com.hz.pm.api.sms.model.dto.VerifyCodeCacheDTO; +import com.hz.pm.api.sms.model.po.ReqVerificationCodePO; +import com.hz.pm.api.sms.utils.DateUtil; +import com.hz.pm.api.sms.utils.SmsRedisKeyUtils; +import com.ningdatech.yxt.client.YxtClient; +import com.ningdatech.yxt.constants.YxtSmsSignEnum; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:42 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class SmsManage { + + private final YxtClient yxtClient; + private final CachePlusOps cachePlusOps; + + public void sendVerificationCode(ReqVerificationCodePO request) { + Assert.isTrue(PhoneUtil.isMobile(request.getMobile()), "手机号码格式不正确"); + String verificationType = request.getVerificationType(); + VerificationCodeType verificationCodeTypeEnum = VerificationCodeType.of(verificationType); + + // 验证是否被锁定 + String lockKey = SmsRedisKeyUtils.smsSendLockKey(verificationCodeTypeEnum, request.getMobile()); + if (StringUtils.isNotBlank(cachePlusOps.get(lockKey))) { + throw BizException.wrap("今日" + verificationCodeTypeEnum.getDesc() + "的验证码发送次数过多,已被锁定"); + } + // 验证发送间隔 + String cacheKey = SmsRedisKeyUtils.smsCodeVerifyKey(verificationCodeTypeEnum, request.getMobile()); + VerifyCodeCacheDTO preCache = (VerifyCodeCacheDTO) cachePlusOps.get(cacheKey); + if (preCache != null) { + if (LocalDateTime.now().minusMinutes(verificationCodeTypeEnum.getSendInterval()) + .isBefore(preCache.getSendTime())) { + throw BizException.wrap(verificationCodeTypeEnum.getSendInterval() + "分钟之内已发送过验证码,请稍后重试"); + } + } + String code = RandomUtil.randomNumbers(6); + VerifyCodeCacheDTO cache = VerifyCodeCacheDTO.builder() + .code(code) + .sendTime(LocalDateTime.now()) + .mobile(request.getMobile()) + .build(); + + // 创建短信内容 + SendSmsCmd sendSmsCmd = new SendSmsCmd(); + switch (verificationCodeTypeEnum) { + case LOGIN: { + SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); + sendSmsContext.setReceiveNumber(request.getMobile()); + sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_COMMON_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime())); + sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); + sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + } + break; + case EXPERT_REGISTER: { + SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); + sendSmsContext.setReceiveNumber(request.getMobile()); + sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, verificationCodeTypeEnum.getExpireTime())); + sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); + sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + } + break; + default: + throw new IllegalArgumentException("非法的短信发送类型"); + } + + // 发送 短信 + yxtClient.submitSmsTask(sendSmsCmd); + log.info("send verificationCode mobile = {},code = {}", request.getMobile(), code); + + cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache); + String limitKey = SmsRedisKeyUtils.smsSendLimitKey(verificationCodeTypeEnum, request.getMobile()); + if (Objects.nonNull(cachePlusOps.get(limitKey))) { + Integer limitCount = cachePlusOps.get(limitKey); + cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), limitCount++); + // 超出单日发送次数之后直接锁定 + if (limitCount >= verificationCodeTypeEnum.getSendTimesByDay().longValue()) { + cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile()); + } + } else { + cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), 1); + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/dto/VerifyCodeCacheDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/dto/VerifyCodeCacheDTO.java new file mode 100644 index 0000000..9dbf1cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/dto/VerifyCodeCacheDTO.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.sms.model.dto; + +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:42 + */ +@Data +@Builder +public class VerifyCodeCacheDTO { + + @Tolerate + public VerifyCodeCacheDTO() { + } + + private String mobile; + + private LocalDateTime sendTime; + + private String code; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/po/ReqVerificationCodePO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/po/ReqVerificationCodePO.java new file mode 100644 index 0000000..e1495e8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/model/po/ReqVerificationCodePO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.sms.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:40 + */ +@Data +@ApiModel(value = "VerificationCodeRequest", description = "验证码发送验证") +public class ReqVerificationCodePO implements Serializable { + + @ApiModelProperty(value = "手机号") + @NotBlank(message = "手机号不能为空") + private String mobile; + + @ApiModelProperty(value = "短信类型", allowableValues = "LOGIN") + @NotBlank(message = "短信类型不能为空") + private String verificationType; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/task/YxtPollingTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/task/YxtPollingTask.java new file mode 100644 index 0000000..8b49caa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/task/YxtPollingTask.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.sms.task; + +import com.ningdatech.yxt.client.YxtContext; +import lombok.RequiredArgsConstructor; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2022/8/9 下午3:58 + * 音信通定时检查电话结果 + */ +@Component +@RequiredArgsConstructor +public class YxtPollingTask { + + + private final YxtContext yxtContext; + + /** + * 校验音信通结果数据 + * 每5分钟执行一次 + */ + @Scheduled(cron = "0 */1 * * * ?") +// @Scheduled(cron = "${cron-expression.sms-msg-result-check-cron}") + public void smsMsgResultCheck() { + yxtContext.smsMsgResultCheck(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/DateUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/DateUtil.java new file mode 100644 index 0000000..5adf654 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/DateUtil.java @@ -0,0 +1,206 @@ +package com.hz.pm.api.sms.utils; + + +import com.hz.pm.api.sms.constant.DatePattern; + +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.Date; + +/** + * @author qinxianyun + * JDK 8 新日期类 格式化与字符串转换 工具类 + */ +public class DateUtil { + + public static final DateTimeFormatter DTF_YMD_HMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + public static final DateTimeFormatter DTF_YMD_HMS_COMPRESS = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); + + public static final DateTimeFormatter DTF_YMD_HM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + + public static final DateTimeFormatter DTF_YMD = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + public static final DateTimeFormatter DTF_YMD_SLASH = DateTimeFormatter.ofPattern("yyyy/MM/dd"); + + public static final DateTimeFormatter DTF_HMS = DateTimeFormatter.ofPattern("HH:mm:ss"); + + /** + * 最大时间,三位小数 + */ + public static final LocalTime LOCAL_TIME_3D = LocalTime.of(23, 59, 59, 999_000_00); + + /** + * LocalDateTime 转时间戳 + * + * @param localDateTime / + * @return / + */ + public static Long getTimeStamp(LocalDateTime localDateTime) { + return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond(); + } + + /** + * 时间戳转LocalDateTime + * + * @param timeStamp / + * @return / + */ + public static LocalDateTime fromTimeStamp(Long timeStamp) { + return LocalDateTime.ofEpochSecond(timeStamp, 0, OffsetDateTime.now().getOffset()); + } + + /** + * LocalDateTime 转 Date + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param localDateTime / + * @return / + */ + public static Date toDate(LocalDateTime localDateTime) { + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + } + + /** + * LocalDate 转 Date + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param localDate / + * @return / + */ + public static Date toDate(LocalDate localDate) { + return toDate(localDate.atTime(LocalTime.now(ZoneId.systemDefault()))); + } + + + /** + * Date转 LocalDateTime + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param date / + * @return / + */ + public static LocalDateTime toLocalDateTime(Date date) { + return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); + } + + /** + * 日期 格式化 + * + * @param localDateTime / + * @param patten / + * @return / + */ + public static String localDateTimeFormat(LocalDateTime localDateTime, String patten) { + DateTimeFormatter df = DateTimeFormatter.ofPattern(patten); + return df.format(localDateTime); + } + + /** + * 日期 格式化 + * + * @param localDateTime / + * @param df / + * @return / + */ + public static String localDateTimeFormat(LocalDateTime localDateTime, DateTimeFormatter df) { + return df.format(localDateTime); + } + + /** + * 日期格式化 yyyy-MM-dd HH:mm:ss + * + * @param localDateTime / + * @return / + */ + public static String localDateTimeFormatyMdHms(LocalDateTime localDateTime) { + return DTF_YMD_HMS.format(localDateTime); + } + + /** + * 日期格式化 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public String localDateTimeFormatyMd(LocalDateTime localDateTime) { + return DTF_YMD.format(localDateTime); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, String pattern) { + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern); + return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, DateTimeFormatter dateTimeFormatter) { + return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd HH:mm:ss + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormatyMdHms(String localDateTime) { + return LocalDateTime.from(DTF_YMD_HMS.parse(localDateTime)); + } + + public static String weekday(LocalDate date) { + return date.format(DateTimeFormatter.ofPattern(DatePattern.EEE)); + } + + public static String weekdayWithChou(LocalDate date) { + return date.format(DateTimeFormatter.ofPattern(DatePattern.EEE)).replace("星期", "周"); + } + + public static boolean between(LocalDate target, LocalDate start, LocalDate end) { + return !(target.isBefore(start) || target.isAfter(end)); + } + + public static boolean between(LocalDateTime target, LocalDateTime start, LocalDateTime end) { + return !(target.isBefore(start) || target.isAfter(end)); + } + + public static boolean between(LocalTime target, LocalTime start, LocalTime end) { + return !(target.isBefore(start) || target.isAfter(end)); + } + + public static boolean between(Date target, Date start, Date end) { + return !(target.before(start) || target.after(end)); + } + + public static LocalDateTime min(LocalDateTime time1, LocalDateTime time2) { + return time1.isAfter(time2) ? time2 : time1; + } + + public static LocalDateTime max(LocalDateTime time1, LocalDateTime time2) { + return time1.isBefore(time2) ? time2 : time1; + } + + public static long restSecondsFromNowToNoon() { + return ChronoUnit.SECONDS.between(LocalDateTime.now(), LocalDate.now().atTime(LocalTime.MAX)); + } + + public static boolean intersect(LocalDateTime startG1, LocalDateTime endG1, LocalDateTime startG2, LocalDateTime endG2) { + if (!startG1.isBefore(startG2) && !startG1.isAfter(endG2)) { + return Boolean.TRUE; + } + return !endG1.isBefore(startG2) && !endG1.isAfter(endG2); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/SmsRedisKeyUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/SmsRedisKeyUtils.java new file mode 100644 index 0000000..9293006 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/utils/SmsRedisKeyUtils.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.sms.utils; + +import cn.hutool.core.text.StrPool; +import com.hz.pm.api.sms.constant.VerificationCodeType; + +/** + *

+ * SmsRedisKeyUtils + *

+ * + * @author WendyYang + * @since 11:21 2022/7/25 + */ +public class SmsRedisKeyUtils { + + private SmsRedisKeyUtils() { + } + + private static final String PROJECT_NAME = "ls_pm:"; + + private static final String SMS_CODE_VERIFY_PREFIX = "sms:verify:"; + private static final String SMS_SEND_LIMIT = "sms:limit:"; + private static final String SMS_SEND_LOCK = "sms:lock:"; + + public static String smsCodeVerifyKey(VerificationCodeType type, String mobile) { + return PROJECT_NAME + SMS_CODE_VERIFY_PREFIX + StrPool.COLON + type.name() + StrPool.COLON + mobile; + } + + public static String smsSendLimitKey(VerificationCodeType type, String mobile) { + return PROJECT_NAME + SMS_SEND_LIMIT + StrPool.COLON + type.name() + StrPool.COLON + mobile; + } + + public static String smsSendLockKey(VerificationCodeType type, String mobile) { + return PROJECT_NAME + SMS_SEND_LOCK + StrPool.COLON + type.name() + StrPool.COLON + mobile; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java new file mode 100644 index 0000000..8591833 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java @@ -0,0 +1,12 @@ +package com.hz.pm.api.staging.contants; + +/** + * 项目暂存 静态配置 + */ +public interface StagingContant { + + class Retry { + public static final Integer MAX_RETRY_TIMES = 10; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/enums/MsgTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/enums/MsgTypeEnum.java new file mode 100644 index 0000000..1fce885 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/enums/MsgTypeEnum.java @@ -0,0 +1,83 @@ +package com.hz.pm.api.staging.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 消息类型枚举 + * + * @author CMM + * @since 2023/02/28 17:34 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum MsgTypeEnum { + /** + * 项目待审核 + */ + PROJECT_REVIEW(1, "项目审核"), + /** + * 预警提醒 + */ + WARING(2, "预警提醒"), + /** + * 专家评审 + */ + EXPERT_REVIEW(3, "专家评审"), + /** + * 评审会议 + */ + REVIEW_MEETING(4, "评审会议"), + /** + * 项目审核被退回 + */ + PROJECT_REVIEW_BACK(5, "项目审核"), + /** + * 项目审核通过 + */ + PROJECT_REVIEW_PASS(6, "项目审核"), + /** + * 项目审核驳回 + */ + PROJECT_REVIEW_REJECT(7, "项目审核"), + + PROJECT_REVIEW_CC(8, "项目抄送"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (MsgTypeEnum t : MsgTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getDescByName(String name) { + if (StringUtils.isBlank(name)) { + return StringUtils.EMPTY; + } + for (MsgTypeEnum t : MsgTypeEnum.values()) { + if (name.equals(t.name())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.java new file mode 100644 index 0000000..98d85a3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.staging.mapper; + +import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +public interface NdWorkNoticeStagingMapper extends BaseMapper { + + Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, + @Param("nextRetryTime") LocalDateTime nextRetryTime, @Param("dead") Boolean dead); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.xml new file mode 100644 index 0000000..e54045b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/NdWorkNoticeStagingMapper.xml @@ -0,0 +1,12 @@ + + + + + + update nd_work_notice_staging + set retry_times = #{retryTimes}, + next_time = #{nextRetryTime}, + dead = #{dead} + where id = #{id} and retry_times = #{retryTimes} - 1 + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.java new file mode 100644 index 0000000..b8f485b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.java @@ -0,0 +1,13 @@ +package com.hz.pm.api.staging.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; + +public interface ProjectStagingMapper extends BaseMapper { + + Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, + @Param("nextRetryTime") LocalDateTime nextRetryTime,@Param("dead") Boolean dead); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.xml new file mode 100644 index 0000000..4c6ab55 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/mapper/ProjectStagingMapper.xml @@ -0,0 +1,12 @@ + + + + + + update nd_project_staging + set retry_times = #{retryTimes}, + next_time = #{nextRetryTime}, + dead = #{dead} + where id = #{id} and retry_times = #{retryTimes} - 1 + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/ProjectStaging.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/ProjectStaging.java new file mode 100644 index 0000000..f97f905 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/ProjectStaging.java @@ -0,0 +1,69 @@ +package com.hz.pm.api.staging.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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @Classname ProjectStaging + * @Description + * @Date 2023/2/20 9:40 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_project_staging") +@ApiModel(value = "ProjectStaging", description = "项目暂存表 扫描进行 状态继续流转 做解耦用") +public class ProjectStaging implements Serializable { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("实例code") + private String instCode; + + @ApiModelProperty("流程状态") + private Integer processStatus; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("重试次数") + private Integer retryTimes; + + @ApiModelProperty("是否死信") + private Boolean dead; + + @ApiModelProperty("下次扫描时间") + private LocalDateTime nextTime; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/WorkNoticeStaging.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/WorkNoticeStaging.java new file mode 100644 index 0000000..25af33b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/model/entity/WorkNoticeStaging.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.staging.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-02-28 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_work_notice_staging") +@ApiModel(value = "NdWorkNoticeStaging对象", description = "") +public class WorkNoticeStaging implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("浙政钉用户ID") + private Long accountId; + + @ApiModelProperty("部门编号") + private String organizationCode; + + @ApiModelProperty("部门名称") + private String organizationName; + + @ApiModelProperty("工作通知唯一标识") + private String bizMsgId; + + @ApiModelProperty("接收人浙政钉ID") + private String receiverUserId; + + @ApiModelProperty("工作通知内容") + private String msg; + + @ApiModelProperty("重试次数 最大10次") + private Integer retryTimes; + + @ApiModelProperty("false 可继续扫描 true 死信") + private Boolean dead; + + @ApiModelProperty("下次扫描时间") + private LocalDateTime nextTime; + + @ApiModelProperty("消息类型") + private MsgTypeEnum msgType; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/INdWorkNoticeStagingService.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/INdWorkNoticeStagingService.java new file mode 100644 index 0000000..8d2301f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/INdWorkNoticeStagingService.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.staging.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +public interface INdWorkNoticeStagingService extends IService { + + Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging); + + Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType); + + /** + * 批量保存工作通知 + * + * @param workNoticeInfos 工作通知内容 + * @param msgType 通知类型 + */ + void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/IProjectStagingService.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/IProjectStagingService.java new file mode 100644 index 0000000..66c712d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/IProjectStagingService.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.staging.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.staging.model.entity.ProjectStaging; + +/** + * @Classname IProjectStagingService + * @Description + * @Date 2023/2/20 10:08 + * @Author PoffyZhang + */ +public interface IProjectStagingService extends IService { + + Boolean addRetryTimes(ProjectStaging projectStaging); + + public Boolean addByProject(Project project,String remark) ; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java new file mode 100644 index 0000000..75fc836 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java @@ -0,0 +1,117 @@ +package com.hz.pm.api.staging.service.impl; + +import com.hz.pm.api.staging.contants.StagingContant; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; +import com.hz.pm.api.staging.mapper.NdWorkNoticeStagingMapper; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.staging.utils.WorkNoticeFlowMapUtil; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class NdWorkNoticeStagingServiceImpl extends ServiceImpl implements INdWorkNoticeStagingService { + + private final NdWorkNoticeStagingMapper mapper; + + private final WorkNoticeFlowMapUtil workNoticeFlowMapUtil; + + /** + * 增加 重试次数 和下次扫描时间 + * + * @param workNoticeStaging + * @return java.lang.Boolean + * @author CMM + * @since 2023/02/28 18:02 + */ + @Override + public Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging) { + Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; + if (!workNoticeFlowMapUtil.intervalTimeMap.containsKey(workNoticeStaging.getRetryTimes())) { + log.info("没有对应重试间隔时间 添加重试信息失败"); + return Boolean.FALSE; + } + Integer addSeconds = workNoticeFlowMapUtil.intervalTimeMap.get(workNoticeStaging.getRetryTimes()); + Boolean dead = Boolean.FALSE; + //超过重试最大次数 dead置为 true + if (retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0) { + dead = Boolean.TRUE; + } + LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); + return mapper.addRetryTimes(workNoticeStaging.getId(), retryTimes, nextRetryTime, dead); + } + + /** + * 在对应的流程处理后,增加一个工作通知到暂存表中 + * + * @param workNoticeInfo + * @param msgType + * @return java.lang.Boolean + * @author CMM + * @since 2023/02/28 20:02 + */ + @Override + public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) { + WorkNoticeStaging workNoticeStaging = WorkNoticeStaging.builder() + .accountId(workNoticeInfo.getAccountId()) + .msg(workNoticeInfo.getMsg()) + .bizMsgId(workNoticeInfo.getBizMsgId()) + .organizationCode(workNoticeInfo.getOrganizationCode()) + .organizationName(workNoticeInfo.getOrganizationName()) + .receiverUserId(workNoticeInfo.getReceiverUserId()) + .msgType(msgType) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .nextTime(LocalDateTime.now()) + .retryTimes(0) + .build(); + return this.save(workNoticeStaging); + } + + /** + * 在对应的流程处理后,增加一个工作通知到暂存表中 + * + * @param workNoticeInfos + * @param msgType + * @return java.lang.Boolean + * @author CMM + * @since 2023/02/28 20:02 + */ + @Override + public void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType) { + LocalDateTime now = LocalDateTime.now(); + List workNoticeInfoList = workNoticeInfos.stream() + .map(workNoticeInfo -> WorkNoticeStaging.builder() + .accountId(workNoticeInfo.getAccountId()) + .msg(workNoticeInfo.getMsg()) + .bizMsgId(workNoticeInfo.getBizMsgId()) + .organizationCode(workNoticeInfo.getOrganizationCode()) + .organizationName(workNoticeInfo.getOrganizationName()) + .receiverUserId(workNoticeInfo.getReceiverUserId()) + .msgType(msgType) + .createOn(now) + .updateOn(now) + .nextTime(now) + .retryTimes(0) + .build()).collect(Collectors.toList()); + saveBatch(workNoticeInfoList); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/ProjectStagingServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/ProjectStagingServiceImpl.java new file mode 100644 index 0000000..d83cb42 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/ProjectStagingServiceImpl.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.staging.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.staging.contants.StagingContant; +import com.hz.pm.api.staging.mapper.ProjectStagingMapper; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.staging.utils.ProjectStatusFlowUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-18 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class ProjectStagingServiceImpl extends ServiceImpl implements IProjectStagingService { + + private final ProjectStagingMapper mapper; + + private final ProjectStatusFlowUtil projectStatusFlowUtil; + + /** + * 在某些状态节点 增加一个项目到状态暂存库 + * @param project + * @return + */ + @Override + public Boolean addByProject(Project project,String remark) { + ProjectStaging projectStaging = ProjectStaging.builder() + .projectId(project.getId()) + .projectName(project.getProjectName()) + .stage(project.getStage()) + .status(project.getStatus()) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .instCode(project.getInstCode()) + .processStatus(project.getProcessStatus()) + .nextTime(LocalDateTime.now()) + .retryTimes(0) + .remark(remark) + .build(); + return this.save(projectStaging); + } + + /** + * 增加 重试次数 和下次扫描时间 + * @param projectStaging + * @return + */ + @Override + public Boolean addRetryTimes(ProjectStaging projectStaging) { + Integer retryTimes = projectStaging.getRetryTimes() + 1; + if(!projectStatusFlowUtil.intervalTimeMap.containsKey(projectStaging.getRetryTimes())){ + log.info("没有对应重试间隔时间 添加重试信息失败"); + return Boolean.FALSE; + } + Integer addSeconds = projectStatusFlowUtil.intervalTimeMap.get(projectStaging.getRetryTimes()); + Boolean dead = Boolean.FALSE; + //超过重试最大次数 dead置为 true + if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ + dead = Boolean.TRUE; + } + LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); + return mapper.addRetryTimes(projectStaging.getId(),retryTimes,nextRetryTime,dead); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java new file mode 100644 index 0000000..651ec1b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.staging.utils; + +import com.google.common.collect.Maps; +import com.hz.pm.api.projectdeclared.manage.*; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.Map; +import java.util.function.Function; + +/** + * @Classname ProjectStatusFlowMapUtil + * @Description 状态流转 事件函数MAP + * @Date 2023/2/15 11:19 + * @Author PoffyZhang + */ +@Component +public class ProjectStatusFlowMapUtil { + @Autowired + private ReviewByProvincialDeptManage provincialDeptManage; + + @Autowired + private ReviewByDeptJointManage reviewByDeptJointManage; + + public Map> statusFlowFunctionMap = Maps.newHashMap(); + + /** + * 初始化业务分派逻辑,代替了if-else部分 + * key: 枚举 状态值 + * value: lambda表达式,最终会获取发起实例的函数 + */ + public ProjectStatusFlowMapUtil(){ + //省级部门联审 + statusFlowFunctionMap.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), + project->provincialDeptManage.startTheProcess(project)); + //部门联审 + statusFlowFunctionMap.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), + project->reviewByDeptJointManage.startTheProcess(project)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowUtil.java new file mode 100644 index 0000000..7bc0f43 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowUtil.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.staging.utils; + +import com.google.common.collect.Maps; +import com.hz.pm.api.projectdeclared.manage.ReviewByDeptJointManage; +import com.hz.pm.api.projectdeclared.manage.ReviewByProvincialDeptManage; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.Map; +import java.util.function.Function; + +/** + * @Classname ProjectStatusFlowMapUtil + * @Description 状态流转 事件函数MAP + * @Date 2023/2/15 11:19 + * @Author PoffyZhang + */ +@Component +public class ProjectStatusFlowUtil { + /** + * key 重试的次数 , value 是增加是描述 + */ + public Map intervalTimeMap = Maps.newHashMap(); + + /** + * 初始化业务分派逻辑,代替了if-else部分 + * key: 枚举 状态值 + * value: lambda表达式,最终会获取发起实例的函数 + */ + public ProjectStatusFlowUtil(){ + intervalTimeMap.put(0,60); + intervalTimeMap.put(1,60 * 2); + intervalTimeMap.put(2,60 * 6); + intervalTimeMap.put(3,60 * 15); + intervalTimeMap.put(4,60 * 30); + intervalTimeMap.put(5,60 * 60); + intervalTimeMap.put(6,60 * 60 * 2); + intervalTimeMap.put(7,60 * 60 * 5); + intervalTimeMap.put(8,60 * 60 * 12); + intervalTimeMap.put(9,60 * 60 * 24); + intervalTimeMap.put(10,60 * 60 * 72); + intervalTimeMap.put(11,60 * 60 * 216); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java new file mode 100644 index 0000000..e26cec3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.staging.utils; + +import java.util.Map; +import javax.annotation.PostConstruct; + +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; +import com.google.common.collect.Maps; +import lombok.RequiredArgsConstructor; + +/** + * 工作通知流转 事件函数MAP + * @return + * @author CMM + * @since 2023/02/28 17:03 + */ +@Component +@AllArgsConstructor +public class WorkNoticeFlowMapUtil { + /** + * key 重试的次数 , value 是增加是描述 + */ + public Map intervalTimeMap = Maps.newHashMap(); + + /** + * 扫描的间隔越来越长 秒数 + */ + public WorkNoticeFlowMapUtil(){ + intervalTimeMap.put(0,60); + intervalTimeMap.put(1,60 * 2); + intervalTimeMap.put(2,60 * 6); + intervalTimeMap.put(3,60 * 15); + intervalTimeMap.put(4,60 * 30); + intervalTimeMap.put(5,60 * 60); + intervalTimeMap.put(6,60 * 60 * 2); + intervalTimeMap.put(7,60 * 60 * 5); + intervalTimeMap.put(8,60 * 60 * 12); + intervalTimeMap.put(9,60 * 60 * 24); + intervalTimeMap.put(10,60 * 60 * 72); + intervalTimeMap.put(11,60 * 60 * 216); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java new file mode 100644 index 0000000..9f51129 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.sys.contants; + +/** + * @Classname UserGuidanceContant + * @Description + * @Date 2023/8/8 14:56 + * @Author PoffyZhang + */ +public interface UserGuidanceContant { + + Integer ALL_FINISHED_NUM = 2; + + 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/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/CpuController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/CpuController.java new file mode 100644 index 0000000..77eb78c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/CpuController.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.sys.manage.CpuManage; +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.*; + +/** + * @Classname CpuController + * @Description + * @Date 2023/10/30 11:06 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/cpu") +@Api(value = "CpuController", tags = "CPU提升和关闭提升") +@RequiredArgsConstructor +public class CpuController { + + private final CpuManage cpuManage; + + @ApiOperation(value = "提升cpu 增加一个线程", notes = "提升cpu 增加一个线程") + @PostMapping("/high") + @WebLog("提升cpu") + public String high() { + cpuManage.high(); + return "提高成功"; + } + + @ApiOperation(value = "关闭提升cpu", notes = "关闭提升cpu") + @PostMapping("/close") + @WebLog("关闭提升cpu") + public String close() { + cpuManage.close(); + return "关闭成功"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/EarlyWarningController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/EarlyWarningController.java new file mode 100644 index 0000000..a901997 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/EarlyWarningController.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.sys.model.req.WarningListReq; +import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; +import com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java new file mode 100644 index 0000000..a6dcab8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.wflow.bean.dto.WflowFormsDto; +import com.wflow.bean.vo.WflowFormVo; +import com.wflow.workflow.service.WflowFormsService; +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.*; + +/** + * @Classname SysProcdefController + * @Description + * @Date 2023/1/18 14:28 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/sys/form") +@Api(value = "SysForm", tags = "系统管理-表单配置") +@RequiredArgsConstructor +public class FormController { + + private final WflowFormsService formService; + + @ApiOperation(value = "获取系统表单", notes = "获取系统表单") + @GetMapping("/{regionCode}") + public WflowFormVo detail(@PathVariable(value = "regionCode") String regionCode) { + return formService.getFormByRegionCode(regionCode); + } + + @ApiOperation(value = "编辑系统表单", notes = "编辑系统表单") + @WebLog("编辑系统表单") + @PostMapping("/modify") + public String modify(@Validated @RequestBody WflowFormsDto dto) { + return formService.modifySysForm(dto); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/MenuController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/MenuController.java new file mode 100644 index 0000000..1704fbf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/MenuController.java @@ -0,0 +1,115 @@ +package com.hz.pm.api.sys.controller; + +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.ningdatech.basic.util.CollUtils; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.model.entity.MenuTreeEntity; +import com.hz.pm.api.common.util.TreeUtil; +import com.hz.pm.api.sys.manage.MenuManage; +import com.hz.pm.api.sys.model.dto.MenuQueryDTO; +import com.hz.pm.api.sys.model.dto.MenuSaveDTO; +import com.hz.pm.api.sys.model.dto.MenuUpdateDTO; +import com.hz.pm.api.sys.model.entity.Menu; +import com.hz.pm.api.sys.model.vo.MenuRoleVO; +import com.hz.pm.api.sys.model.vo.MenuVO; +import com.hz.pm.api.sys.service.IMenuService; +import com.hz.pm.api.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.*; + +import javax.validation.Valid; +import java.util.Collections; +import java.util.List; + +/** + *

+ * 前端控制器-菜单 + *

+ * + * @author WendyYang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/menu") +@Api(value = "Menu", tags = "系统管理-菜单") +public class MenuController { + + private final IMenuService menuService; + private final MenuManage menuManage; + + @ApiOperation("查询系统所有的菜单") + @GetMapping("/list") + public List allTree() { + List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); + return TreeUtil.buildTree(list); + } + + @ApiOperation("查询系统所有数据权限的菜单") + @GetMapping("/listByDataScope") + public List allTreeByDataScope() { + LambdaQueryWrapper dsQuery = Wrappers.lambdaQuery(Menu.class) + .eq(Menu::getHasDataScope, Boolean.TRUE) + .orderByAsc(Menu::getSort); + List list = menuService.list(dsQuery); + if (!list.isEmpty()) { + List pidList = CollUtils.fieldList(list, MenuTreeEntity::getPid); + list.addAll(menuService.listByIds(pidList)); + } + return TreeUtil.buildTree(list); + } + + @ApiOperation(value = "查询当前登录用户的菜单", notes = "查询当前登录用户的菜单") + @GetMapping("/myMenu") + public List currentUserMenu() { + List roleIdList = LoginUserUtil.getRoleIdList(); + if (CollUtil.isEmpty(roleIdList)) { + return Collections.emptyList(); + } + String tmpSql = "(" + CollUtils.joinByComma(roleIdList) + ")"; + List list = menuService.list(Wrappers.lambdaQuery(Menu.class) + .exists("select 1 from nd_role_menu nur where nur.menu_id = nd_menu.id and nur.role_id in " + tmpSql) + .orderByAsc(Menu::getSort)); + return menuManage.buildUserMenu(list); + } + + @ApiOperation(value = "查询菜单", notes = "查询菜单") + @GetMapping("/details") + public MenuQueryDTO getDetails(@RequestParam Long id) { + Menu menu = menuService.getById(id); + return BeanUtil.toBean(menu, MenuQueryDTO.class); + } + + @ApiOperation(value = "保存新菜单", notes = "保存新菜单") + @PostMapping("/save") + @WebLog("保存菜单") + public MenuVO handlerSave(@Valid @RequestBody MenuSaveDTO data) { + menuService.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, MenuVO.class); + } + + @ApiOperation(value = "编辑菜单", notes = "编辑菜单") + @PostMapping("/modify") + @WebLog("编辑菜单") + public MenuVO handlerUpdate(@RequestBody MenuUpdateDTO data) { + menuService.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, MenuVO.class); + } + + @ApiOperation(value = "删除菜单", notes = "删除菜单") + @PostMapping("/remove") + @WebLog("删除菜单") + public Boolean handlerDelete(@RequestBody List ids) { + return menuService.removeByIdWithCache(ids); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NoticeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NoticeController.java new file mode 100644 index 0000000..9b64031 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NoticeController.java @@ -0,0 +1,82 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.sys.model.req.NoticeListReq; +import com.hz.pm.api.sys.model.req.NoticeSaveReq; +import com.hz.pm.api.sys.model.req.NoticeStatusModifyReq; +import com.hz.pm.api.sys.model.vo.NoticeDetailVO; +import com.hz.pm.api.sys.model.vo.NoticeListItemVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 系统公告 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-07-21 + */ +@RestController +@Api(tags = "公告管理") +@RequiredArgsConstructor +@RequestMapping("/api/v1/notice") +public class NoticeController { + + private final NoticeManage noticeManage; + + @PostMapping("/save") + @ApiOperation("新增公告") + @WebLog("新增公告") + public IdVo save(@Valid @RequestBody NoticeSaveReq req) { + return noticeManage.saveOrModify(req); + } + + @GetMapping("/detail/{id}") + @ApiOperation("公告详情") + public NoticeDetailVO save(@PathVariable Long id) { + return noticeManage.detail(id); + } + + @PostMapping("/enabled") + @ApiOperation("启用/禁用") + @WebLog("启用/禁用") + public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) { + return noticeManage.changeEnabled(req); + } + + @PostMapping("/topped") + @ApiOperation("置顶") + @WebLog("置顶") + public void topped(@RequestBody IdVo id) { + noticeManage.topped(id.getId()); + } + + @GetMapping("/dashboard/list") + @ApiOperation("工作台公告列表") + public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, + @RequestParam(required = false) Integer type) { + return noticeManage.dashboardList(limit, type); + } + + @GetMapping("/manage/list") + @ApiOperation("公告管理列表") + public PageVo listByManager(NoticeListReq req) { + return noticeManage.listByManager(req); + } + + @DeleteMapping("/del") + @ApiOperation("删除公告") + @WebLog("删除公告") + public void delNotice(@RequestBody IdVo req) { + noticeManage.delNotice(req.getId()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NotifyController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NotifyController.java new file mode 100644 index 0000000..ccdf5cc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/NotifyController.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.sys.manage.NotifyManage; +import com.hz.pm.api.sys.model.req.NotifyListReq; +import com.hz.pm.api.sys.model.vo.NotifyVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 通知消息 前端控制器 + *

+ * + * @author ZPF + * @since 2023-03-22 + */ +@RestController +@Api(tags = "通知管理") +@RequiredArgsConstructor +@RequestMapping("/api/v1/notify") +public class NotifyController { + + private final NotifyManage notifyManage; + + @GetMapping("/list") + @ApiOperation("通知列表") + public PageVo page(@ModelAttribute NotifyListReq notifyListReq){ + return notifyManage.page(notifyListReq); + } + + @GetMapping("/detail/{id}") + @ApiOperation("通知详情") + public NotifyVO save(@PathVariable Long id) { + return notifyManage.detail(id); + } + + @PostMapping("/read/{id}") + @ApiOperation("已读") + @WebLog("消息-已读") + public Boolean read(@PathVariable Long id) { + return notifyManage.read(id); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/ProcessStatisticsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/ProcessStatisticsController.java new file mode 100644 index 0000000..c25a1eb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/ProcessStatisticsController.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.sys.controller; + +import com.hz.pm.api.sys.manage.ProcessStatisticsManage; +import com.hz.pm.api.sys.model.vo.ProcessDetailStatVO; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + *

+ * ProcessStatisticsController + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Validated +@RestController +@RequestMapping("/api/v1/process/statistics") +@AllArgsConstructor +public class ProcessStatisticsController { + + private final ProcessStatisticsManage processStatisticsManage; + + @GetMapping("/detail") + @ApiOperation("流程统计详情") + public ProcessDetailStatVO processStatDetail(@RequestParam(required = false, defaultValue = "DAYS") TimeUnit unit, + @Valid @NotNull(message = "流程类型不能为空") Integer instType) { + return processStatisticsManage.processStatDetail(unit, instType); + } + + @GetMapping("/list") + @ApiOperation("流程统计详情列表") + public List listProcessStatDetail(@RequestParam(required = false, defaultValue = "DAYS") TimeUnit unit) { + return processStatisticsManage.processStatDetailList(unit); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RegionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RegionController.java new file mode 100644 index 0000000..b77a39c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RegionController.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.sys.controller; + +import com.hz.pm.api.sys.manage.RegionManage; +import com.hz.pm.api.sys.model.vo.RegionTreeVO; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-08 + */ +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/region") +@Api(tags = "系统管理-地域管理") +public class RegionController { + + private final RegionManage regionManage; + + @GetMapping("/tree") + @ApiOperation("获取区域编码的树状结构") + public RegionTreeVO getRegionTree(@RequestParam(required = false) String regionCode, + @RequestParam(required = false) Integer regionLevel) { + return regionManage.getRegionTree(regionCode, regionLevel); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RoleController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RoleController.java new file mode 100644 index 0000000..5a77b30 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/RoleController.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.sys.controller; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.sys.manage.RoleManage; +import com.hz.pm.api.sys.model.dto.MenuDataScopeDTO; +import com.hz.pm.api.sys.model.dto.RoleSaveDTO; +import com.hz.pm.api.sys.model.dto.RoleUpdateDTO; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.req.RolePageReq; +import com.hz.pm.api.sys.model.vo.RoleVO; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.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.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器-角色 + *

+ * + * @author WendyYang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/role") +@Api(value = "Role", tags = "系统管理-角色") +@RequiredArgsConstructor +public class RoleController { + + private final IRoleService roleService; + private final RoleManage roleManage; + + + @ApiOperation(value = "角色列表查询", notes = "角色列表查询") + @GetMapping("/list") + public PageVo query(@Valid @ModelAttribute RolePageReq rolePageReq) { + return roleManage.queryList(rolePageReq); + } + + /** + * 查询角色 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询角色", notes = "查询角色") + @GetMapping("/details") + public RoleVO getDetails(@Valid @RequestParam Long id) { + Role role = roleService.getById(id); + Assert.notNull(role, "角色不存在"); + RoleVO query = BeanUtil.toBean(role, RoleVO.class); + query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); + List menuDataScope = roleManage.getMenuDataScope(id); + query.setMenuDataScopeList(menuDataScope); + // 菜单 + roleManage.buildMenu(query); + return query; + } + + @ApiOperation(value = "保存新角色", notes = "保存新角色") + @PostMapping("/save") + @WebLog("保存新角色") + public RoleVO handlerSave(@Valid @RequestBody RoleSaveDTO data) { + roleService.saveRole(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, RoleVO.class); + } + + @ApiOperation(value = "编辑角色", notes = "编辑角色") + @PostMapping("/modify") + @WebLog("编辑角色") + public RoleVO handlerUpdate(@Valid @RequestBody RoleUpdateDTO data) { + roleService.updateRole(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, RoleVO.class); + } + + @ApiOperation(value = "删除角色", notes = "删除角色") + @PostMapping("/remove") + @WebLog("删除角色") + public Boolean handlerDelete(@Valid @RequestBody List ids) { + return roleService.removeByIdWithCache(ids); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java new file mode 100644 index 0000000..15e0aaa --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.sys.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.wflow.bean.dto.WflowModelHistorysDto; +import com.wflow.bean.vo.WflowModelVo; +import com.wflow.service.ModelGroupService; +import com.wflow.workflow.service.ProcessModelService; +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.*; + +/** + * @Classname SysProcdefController + * @Description + * @Date 2023/1/18 14:28 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/sys/procdef") +@Api(value = "SysProcdef", tags = "系统管理-流程配置") +@RequiredArgsConstructor +public class SysProcDefController { + + private final ModelGroupService modelGroupService; + + private final ProcessModelService processModelService; + + @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") + @GetMapping("/list") + public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber, + @RequestParam(defaultValue = "10") Integer pageSize) { + return modelGroupService.getModelsPage(regionCode,pageNumber,pageSize); + } + + @ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情") + @GetMapping("/detail/{formId}") + public Object list(@PathVariable String formId) { + return modelGroupService.getModelById(formId); + } + + @ApiOperation(value = "系统流程配置保存", notes = "系统流程配置保存") + @PostMapping("/save") + @WebLog("系统流程配置保存") + public String save(@Validated @RequestBody WflowModelHistorysDto dto) { + return processModelService.saveProcess(dto); + } + + @ApiOperation(value = "系统流程配置启用(停用)", notes = "系统流程配置启用(停用)") + @PutMapping("/{formId}/active/{state}") + public String enOrDisModel(@PathVariable String formId, + @PathVariable Boolean state) { + modelGroupService.enOrDisModel(formId, !state); + return Boolean.TRUE.equals(state) ? "启用流程成功":"停用流程成功"; + } + + @ApiOperation(value = "系统流程配置发布", notes = "系统流程配置发布") + @PostMapping("/deploy/{formId}") + @WebLog("系统流程配置发布") + public String deploy(@Validated @PathVariable String formId) { + return processModelService.deployProcessLs(formId, null); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java new file mode 100644 index 0000000..809782e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sys.controller; + +import com.hz.pm.api.sys.manage.UserGuidanceManage; +import com.hz.pm.api.sys.model.vo.UserGuidanceVO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.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.*; + +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); + } + + @ApiOperation(value = "删除重复用户", notes = "删除重复用户") + @GetMapping("/remove-repeat/{userId}") + public String removeRepeat(@PathVariable Long userId) { + return userGuidanceManage.removeRepeat(userId); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java new file mode 100644 index 0000000..a90aa59 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java @@ -0,0 +1,91 @@ +package com.hz.pm.api.sys.convert; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.dto.RegionTreeDTO; +import com.hz.pm.api.sys.model.vo.RegionTreeVO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * RegionConverter + *

+ * + * @author WendyYang + * @since 10:31 2022/10/12 + */ +public class RegionConverter { + + public static RegionDTO toRegionDTO(Region region) { + RegionDTO dto = new RegionDTO(); + dto.setRegionLevel(region.getRegionLevel()); + dto.setRegionName(region.getRegionName()); + dto.setParentCode(region.getParentCode()); + dto.setRegionCode(region.getRegionCode()); + dto.setId(region.getId()); + dto.setDeleted(region.getDeleted()); + dto.setGovUnit(region.getGovUnit()); + dto.setParentId(region.getParentId()); + dto.setRegionCodePath(region.getRegionCodePath()); + dto.unionCode(); + return dto; + } + + public static List toRegionTreeDTOList(List regionDTOList) { + if (CollectionUtils.isEmpty(regionDTOList)) { + return new ArrayList<>(); + } + return regionDTOList.stream().map(RegionConverter::toRegionTreeDTO).collect(Collectors.toList()); + } + + public static RegionTreeDTO toRegionTreeDTO(RegionDTO regionDTO) { + RegionTreeDTO treeDto = new RegionTreeDTO(); + treeDto.setLevel(regionDTO.getRegionLevel()); + treeDto.setName(regionDTO.getRegionName()); + treeDto.setParentCode(regionDTO.getParentCode()); + treeDto.setRegionCode(regionDTO.getRegionCode()); + treeDto.setUnionCode(regionDTO.getUnionCode()); + treeDto.setId(regionDTO.getId()); + treeDto.setDeleted(regionDTO.getDeleted()); + treeDto.setGovUnit(regionDTO.getGovUnit()); + return treeDto; + } + + public static RegionTreeVO toRegionTreeVO(RegionDTO region) { + RegionTreeVO node = new RegionTreeVO(); + node.setRegionLevel(region.getRegionLevel()); + node.setName(region.getRegionName()); + node.setParentCode(region.getParentCode()); + node.setRegionCode(region.getRegionCode()); + node.setUnionCode(region.getUnionCode()); + node.setId(region.getId()); + node.setUnionCode(region.getUnionCode()); + node.setGovUnit(region.getGovUnit()); + return node; + } + + public static List toRegionTree(Long parentId, Map> regions, + boolean showDeleted) { + List treeList = new ArrayList<>(); + List children = regions.getOrDefault(parentId, Collections.emptyList()); + for (RegionDTO region : children) { + if (!showDeleted && region.getDeleted()) { + continue; + } + RegionTreeVO node = toRegionTreeVO(region); + List regionList = regions.get(region.getId()); + if (CollUtil.isNotEmpty(regionList)) { + node.setChildren(toRegionTree(region.getId(), regions, showDeleted)); + } + treeList.add(node); + } + return treeList; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticePermissionsEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticePermissionsEnum.java new file mode 100644 index 0000000..7dc005d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticePermissionsEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.sys.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 公告权限枚举 + * @author ZPF + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum NoticePermissionsEnum { + /** + * 公告权限枚举 + */ + SUPER(0, "所有人可看"), + REGION(1, "区域可看"), + ORG(2, "单位可看"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getNameByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { + if (code.equals(t.getCode())) { + return t.name(); + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticeTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticeTypeEnum.java new file mode 100644 index 0000000..0a427ba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/NoticeTypeEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.sys.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 公告类型枚举 + * @author ZPF + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum NoticeTypeEnum { + /** + * 公告类型枚举 + */ + ANNOUNCEMENT(1, "公告"), + HELP_DOCUMENTS(2, "帮助文档"), + POLICY_DOCUMENTS(3, "政策文件"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticeTypeEnum t : NoticeTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getNameByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticeTypeEnum t : NoticeTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.name(); + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/ProjectEarlyWarningStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/ProjectEarlyWarningStatusEnum.java new file mode 100644 index 0000000..6dee8e9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/enumeration/ProjectEarlyWarningStatusEnum.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.sys.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 项目预警状态枚举 + * @author ZPF + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum ProjectEarlyWarningStatusEnum { + /** + * 项目预警状态枚举 + */ + NORMAL(1, "正常"), + OVER_TIME(2, "超期"), + ADVENT_TIME(3, "临期"); + + private Integer code; + private String desc; + + public static String match(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectEarlyWarningStatusEnum t : ProjectEarlyWarningStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getNameByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectEarlyWarningStatusEnum t : ProjectEarlyWarningStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.name(); + } + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/CpuManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/CpuManage.java new file mode 100644 index 0000000..3cedd27 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/CpuManage.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.sys.manage; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.*; + +/** + * @Classname CpuManage + * @Description + * @Date 2023/8/7 9:25 + * @Author PoffyZhang + */ +@Component +@Slf4j +public class CpuManage { + private static ExecutorService executorService = Executors.newFixedThreadPool(10); + + private static volatile boolean flag = true; + + public void high() { + flag = true; + executorService.execute(() -> { + while (flag) { + // 一个复杂的计算任务 + long x = 123456789123456789L; + for (int j = 0; j < 10000; j++) { + if(!flag){ + break; + } + x = (x * 123456789123456789L) % 123456789; + } + } + }); + } + + public void close(){ + try{ + executorService.shutdownNow(); + flag = false; + executorService = Executors.newFixedThreadPool(10); + }catch (Exception e){ + log.error(e.getMessage()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java new file mode 100644 index 0000000..19dcff8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -0,0 +1,373 @@ +package com.hz.pm.api.sys.manage; + +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.WarningFlowTypeEnum; +import com.hz.pm.api.projectlib.enumeration.WarningOperationTypeEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.hz.pm.api.sys.model.entity.Notify; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; +import com.hz.pm.api.sys.service.INotifyService; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.wflow.enums.WarningNoticeTypeEnum; +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 adventTimeout + * @param employeeCode + * @param project + */ + public void doEarlyWarning(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, + Integer biz, LocalDateTime startTime,String employeeCode, + Project project,Integer ruleType,Integer noticeType, + String path,String batchEmployees,String nodeId) { + //1.存入 预警记录 + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); + String content = StringUtils.EMPTY; + + switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + case PROCESS_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); + break; + case DECLARED_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); + break; + case OPERATION_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + break; + case RENEWAL_FUND: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + } + + records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.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); + records.setProjectId(project.getId()); + records.setProjectCode(project.getProjectCode()); + records.setProjectStatus(project.getStatus()); + records.setNoticeType(noticeType); + records.setPath(path); + records.setBatchEmployees(batchEmployees); + records.setBiz(biz); + records.setNodeId(nodeId); + records.setOverTime(overTimeout); + 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 noticeMethod + * @param noticeContent + * @param adventTimeout + * @param employeeCode + * @param project + */ + public void urging(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, + Integer biz, LocalDateTime startTime,String employeeCode, + Project project,Integer ruleType,Integer noticeType, + String path,String batchEmployees,String nodeId) { + //1.存入 预警记录 + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); + String content = StringUtils.EMPTY; + + switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + case PROCESS_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); + break; + case DECLARED_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); + break; + case OPERATION_WARNING: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + break; + case RENEWAL_FUND: + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + } + + records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.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); + records.setProjectId(project.getId()); + records.setProjectCode(project.getProjectCode()); + records.setProjectStatus(project.getStatus()); + records.setNoticeType(noticeType); + records.setPath(path); + records.setBatchEmployees(batchEmployees); + records.setBiz(biz); + records.setNodeId(nodeId); + 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 timeout + * @return + */ + private String convertContent(String noticeContent, String projectName, Integer timeout) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{time}",String.valueOf(timeout)); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + private String convertAdventContent(String noticeContent, String projectName, Integer timeout,Integer overTimeOut) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{time}",String.valueOf(timeout)) + .replace("{time2}",String.valueOf((overTimeOut - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + + /** + * 转换出 通知的内容 + * @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 convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout,Integer overTimeOut) { + 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)) + .replace("{time2}",String.valueOf((overTimeOut - 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 convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout,Integer overTimeout) { + 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)) + .replace("{time2}",String.valueOf((overTimeout - 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; + } + + private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout,Integer overTimeout) { + 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)) + .replace("{time2}",String.valueOf((overTimeout - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java new file mode 100644 index 0000000..22c0574 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java @@ -0,0 +1,133 @@ +package com.hz.pm.api.sys.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.entity.MenuTreeEntity; +import com.hz.pm.api.common.util.TreeUtil; +import com.hz.pm.api.scheduler.contants.TaskContant; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.Menu; +import com.hz.pm.api.sys.model.vo.MenuRoleVO; +import com.hz.pm.api.sys.service.IMenuService; +import com.hz.pm.api.sys.service.IRegionService; +import com.wflow.bean.dto.WflowModelHistorysInsertDto; +import com.wflow.workflow.bean.process.ProcessNode; +import com.wflow.workflow.service.ProcessModelService; +import com.wflow.workflow.service.WflowFormsService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * MenuManage - 菜单管理业务层 + *

+ * + * @author WendyYang + * @since 14:23 2023/1/28 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class MenuManage { + + private final IMenuService menuService; + private final ProcessModelService processModelService; + private final RegionCacheHelper regionCacheHelper; + + public List buildUserMenu(List list) { + Set menuIds = new HashSet<>(); + List menuRoles = CollUtils.convert(list, w -> { + menuIds.add(w.getId()); + return BeanUtil.copyProperties(w, MenuRoleVO.class); + }); + List pidList = menuRoles.stream() + .map(MenuTreeEntity::getPid) + .filter(pid -> !menuIds.contains(pid) && pid != BizConst.PARENT_ID) + .collect(Collectors.toList()); + parentMenuCheck(pidList, menuRoles, menuIds); + return TreeUtil.buildUserTree(menuRoles); + } + + public void parentMenuCheck(List pidList, List menuRoles, Set menuIds) { + if (pidList.isEmpty()) { + return; + } + List menus = menuService.listByIds(pidList); + if (menus.isEmpty()) { + return; + } + Set tmpSet = new HashSet<>(); + menus.forEach(w -> { + menuIds.add(w.getId()); + tmpSet.add(w.getPid()); + menuRoles.add(BeanUtil.copyProperties(w, MenuRoleVO.class)); + }); + List tmpPidList = tmpSet.stream() + .filter(pid -> !menuIds.contains(pid) && pid != BizConst.PARENT_ID) + .collect(Collectors.toList()); + parentMenuCheck(tmpPidList, menuRoles, menuIds); + } + + public String init() { + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + + if(CollUtil.isEmpty(regions)){ + throw new BizException("丽水地区数据为空 任务结束!"); + } + + for(RegionDTO region : regions){ + log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); + + Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; + for(Integer processType : processTypeList){ + String formName = ProjectProcessStageEnum.getDesc(processType); + WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); + + models.setGroupId(1); + models.setProcessDefId("pd" + IdUtil.objectId()); + models.setFormName(formName); + models.setProcessType(processType); + models.setRegionCode(region.getRegionCode()); + String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; + ProcessNode processNode = JSON.parseObject(process,ProcessNode.class); + models.setProcess(processNode); + models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); + models.setFormItems("[]"); + + String formId = processModelService.insertProcess(models); + if(StringUtils.isNotBlank(formId)){ + //初始的流程在部署表也存一份,用来查询 + if(StringUtils.isNotBlank(processModelService.deployProcess(formId,null))){ + log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getRegionName(),formName); + }else{ + log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getRegionName(),formName); + } + }else{ + log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getRegionName(),formName); + } + } + } + + stopWatch.stop(); + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "初始化完成"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java new file mode 100644 index 0000000..3c2a026 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -0,0 +1,371 @@ +package com.hz.pm.api.sys.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +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.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.hz.pm.api.sys.enumeration.NoticePermissionsEnum; +import com.hz.pm.api.sys.enumeration.NoticeTypeEnum; +import com.hz.pm.api.sys.model.entity.Notice; +import com.hz.pm.api.sys.model.entity.Notify; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.req.NoticeListReq; +import com.hz.pm.api.sys.model.req.NoticeSaveReq; +import com.hz.pm.api.sys.model.req.NoticeStatusModifyReq; +import com.hz.pm.api.sys.model.vo.NoticeDetailVO; +import com.hz.pm.api.sys.model.vo.NoticeListItemVO; +import com.hz.pm.api.sys.service.INoticeService; +import com.hz.pm.api.sys.service.INotifyService; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.hz.pm.api.todocenter.model.dto.ProjectAuditMsgExtraDTO; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.service.IUserInfoService; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.runtime.ActivityInstance; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.AUDIT_WORK_TITLE; + +/** + *

+ * MsgManage + *

+ * + * @author WendyYang + * @since 21:30 2022/7/21 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class NoticeManage { + + private final INoticeService noticeService; + private final FileService fileService; + + private final IUserInfoService userInfoService; + + private final IDingEmployeeInfoService dingEmployeeInfoService; + + private final IDingOrganizationService dingOrganizationService; + + private final INotifyService notifyService; + + private final INdWorkNoticeStagingService workNoticeStagingService; + + private final RuntimeService runtimeService; + + private final UserInfoHelper userInfoHelper; + + @Transactional(rollbackFor = Exception.class) + public IdVo saveOrModify(NoticeSaveReq req) { + Notice notice = BeanUtil.copyProperties(req, Notice.class); + permissionsSave(notice,LoginUserUtil.loginUserDetail()); + noticeService.saveOrUpdate(notice); + return IdVo.of(notice.getId()); + } + + public NoticeDetailVO detail(Long id) { + Notice notice = noticeService.getById(id); + NoticeDetailVO detail = BeanUtil.copyProperties(notice, NoticeDetailVO.class); + List fileIds = BizUtils.splitToLong(notice.getAttachment()); + if (!fileIds.isEmpty()) { + List attachFiles = fileService.getByIds(fileIds); + detail.setAttachments(attachFiles); + } + return detail; + } + + public boolean changeEnabled(NoticeStatusModifyReq req) { + Notice notice = new Notice(); + notice.setId(req.getId()); + notice.setEnabled(req.getStatus()); + return noticeService.updateById(notice); + } + + public void topped(Long id) { + Notice notice = new Notice(); + notice.setId(id); + notice.setToppedTime(LocalDateTime.now()); + noticeService.updateById(notice); + } + + public PageVo dashboardList(Integer limit, Integer type) { + NoticeListReq req = new NoticeListReq(); + req.setPageSize(limit); + req.setEnabled(true); + req.setType(type); + return listByManagerByPermission(req); + } + + public PageVo listByManager(NoticeListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) + .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) + .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) + .eq(req.getType() != null, Notice::getType, req.getType()) + .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + permissionsWrapperByEdit(wrapper,user); + Page page = noticeService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO + .builder() + .id(w.getId()) + .type(w.getType()) + .title(w.getTitle()) + .enabled(w.getEnabled()) + .createOn(w.getCreateOn()) + .topped(w.getToppedTime() != null) + .build()); + return PageVo.of(tempDataList, page.getTotal()); + } + + public PageVo listByManagerByPermission(NoticeListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) + .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) + .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) + .eq(req.getType() != null, Notice::getType, req.getType()) + .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + permissionsWrapper(wrapper,user); + Page page = noticeService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO + .builder() + .id(w.getId()) + .type(w.getType()) + .title(w.getTitle()) + .enabled(w.getEnabled()) + .createOn(w.getCreateOn()) + .topped(w.getToppedTime() != null) + .build()); + return PageVo.of(tempDataList, page.getTotal()); + } + + public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) + .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) + .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) + .eq(req.getType() != null, Notice::getType, req.getType()) + .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + permissionsWrapper(wrapper,user); + List records = noticeService.list(wrapper); + return CollUtils.convert(records, w -> NoticeListItemVO + .builder() + .id(w.getId()) + .type(w.getType()) + .title(w.getTitle()) + .enabled(w.getEnabled()) + .createOn(w.getCreateOn()) + .topped(w.getToppedTime() != null) + .build()).stream().collect(Collectors.groupingBy(v -> NoticeTypeEnum.getNameByCode(v.getType()))); + } + + public void delNotice(Long id) { + noticeService.removeById(id); + } + + + /** + * 发送消息 + * @param employeeCode 员工号 + * @param userId 用户ID + * @param project 项目 + * @param procDefinitionName 流程定义名 + * @param template 消息模板内容 + * @param msgTypeEnum 枚举 + */ + public void sendNotice(String employeeCode, Long userId, Project project, String procDefinitionName, + String template, MsgTypeEnum msgTypeEnum){ + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); + String passMsg = String.format(template, project.getProjectName(), procDefinitionName); + passWorkNoticeInfo.setMsg(passMsg); + // 放入系统通知表中,保存记录 + Notify notify = assemblyAuditNotify(userId, project, passMsg); + notify.setType(msgTypeEnum.name()); + notifyService.save(notify); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); + } + + /** + * 获取发送浙政钉工作通知的信息 + * + * @param currentEmployeeCode + * @return com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo + * @author CMM + * @since 2023/02/15 14:04 + */ + public WorkNoticeInfo getSendWorkNoticeInfo(String currentEmployeeCode) { + UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode,currentEmployeeCode).last("limit 1")); + if (Objects.isNull(auditUserInfo)) { + throw new BizException("该用户不存在!"); + } + WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); + Long accountId = auditUserInfo.getAccountId(); + if (Objects.isNull(accountId)) { + throw new BizException("该用户没有录入浙政钉信息!"); + } + workNoticeInfo.setAccountId(accountId); + // 根据浙政钉用户ID获取部门code + DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getAccountId, accountId) + .eq(DingEmployeeInfo::getMainJob,String.valueOf(Boolean.TRUE)) + .last("limit 1")); + String organizationCode = employeeInfo.getOrganizationCode(); + workNoticeInfo.setOrganizationCode(organizationCode); + // 根据部门code获取部门名称 + DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, organizationCode)); + String organizationName = dingOrganization.getOrganizationName(); + workNoticeInfo.setOrganizationName(organizationName); + // 构建唯一的消息ID + String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE + + organizationName + accountId + StrUtil.UNDERLINE + System.currentTimeMillis(); + workNoticeInfo.setBizMsgId(bizMsgId); + String receiverUserId = String.valueOf(accountId); + workNoticeInfo.setReceiverUserId(receiverUserId); + return workNoticeInfo; + } + + /** + * 装配项目审核工作通知 + * @param userId + * @param project + * @param msg + */ + public Notify assemblyAuditNotify(Long userId, Project project, String msg) { + Notify notify = new Notify(); + notify.setTitle(AUDIT_WORK_TITLE); + notify.setUserId(userId); + notify.setContent(msg); + notify.setReaded(Boolean.FALSE); + notify.setCreateTime(LocalDateTime.now()); + ProjectAuditMsgExtraDTO msgExtraDto = new ProjectAuditMsgExtraDTO(); + msgExtraDto.setProjectId(project.getId()); + msgExtraDto.setInstanceId(project.getInstCode()); + String extraJson = JSON.toJSONString(msgExtraDto); + notify.setExtraInfo(extraJson); + return notify; + } + + /** + * 找寻第一个审核人 去发消息 + * @param project + * @param formName + * @param template + * @param msgTypeEnum + */ + public void sendFirtUser(Project project, String formName,String instanceId, String template, MsgTypeEnum msgTypeEnum) { + try { + List activityInstances = runtimeService.createActivityInstanceQuery() + .processInstanceId(instanceId) + .activityType("userTask") + .orderByActivityInstanceStartTime() + .asc() + .list(); + + for (ActivityInstance activityInstance : activityInstances) { + if(StringUtils.isNotBlank(activityInstance.getAssignee())){ + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(activityInstance.getAssignee()); + sendNotice(activityInstance.getAssignee(), user.getUserId(), project, formName, + template, msgTypeEnum); + } + } + }catch (Exception e){ + log.error("发送消息失败 :" + e); + } + + } + + /** + * 公告保存 权限控制 + * @param notice + * @param user + */ + private void permissionsSave(Notice notice, UserInfoDetails user) { + List userRoleList = user.getUserRoleList(); + if(CollUtil.isEmpty(userRoleList)){ + //默认 权限是单位 + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + return; + } + if(user.getSuperAdmin()){ + notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); + return; + }else if(user.getRegionAdmin()){ + notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); + notice.setPermissionsValue(user.getRegionCode()); + return; + }else if(user.getIsOrgAdmin()){ + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + return; + } + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + } + + /** + * 列表查询 权限体现 + * @param wrapper + */ + private void permissionsWrapper(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { + wrapper.and(q3 -> q3.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) + .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) + .eq(Notice::getPermissionsValue,user.getRegionCode())) + .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); + } + + private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { + //如果是超管 就能看所有 + if(user.getSuperAdmin()){ + log.info(user.getUsername() + ",超管可以看所有"); + }else if(user.getRegionAdmin()){ + wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) + .eq(Notice::getPermissionsValue,user.getRegionCode()); + }else if(user.getIsOrgAdmin()){ + wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()); + }else{ + wrapper.eq(Notice::getCreateOn,user.getUserId()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java new file mode 100644 index 0000000..1a22ab5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java @@ -0,0 +1,83 @@ +package com.hz.pm.api.sys.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.sys.model.entity.Notify; +import com.hz.pm.api.sys.model.req.NotifyListReq; +import com.hz.pm.api.sys.model.vo.NotifyVO; +import com.hz.pm.api.sys.service.INotifyService; +import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * NotifyManage + *

+ * + * @author ZPF + * @since 21:30 2023/03/21 + */ +@Component +@RequiredArgsConstructor +public class NotifyManage { + + private final INotifyService notifyService; + + public PageVo page(NotifyListReq notifyListReq) { + Long userId = LoginUserUtil.getUserId(); + Page page = notifyListReq.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notify.class) + .eq(Objects.nonNull(notifyListReq.getReaded()), Notify::getReaded, notifyListReq.getReaded()) + .eq(Notify::getUserId, userId) + .like(Objects.nonNull(notifyListReq.getTitle()), Notify::getTitle, notifyListReq.getTitle()) + .eq(Objects.nonNull(notifyListReq.getType()), Notify::getType, notifyListReq.getType()) + .orderByDesc(Notify::getCreateTime); + notifyService.page(page, wrapper); + if (page.getTotal() == 0L) { + return PageVo.empty(); + } + List list = page.getRecords().stream() + .map(n -> { + NotifyVO notifyVo = new NotifyVO(); + BeanUtil.copyProperties(n, notifyVo); + String extraInfo = n.getExtraInfo(); + if (StringUtils.isNotBlank(extraInfo)) { + JSONObject jsonObject = JSON.parseObject(extraInfo); + Long projectId = jsonObject.getLong(WorkNoticeConstant.PROJECT_ID); + String instanceId = jsonObject.getString(WorkNoticeConstant.INSTANCE_ID); + Long meetingId = jsonObject.getLong(WorkNoticeConstant.MEETING_ID); + notifyVo.setProjectId(projectId); + notifyVo.setInstanceId(instanceId); + notifyVo.setMeetingId(meetingId); + } + return notifyVo; + }) + .collect(Collectors.toList()); + return PageVo.of(list, page.getTotal()); + } + + public NotifyVO detail(Long id) { + Notify one = notifyService.getById(id); + return BeanUtil.copyProperties(one, NotifyVO.class); + } + + public Boolean read(Long id) { + Notify one = notifyService.getById(id); + VUtils.isTrue(Objects.isNull(one)).throwMessage("该通知不存在"); + one.setReaded(Boolean.TRUE); + return notifyService.updateById(one); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/ProcessStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/ProcessStatisticsManage.java new file mode 100644 index 0000000..d36a3d8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/ProcessStatisticsManage.java @@ -0,0 +1,120 @@ +package com.hz.pm.api.sys.manage; + +import cn.hutool.core.util.NumberUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.sys.model.vo.ProcessDetailStatVO; +import lombok.AllArgsConstructor; +import org.flowable.engine.HistoryService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * ProcessStatisticsManage + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Component +@AllArgsConstructor +public class ProcessStatisticsManage { + + private final HistoryService historyService; + private final IProjectInstService projectInstService; + + public ProcessDetailStatVO processStatDetail(TimeUnit unit, Integer instType) { + unitCheck(unit); + ProcessDetailStatVO detailStat = ProcessDetailStatVO.init(); + LambdaQueryWrapper modelQuery = Wrappers.lambdaQuery(ProjectInst.class) + .select(ProjectInst::getInstCode) + .eq(ProjectInst::getInstType, instType); + List projectInsts = projectInstService.list(modelQuery); + if (projectInsts.isEmpty()) { + return detailStat; + } + List instCodeList = CollUtils.fieldList(projectInsts, ProjectInst::getInstCode); + List instances = historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(new HashSet<>(instCodeList)) + .list(); + buildProcessDetailStat(unit, detailStat, instances); + return detailStat; + } + + private static void unitCheck(TimeUnit unit) { + if (!TimeUnit.DAYS.equals(unit) && !TimeUnit.HOURS.equals(unit)) { + throw BizException.wrap("仅支持以天和小时为单位的统计"); + } + } + + private static void buildProcessDetailStat(TimeUnit unit, ProcessDetailStatVO stat, + List instances) { + stat.setTotalInst(instances.size()); + LongSummaryStatistics statistics = instances.stream().filter(w -> { + boolean finished = w.getEndTime() != null; + if (finished) { + stat.incrFinished(); + } else { + stat.incrPending(); + } + return finished; + }).map(HistoricProcessInstance::getDurationInMillis) + .collect(Collectors.summarizingLong(Long::longValue)); + if (stat.getFinishedInst() != 0) { + long unitMillis = unit.toMillis(1); + stat.setAvgTime(NumberUtil.div(statistics.getAverage(), unitMillis, 1)); + stat.setMaxTime(NumberUtil.div(statistics.getMax(), unitMillis, 1)); + stat.setMinTime(NumberUtil.div(statistics.getMin(), unitMillis, 1)); + } + } + + public List processStatDetailList(TimeUnit unit) { + unitCheck(unit); + List projectInsts = projectInstService.list(); + if (projectInsts.isEmpty()) { + return Collections.emptyList(); + } + HashSet instCodes = new HashSet<>(); + Map> mapByInstType = projectInsts.stream() + .filter(w -> InstTypeEnum.getByCode(w.getInstType()) != null) + .collect(Collectors.groupingBy(w -> InstTypeEnum.getByCode(w.getInstType()), + Collectors.mapping(w -> { + instCodes.add(w.getInstCode()); + return w.getInstCode(); + }, Collectors.toList()))); + List instances = historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(new HashSet<>(instCodes)) + .list(); + List res = new ArrayList<>(); + for (Map.Entry> entry : mapByInstType.entrySet()) { + List currInstCodes = entry.getValue(); + List currInsts = new ArrayList<>(); + instances.removeIf(w -> { + boolean contains = currInstCodes.contains(w.getId()); + if (contains) { + currInsts.add(w); + } + return contains; + }); + ProcessDetailStatVO item = ProcessDetailStatVO.init(); + InstTypeEnum instType = entry.getKey(); + item.setInstType(instType.getCode()); + item.setInstTypeName(instType.getDesc()); + buildProcessDetailStat(unit, item, currInsts); + res.add(item); + } + res.sort(Comparator.comparing(ProcessDetailStatVO::getInstType)); + return res; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RegionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RegionManage.java new file mode 100644 index 0000000..43301b3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RegionManage.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.sys.manage; + +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.sys.model.vo.RegionTreeVO; +import com.hz.pm.api.sys.service.IRegionService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * RegionManage + *

+ * + * @author ZPF + * @since 10:39 2023/1/18 + */ +@Component +@RequiredArgsConstructor +public class RegionManage { + + private final IRegionService regionService; + private final RegionCacheHelper regionCache; + + public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { + return regionCache.getRegionTree(regionCode, regionLevel); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java new file mode 100644 index 0000000..d4a6464 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java @@ -0,0 +1,128 @@ +package com.hz.pm.api.sys.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.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.sys.model.dto.MenuDataScopeDTO; +import com.hz.pm.api.sys.model.entity.*; +import com.hz.pm.api.sys.model.req.RolePageReq; +import com.hz.pm.api.sys.model.vo.MenuRoleVO; +import com.hz.pm.api.sys.model.vo.RoleVO; +import com.hz.pm.api.sys.service.*; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 角色管理 + *

+ * + * @author WendyYang + * @since 12:01 2023/1/28 + */ +@Component +@RequiredArgsConstructor +public class RoleManage { + + private final IRoleService roleService; + private final IMenuService menuService; + private final IRoleMenuService roleMenuService; + private final IRoleMenuDatascopeService roleMenuDatascopeService; + + private final IUserRoleService iUserRoleService; + + private final IUserInfoService userInfoService; + + public PageVo queryList(RolePageReq rolePageReq) { + Page page = rolePageReq.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Role.class); + searchList(page, wrapper, rolePageReq); + List data = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, RoleVO.class)); + return PageVo.of(data, page.getTotal()); + } + + private void searchList(Page page, LambdaQueryWrapper wrapper, RolePageReq req) { + wrapper.like(StringUtils.isNotBlank(req.getName()), Role::getName, req.getName()) + .eq(req.getFixed() != null, Role::getFixed, req.getFixed()) + .orderByDesc(Role::getUpdateOn); + roleService.page(page, wrapper); + } + + + public void buildMenu(RoleVO query) { + //改成直接返回有权限的 + List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); + List roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class) + .eq(RoleMenu::getRoleId, query.getId())); + List menus = list.stream().map(menu -> { + for (RoleMenu roleMenu : roleMenus) { + if (roleMenu.getMenuId().equals(menu.getId())) { + return BeanUtil.copyProperties(menu, MenuRoleVO.class); + } + } + return null; + }).filter(Objects::nonNull).collect(Collectors.toList()); + query.setMenu(menus); + } + + public List getMenuDataScope(Long roleId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(RoleMenuDatascope.class) + .eq(RoleMenuDatascope::getRoleId, roleId); + List menuDataScopes = roleMenuDatascopeService.list(query); + return CollUtils.convert(menuDataScopes, w -> { + MenuDataScopeDTO dto = new MenuDataScopeDTO(); + dto.setDataScope(w.getDatascope()); + dto.setMenuId(w.getMenuId()); + return dto; + }); + } + + public List getUsersByRoleType(String roleType) { + Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getCode, roleType) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(regionRole)){ + return Collections.emptyList(); + } + List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getRoleId, regionRole.getId())); + if(CollUtil.isEmpty(userRoles)){ + return Collections.emptyList(); + } + List userIds = userRoles.stream().map(UserRole::getUserId) + .collect(Collectors.toList()); + return userInfoService.listByIds(userIds); + } + + public List getUsersByRoleType(String roleType,String regionCode) { + Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getCode, roleType) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(regionRole)){ + return Collections.emptyList(); + } + List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getRoleId, regionRole.getId())); + if(CollUtil.isEmpty(userRoles)){ + return Collections.emptyList(); + } + List userIds = userRoles.stream().map(UserRole::getUserId) + .collect(Collectors.toList()); + return userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getId,userIds) + .eq(UserInfo::getRegionCode,regionCode)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java new file mode 100644 index 0000000..6d15526 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java @@ -0,0 +1,161 @@ +package com.hz.pm.api.sys.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.ExpertInfoService; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; +import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; +import com.hz.pm.api.signature.entity.CompanySignature; +import com.hz.pm.api.signature.service.ICompanySignatureService; +import com.hz.pm.api.sys.contants.UserGuidanceContant; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.model.vo.UserGuidanceDetailVO; +import com.hz.pm.api.sys.model.vo.UserGuidanceVO; +import com.hz.pm.api.sys.service.IUserRoleService; +import com.hz.pm.api.user.entity.UserAuth; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.service.IUserAuthService; +import com.hz.pm.api.user.service.IUserInfoService; +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; +import java.util.stream.Collectors; + +/** + * @Classname UserGuidanceManage + * @Description + * @Date 2023/8/8 13:49 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class UserGuidanceManage { + + private final OrgProcdefService orgProcdefService; + + private final IUserInfoService userInfoService; + + private final IUserRoleService userRoleService; + + private final IUserAuthService userAuthService; + + private final ICompanySignatureService signatureService; + + private final IExpertUserFullInfoService expertUserFullInfoService; + + /** + * 查询用户引导 详情 + * @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 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; + } + + /** + * 删除重复用户 + * @param userId + * @return + */ + public String removeRepeat(Long userId) { + UserInfo user = userInfoService.getById(userId); + VUtils.isTrue(Objects.isNull(user)).throwMessage("该用户不存在 删除重复失败"); + List repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, user.getUsername()) + .ne(UserInfo::getId, userId) + .isNull(UserInfo::getAccountId)); + if(CollUtil.isNotEmpty(repeatUsers)){ + List repeatIds = repeatUsers.stream().map(UserInfo::getId).collect(Collectors.toList()); + userInfoService.removeBatchByIds(repeatIds); + userAuthService.remove(Wrappers.lambdaQuery(UserAuth.class) + .in(UserAuth::getUserId,repeatIds)); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class) + .in(UserRole::getUserId,repeatIds)); + for(Long repeatId : repeatIds){ + ExpertUserFullInfo expert = expertUserFullInfoService.getByUserId(repeatId); + expert.setUserId(userId); + expertUserFullInfoService.updateById(expert); + } + return "删除成功"; + } + return "不存在重复的用户"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/EarlyWarningRecordsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/EarlyWarningRecordsMapper.java new file mode 100644 index 0000000..5acbd11 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/EarlyWarningRecordsMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface EarlyWarningRecordsMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.java new file mode 100644 index 0000000..70d2a83 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Menu; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface MenuMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.xml new file mode 100644 index 0000000..df7690f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/MenuMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.java new file mode 100644 index 0000000..f1fdd5c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Notice; + +/** + *

+ * 系统通知 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-07-21 + */ +public interface NoticeMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.xml new file mode 100644 index 0000000..7d3abc2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NoticeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java new file mode 100644 index 0000000..96baca1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Notice; +import com.hz.pm.api.sys.model.entity.Notify; + +/** + *

+ * 通知 Mapper 接口 + *

+ * + * @author zpf + * @since 2023-03-21 + */ +public interface NotifyMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.xml new file mode 100644 index 0000000..c1206b8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ProjectEarlyWarningMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ProjectEarlyWarningMapper.java new file mode 100644 index 0000000..af937c7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ProjectEarlyWarningMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface ProjectEarlyWarningMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.java new file mode 100644 index 0000000..756efb4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Region; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ZPF + * @since 2023-1-18 + */ +public interface RegionMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.xml new file mode 100644 index 0000000..ab31020 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RegionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.java new file mode 100644 index 0000000..eac6cef --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Resource; +import com.hz.pm.api.sys.model.dto.ResourceQueryDTO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface ResourceMapper extends BaseMapper { + /** + * 查询 拥有的资源 + * + * @param resource 查询参数 + * @return 可用资源 + */ + List findVisibleResource(ResourceQueryDTO resource); + + /** + * 根据唯一索引 保存或修改资源 + * + * @param resource 资源 + * @return 操作条数 + */ + int saveOrUpdateUnique(Resource resource); + + /** + * 根据资源id查询菜单id + * + * @param resourceIdList 资源id + * @return 菜单id + */ + List findMenuIdByResourceId(@Param("resourceIdList") List resourceIdList); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.xml new file mode 100644 index 0000000..24ee784 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + id,created_by,create_time,updated_by,update_time, + code, name, menu_id, describe_, readonly_ + + + + + + + insert into nd_resource ( id, created_by, create_time, updated_by, update_time, + code, name, menu_id, describe_) + values (#{id,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},#{updateUser,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, + #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{menuId,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR} ) + ON DUPLICATE KEY UPDATE + name = #{name,jdbcType=VARCHAR}, + describe_ = #{describe,jdbcType=VARCHAR}, + updated_by = #{updateUser,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.java new file mode 100644 index 0000000..56d6e51 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.Role; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface RoleMapper extends BaseMapper { + /** + * 查询用户拥有的角色 + * + * @param userId 用户id + * @return 角色 + */ + List findRoleByUserId(@Param("userId") Long userId); + + /** + * 根据角色编码查询用户ID + * + * @param codes 角色编码 + * @return 用户id + */ + List findUserIdByCode(@Param("codes") String[] codes); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.xml new file mode 100644 index 0000000..0bff191 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.java new file mode 100644 index 0000000..6653d2c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.mapper; + +import com.hz.pm.api.sys.model.entity.RoleMenuDatascope; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 角色菜单数据权限关联表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-01-28 + */ +public interface RoleMenuDatascopeMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.xml new file mode 100644 index 0000000..91a0f77 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuDatascopeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.java new file mode 100644 index 0000000..73d5bae --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.RoleMenu; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +public interface RoleMenuMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.xml new file mode 100644 index 0000000..425dbf1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/RoleMenuMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.java new file mode 100644 index 0000000..478c83d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.sys.model.entity.UserRole; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface UserRoleMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.xml new file mode 100644 index 0000000..0d0e02c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/UserRoleMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java new file mode 100644 index 0000000..234a13a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java @@ -0,0 +1,13 @@ +package com.hz.pm.api.sys.model.dto; + +/** + *

+ * AbstractExtraDTO + *

+ * + * @author WendyYang + * @since 2023/4/12 + **/ +public abstract class AbstractMsgExtraDTO { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java new file mode 100644 index 0000000..84b5bdc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.sys.model.dto; + +/** + *

+ * MeetingReviewMsgExtraDTO + *

+ * + * @author WendyYang + * @since 2023/4/12 + **/ +public class MeetingReviewMsgExtraDTO extends AbstractMsgExtraDTO { + + private Long meetingId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuDataScopeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuDataScopeDTO.java new file mode 100644 index 0000000..b1e3735 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuDataScopeDTO.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MenuDataScopeDTO + *

+ * + * @author WendyYang + * @since 16:06 2023/1/28 + */ +@Data +public class MenuDataScopeDTO { + + @ApiModelProperty("菜单ID") + private Long menuId; + + @ApiModelProperty("数据权限") + private Integer dataScope; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuQueryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuQueryDTO.java new file mode 100644 index 0000000..ab85d08 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuQueryDTO.java @@ -0,0 +1,97 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuQueryDTO", description = "菜单") +public class MenuQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String title; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 权限 + */ + @ApiModelProperty(value = "权限") + private String permission; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java new file mode 100644 index 0000000..008e59e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java @@ -0,0 +1,99 @@ +package com.hz.pm.api.sys.model.dto; + +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author WendyYang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuSaveDTO", description = "菜单") +public class MenuSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + @NotEmpty(message = "标题不能为空") + private String title; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * 是否隐藏 0不隐藏 1隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; + + @ApiModelProperty("菜单类型") + @NotNull(message = "菜单类型不能为空") + private MenuTypeEnum menuType; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuUpdateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuUpdateDTO.java new file mode 100644 index 0000000..3237351 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuUpdateDTO.java @@ -0,0 +1,101 @@ +package com.hz.pm.api.sys.model.dto; + +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuUpdateDTO", description = "菜单") +public class MenuUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotNull(message = "请传id") + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String title; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private MenuTypeEnum menuType; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * 是否隐藏 0不隐藏 1隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionDTO.java new file mode 100644 index 0000000..aa96380 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionDTO.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.sys.model.dto; + +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:12 + */ +@Data +@Builder +public class RegionDTO { + + @Tolerate + public RegionDTO() { + } + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区名 + */ + private String regionName; + + /** + * 地区级别 + */ + private Integer regionLevel; + + /** + * 地区父级code 当parent_code 为 -1 时为顶级区域 + */ + private String parentCode; + + /** + * 唯一编码:regionCode##regionName##regionLevel + */ + private String unionCode; + + private Long id; + + private Boolean deleted; + + private String govUnit; + + private Long parentId; + + private String regionCodePath; + + public void unionCode() { + this.unionCode = String.format("%s##%s##%s", this.regionCode, this.regionName, this.regionLevel); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionTreeDTO.java new file mode 100644 index 0000000..595d797 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RegionTreeDTO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.sys.model.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:08 + */ +@Data +public class RegionTreeDTO { + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区名 + */ + private String name; + + /** + * 地区级别 + */ + private Integer level; + + /** + * 地区父级code 当parent_code 为 -1 时为顶级区域 + */ + private String parentCode; + + private String unionCode; + + private List children; + + private Long id; + + private String mapData; + + private Boolean deleted; + + private String govUnit; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceQueryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceQueryDTO.java new file mode 100644 index 0000000..941e8db --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceQueryDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.sys.model.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 资源 查询DTO + * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ApiModel(value = "ResourceQueryDTO", description = "资源查询") +public class ResourceQueryDTO { + + /** + * 父资源id, 用于查询按钮 + */ + @ApiModelProperty(value = "菜单id", notes = "指定菜单id") + private Long menuId; + /** + * 登录人用户id + */ + @ApiModelProperty(value = "指定用户id", notes = "指定用户id,前端不传则自动获取") + private Long userId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceSaveDTO.java new file mode 100644 index 0000000..9b5cd62 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceSaveDTO.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "ResourceSaveDTO", description = "资源") +public class ResourceSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + private String code; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + private String name; + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + private Long menuId; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + private String describe; + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + private Boolean readonly; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceUpdateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceUpdateDTO.java new file mode 100644 index 0000000..f8fb0b6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/ResourceUpdateDTO.java @@ -0,0 +1,68 @@ +package com.hz.pm.api.sys.model.dto; + +import com.baomidou.mybatisplus.core.conditions.update.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "ResourceUpdateDTO", description = "资源") +public class ResourceUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @NotNull(message = "id不能为空", groups = Update.class) + private Long id; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + private String code; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + private String name; + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + private Long menuId; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + private String describe; + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + private Boolean readonly; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleAuthoritySaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleAuthoritySaveDTO.java new file mode 100644 index 0000000..d8a4c91 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleAuthoritySaveDTO.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleAuthoritySaveDTO", description = "角色的资源") +public class RoleAuthoritySaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "资源ID") + private List menuIdList; + + /** + * 资源id + * #c_resource + */ + private List resourceIdList; + + /** + * 角色id + * #c_role + */ + @ApiModelProperty(value = "角色id") + @NotNull(message = "角色id不能为空") + private Long roleId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleQueryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleQueryDTO.java new file mode 100644 index 0000000..068cc10 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleQueryDTO.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleQueryDTO", description = "角色") +public class RoleQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "ID") + private Long id; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称") + private String name; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围") + private Integer dataScope; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleSaveDTO.java new file mode 100644 index 0000000..af7b440 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleSaveDTO.java @@ -0,0 +1,63 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleSaveDTO", description = "角色") +public class RoleSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 50, message = "名称长度不能超过50") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "管理角色ID") + private String manageRoleIds; + + /** + * 菜单id + */ + @ApiModelProperty(value = "菜单id") + private List menuIds; + + @ApiModelProperty("菜单数据权限") + private List menuDataScopeList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java new file mode 100644 index 0000000..15fecda --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.sys.model.dto; + +import com.baomidou.mybatisplus.core.conditions.update.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleUpdateDTO", description = "角色") +public class RoleUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @NotNull(message = "id不能为空", groups = Update.class) + private Long id; + + @ApiModelProperty(value = "名称") + @Size(max = 50, message = "名称长度不能超过30") + private String name; + + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + private String describe; + + @ApiModelProperty(value = "菜单id") + private List menuIds; + + @ApiModelProperty(value = "管理角色ID") + private String manageRoleIds; + + @ApiModelProperty("菜单数据权限") + private List menuDataScopeList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/UserRoleSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/UserRoleSaveDTO.java new file mode 100644 index 0000000..1d58ef0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/UserRoleSaveDTO.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.sys.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserRoleSaveDTO", description = "角色分配 账号角色绑定") +public class UserRoleSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + * #c_role + */ + @ApiModelProperty(value = "角色ID") + @NotNull(message = "请选择角色") + private Long roleId; + /** + * 用户ID + * #c_user + */ + @ApiModelProperty(value = "用户ID") + private List userIdList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/BaseEntity.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/BaseEntity.java new file mode 100644 index 0000000..19f846c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/BaseEntity.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 通用字段, is_del 根据需求自行添加 + *

+ * + * @author WendyYang + * @since 11:01 2023/1/28 + */ +@Getter +@Setter +public class BaseEntity implements Serializable { + + @ApiModelProperty("创建人userId") + @TableField(fill = FieldFill.INSERT) + protected Long createBy; + + @ApiModelProperty("最后修改人userId") + @TableField(fill = FieldFill.INSERT_UPDATE) + protected Long updateBy; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + protected LocalDateTime createOn; + + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + protected LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java new file mode 100644 index 0000000..a9b55b8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java @@ -0,0 +1,86 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.hz.pm.api.common.model.entity.MenuTreeEntity; +import com.hz.pm.api.sys.model.enumeration.DataScopeEnum; +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_menu") +@ApiModel(value = "Menu", description = "菜单") +@AllArgsConstructor +public class Menu extends MenuTreeEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "组件") + @Size(max = 255, message = "组件长度不能超过255") + @TableField(value = "component", condition = LIKE) + private String component; + + @ApiModelProperty(value = "菜单图标") + @Size(max = 255, message = "菜单图标长度不能超过255") + @TableField(value = "icon", condition = LIKE) + private String icon; + + @ApiModelProperty(value = "是否隐藏") + @TableField(value = "hidden") + private Integer hidden; + + @ApiModelProperty(value = "activeMenu") + @TableField(value = "active_menu") + private String activeMenu; + + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; + + @ApiModelProperty("是否有数据权限") + private Boolean hasDataScope; + + /** + * @see DataScopeEnum + */ + @ApiModelProperty("数据权限选项") + private String dataScopeOption; + + @ApiModelProperty("菜单类型") + private MenuTypeEnum menuType; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notice.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notice.java new file mode 100644 index 0000000..747bbc9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notice.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.sys.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 WendyYang + * @since 2022-07-21 + */ +@Data +@TableName("nd_notice") +@ApiModel(value = "SysNotice对象", description = "系统通知") +public class Notice implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("消息类型") + private Integer type; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("启用禁用") + private Boolean enabled; + + @ApiModelProperty("附件ID") + private String attachment; + + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @ApiModelProperty("创建人id") + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @ApiModelProperty("最后修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + @ApiModelProperty("是否删除") + @TableLogic + private Boolean deleted; + + @ApiModelProperty("置顶时间") + private LocalDateTime toppedTime; + + @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") + private Integer permissions; + + @ApiModelProperty("权限值") + private String permissionsValue; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notify.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notify.java new file mode 100644 index 0000000..5692e3e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Notify.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.sys.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-03-21 + */ +@Data +@TableName("nd_notifys") +@ApiModel(value = "消息通知", description = "消息通知") +public class Notify implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("消息类型") + private String type; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("是否已读") + private Boolean readed; + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("link") + private String link; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("其他业务信息") + private String extraInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/ProjectEarlyWarning.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/ProjectEarlyWarning.java new file mode 100644 index 0000000..890f84c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/ProjectEarlyWarning.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.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("nd_project_early_warning") +@ApiModel(value = "ProjectEarlyWarning", description = "项目预警") +public class ProjectEarlyWarning implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "项目编码") + private String projectCode; + + @ApiModelProperty(value = "区域") + private String areaCode; + + @ApiModelProperty(value = "建设单位CODE") + private String buildOrgCode; + + @ApiModelProperty(value = "预警状态") + private String status; + + @ApiModelProperty(value = "流程预警是否异常") + private Boolean processWarning; + @ApiModelProperty(value = "填报预警是否异常") + private Boolean declaredWarning; + @ApiModelProperty(value = "运维预警是否异常") + private Boolean operationWarning; + @ApiModelProperty(value = "续建资金预警是否异常") + private Boolean renewalFundWarning; + @ApiModelProperty(value = "是否正常") + private Boolean normal; + + @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") + private Integer ruleType; + @ApiModelProperty(value = "1超期 2临期") + private Integer noticeType; + + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Region.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Region.java new file mode 100644 index 0000000..90529ca --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Region.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * Region - 地域实体 + *

+ * + * @author WendyYang + * @since 10:33 2022/10/12 + */ +@Data +@TableName("nd_region") +public class Region implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String regionCode; + + private String regionName; + + private Integer regionLevel; + + private String govUnit; + + private String parentCode; + + private Long parentId; + + private String regionCodePath; + + private Boolean deleted; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Resource.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Resource.java new file mode 100644 index 0000000..0389619 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Resource.java @@ -0,0 +1,94 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("c_resource") +@ApiModel(value = "Resource", description = "资源") +@AllArgsConstructor +public class Resource extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + @TableField(value = "code", condition = LIKE) + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + @TableField("menu_id") + private Long menuId; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + @TableField(value = "describe_", condition = LIKE) + private String describe; + + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + @TableField("readonly_") + private Boolean readonly; + + + @Builder + public Resource(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, + String code, String name, Long menuId, String describe, Boolean readonly) { + this.id = id; + this.createBy = createdBy; + this.createOn = createTime; + this.updateBy = updatedBy; + this.updateOn = updateTime; + this.code = code; + this.name = name; + this.menuId = menuId; + this.describe = describe; + this.readonly = readonly; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Role.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Role.java new file mode 100644 index 0000000..3bd5356 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Role.java @@ -0,0 +1,50 @@ +package com.hz.pm.api.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.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_role") +@ApiModel(value = "Role", description = "角色") +@AllArgsConstructor +public class Role extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty("角色编码") + private String code; + + @ApiModelProperty("是否是内置角色") + private Boolean fixed; + + @ApiModelProperty(value = "描述") + private String describe; + + @ApiModelProperty(value = "管理角色ID") + private String manageRoleIds; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleAuthority.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleAuthority.java new file mode 100644 index 0000000..d7805cd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleAuthority.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.hz.pm.api.sys.model.enumeration.AuthorizeTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_role_authority") +@ApiModel(value = "RoleAuthority", description = "角色的资源") +@AllArgsConstructor +public class RoleAuthority extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 资源id + */ + @ApiModelProperty(value = "资源id") + @NotNull(message = "资源id不能为空") + @TableField("authority_id") + private Long authorityId; + + /** + * 权限类型 + * #AuthorizeType{MENU:菜单;RESOURCE:资源;} + */ + @ApiModelProperty(value = "权限类型") + @NotNull(message = "权限类型不能为空") + @TableField("authority_type") + private AuthorizeTypeEnum authorityType; + + /** + * 角色id + * #c_role + */ + @ApiModelProperty(value = "角色id") + @NotNull(message = "角色id不能为空") + @TableField("role_id") + private Long roleId; + + + @Builder + public RoleAuthority(Long id, LocalDateTime createTime, Long createdBy, + Long authorityId, AuthorizeTypeEnum authorityType, Long roleId) { + this.id = id; + this.createOn = createTime; + this.createBy = createdBy; + this.authorityId = authorityId; + this.authorityType = authorityType; + this.roleId = roleId; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenu.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenu.java new file mode 100644 index 0000000..b954d60 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenu.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +@TableName("nd_role_menu") +@Data +@ApiModel(value = "RoleMenu对象") +@AllArgsConstructor +@NoArgsConstructor +public class RoleMenu implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("menu_id") + private Long menuId; + + @ApiModelProperty("role_id") + private Long roleId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenuDatascope.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenuDatascope.java new file mode 100644 index 0000000..b087972 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/RoleMenuDatascope.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.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; + +/** + *

+ * 角色菜单数据权限关联表 + *

+ * + * @author WendyYang + * @since 2023-01-28 + */ +@Data +@TableName("nd_role_menu_datascope") +@ApiModel(value = "NdRoleMenuDatascope对象", description = "角色菜单数据权限关联表") +public class RoleMenuDatascope extends BaseEntity { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("角色ID") + private Long roleId; + + @ApiModelProperty("菜单ID") + private Long menuId; + + @ApiModelProperty("数据权限") + private Integer datascope; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/UserRole.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/UserRole.java new file mode 100644 index 0000000..0e31718 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/UserRole.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.sys.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@TableName("nd_user_role") +@ApiModel(value = "UserRole", description = "角色分配") +public class UserRole implements Serializable { + + private static final long serialVersionUID = 2210188203287234336L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID") + @NotNull(message = "角色ID不能为空") + @TableField("role_id") + private Long roleId; + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + @NotNull(message = "用户ID不能为空") + @TableField("user_id") + private Long userId; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @Builder + public UserRole(Long roleId, Long userId) { + this.roleId = roleId; + this.userId = userId; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java new file mode 100644 index 0000000..bea2507 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java @@ -0,0 +1,130 @@ +package com.hz.pm.api.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 projectCode; + @ApiModelProperty(value = "建设单位") + private String buildOrgCode; + @ApiModelProperty(value = "项目id") + private Long projectId; + @ApiModelProperty(value = "项目名称") + private String projectName; + @ApiModelProperty(value = "项目当时的状态") + private Integer projectStatus; + + /** + * 流程类型 + */ + @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 = "1超期 2临期") + private Integer noticeType; + + @ApiModelProperty(value = "申报单位") + private String buildOrgName; + + /** + * 规则 + */ + @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") + private Integer ruleType; + + @ApiModelProperty(value = "业务biz") + private Integer biz; + + @ApiModelProperty(value = "路径") + private String path; + + @ApiModelProperty(value = "审批节点ID") + private String nodeId; + + @ApiModelProperty(value = "这一批要通知的员工号") + private String batchEmployees; + + @ApiModelProperty(value = "临期时要记录下 超期的时间") + private Integer overTime; + + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/AuthorizeTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/AuthorizeTypeEnum.java new file mode 100644 index 0000000..753298c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/AuthorizeTypeEnum.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.sys.model.enumeration; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.stream.Stream; + +/** + *

+ * 实体注释中生成的类型枚举 + * 角色的资源 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AuthorizeType", description = "权限类型-枚举") +public enum AuthorizeTypeEnum { + + /** + * MENU="菜单" + */ + MENU("菜单"), + DATA("数据"), + /** + * RESOURCE="资源" + */ + RESOURCE("资源"); + + @ApiModelProperty(value = "描述") + private String desc; + + + /** + * 根据当前枚举的name匹配 + */ + public static AuthorizeTypeEnum match(String val, AuthorizeTypeEnum def) { + return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); + } + + public static AuthorizeTypeEnum get(String val) { + return match(val, null); + } + + public boolean eq(AuthorizeTypeEnum val) { + return val != null && getCode().equals(val.name()); + } + + @ApiModelProperty(value = "编码", allowableValues = "MENU,RESOURCE", example = "MENU") + public String getCode() { + return this.name(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/DataScopeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/DataScopeEnum.java new file mode 100644 index 0000000..0a3eb03 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/DataScopeEnum.java @@ -0,0 +1,52 @@ +package com.hz.pm.api.sys.model.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * 数据权限可见范围枚举 + *

+ * + * @author WendyYang + * @since 15:59 2023/1/28 + */ +@Getter +public enum DataScopeEnum { + + /** + * 数据权限可见范围 + */ + CURRENT_ORG("本单位", 1), + CURRENT_AND_SUB_ORG("本单位及下属单位", 2), + CURRENT_REGION("当前区域", 3), + CURRENT_CITY("全市", 4); + + private final String desc; + private final Integer code; + + DataScopeEnum(String desc, Integer code) { + this.code = code; + this.desc = desc; + } + + public boolean eq(Integer code) { + return this.code.equals(code); + } + + /** + * 根据code获取枚举实例 + * + * @param code 编码 + * @return {@link DataScopeEnum} + * @author WendyYang + **/ + public static DataScopeEnum getByCode(Integer code) { + return Arrays.stream(values()) + .filter(w -> w.eq(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的数据权限可见范围编码")); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/MenuTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/MenuTypeEnum.java new file mode 100644 index 0000000..864e88d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/enumeration/MenuTypeEnum.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.sys.model.enumeration; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 资源类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "MenuTypeEnum", description = "资源类型-枚举") +public enum MenuTypeEnum { + /** + * 菜单 + */ + MENU(0, "菜单"), + + /** + * 按钮 + */ + BUTTON(1, "按钮"); + + /** + * 资源类型 + */ + private Integer code; + + /** + * 资源描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @ApiModelProperty(value = "编码", allowableValues = "0,1", example = "0") + public Integer getCode() { + return this.code; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeListReq.java new file mode 100644 index 0000000..95fdbd0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeListReq.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.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; + +/** + *

+ * NoticeListReq + *

+ * + * @author WendyYang + * @since 00:32 2022/7/23 + */ +@Data +@ApiModel("公告查询参数类") +@EqualsAndHashCode(callSuper = true) +public class NoticeListReq extends PagePo { + + @ApiModelProperty("消息类型") + private Integer type; + + @ApiModelProperty("公告标题") + private String title; + + @ApiModelProperty("公告状态") + private Boolean enabled; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeSaveReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeSaveReq.java new file mode 100644 index 0000000..3ce3471 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeSaveReq.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sys.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * MsgUpdatePo + *

+ * + * @author WendyYang + * @since 21:35 2022/7/21 + */ +@Data +@ApiModel("消息新增实体") +public class NoticeSaveReq { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("通知标题") + @NotBlank(message = "通知标题不能为空") + private String title; + + @ApiModelProperty("通知类型") + @NotNull(message = "通知类型不能为空") + private Integer type; + + @ApiModelProperty("通知内容") + @NotBlank(message = "通知内容不能为空") + private String content; + + @ApiModelProperty("附件ID编码") + private String attachment; + + @ApiModelProperty("是否启用") + @NotNull(message = "是否启用不能为空") + private Boolean enabled; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeStatusModifyReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeStatusModifyReq.java new file mode 100644 index 0000000..b15b1ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NoticeStatusModifyReq.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.sys.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * NoticeStatusUpdatePo + *

+ * + * @author WendyYang + * @since 22:32 2022/7/22 + */ +@Data +@ApiModel("消息状态修改") +public class NoticeStatusModifyReq { + + @ApiModelProperty("ID") + @NotNull(message = "ID不能为空") + private Long id; + + @ApiModelProperty("状态:true 启用、false 停用") + @NotNull(message = "状态不能为空") + private Boolean status; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NotifyListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NotifyListReq.java new file mode 100644 index 0000000..17ca78c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/NotifyListReq.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.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; + +/** + *

+ * NoticeListReq + *

+ * + * @author zpf + * @since 00:32 2023/3/23 + */ +@Data +@ApiModel("通知查询参数类") +@EqualsAndHashCode(callSuper = true) +public class NotifyListReq extends PagePo { + + @ApiModelProperty("是否已读") + private Boolean readed; + + @ApiModelProperty("公告标题") + private String title; + + @ApiModelProperty("类型") + private String type; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/RolePageReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/RolePageReq.java new file mode 100644 index 0000000..a37534d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/RolePageReq.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.sys.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RolePageQuery", description = "角色") +public class RolePageReq extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty("是否是内置角色") + private Boolean fixed; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/WarningListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/WarningListReq.java new file mode 100644 index 0000000..4c68cd4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/req/WarningListReq.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.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("申报单位code") + private String buildOrgCode; + + @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/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuResourceTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuResourceTreeVO.java new file mode 100644 index 0000000..d0788ff --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuResourceTreeVO.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.sys.model.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.hz.pm.api.sys.model.enumeration.AuthorizeTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.Size; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * menuList + * 菜单资源树 + * + * @author PoffyZhang + */ +@Data +@ToString(callSuper = true) +public class MenuResourceTreeVO { + + private AuthorizeTypeEnum type; + private String code; + private String icon; + private Boolean isDef; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + @TableField(value = "describe_", condition = LIKE) + private String describe; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java new file mode 100644 index 0000000..c1c6014 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.sys.model.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.hz.pm.api.common.model.entity.MenuTreeEntity; +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "RoleMenuVO", description = "菜单") +@AllArgsConstructor +public class MenuRoleVO extends MenuTreeEntity { + + private static final long serialVersionUID = 1L; + + /** + * 类型;[0-菜单 1-目录 2-按钮] + */ + @ApiModelProperty(value = "类型") + private MenuTypeEnum menuType; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + private String icon; + + /** + * 是否隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * 是否有权限 + */ + @ApiModelProperty(value = "是否有权限 0没有 1有") + private Integer hasPermission = 0; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuVO.java new file mode 100644 index 0000000..fcd1cdf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuVO.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.sys.model.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "MenuVO", description = "菜单") +@AllArgsConstructor +@Builder +public class MenuVO { + + private static final long serialVersionUID = 1L; + + /** + * 权限" + */ + @ApiModelProperty(value = "权限") + private String permission; + /** + * 类型;[0-菜单 1按钮] + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + private String icon; + + /** + * 子菜单数目 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeDetailVO.java new file mode 100644 index 0000000..4dfc9b0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeDetailVO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.sys.model.vo; + +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * NoticeDetailVo + *

+ * + * @author WendyYang + * @since 16:56 2022/7/22 + */ +@Data +@ApiModel("公告详情") +public class NoticeDetailVO { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("状态") + private Boolean enabled; + + @ApiModelProperty("公告类型") + private Integer type; + + @ApiModelProperty("附件信息") + private List attachments; + + @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") + private Integer permissions; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeListItemVO.java new file mode 100644 index 0000000..39aff82 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NoticeListItemVO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.sys.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.time.LocalDateTime; + +/** + *

+ * ManageNoticeListItem + *

+ * + * @author WendyYang + * @since 00:30 2022/7/23 + */ +@Data +@Builder +public class NoticeListItemVO { + + @Tolerate + public NoticeListItemVO() { + } + + @ApiModelProperty("公告ID") + private Long id; + + @ApiModelProperty("公告类型") + private Integer type; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("是否启用") + private Boolean enabled; + + @ApiModelProperty("是否置顶") + private Boolean topped; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NotifyVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NotifyVO.java new file mode 100644 index 0000000..bf4d857 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/NotifyVO.java @@ -0,0 +1,69 @@ +package com.hz.pm.api.sys.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * 通知 + *

+ * + * @author zpf + * @since 2023-03-21 + */ +@Data +@ApiModel(value = "消息通知VO", description = "消息通知") +public class NotifyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("消息类型") + private String type; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("实例id") + private String instanceId; + + @ApiModelProperty("是否已读") + private Boolean readed; + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("link") + private String link; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("会议ID") + private Long meetingId; + + public String getTypeName(){ + if(Objects.nonNull(this.type)){ + return MsgTypeEnum.getDescByName(this.type); + } + return StringUtils.EMPTY; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProcessDetailStatVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProcessDetailStatVO.java new file mode 100644 index 0000000..c9a5ed2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProcessDetailStatVO.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.sys.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.concurrent.TimeUnit; + +/** + *

+ * ProcessDetailStatVO + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Data +public class ProcessDetailStatVO { + + private Integer instType; + + private String instTypeName; + + @ApiModelProperty("流程实例总数") + private Integer totalInst; + + @ApiModelProperty("已完成流程实例数") + private Integer finishedInst; + + @ApiModelProperty("已完成流程实例数") + private Integer pendingInst; + + @ApiModelProperty("平均耗时") + private double avgTime; + + @ApiModelProperty("最长耗时") + private double maxTime; + + @ApiModelProperty("最短耗时") + private double minTime; + + @ApiModelProperty("时间单位") + private TimeUnit timeUnit; + + public static ProcessDetailStatVO init() { + ProcessDetailStatVO stat = new ProcessDetailStatVO(); + stat.setFinishedInst(0); + stat.setTotalInst(0); + stat.setPendingInst(0); + return stat; + } + + public void incrPending() { + this.pendingInst += 1; + } + + public void incrFinished() { + this.finishedInst += 1; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java new file mode 100644 index 0000000..c88de44 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java @@ -0,0 +1,88 @@ +package com.hz.pm.api.sys.model.vo; + +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("nd_project_early_warning") +@ApiModel(value = "ProjectEarlyWarning", description = "项目预警") +public class ProjectEarlyWarningVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "项目编码") + private String projectCode; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "区域") + private String areaCode; + + @ApiModelProperty(value = "建设单位CODE") + private String buildOrgCode; + + @ApiModelProperty(value = "预警状态") + private String status; + + @ApiModelProperty(value = "流程预警是否异常") + private Boolean processWarning; + @ApiModelProperty(value = "填报预警是否异常") + private Boolean declaredWarning; + @ApiModelProperty(value = "运维预警是否异常") + private Boolean operationWarning; + @ApiModelProperty(value = "续建资金预警是否异常") + private Boolean renewalFundWarning; + @ApiModelProperty(value = "是否正常") + private Boolean normal; + + @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") + private Integer ruleType; + @ApiModelProperty(value = "1超期 2临期") + private Integer noticeType; + + /** + * 最新的一条预警记录 + */ + @ApiModelProperty(value = "预警ID") + private Long recordId; + @ApiModelProperty(value = "预警员工号") + private String warningEmployeecode; + @ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔") + private String noticeMethod; + @ApiModelProperty(value = "通知内容") + private String noticeContent; + @ApiModelProperty(value = "任务开始时间") + private LocalDateTime instStart; + @ApiModelProperty(value = "预警时间") + private LocalDateTime warningTime; + @ApiModelProperty(value = "路径") + private String path; + @ApiModelProperty(value = "这一批要通知的员工号") + private String batchEmployees; + + + private LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RegionTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RegionTreeVO.java new file mode 100644 index 0000000..a849ecf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RegionTreeVO.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.sys.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * RegionTreeVO + *

+ * + * @author WendyYang + * @since 10:35 2022/10/12 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "RegionTreeVO", description = "区域树状结构VO") +public class RegionTreeVO { + + private Long id; + + @ApiModelProperty("区域码") + @NotBlank(message = "地区编码不能为空") + private String regionCode; + + @ApiModelProperty("地区名") + @NotBlank(message = "地区名称不能为空") + private String name; + + @ApiModelProperty("级别") + @NotNull(message = "级别不能为空") + private Integer regionLevel; + + @ApiModelProperty("区域级别") + @NotBlank(message = "区域级别不能为空") + private String govUnit; + + @ApiModelProperty("地区父级编码:-1为顶级区域") + @NotBlank(message = "地区父级编码不能为空") + private String parentCode; + + @ApiModelProperty("子区域") + private List children; + + @ApiModelProperty("唯一编码:regionCode##name##level") + private String unionCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleUserSaveVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleUserSaveVO.java new file mode 100644 index 0000000..070e87c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleUserSaveVO.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.sys.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色下的员工 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleUserSaveVO", description = "给角色分配员工") +public class RoleUserSaveVO implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "绑定或取消") + @NotNull(message = "请填写绑定或取消参数") + private Boolean flag; + /** + * 角色;#c_role + */ + @ApiModelProperty(value = "角色") + @NotNull(message = "请选择角色") + private Long roleId; + /** + * 用户;#c_user + */ + @ApiModelProperty(value = "用户") + @Size(min = 1, message = "请选择用户") + private List userIdList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleVO.java new file mode 100644 index 0000000..e6c01fb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/RoleVO.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.sys.model.vo; + +import com.hz.pm.api.sys.model.dto.MenuDataScopeDTO; +import com.hz.pm.api.sys.model.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "Role", description = "角色") +@AllArgsConstructor +@Builder +public class RoleVO extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty("管理角色ID") + private List manageRoleIdList; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + @ApiModelProperty("是否是内置角色:true 是、false 否") + private Boolean fixed; + + @ApiModelProperty("菜单数据权限") + private List menuDataScopeList; + + /** + * 菜单 + */ + @ApiModelProperty(value = "菜单") + private List menu; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceDetailVO.java new file mode 100644 index 0000000..cd74150 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceDetailVO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java new file mode 100644 index 0000000..974721f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java new file mode 100644 index 0000000..41110dd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java @@ -0,0 +1,157 @@ +package com.hz.pm.api.sys.model.vo; + +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.enumeration.WarningFlowTypeEnum; +import com.hz.pm.api.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 = "1超期 2临期") + private Integer noticeType; + + + /** + * 申报单位 + */ + @ApiModelProperty(value = "申报单位CODE") + private String buildOrgCode; + @ApiModelProperty(value = "申报单位") + private String buildOrgName; + + /** + * 规则 + */ + @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督4.续建") + private Integer ruleType; + + @ApiModelProperty(value = "路径") + private String path; + @ApiModelProperty(value = "这一批要通知的员工号") + private String batchEmployees; + + private LocalDateTime createOn; + private String createBy; + private LocalDateTime updateOn; + private String updateBy; + @ApiModelProperty(value = "业务biz") + private Integer biz; + @ApiModelProperty(value = "临期时要记录下 超期的时间") + private Integer overTime; + + 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/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IEarlyWarningRecordsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IEarlyWarningRecordsService.java new file mode 100644 index 0000000..05c6a85 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IEarlyWarningRecordsService.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.model.req.WarningListReq; +import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; + +/** + * @author PoffyZhang + */ +public interface IEarlyWarningRecordsService extends IService { + + PageVo records(Integer ruleType, WarningListReq req); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IMenuService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IMenuService.java new file mode 100644 index 0000000..b1c997b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IMenuService.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.entity.Menu; +import com.hz.pm.api.sys.model.dto.MenuSaveDTO; +import com.hz.pm.api.sys.model.dto.MenuUpdateDTO; + +import java.util.List; + +/** + *

+ * 业务接口 + * 菜单 + *

+ * + * @author WendyYang + * @since 2022-09-30 + */ +public interface IMenuService extends IService { + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 修改菜单 + * + * @param menu 菜单 + * @param userId / + * @return 是否成功 + */ + boolean update(MenuUpdateDTO menu, Long userId); + + /** + * 保存菜单 + * + * @param menu 菜单 + * @param userId / + * @return 是否成功 + */ + boolean save(MenuSaveDTO menu, Long userId); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INoticeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INoticeService.java new file mode 100644 index 0000000..a99ee7f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INoticeService.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.entity.Notice; + +/** + *

+ * 系统通知 服务类 + *

+ * + * @author WendyYang + * @since 2022-07-21 + */ +public interface INoticeService extends IService { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INotifyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INotifyService.java new file mode 100644 index 0000000..cdd4bec --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/INotifyService.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.entity.Notify; + +/** + *

+ * 系统通知 服务类 + *

+ * + * @author zpf + * @since 2023-03-21 + */ +public interface INotifyService extends IService { + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IProjectEarlyWarningService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IProjectEarlyWarningService.java new file mode 100644 index 0000000..a02ebab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IProjectEarlyWarningService.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; + +import java.util.List; + +/** + * @author PoffyZhang + */ +public interface IProjectEarlyWarningService extends IService { + + Boolean earlyWarning(Project project, Integer ruleType, Integer noticeType); + + Boolean earlyWarning(Project project, Integer ruleType, List noticeTypes); + + Boolean earlyWarning(String projectCode, Integer code, List noticeTypes); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRegionService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRegionService.java new file mode 100644 index 0000000..d65cd2f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRegionService.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.Region; + +import java.util.List; + +/** + *

+ * 地域管理 服务类 + *

+ * + * @author zpf + * @since 2023-1-18 + */ +public interface IRegionService extends IService { + + /** + * 查询所有区域 + * + * @return 所有区域 + */ + List all(); + + /** + * 查询区域 + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return {@link Region} + */ + Region getOne(String regionCode, int regionLevel); + + /** + * 查询大于等与该级别的所有区域 + * + * @param regionLevel + * @return 区域集合 + */ + List listGeLevel(int regionLevel); + + /** + * 是否为父节点 + * + * @param regionId 区域ID + * @return boolean + **/ + boolean isParentRegion(Long regionId); + + /** + * 获取当前区域的本级 + * + * @param parentId 区域ID + * @param regionCode 区域code + * @return 区域ID + **/ + Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuDatascopeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuDatascopeService.java new file mode 100644 index 0000000..4afddd4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuDatascopeService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.service; + +import com.hz.pm.api.sys.model.entity.RoleMenuDatascope; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 角色菜单数据权限关联表 服务类 + *

+ * + * @author WendyYang + * @since 2023-01-28 + */ +public interface IRoleMenuDatascopeService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuService.java new file mode 100644 index 0000000..cf11b34 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleMenuService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.entity.RoleMenu; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +public interface IRoleMenuService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java new file mode 100644 index 0000000..aa2dbf1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.dto.RoleSaveDTO; +import com.hz.pm.api.sys.model.dto.RoleUpdateDTO; + +import java.util.List; + +/** + *

+ * 业务接口 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface IRoleService extends IService { + + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 查询用户拥有的角色 + * + * @param userId 用户id + * @return 角色 + */ + List findRoleByUserId(Long userId); + + /** + * 保存角色 + * + * @param data 角色 + * @param userId 用户id + */ + void saveRole(RoleSaveDTO data, Long userId); + + /** + * 修改 + * + * @param role 角色 + * @param userId 用户id + */ + void updateRole(RoleUpdateDTO role, Long userId); + + /** + * 根据角色编码查询用户ID + * + * @param codes 角色编码 + * @return 用户id + */ + List findUserIdByCode(String[] codes); + + /** + * 检测角色名重复 + * + * @param name / + * @return 存在返回真 + */ + Boolean check(String name); + + /** + * 校验角色名 + * + * @param name / + * @param id / + * @return boolean + */ + Boolean check(String name, Long id); + + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java new file mode 100644 index 0000000..2ee9867 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.sys.model.entity.UserRole; + +import java.util.List; + +/** + *

+ * 业务接口 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +public interface IUserRoleService extends IService { + /** + * 初始化超级管理员角色 权限 + * + * @param userId 用户id + * @return 是否正确 + */ + boolean initAdmin(Long userId); + + /** + * 查询角色关联的用户ID + * + * @param roleId 角色ID + * @return 用户ID集合 + * @author WendyYang + **/ + List listUserIdByRoleId(Long roleId); + + default UserRole getOne(Long userId, Long roleId) { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId) + .eq(UserRole::getRoleId, roleId) + .last(BizConst.LIMIT_1); + return getOne(eq); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/EarlyWarningRecordsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/EarlyWarningRecordsServiceImpl.java new file mode 100644 index 0000000..637c7c6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/EarlyWarningRecordsServiceImpl.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.sys.service.impl; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.sys.mapper.EarlyWarningRecordsMapper; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.model.req.WarningListReq; +import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; +import com.hz.pm.api.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()) + .eq(StringUtils.isNotBlank(req.getBuildOrgCode()), WflowEarlyWarningRecords::getBuildOrgCode, req.getBuildOrgCode()) + .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(CollUtil.isEmpty(page.getRecords())){ + 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/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/MenuServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..f78e1da --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/MenuServiceImpl.java @@ -0,0 +1,166 @@ +package com.hz.pm.api.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.ValidatorUtil; +import com.hz.pm.api.common.constant.DefValConst; +import com.hz.pm.api.sys.mapper.MenuMapper; +import com.hz.pm.api.sys.model.dto.MenuSaveDTO; +import com.hz.pm.api.sys.model.dto.MenuUpdateDTO; +import com.hz.pm.api.sys.model.entity.Menu; +import com.hz.pm.api.sys.model.enumeration.MenuTypeEnum; +import com.hz.pm.api.sys.service.IMenuService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.ningdatech.basic.util.StrPool.DEF_PARENT_ID; + + +/** + *

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

+ * + * @author WendyYang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class MenuServiceImpl extends ServiceImpl implements IMenuService { + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + + List lastIds = Lists.newArrayList(); + lastIds.addAll(ids); + + //子菜单id + subMenus(ids, lastIds); + + return this.removeByIds(lastIds); + } + + private void subMenus(List ids, List lastIds) { + if (CollUtil.isEmpty(ids)) { + return; + } + ids.forEach(id -> { + List subMenus = list(Wrappers.lambdaQuery(Menu.class).eq(Menu::getPid, id)); + if (CollUtil.isNotEmpty(subMenus)) { + //添加子菜单ID + List subIds = subMenus.stream().map(Menu::getId).collect(Collectors.toList()); + lastIds.addAll(subIds); + //递归 + subMenus(subIds, lastIds); + } + }); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean update(MenuUpdateDTO data, Long userId) { + if (MenuTypeEnum.MENU.equals(data.getMenuType())) { + if (StrUtil.isBlank(data.getPath())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空"); + } + if (StrUtil.isBlank(data.getComponent())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【页面路径】不能为空"); + } + if (!ValidatorUtil.isUrl(data.getPath())) { + if (checkPath(data.getId(), data.getPath())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】:{}重复", data.getPath()); + } + } + } + Menu old = getById(data); + if (Objects.isNull(old)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "您修改的菜单已不存在"); + } + Menu menu = BeanUtil.toBean(data, Menu.class); + menu.setUpdateBy(userId); + return this.updateById(menu); + } + + public Boolean checkPath(Long id, String path) { + return baseMapper.selectCount(Wrappers.lambdaQuery(Menu.class).ne(Menu::getId, id).eq(Menu::getPath, path)) > 0; + } + + public Boolean checkTitle(Long id, String title) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Menu.class) + .ne(Menu::getId, id).eq(Menu::getTitle, title); + return baseMapper.selectCount(wrapper) > 0; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean save(MenuSaveDTO data, Long userId) { + data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); + if (data.getMenuType().equals(MenuTypeEnum.MENU)) { + if (StrUtil.isBlank(data.getPath())) { + throw BizException.wrap("【地址栏路径】不能为空"); + } + if (StrUtil.isBlank(data.getComponent())) { + throw BizException.wrap("【页面路径】不能为空"); + } + if (!ValidatorUtil.isUrl(data.getPath())) { + if (checkPath(null, data.getPath())) { + throw BizException.wrap("【地址栏路径】:{}重复", data.getPath()); + } + } + } + data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); + Menu menu = BeanUtil.toBean(data, Menu.class); + menu.setCreateBy(userId); + menu.setUpdateBy(userId); + save(menu); + return Boolean.TRUE; + } + + private void checkButtonUnique(Long pid, String path, Long menuId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Menu.class) + .eq(Menu::getPid, pid).eq(Menu::getPath, path) + .ne(menuId != null, Menu::getId, menuId); + if (count(query) > 1) { + throw BizException.wrap("【按钮路径】:{}重复", path); + } + } + + public List findChildrenByParentId(Long pid) { + if (Objects.isNull(pid)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空"); + } + return list(Wrappers.lambdaQuery(Menu.class).in(Menu::getPid, pid).orderByAsc(Menu::getSort)); + } + + private void fill(Menu resource) { + if (resource.getPid() == null || resource.getPid() <= 0) { + resource.setPid(DefValConst.PARENT_ID); + } else { + Menu parent = getById(resource.getPid()); + if (Objects.isNull(parent)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "请正确填写父级"); + } + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NoticeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NoticeServiceImpl.java new file mode 100644 index 0000000..5d2b9bb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NoticeServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.sys.model.entity.Notice; +import com.hz.pm.api.sys.mapper.NoticeMapper; +import com.hz.pm.api.sys.service.INoticeService; +import org.springframework.stereotype.Service; + +/** + *

+ * 系统通知 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-07-21 + */ +@Service +public class NoticeServiceImpl extends ServiceImpl implements INoticeService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NotifyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NotifyServiceImpl.java new file mode 100644 index 0000000..a5e5016 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/NotifyServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.sys.mapper.NotifyMapper; +import com.hz.pm.api.sys.model.entity.Notify; +import com.hz.pm.api.sys.service.INotifyService; +import org.springframework.stereotype.Service; + +/** + *

+ * 系统通知 服务实现类 + *

+ * + * @author zof + * @since 2023-03-21 + */ +@Service +public class NotifyServiceImpl extends ServiceImpl implements INotifyService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/ProjectEarlyWarningServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/ProjectEarlyWarningServiceImpl.java new file mode 100644 index 0000000..95b68ae --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/ProjectEarlyWarningServiceImpl.java @@ -0,0 +1,119 @@ +package com.hz.pm.api.sys.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.enumeration.ProjectEarlyWarningStatusEnum; +import com.hz.pm.api.sys.mapper.ProjectEarlyWarningMapper; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; +import com.hz.pm.api.sys.service.IProjectEarlyWarningService; +import com.wflow.enums.WarningNoticeTypeEnum; +import com.wflow.enums.WarningRuleTypeEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + + +/** + *

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

+ * + * @author ZPF + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class ProjectEarlyWarningServiceImpl extends ServiceImpl + implements IProjectEarlyWarningService { + + private final IProjectService projectService; + + @Override + public Boolean earlyWarning(Project project, Integer ruleType, Integer noticeType) { + return doEarlyWarning(project, ruleType, noticeType); + } + + @Override + public Boolean earlyWarning(Project project, Integer ruleType, List noticeTypes) { + if(CollUtil.isNotEmpty(noticeTypes)){ + if(noticeTypes.contains(WarningNoticeTypeEnum.OVER.getCode())){ + return doEarlyWarning(project, ruleType,WarningNoticeTypeEnum.OVER.getCode()); + }else{ + return doEarlyWarning(project, ruleType,WarningNoticeTypeEnum.ADVENT.getCode()); + } + } + return doEarlyWarning(project, ruleType, null); + } + + @Override + public Boolean earlyWarning(String projectCode, Integer ruleType, List noticeTypes) { + Project project = projectService.getProjectByCode(projectCode); + if(Objects.isNull(project)){ + return Boolean.FALSE; + } + return earlyWarning(project,ruleType,noticeTypes); + } + + private Boolean doEarlyWarning(Project project, Integer ruleType, Integer noticeType) { + if(Objects.isNull(project) || Objects.isNull(ruleType)){ + return Boolean.FALSE; + } + String projectCode = project.getProjectCode(); + ProjectEarlyWarning old = getOne(Wrappers.lambdaQuery(ProjectEarlyWarning.class) + .eq(ProjectEarlyWarning::getProjectCode, projectCode) + .last(BizConst.LIMIT_1)); + ProjectEarlyWarning warning = new ProjectEarlyWarning(); + if(Objects.nonNull(old)){ + warning.setId(old.getId()); + }else{ + warning.setBuildOrgCode(project.getBuildOrgCode()); + warning.setAreaCode(project.getAreaCode()); + } + + switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + case PROCESS_WARNING: + warning.setProcessWarning(Boolean.TRUE); + break; + case DECLARED_WARNING: + warning.setDeclaredWarning(Boolean.TRUE); + break; + case OPERATION_WARNING: + warning.setOperationWarning(Boolean.TRUE); + break; + case RENEWAL_FUND: + warning.setRenewalFundWarning(Boolean.TRUE); + break; + default: + return Boolean.FALSE; + } + + warning.setRuleType(ruleType); + if(Objects.isNull(noticeType)){ + warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); + }else{ + switch (WarningNoticeTypeEnum.match(noticeType)){ + case OVER: + warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); + break; + case ADVENT: + warning.setStatus(ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); + break; + default: + warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); + break; + } + } + + warning.setNoticeType(noticeType); + warning.setNormal(Boolean.FALSE); + return saveOrUpdate(warning); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RegionServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RegionServiceImpl.java new file mode 100644 index 0000000..f7d168f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RegionServiceImpl.java @@ -0,0 +1,62 @@ +package com.hz.pm.api.sys.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.sys.convert.RegionConverter; +import com.hz.pm.api.sys.mapper.RegionMapper; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.service.IRegionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-1-18 + */ +@Service +public class RegionServiceImpl extends ServiceImpl implements IRegionService { + + @Override + public List all() { + return CollUtils.convert(list(), RegionConverter::toRegionDTO); + } + + @Override + public Region getOne(String regionCode, int regionLevel) { + return getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, regionCode) + .eq(Region::getRegionLevel, regionLevel)); + } + + @Override + public List listGeLevel(int regionLevel) { + List regionsByLevel = lambdaQuery().ne(Region::getId, -1) + .le(Region::getRegionLevel, regionLevel).list(); + return CollUtils.convert(regionsByLevel, RegionConverter::toRegionDTO); + } + + @Override + public boolean isParentRegion(Long regionId) { + return baseMapper.exists(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentId, regionId) + .eq(Region::getDeleted, false)); + } + + @Override + public Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode) { + return baseMapper.selectOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentId, parentId) + .eq(Region::getRegionCode, regionCode) + .eq(Region::getDeleted, false)) + .getId(); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuDatascopeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuDatascopeServiceImpl.java new file mode 100644 index 0000000..5e8e015 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuDatascopeServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.sys.service.impl; + +import com.hz.pm.api.sys.model.entity.RoleMenuDatascope; +import com.hz.pm.api.sys.mapper.RoleMenuDatascopeMapper; +import com.hz.pm.api.sys.service.IRoleMenuDatascopeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 角色菜单数据权限关联表 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-01-28 + */ +@Service +public class RoleMenuDatascopeServiceImpl extends ServiceImpl implements IRoleMenuDatascopeService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuServiceImpl.java new file mode 100644 index 0000000..f844be1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleMenuServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.sys.model.entity.RoleMenu; +import com.hz.pm.api.sys.mapper.RoleMenuMapper; +import com.hz.pm.api.sys.service.IRoleMenuService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +@Service +public class RoleMenuServiceImpl extends ServiceImpl implements IRoleMenuService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..3edba4c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java @@ -0,0 +1,224 @@ +package com.hz.pm.api.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.sys.mapper.RoleMapper; +import com.hz.pm.api.sys.model.dto.MenuDataScopeDTO; +import com.hz.pm.api.sys.model.dto.RoleSaveDTO; +import com.hz.pm.api.sys.model.dto.RoleUpdateDTO; +import com.hz.pm.api.sys.model.entity.*; +import com.hz.pm.api.sys.service.*; +import com.hz.pm.api.sys.utils.AuthCacheKeyUtils; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.manage.UserAuthManage; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 业务实现类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class RoleServiceImpl extends ServiceImpl implements IRoleService { + + private final IUserRoleService userRoleService; + private final RoleMapper roleMapper; + private final IRoleMenuDatascopeService roleMenuDatascopeService; + private final CachePlusOps cachePlusOps; + private final IRoleMenuService roleMenuService; + private final IMenuService menuService; + private final UserAuthManage userAuthManage; + + /** + * 删除角色时,需要级联删除跟角色相关的一切资源: + * 1,角色本身 + * 2,角色-组织: + * 3,角色-权限(菜单和按钮): + * 4,角色-用户:角色拥有的用户 + * 5,用户-权限: + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + + if (userRoleService.count(Wrappers.lambdaQuery(UserRole.class).select(UserRole::getUserId) + .in(UserRole::getRoleId, ids)) > 0) { + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "该角色下还有用户 不能随意删除!"); + } + + // 角色 + boolean removeFlag = removeByIds(ids); + + //角色拥有的用户 + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId, ids)); + if (removeFlag) { + // 角色绑定了那些用户 + if (roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).in(RoleMenu::getRoleId, ids))) { + return Boolean.TRUE; + } + } + return removeFlag; + } + + /** + * 1、根据 USER_ROLE:{userId} 查询用户拥有的角色ID集合 + * 2、缓存中有,则根据角色ID集合查询 角色集合 + * 3、缓存中有查不到,则从DB查询,并写入缓存, 立即返回 + * + * @param userId 用户id + */ + @Override + public List findRoleByUserId(Long userId) { + String cacheKey = AuthCacheKeyUtils.userRoleCacheKey(userId); + List roleList = new ArrayList<>(); + List list = cachePlusOps.get(cacheKey); + if (list == null) { + roleList.addAll(baseMapper.findRoleByUserId(userId)); + list = roleList.stream().map(Role::getId).collect(Collectors.toList()); + } + if (roleList.isEmpty()) { + return listByIds(list); + } + return roleList; + } + + /** + * 1,保存角色 + * 2,保存 与组织的关系 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveRole(RoleSaveDTO data, Long userId) { + if (StrUtil.isNotBlank(data.getName()) && check(data.getName())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "角色名称{} 已存在", data.getName()); + } + Role role = BeanUtil.toBean(data, Role.class); + role.setCreateBy(userId); + role.setUpdateBy(userId); + role.setCode(RoleEnum.NORMAL_MEMBER.name()); + save(role); + saveRoleMenu(data.getMenuIds(), role.getId()); + saveRoleMenuDatascope(data.getMenuDataScopeList(), role.getId()); + } + + private void saveRoleMenuDatascope(List menuDataScopeList, Long roleId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(RoleMenuDatascope.class) + .eq(RoleMenuDatascope::getRoleId, roleId); + roleMenuDatascopeService.remove(query); + if (menuDataScopeList == null || menuDataScopeList.isEmpty()) { + return; + } + List datascopeList = CollUtils.convert(menuDataScopeList, w -> { + RoleMenuDatascope roleMenuDatascope = new RoleMenuDatascope(); + roleMenuDatascope.setMenuId(w.getMenuId()); + roleMenuDatascope.setDatascope(w.getDataScope()); + roleMenuDatascope.setRoleId(roleId); + return roleMenuDatascope; + }); + roleMenuDatascopeService.saveBatch(datascopeList); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateRole(RoleUpdateDTO data, Long userId) { + Role roleOld = roleMapper.selectById(data.getId()); + if (Objects.isNull(roleOld)) { + throw BizException.wrap("修改用户 %d 为空", data.getId()); + } + + if (StrUtil.isNotBlank(data.getName()) && check(data.getName(), roleOld.getId())) { + throw BizException.wrap("角色名 %s 已经存在", data.getName()); + } + Role role = BeanUtil.toBean(data, Role.class); + role.setUpdateOn(LocalDateTime.now()); + role.setUpdateBy(userId); + updateById(role); + saveRoleMenu(data.getMenuIds(), role.getId()); + saveRoleMenuDatascope(data.getMenuDataScopeList(), role.getId()); + List userIdList = userRoleService.listUserIdByRoleId(role.getId()); + userIdList.forEach(w -> { + cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(w)); + userAuthManage.refreshSession(w); + }); + } + + @Override + public List findUserIdByCode(String[] codes) { + return baseMapper.findUserIdByCode(codes); + } + + @Override + public Boolean check(String name) { + return super.count(Wrappers.lambdaQuery(Role.class).eq(Role::getName, name)) > 0; + } + + @Override + public Boolean check(String name, Long id) { + return super.count(Wrappers.lambdaQuery(Role.class).ne(Role::getId, id) + .eq(Role::getName, name)) > 0; + } + + private void saveRoleMenu(List menuIds, Long roleId) { + roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)); + if (CollUtil.isNotEmpty(menuIds)) { + Set toAddMenus = new HashSet<>(); + // Set addParentIds = new HashSet<>(); + for (Long menuId : menuIds) { + Menu menu = menuService.getById(menuId); + if (Objects.isNull(menu)) { + continue; + } + RoleMenu roleMenu = new RoleMenu(null, menuId, roleId); + toAddMenus.add(roleMenu); + // 父级菜单 + // addParent(toAddMenus, menu, roleId, addParentIds); + } + if (CollUtil.isNotEmpty(toAddMenus)) { + roleMenuService.saveBatch(toAddMenus); + } + } + } + + private void addParent(Set toAddMenus, Menu menu, Long roleId, Set addParentIds) { + if (Objects.isNull(menu.getPid()) || menu.getPid().equals(0L)) { + return; + } + if (addParentIds.contains(menu.getPid())) { + return; + } + Menu parent = menuService.getById(menu.getPid()); + if (Objects.isNull(parent)) { + return; + } + addParentIds.add(menu.getPid()); + RoleMenu roleMenu = new RoleMenu(null, parent.getId(), roleId); + toAddMenus.add(roleMenu); + addParent(toAddMenus, parent, roleId, addParentIds); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..85857d4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.sys.service.impl; + +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.sys.mapper.RoleMapper; +import com.hz.pm.api.sys.mapper.UserRoleMapper; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.service.IUserRoleService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * 业务实现类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class UserRoleServiceImpl extends ServiceImpl implements IUserRoleService { + + private static final String INIT_ROLE_CODE = "SUPER_ADMIN"; + + private final RoleMapper roleMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean initAdmin(Long userId) { + Role role = roleMapper.selectOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getName, INIT_ROLE_CODE)); + if (role == null) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("初始化用户角色失败, 无法查询到内置角色:%s", INIT_ROLE_CODE)); + } + UserRole userRole = UserRole.builder() + .userId(userId).roleId(role.getId()) + .build(); + + return super.save(userRole); + } + + @Override + public List listUserIdByRoleId(Long roleId) { + List userRoles = this.list(Wrappers.lambdaQuery() + .eq(UserRole::getRoleId, roleId)); + return CollUtils.fieldList(userRoles, UserRole::getUserId); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/AuthCacheKeyUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/AuthCacheKeyUtils.java new file mode 100644 index 0000000..713cbdd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/AuthCacheKeyUtils.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.sys.utils; + +/** + *

+ * AuthCacheKeyUtils + *

+ * + * @author WendyYang + */ +public class AuthCacheKeyUtils { + + private static final String USER_RESOURCE_CKP = "user_resource:"; + private static final String USER_MENU_CKP = "user_menu:"; + private static final String USER_ROLE_CKP = "user_role:"; + private static final String ROLE_RESOURCE_CKP = "role_resource:"; + private static final String ROLE_MENU_CKP = "role_menu:"; + + public static String roleResourceCacheKey(Long roleId) { + return ROLE_RESOURCE_CKP + roleId; + } + + public static String roleMenuCacheKey(Long roleId) { + return ROLE_MENU_CKP + roleId; + } + + public static String userResourceCacheKey(Long userId) { + return USER_RESOURCE_CKP + userId; + } + + public static String userMenuCacheKey(Long userId) { + return USER_MENU_CKP + userId; + } + + public static String userRoleCacheKey(Long userId) { + return USER_ROLE_CKP + userId; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java new file mode 100644 index 0000000..85bd930 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.sys.utils; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; + +/** + * @Classname EarlyWarningUtil + * @Description + * @Date 2023/12/7 14:14 + * @Author PoffyZhang + */ +public class EarlyWarningUtil { + + public static void buildPermissonWrapper(LambdaQueryWrapper wrapper, + UserInfoDetails user) { + //如果是超管的话 + if(user.getSuperAdmin()){ + //可以看所有 + //如果是区管 + }else if(user.getRegionAdmin()){ + wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); + }else if(user.getIsOrgAdmin()){ + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + }else{ + //否则都只能看自己单位的 + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + } + } + + public static void buildPermissonFullWrapper(LambdaQueryWrapper wrapper, + UserFullInfoDTO user) { + //如果是超管的话 + if(user.getSuperAdmin()){ + //可以看所有 + //如果是区管 + }else if(user.getRegionAdmin()){ + wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); + }else if(user.getIsOrgAdmin()){ + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + }else{ + //否则都只能看自己单位的 + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + } + } + + public static void buildPermissonProjectWrapper(LambdaQueryWrapper wrapper, + UserFullInfoDTO user) { + //如果是超管的话 + if(user.getSuperAdmin()){ + //可以看所有 + //如果是区管 + }else if(user.getRegionAdmin()){ + wrapper.eq(Project::getAreaCode,user.getRegionCode()); + }else if(user.getIsOrgAdmin()){ + wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + }else{ + //否则都只能看自己单位的 + wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/bean/entity/WorkNoticeInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/bean/entity/WorkNoticeInfo.java new file mode 100644 index 0000000..c3480c5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/bean/entity/WorkNoticeInfo.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.todocenter.bean.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 发送工作通知所需信息 + * + * @author CMM + * @since 2023/02/15 13:57 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WorkNoticeInfo { + private String msg; + private Long accountId; + private String organizationCode; + private String organizationName; + private String bizMsgId; + private String receiverUserId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java new file mode 100644 index 0000000..5a1792f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.todocenter.constant; +/** + * @author ZPF + * @since 2023/04/02 14:56 + */ +public interface TodoCenterConstant { + + class Handler { + + public static final String ACTIVITY_APPROVAL = "userTask"; + + public static final String OR_SIGN_FLAG = "MI_END"; + + public static final String TASKID_ERROR = "TASKID_ERROR"; + } + + class Declared { + + public static final String NULL_INST_CODE = "EMPTY"; + + } + + class SealTemplate{ + public static final String CITY_TEMPLATE = "市级-预审申请单"; + public static final String COUNTRY_TEMPLATE = "区县-预审申请单"; + public static final String CONSTRUCT_TEMPLATE = "建设方案申请单"; + + public static final String COUNTRY_SEAL_POS_PAGE = "6"; + public static final Float COUNTRY_SEAL_POS_X = 487F; + public static final Float COUNTRY_SEAL_POS_Y = 380F; + public static final Integer COUNTRY_SEAL_SIGN_TYPE = 1; + + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java new file mode 100644 index 0000000..4026006 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.todocenter.constant; +/** + * 工作通知格式常量 + * @author CMM + * @since 2023/02/01 14:56 + */ +public interface WorkNoticeConstant { + public final String PASS_MSG_TEMPLATE = "【%s】的【%s】需要您审核。"; + public final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; + public final String BACK_MSG_TEMPLATE = "【%s】的【%s】被退回,请及时处理。"; + public final String REJECT_MSG_TEMPLATE = "【%s】的【%s】被驳回,请及时处理。"; + + public final String CC_MSG_TEMPLATE = "【%s】的【%s】有消息抄送您,请查看详情"; + + public final String AUDIT_WORK_TITLE = "审核任务"; + + public final String EXPERT_REVIEW_TEMPLATE = "【%s】的【%s】待您评审,请及时处理。"; + public final String REVIEW_MEETING_TEMPLATE = "【%s】已完成专家抽取,请及时处理。"; + public final String WARNING_ALERT_TEMPLATE = "【%s】的【%s】待您审核,已停留2小时,请及时处理。"; + + public final String PROJECT_ID = "projectId"; + public final String INSTANCE_ID = "instanceId"; + public final String MEETING_ID = "meetingId"; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java new file mode 100644 index 0000000..a3c0745 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java @@ -0,0 +1,206 @@ +package com.hz.pm.api.todocenter.controller; + + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.todocenter.model.vo.NotSealedInfoVO; +import com.hz.pm.api.todocenter.model.vo.TodoNumVO; +import com.wflow.workflow.bean.dto.ReqAuditOpinionSaveDTO; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.todocenter.manage.TodoCenterManage; +import com.hz.pm.api.todocenter.model.dto.AdjustHandleDTO; +import com.hz.pm.api.todocenter.model.dto.SealInfoDTO; +import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedExportReq; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedReq; +import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVo; +import com.hz.pm.api.todocenter.model.vo.ResToBeProcessedVO; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; + +/** + *

+ * 待办中心 前端控制器 + *

+ * + * @author CMM + * @since 2023-01-12 + */ +@RestController +@AllArgsConstructor +@Api(tags = "待办中心控制器") +@RequestMapping("/api/v1/todo-center") +public class TodoCenterController { + + private final TodoCenterManage todoCenterManage; + + /** + * 实时取当前操作人 某个工作流的下一个操作taskId + */ + @GetMapping("/todo/taskId/{instanceId}") + public String todoTaskId(@PathVariable String instanceId){ + return todoCenterManage.todoTaskId(instanceId); + } + + /** + * 待办中心-待我处理项目列表查询 + * @param param + * @return + */ + @GetMapping("/todo-list") + public PageVo todoList(@Valid @ModelAttribute ToBeProcessedReq param){ + return todoCenterManage.todoProjectList(param); + } + + /** + * 待办中心-待我处理项目列表导出 + * + * @param param + * @param response + * @return void + */ + @PostMapping("/todo-list/export") + @WebLog("待办中心-待我处理项目列表导出") + public void exportPendingProjectList(@Valid @RequestBody ToBeProcessedExportReq param, + HttpServletResponse response){ + todoCenterManage.exportTodoList(response,param); + } + + /** + * 查询流程表单数据及审批的进度步骤 + * @param request 请求参数 + * @return 流程进度及表单详情 + */ + @GetMapping("/progress/detail") + public ProcessProgressDetailVo getProcessDetail(@Valid @ModelAttribute ProcessDetailReq request) { + return todoCenterManage.getProcessDetail(request); + } + + /** + * 审核通过,盖章并通过、退回、撤回、驳回等操作 + * @param param 操作参数 + * @return 操作结果 + */ + @PostMapping("/handler") + @WebLog("审核通过,盖章并通过、退回、撤回、驳回等操作") + public Object handler(@Valid @RequestBody ReqProcessHandlerDTO param) { + String nextTaskId = todoCenterManage.handler(param); + return nextTaskId; + } + + /** + * 保存盖章审核提交的审核意见 + * @param param 操作参数 + * @return 操作结果 + */ + @PostMapping("/saveAuditOpinion") + @WebLog("保存盖章审核提交的审核意见") + public Object saveAuditOpinion(@Valid @RequestBody ReqAuditOpinionSaveDTO param) { + return todoCenterManage.saveAuditOpinion(param); + } + + + + /** + * 待办中心-我已处理项目列表查询 + * @param param + * @return + */ + @GetMapping("/ido-list") + public PageVo idoList(@ModelAttribute ToBeProcessedReq param){ + return todoCenterManage.idoList(param); + } + /** + * 待办中心-我已处理项目列表导出 + * + * @param param + * @param response + * @return void + */ + @PostMapping("/ido-list/export") + public void exportHandledProjectList(@RequestBody ToBeProcessedExportReq param, + HttpServletResponse response){ + todoCenterManage.idoExport(response,param); + } + + /** + * 待办中心-我发起的项目列表查询 + * @param param + * @return + */ + @GetMapping("/my-submitted-list") + public PageVo mySubmittedList(@ModelAttribute ToBeProcessedReq param){ + return todoCenterManage.mySubmittedList(param); + } + + /** + * 待办中心-我发起的项目列表导出 + * + * @param param + * @param response + * @return void + */ + @PostMapping("/my-submitted-list/export") + public void exportMySubmittedList(@RequestBody ToBeProcessedExportReq param, + HttpServletResponse response){ + todoCenterManage.exportMySubmittedList(response,param); + } + + /** + * 待办中心-抄送我的项目列表查询 + * @param param + * @return + */ + @GetMapping("/ccme-list") + public PageVo ccmeList(@Valid @ModelAttribute ToBeProcessedReq param){ + return todoCenterManage.ccmeList(param); + } + + /** + * 待办中心-抄送我的项目列表导出 + * + * @param param + * @param response + * @return void + */ + @PostMapping("/ccme-list/export") + public void exportCcMeProjectList(@Valid @RequestBody ToBeProcessedExportReq param, HttpServletResponse response){ + todoCenterManage.exportCcMeProjectList(response,param); + } + + @ApiOperation(value = "被退回项目内容调整并通过", notes = "被退回项目内容调整并通过") + @PostMapping("/adjustAndHandle") + @WebLog("被退回项目内容调整并通过") + public String startTheProcess(@Validated @RequestBody AdjustHandleDTO dto) { + String instanceId = todoCenterManage.adjustmentAndHandle(dto); + return "退回项目内容调整并且重新通过 【" + instanceId + "】 成功"; + } + + @ApiOperation("获取未签章的pdf文件") + @WebLog("获取未签章的pdf文件") + @PostMapping("/getNotSealedPdf") + public NotSealedInfoVO getNotSealedPdf (@Valid @RequestBody SealInfoDTO req){ + return todoCenterManage.getNotSealedPdf(req); + } + + @ApiOperation("获取签章后的pdf文件") + @WebLog("获取签章后的pdf文件") + @PostMapping("/getSealedPdf") + public Long getSealedPdf(@Valid @RequestBody SealInfoDTO req){ + return todoCenterManage.getSealedPdf(req); + } + + @ApiOperation("待办中心待我处理数量统计") + @GetMapping("/getTodoNums") + public TodoNumVO getTodoNums(@Valid @ModelAttribute ToBeProcessedReq param){ + return todoCenterManage.getTodoNums(param); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsAppendProjectEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsAppendProjectEnum.java new file mode 100644 index 0000000..eda5d93 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsAppendProjectEnum.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.todocenter.enumeration; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 是否增补项目枚举 + * + * @author CMM + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "IsAppendProjectEnum", description = "是否增补项目-枚举") +public enum IsAppendProjectEnum { + /** + * 非增补项目 + */ + NOT_APPEND_PROJECT(0, "非增补项目"), + + /** + * 增补项目 + */ + APPEND_PROJECT(1, "增补项目"); + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static IsAppendProjectEnum getEnumByValue(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java new file mode 100644 index 0000000..7e605b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.todocenter.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 是否增补项目枚举 + * + * @author CMM + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "IsOrNotEnum", description = "是否-枚举") +public enum IsOrNotEnum { + /** + * 否 + */ + NOT(0, "否"), + + /** + * 是 + */ + IS(1, "是"); + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (IsOrNotEnum t : IsOrNotEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static IsOrNotEnum getEnumByValue(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (IsOrNotEnum t : IsOrNotEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/PassHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/PassHandle.java new file mode 100644 index 0000000..995c4ab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/PassHandle.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.todocenter.handle; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.runtime.ActivityInstance; +import org.springframework.stereotype.Component; +import java.util.List; + +/** + * @Classname PassHandle + * @Description + * @Date 2023/5/5 14:46 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class PassHandle { + + private final RuntimeService runtimeService; + + /** + * 判断节点类型 + * @param instanceId + * @param employeeCode + * @return + */ + public void checkCanPassOrSeal(String instanceId,String taskId,String employeeCode, ProcessProgressDetailVo res) { + + List activities = runtimeService.createActivityInstanceQuery() + .taskAssignee(employeeCode) + .processInstanceId(instanceId) + .unfinished() + .orderByActivityInstanceStartTime() + .asc() + .list(); + + if(CollUtil.isEmpty(activities)){ + res.setCanPass(Boolean.FALSE); + res.setCanReject(Boolean.FALSE); + res.setCanSeal(Boolean.FALSE); + return; + } + + for(ActivityInstance activity : activities){ + if(StringUtils.isNotBlank(taskId)){ + if(taskId.equals(activity.getTaskId())){ + if(StringUtils.isNotBlank(activity.getActivityId())){ + res.setCanReject(Boolean.TRUE); + if(activity.getActivityId().startsWith("node")){ + res.setCanPass(Boolean.TRUE); + }else if(activity.getActivityId().startsWith("seal")){ + res.setCanSeal(Boolean.TRUE); + } + break; + } + } + } + + if(StringUtils.isNotBlank(activity.getActivityId())){ + res.setCanReject(Boolean.TRUE); + if(activity.getActivityId().startsWith("node")){ + res.setCanPass(Boolean.TRUE); + }else if(activity.getActivityId().startsWith("seal")){ + res.setCanSeal(Boolean.TRUE); + } + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java new file mode 100644 index 0000000..b4e39b8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java @@ -0,0 +1,343 @@ +package com.hz.pm.api.todocenter.handle; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.assertj.core.util.Lists; +import org.flowable.bpmn.model.*; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RepositoryService; +import org.flowable.engine.history.HistoricActivityInstance; +import org.flowable.engine.history.HistoricProcessInstance; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname WithDrawHandle + * @Description + * @Date 2023/4/2 14:46 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class WithDrawHandle { + + private final UserInfoHelper userInfoHelper; + + private final HistoryService historyService; + private final RepositoryService repositoryService; + private final IProjectInstService projectInstService; + + /** + * 判断 当前流程 可否被当前登录人 所撤回 + * @param instanceId + * @param progressInstanceDetail + * @return + */ + public Boolean checkCanWithdraw(String instanceId, ProcessProgressVo progressInstanceDetail,String taskId) { + HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instanceId).singleResult(); + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + String employeeCode = userInfoDetails.getEmployeeCode(); + //如果不是审核中 + if(!ProcessStatusEnum.UNDER_REVIEW.getDesc() + .equals(progressInstanceDetail.getStatus())){ + return Boolean.FALSE; + } + // 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回 + Boolean userIsRoot = checkUserIsRoot(instanceId, null); + if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)){ + return Boolean.TRUE; + } + ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO(); + dto.setTaskId(taskId); + dto.setInstanceId(instanceId); + return checkUserIsBefore(progressInstanceDetail.getProgressInfo(),dto); + } + + // 判断当前操作人 是上一个节点的审批人 + public Boolean checkUserIsBefore(List currentProgressInfo, ReqProcessHandlerDTO param) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + + // 先排除掉抄送任务节点 + currentProgressInfo = currentProgressInfo.stream() + .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) + .collect(Collectors.toList()); + + if (CollUtil.isEmpty(currentProgressInfo)){ + return Boolean.FALSE; + } + + String taskId = param.getTaskId(); + + //1.判断出 当前审批人和上一个审批人 如果传了taskid + ProgressNode progressNode = StringUtils.isBlank(taskId) ? + currentProgressInfo.get(currentProgressInfo.size() - 1) + : findSubNodeByTaskId(taskId,currentProgressInfo); + + if (Objects.isNull(progressNode)){ + return Boolean.FALSE; + } + + ProgressNode beforeProgressNode = null; + ProgressNode currentProgressNode = null; + + // 说明当前节点是子流程节点 + // 如果是会签 或签 当前和上个 + List thisAndOr = Lists.newArrayList(); + List beforeAndOr = Lists.newArrayList(); + if (progressNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { + List children = progressNode.getChildren(); + // 先排除掉子流程中抄送的节点,避免塞入错误的taskId + children = children.stream() + .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(children)){ + return Boolean.FALSE; + } + currentProgressNode = children.get(children.size() - 1); + + //把当前和上一个节点和 会签或签的情况 都check出来 + beforeProgressNode = checkBeforeNodeAndOr(children,currentProgressNode,thisAndOr,beforeAndOr); + } else { + currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); + + // 把当前和上一个节点和 会签或签的情况 都check出来 + beforeProgressNode = checkBeforeNodeAndOr(currentProgressInfo,currentProgressNode,thisAndOr,beforeAndOr); + } + // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 + // 获取当前当前工作流任务当前审核人信息 + UserFullInfoDTO currentUserInfo = userInfoHelper.getUserFullInfoByEmployeeCode(currentProgressNode.getUserId()); + if(Objects.isNull(currentUserInfo) || !currentUserInfo.getEmpPosUnitCode().equals(user.getEmpPosUnitCode())){ + return Boolean.FALSE; + } + + Boolean isAndOr = Boolean.FALSE; + + //判断当前子流程是否结束 如果结束了 必不能撤回 + Boolean thisSubNodeOver = Boolean.FALSE; + //当前节点是 会签|或签的情况 + if(CollUtil.isNotEmpty(thisAndOr)){ + Integer finishNodes = 0; + for(ProgressNode n : thisAndOr){ + if(Objects.nonNull(n.getFinishTime())){ + //当前会签 有审批过的 那么上个会签|或签 无论如何 就不可能可以撤回了 + beforeAndOr = Collections.emptyList(); + finishNodes ++; + } + //找到了 当前的操作人 在当前的 会签|或签 中 并且已经审批了 + if(n.getUserId().equals(user.getEmployeeCode()) && + Objects.nonNull(n.getFinishTime())){ + beforeProgressNode = n; + //说明当前操作人 在上个会签或者或签节点 + isAndOr = Boolean.TRUE; + } + } + //如果都审批过了 结束了 那说明此子流程已经结束了 不能再撤回了 + if(finishNodes.equals(thisAndOr.size())){ + return Boolean.FALSE; + } + }else{ + //如果当前不是会签|或签 就判断 当前最后一个节点 结束了没 + //如果结束了 也同样 直接不能撤回 + if(Objects.nonNull(currentProgressNode.getFinishTime())){ + return Boolean.FALSE; + } + } + + //如果上个会签没取到 还有种情况是 会签 或签 并且在上个节点 + if(!isAndOr && CollUtil.isNotEmpty(beforeAndOr)) { + for (ProgressNode n : beforeAndOr) { + if (n.getUserId().equals(user.getEmployeeCode()) + && !TodoCenterConstant.Handler.OR_SIGN_FLAG.equals(n.getWithdrawFlag())) { + beforeProgressNode = n; + //说明当前操作人 在上个会签或者或签节点 + isAndOr = Boolean.TRUE; + break; + } + } + } + + if(!isAndOr && (Objects.isNull(beforeProgressNode) + || !user.getEmployeeCode().equals(beforeProgressNode.getUserId()))){ + return Boolean.FALSE; + } + + //如果是true 把对应操作人 在上个审批节点的task 也传入 + if(Objects.nonNull(param)){ + // 获取bpmn文件中节点的连线关系,如果前一个节点的下一个节点是抄送节点, + // 获取抄送节点传入param中,在执行撤回操作时,将抄送信息从抄送表中删除 + HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(param.getInstanceId()) + .singleResult(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); + // 传节点定义key 获取撤回操作人在流程配置中所在的节点 + FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(beforeProgressNode.getNodeId()); + List outgoingFlows = flowNode.getOutgoingFlows(); + for (SequenceFlow outgoingFlow : outgoingFlows) { + //获取输出节点元素 + FlowElement targetFlowElement = outgoingFlow.getTargetFlowElement(); + // 获取下一个抄送任务的节点 + if(targetFlowElement instanceof ServiceTask){ + param.setCcNodeId(targetFlowElement.getId()); + break; + } + } + param.setTaskId(beforeProgressNode.getTaskId()); + } + return Boolean.TRUE; + } + + /** + * 找到其 所在的子流程父节点 + * @param taskId + * @return + */ + private ProgressNode findSubNodeByTaskId(String taskId,List currentProgressInfos) { + for(ProgressNode progressNode : currentProgressInfos){ + if(progressNode.getNodeType().equals(NodeTypeEnum.SUB)){ + List children = progressNode.getChildren(); + for(ProgressNode c : children){ + if(taskId.equals(c.getTaskId())){ + //如果任务ID对得上 返回其 所在的子流程 + return progressNode; + } + } + } + } + return null; + } + + /** + * 判断撤回用户 是不是发起人 + * @param processInstanceId + * @param task + * @return + */ + public Boolean checkUserIsRoot(String processInstanceId,String task){ + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + // 获取当前要处理的流程实例 + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(processInstanceId) + .singleResult(); + if (user.getEmployeeCode().equals(instance.getStartUserId()) && + (Objects.isNull(task) || user.getEmployeeCode().equals(instance.getStartUserId()))) { + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + + /** + * 把上一个节点 和 或签 会签情况都check出来 + * @param progressNodes andOr + * @param thisAndOr beforeAndOr + * @return + */ + public ProgressNode checkBeforeNodeAndOr(List progressNodes,ProgressNode curr, + List thisAndOr,List beforeAndOr) { + ProgressNode beforeNode = null; + if(progressNodes.size() == 1){ + return null; + } + //进入上一个节点的标识 + Boolean enterBefore = Boolean.FALSE; + //假设 作为当前会签的第一个点 + String thisAndOrNodeId = curr.getNodeId(); + //假设 作为上一个会签/或签的第一个点 + ProgressNode beforeAndOrNode = null; + for(int i = progressNodes.size() - 2;i >= 0;i--){ + //说明有会签 或签 + if(progressNodes.get(i).getNodeId().equals(thisAndOrNodeId)){ + //还在当前节点 + if(!enterBefore){ + if(thisAndOr.isEmpty()){ + //放入当前的那个点 + thisAndOr.add(curr); + } + thisAndOr.add(progressNodes.get(i)); + } + //如果在上个节点了 + else{ + if(beforeAndOr.isEmpty()){ + //放入假设的那个点 + beforeAndOr.add(beforeAndOrNode); + //如果 上个节点也是 会签|或签 那么就置为null + beforeNode = null; + } + beforeAndOr.add(progressNodes.get(i)); + } + }else{ + thisAndOrNodeId = progressNodes.get(i).getNodeId(); + //存在假设可能 + beforeAndOrNode = progressNodes.get(i); + if(!enterBefore){ + beforeNode = progressNodes.get(i); + enterBefore = Boolean.TRUE; + continue; + } + break; + } + } + return beforeNode; + } + + /** + * 1.判断 当前 撤回人 是否是 发起人 + * 2.并且流程 尚未开始审批 + * @return + */ + public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { + String startUserId = instance.getStartUserId(); + // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false + String instanceId = instance.getId(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || + InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + return Boolean.FALSE; + } + //如果流程发起人 不是 当前登录人 直接返回false + if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) + || !employeeCode.equals(startUserId)){ + return Boolean.FALSE; + } + + List finished = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(instance.getId()).finished() + .activityType(TodoCenterConstant.Handler.ACTIVITY_APPROVAL) + .orderByHistoricActivityInstanceEndTime().asc().list(); + List instances = finished.stream() + .filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) + .collect(Collectors.toList()); + //如果有已经被审核过的 节点 返回false + if(CollUtil.isNotEmpty(instances)){ + return Boolean.FALSE; + } + + return Boolean.TRUE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java new file mode 100644 index 0000000..de41fbc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -0,0 +1,540 @@ +package com.hz.pm.api.todocenter.manage; + +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.date.DatePattern; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; +import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; +import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; +import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.task.Comment; +import org.flowable.variable.api.history.HistoricVariableInstance; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; +import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.dto.ProjectApplicationDTO; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessHandlerEnum; +import com.wflow.workflow.service.ProcessInstanceService; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname HandlerManage + * @Description + * @Date 2023/4/2 14:25 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class HandlerManage { + + private final RuntimeService runtimeService; + + private final TaskService taskService; + private final HistoryService historyService; + private final IProjectService projectService; + private final StateMachineUtils stateMachineUtils; + private final ProcessInstanceService processInstanceService; + private final IProjectApplicationService projectApplicationService; + private final IProjectStagingService projectStagingService; + private final IProjectInstService projectInstService; + private final NoticeManage noticeManage; + private final DeclaredProjectManage declaredProjectManage; + private final FileService fileService; + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + private final INdProjectDelayApplyService projectDelayApplyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; + + private final IConstrctionSuggestionsService constrctionSuggestionsService; + + @Value("${spring.profiles.active}") + private String active; + + + /** + * 审核通过后 所处理的逻辑 + * @param declaredProject + * @param instance + */ + public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ + Long userId = LoginUserUtil.getUserId(); + // 获取流程通过后的流程实例 + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instance.getId()) + .singleResult(); + // 获取当前流程实例类型 + String instanceId = newInstance.getId(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId) + .last(BizConst.LIMIT_1)); + Integer instType = projectInst.getInstType(); + InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); + if (Objects.isNull(instTypeEnum)){ + throw new BizException("当前审批流类型不存在,流程类型code:" + instType); + } + + // 获取流程通过后当前流程详情 + ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); + // 获取流程通过后当前审核人信息,向其发送工作通知 + // 会签/或签会有多个审核人 + List currentEmployeeCodeList = Lists.newArrayList(); + List newProgressInfo = newInstanceDetail.getProgressInfo(); + ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); + + // 说明当前节点是子流程节点 + if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { + List children = currentNode.getChildren(); + // 获取子流程当前审核人节点 + ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); + // 获取节点ID相同地审核节点 + List nodeList = children.stream() + .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); + currentEmployeeCodeList.addAll(userIdList); + } else { + List nodeList = newProgressInfo.stream() + .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); + currentEmployeeCodeList.addAll(userIdList); + } + + // 流程通过后,判断当前登录用户是不是最后一个审核人 + // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 + // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 + if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { + // 如果是申请延期和申请借阅审批流程,不走状态机 + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + switch (instTypeEnum) { + case APPLY_DELAY: + // 保存延期申请记录,更新项目建设周期和计划验收时间 + updateProjectDelayApplyInfo(declaredProject,instanceId); + break; + case APPLY_BORROW: + // 更新申请借阅状态为成功 + updateProjectApplyBorrowInfo(declaredProject,instanceId); + break; + default: + throw new BizException("传入实例类型错误: " + instTypeEnum); + } + }else { + switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { + // 当前项目状态是预审中 + case PRE_APPLYING: + //先修改项目状态 + updatePassProjectStatus(userId, declaredProject); + //然后入库暂存库 + projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); + break; + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + log.info("部门联审成功后 要判断是否是 区县重大项目"); + + Boolean isImport = !StateMachineUtils.isCityProject(declaredProject) && + StateMachineUtils.judgeDeclareAmount(declaredProject, + ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); + log.info("isImport :{}",isImport); + //如果是 区县 并且 500万及以上要推送省局重大项目 + if (isImport) { + try { + List applications = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); + joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); + updatePassProjectStatus(userId, declaredProject); + break; + } catch (Exception e) { + log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); + log.error("区县推送省级联审失败:" + e); + } + break; + } + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 当前项目状态是方案评审中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updatePassProjectStatus(userId, declaredProject); + break; + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + updatePassProjectStatus(userId, declaredProject); + // 判断是否 保存建设建议信息 + saveContructionSuggestionInfo(instance.getId(),declaredProject); + break; + default: + throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); + } + } + //发送消息 + noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS); + } else { + // 若有下一个审核人(当前节点的用户),会签/或签会有多个 + // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 + // 获取发送浙政钉工作通知必要信息 + for (String currentEmployeeCode : currentEmployeeCodeList) { + if (Objects.isNull(currentEmployeeCode)) { + throw new BizException("审核人信息不存在!"); + } + //发送消息 + noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); + } + } + } + + /** + * 去保存 建设建议信息 + * @param instanceId + * @param project + */ + private void saveContructionSuggestionInfo(String instanceId, Project project) { + ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) + .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) + .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(pcs)){ + log.info("没有该流程的 建设 建议信息"); + return; + } + + project.setProposeTotalInvest(pcs.getProposeTotalInvest()); + project.setProposeAnnualBudget(pcs.getProposeAnnualBudget()); + project.setProposeAttachFiles(pcs.getProposeAttachFiles()); + projectService.updateById(project); + } + + public void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { + // 获取申请借阅信息 + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) + .eq(ProjectApplyBorrow::getInstanceId, instanceId)); + // 更新项目借阅信息为成功 + projectApplyBorrow.setIsSuccess(Boolean.TRUE); + projectApplyBorrow.setUpdateOn(LocalDateTime.now()); + projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); + projectApplyBorrowService.updateById(projectApplyBorrow); + } + + public void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { + // 获取延期申请填写的相关信息 + 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(); + // 重新计算建设周期、验收时间 + String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); + declaredProject.setBuildCycle(constructCycle); + Long constructMonth = Long.valueOf(constructCycle); + String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); + LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + declaredProject.setPlanAcceptanceTime(time); + 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); + } + + + /** + * 驳回后 所处理的逻辑 + * @param declaredProject + * @param instance + */ + public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { + Long userId = LoginUserUtil.getUserId(); + // 获取当前流程实例类型 + String instanceId = declaredProject.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + // 审批流程不是申请延期和申请借阅,需调用状态机 + if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + // 更新项目状态和流程状态 + updateRejectProjectStatus(userId, declaredProject, instType); + } + //发送消息 + noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), + REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); + } + + /** + * 发起人 撤回逻辑 + */ + public void rootWithDraw(Project declaredProject) { + Long userId = LoginUserUtil.getUserId(); + // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 + switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 更新项目状态为待申报 + updateWithdrawProjectStatus(userId, declaredProject); + // 保存到草稿箱中 + saveToDraft(declaredProject); + //删除所有项目相关的信息 + deleteProjectRelated(declaredProject); + break; + // 当前项目状态是预审中 + case PRE_APPLYING: + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updateWithdrawProjectStatus(userId, declaredProject); + break; + default: + throw new IllegalStateException("Unexpected value: " + declaredProject.getStatus()); + } + } + + // 保存到草稿箱中 + private void saveToDraft(Project declaredProject) { + ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO(); + ProjectDTO projectInfo = new ProjectDTO(); + BeanUtils.copyProperties(declaredProject,projectInfo); + // 查询出项目关联的应用信息 + List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, declaredProject.getId())); + List applicationDTOList = applicationList.stream().map(a -> { + ProjectApplicationDTO applicationDTO = new ProjectApplicationDTO(); + BeanUtils.copyProperties(a, applicationDTO); + return applicationDTO; + }).collect(Collectors.toList()); + projectInfo.setApplicationList(applicationDTOList); + HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); + projectInfo.setDynamicForm(dynamicMap); + draftSaveDto.setProjectInfo(projectInfo); + declaredProjectManage.saveToDraft(draftSaveDto); + } + + /** + * 删除项目的所有信息 + * @param declaredProject + */ + public void deleteProjectRelated(Project declaredProject) { + //删除项目库中该项目信息 + projectService.removeById(declaredProject); + //删除app信息 + projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId,declaredProject.getId())); + } + + /** + * 退回审核后 所处理的逻辑 + * @param declaredProject + * @param instance + */ + public void afterBackTodo(Project declaredProject, HistoricProcessInstance instance) { + Long userId = LoginUserUtil.getUserId(); + // 获取当前流程实例类型 + String instanceId = declaredProject.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); + // 如果是预审审批或建设方案退回,需要重新盖章,原来盖过章的文件要清空 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ + updateWrapper.set(Project::getPretrialFileId,null) + .set(Project::getPretrialFileName,null) + .eq(Project::getId,declaredProject.getId()); + projectService.update(updateWrapper); + } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getConstructFileId,null) + .set(Project::getConstructFileName,null) + .eq(Project::getId,declaredProject.getId()); + projectService.update(updateWrapper); + } + // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 + //发送消息 + noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), + BACK_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_BACK); + } + + + /** + * 当为通过操作时,更新项目表中项目状态 + * + * @param userId + * @param declaredProject + * @return void + * @author CMM + * @since 2023/02/08 + */ + public void updatePassProjectStatus(Long userId, Project declaredProject) { + try { + stateMachineUtils.pass(declaredProject); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + projectService.updateById(declaredProject); + } catch (Exception e) { + log.error("状态机执行失败",e); + throw new BizException("状态机执行失败!"); + } + } + + /** + * 当为驳回操作时,更新项目表中的项目状态 + * + * @param userId + * @param declaredProject + * @param instType + * @return void + * @author CMM + * @since 2023/02/08 + */ + private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { + stateMachineUtils.reject(declaredProject); + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + projectService.updateById(declaredProject); + // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ + updateWrapper.set(Project::getPretrialFileId,null) + .set(Project::getPretrialFileName,null) + .eq(Project::getId,declaredProject.getId()); + projectService.update(updateWrapper); + }else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getConstructFileId,null) + .set(Project::getConstructFileName,null) + .eq(Project::getId,declaredProject.getId()); + projectService.update(updateWrapper); + } + } + + /** + * 当为撤回操作时,更新项目表中的项目状态为前一个状态 + * + * @param userId + * @param declaredProject + * @return void + * @author CMM + * @since 2023/02/08 + */ + @Transactional(rollbackFor = Exception.class) + public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { + // 删除关联表信息 + projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId,declaredProject.getId()) + .eq(ProjectInst::getInstCode,declaredProject.getInstCode())); + //删除项目的实例信息 + historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); + + stateMachineUtils.withDraw(declaredProject); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + declaredProject.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + projectService.updateById(declaredProject); + } + + public void deleteBackComments(List approves) { + if(CollUtil.isNotEmpty(approves)){ + for(HistoricVariableInstance approve : approves){ + if(approve.getValue() instanceof ProcessHandlerEnum){ + if(ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))){ + runtimeService.removeVariable(approve.getProcessInstanceId(),approve.getVariableName()); + + Comment comment; + Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) + .stream() + .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) + .findFirst(); + if (first.isPresent()){ + comment = first.get(); + taskService.deleteComment(comment.getId()); + } + + break; + } + } + } + } + } + + /** + * 判断是否包含 此任务 + * @param progressNodes + * @param taskId + * @return + */ + public static Boolean checkIsContainsTask(List progressNodes, String taskId) { + if(CollUtil.isEmpty(progressNodes)){ + return Boolean.FALSE; + } + + final Boolean[] res = {Boolean.FALSE}; + progressNodes.forEach(p -> { + if(p.getTaskId().equals(taskId)){ + res[0] = Boolean.TRUE; + return; + } + if(CollUtil.isNotEmpty(p.getChildren()) && + (checkIsContainsTask(p.getChildren(),taskId))){ + res[0] = Boolean.TRUE; + return; + } + }); + return res[0]; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java new file mode 100644 index 0000000..7419c0e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -0,0 +1,1868 @@ +package com.hz.pm.api.todocenter.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.codec.Base64; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +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.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.file.entity.File; +import com.ningdatech.file.entity.vo.result.FileResultVO; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.entity.ExcelExportWriter; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.irs.sign.IRSAPIRequest; +import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; +import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; +import com.hz.pm.api.projectlib.enumeration.*; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.dto.ProjectApplicationDTO; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.signature.entity.CompanySignature; +import com.hz.pm.api.signature.service.ICompanySignatureService; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.service.IRegionService; +import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.enumeration.IsAppendProjectEnum; +import com.hz.pm.api.todocenter.enumeration.IsOrNotEnum; +import com.hz.pm.api.todocenter.handle.PassHandle; +import com.hz.pm.api.todocenter.handle.WithDrawHandle; +import com.hz.pm.api.todocenter.model.dto.AdjustHandleDTO; +import com.hz.pm.api.todocenter.model.dto.PdfGenerateDTO; +import com.hz.pm.api.todocenter.model.dto.SealInfoDTO; +import com.hz.pm.api.todocenter.model.dto.SignReqDTO; +import com.hz.pm.api.todocenter.model.po.TodoCenterStatisticsPO; +import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedExportReq; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedReq; +import com.hz.pm.api.todocenter.model.vo.*; +import com.hz.pm.api.todocenter.service.ITodoService; +import com.hz.pm.api.todocenter.service.StatisticsService; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.hz.pm.api.todocenter.utils.PdfUtils; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.contants.HisProInsEndActId; +import com.wflow.contants.ProcessConstant; +import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.dto.ReqAuditOpinionSaveDTO; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; +import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessInstanceVo; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.bean.vo.ProcessTaskVo; +import com.wflow.workflow.service.ProcessInstanceService; +import com.wflow.workflow.service.ProcessTaskService; +import com.wflow.workflow.utils.ProcessTaskUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.flowable.bpmn.model.BpmnModel; +import org.flowable.bpmn.model.FlowElement; +import org.flowable.bpmn.model.FlowElementsContainer; +import org.flowable.bpmn.model.SubProcess; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RepositoryService; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.task.api.Task; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.flowable.variable.api.history.HistoricVariableInstance; +import org.springframework.beans.BeanUtils; +import org.springframework.mock.web.MockMultipartFile; +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; +import java.io.InputStream; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author ZPF + * @since 2023/02/19 16:09 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class TodoCenterManage { + + private final ProcessTaskService processTaskService; + private final HistoryService historyService; + private final TaskService taskService; + private final IProjectService projectService; + private final ProjectLibManage projectLibManage; + private final ProcessInstanceService processInstanceService; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final IProjectApplicationService projectApplicationService; + private final UserInfoHelper userInfoHelper; + private final BuildUserUtils buildUserUtils; + private final IProjectInstService projectInstService; + private final PdfUtils pdfUtils; + private final FileService fileService; + private final ICompanySignatureService companySignatureService; + private final StatisticsService statisticsService; + private final HandlerManage handlerManage; + private final WithDrawHandle withDrawHandle; + private final PassHandle passHandle; + private final RepositoryService repositoryService; + private final IRegionService regionService; + private final ITodoService todoService; + + /** + * 待办中心待我处理项目列表查询 + * + * @param param + * @author zpf + * @since 2023/02/18 + */ + public PageVo todoProjectList(ToBeProcessedReq param) { + String employeeCode = param.getEmployeeCode(); + if (StringUtils.isBlank(employeeCode)) { + // 获取登录用户ID + Long userId = Optional.ofNullable(param.getLoginUserId()).orElseGet(LoginUserUtil::getUserId); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取员工浙政钉code + if (Objects.nonNull(userFullInfo)) { + employeeCode = userFullInfo.getEmployeeCode(); + } + if (StringUtils.isBlank(employeeCode)) { + return PageVo.empty(); + } + } + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + if (CollUtil.isEmpty(projects)) { + return PageVo.empty(); + } + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + if (CollUtil.isEmpty(instCodes)) { + return PageVo.empty(); + } + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setInstCodes(instCodes); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + req.setProcessDefId(param.getProcessDefId()); + req.setEmployeeCode(employeeCode); + //有待办节点的(不包含退回) + List todoList = processTaskService.getUserTodoList(req); + //有退回待办的 + List backList = processTaskService.getBackTodoList(req); + //合并 并且排序 + List list = Stream.concat(todoList.stream(), backList.stream()) + .filter(Objects::nonNull) + .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()) + .collect(Collectors.toList()); + + if (CollUtil.isEmpty(list)) { + return PageVo.empty(); + } + + List userTodoList = list.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + Set processSet = Sets.newHashSet(); + Map taskMap = userTodoList.stream() + .sorted((t1, t2) -> t2.getTaskCreateTime().compareTo(t1.getTaskCreateTime())) + .collect(Collectors.toList()).stream() + .filter(v -> processSet.add(v.getNodeId())) + .collect(Collectors.toMap(ProcessTaskVo::getNodeId, v -> v)); + + + List resVos = userTodoList.stream().map(d -> { + Project projectInfo = projectInfoMap.get(d.getInstanceId()); + ResToBeProcessedVO res = new ResToBeProcessedVO(); + BeanUtils.copyProperties(projectInfo, res); + res.setInstCode(d.getInstanceId()); + res.setProjectId(projectInfo.getId()); + res.setBuildOrg(projectInfo.getBuildOrgName()); + res.setDeclaredAmount(projectInfo.getDeclareAmount()); + ProcessTaskVo taskVo = taskMap.get(d.getNodeId()); + res.setNodeId(d.getNodeId()); + res.setProcessStatusName(taskVo.getStatus()); + res.setProcessLaunchTime(d.getTaskCreateTime()); + res.setProcessDefName(d.getProcessDefName()); + res.setTaskId(d.getTaskId()); + res.setNodeName(findSubProcessName(d)); + res.setPretrialFileId(projectInfo.getPretrialFileId()); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resVos, list.size()); + } + + private String findSubProcessName(ProcessTaskVo d) { + if (StringUtils.isBlank(d.getProcessDefId())) { + return null; + } + BpmnModel bpmnModel = repositoryService.getBpmnModel(d.getProcessDefId()); + + if (Objects.nonNull(bpmnModel)) { + FlowElement flowElement = bpmnModel.getFlowElement(d.getTaskDefKey()); + FlowElementsContainer parentContainer = flowElement.getParentContainer(); + if (parentContainer instanceof SubProcess) { + return ((SubProcess) parentContainer).getName(); + } + } + return null; + } + + /** + * 待办中心列表导出 + * + * @param response \ + * @param param \ + * @author CMM + * @since 2023/02/01 + */ + public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { + + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取用户全量用户信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + List userTodoList = Lists.newArrayList(); + Map projectInfoMap = MapUtil.newHashMap(); + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + if(StringUtils.isBlank(employeeCode)){ + projects = Collections.emptyList(); + } + if (CollUtil.isNotEmpty(projects)) { + Map projectsMap = CollUtils.listToMap(projects, Project::getId); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList).orderByDesc(ProjectInst::getProjectId)); + projectInstList.forEach(p -> projectInfoMap.put(p.getInstCode(), projectsMap.get(p.getProjectId()))); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setInstCodes(instCodes); + req.setProcessDefId(param.getProcessDefId()); + req.setEmployeeCode(employeeCode); + + // 有待办节点的(不包含退回) + List todoList = processTaskService.getUserTodoList(req); + // 有退回待办的 + List backList = processTaskService.getBackTodoList(req); + // 合并 并且排序 + Stream.of(todoList, backList) + .flatMap(Collection::stream) + .filter(Objects::nonNull) + .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()) + .forEach(userTodoList::add); + } + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + String fileName = null; + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_待我处理_增补项目列表"; + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_待我处理_非增补项目列表"; + } + excelExportWriter.setFileName(fileName); + List sheetsNames = Lists.newArrayList(fileName); + List> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userTodoList, projectInfoMap); + // sheet列表集合 + List>> sheets = Lists.newArrayList(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + } + + /** + * 流程处理相关操作 + * + * @param param + * @return void + * @author CMM + * @since 2023/02/01 + */ + public String handler(ReqProcessHandlerDTO param) { + // 获取登录用户ID + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + // 获取登录用户浙政钉code + String employeeCode = user.getEmployeeCode(); + // 获取入参 + String processInstanceId = param.getInstanceId(); + Long projectId = param.getProjectId(); + VUtils.isTrue(Objects.isNull(processInstanceId)).throwMessage("获取流程实例ID失败!"); + VUtils.isTrue(Objects.isNull(projectId)).throwMessage("获取项目ID失败!"); + + // 获取当前申报项目 + Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + .eq(Project::getInstCode, processInstanceId) + .eq(Project::getId, projectId)); + VUtils.isTrue(Objects.isNull(declaredProject)).throwMessage("获取项目失败!"); + + // 获取当前未处理流程详情 + ProcessProgressVo currentInstanceDetail = processInstanceService.getProgressInstanceDetail(null, processInstanceId); + + // 获取当前要处理的流程实例 + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(processInstanceId) + .singleResult(); + + //提前判断下 是不是 已经被退回了 + checkIsBack(instance); + + //进入处理逻辑 + switch (param.getAction()) { + // 通过 + case PASS: + // 盖章并通过 + case SEAL_PASS: { + //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 + Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); + if (ObjectUtil.isNull(task)) { + return TodoCenterConstant.Handler.TASKID_ERROR; + } + String nodeId = task.getTaskDefinitionKey(); + // 通过该任务,流程到下一审核人处 + processTaskService.handleTask(param, employeeCode); + //通过审核后 所处理的逻辑 + handlerManage.afterPassTodo(declaredProject, instance); + + return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); + } + // 驳回 + case REJECT: { + //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 + Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); + if (ObjectUtil.isNull(task)) { + return TodoCenterConstant.Handler.TASKID_ERROR; + } + // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: + // 【项目名称】的【流程名称】被驳回,请及时处理。 + processTaskService.handleTask(param, employeeCode); + //驳回审核后 所处理的逻辑 + handlerManage.afterRejectTodo(declaredProject, instance); + } + break; + // 退回 + case BACK: { + //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 + Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); + if (ObjectUtil.isNull(task)) { + return TodoCenterConstant.Handler.TASKID_ERROR; + } + // 退回该任务 + processTaskService.handleTaskLs(param, employeeCode); + //退回审核后 所处理的逻辑 + handlerManage.afterBackTodo(declaredProject, instance); + } + break; + // 撤回(流程发起人和当前流程审核人的前一个审核人操作) + case WITHDRAW: { + /** + * 新逻辑 + * 不判断前端传的taskId + * 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批 + */ + if (withDrawHandle.canRootWithDraw(instance, employeeCode)) { + // 登录用户是流程发起人,且是流程发起人撤回 + processTaskService.rootWithdrawTask(param, employeeCode); + //发起人撤回 + handlerManage.rootWithDraw(declaredProject); + } else { + // 2.如果用户不是ROOT发起人 或者 不满足root撤回 那么必定要判断 他是不是上个节点审批人 或者 当前会签已审批的审批人 + // 这里有个小操作 check的同时 把对应的操作人的taskId 也塞入 + VUtils.isTrue(!withDrawHandle.checkUserIsBefore(currentInstanceDetail.getProgressInfo(), param)) + .throwMessage("当前登录用户不是发起人,也不是上一个节点审批人或者当前会签已批审批人 无法进行撤回操作!"); + + //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 + HistoricTaskInstance taskInst = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).finished().singleResult(); + if (ObjectUtil.isNull(taskInst)) { + return TodoCenterConstant.Handler.TASKID_ERROR; + } + String nodeId = taskInst.getTaskDefinitionKey(); + //上个审批人处理逻辑 + processTaskService.lastWithdrawTask(param); + + return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); + } + } + break; + default: + throw new IllegalStateException("Unexpected value: " + param.getAction()); + } + return "操作成功"; + } + + private void checkIsBack(HistoricProcessInstance instance) { + VUtils.isTrue(Objects.nonNull(instance.getBusinessStatus()) && + HisProInsEndActId.BACK.equals(instance.getBusinessStatus())) + .throwMessage("该审核流程已被退回 暂时无法操作!"); + } + + /** + * 调用IRS接口,获取盖章后的pdf文件,上传到OSS,并保存文件ID到项目库中 + * + * @param req + * @param declaredProject + * @param templateName + * @param notSealedFileId + * @return void + * @author CMM + * @since 2023/03/16 21:34 + */ + private Long generateSealedPdf(SealInfoDTO req, Project declaredProject, String templateName, Long notSealedFileId) { + // 获取预审申请单文件,并转换为Base64 + File pdfFile = fileService.getById(notSealedFileId); + InputStream fileInputStream = fileService.getFileInputStream(pdfFile); + String pdfEncode64 = Base64.encode(fileInputStream); + // 装配盖章接口请求参数信息 + SignReqDTO signReq = new SignReqDTO(); + signReq.setPdfEncode64(pdfEncode64); + String originalFileName = pdfFile.getOriginalFileName(); + signReq.setFileName(originalFileName); + Float posX = req.getPosX(); + Float posY = req.getPosY(); + signReq.setPosX(posX); + signReq.setPosY(posY); + String sealSn; + if (Objects.isNull(req.getSealSn())) { + // 获取当前登录签章用户信息 + Long userId = LoginUserUtil.getUserId(); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取印章编号 + CompanySignature companySignature = companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, userFullInfo.getEmpPosUnitCode())); + sealSn = companySignature.getSealSn(); + } else { + // 区县预审时,对有上级条线主管单位并进行了盖章的情况,需要根据上次的印章编号再次盖章 + sealSn = req.getSealSn(); + } + signReq.setSealSn(sealSn); + String posPage = req.getPosPage(); + signReq.setPosPage(posPage); + Integer signType = req.getSignType(); + signReq.setSignType(signType); + // 调用盖章接口,获取盖章后返回的pdf文件字符数组 + String signPdf = IRSAPIRequest.createSignPdf(signReq); + ByteArrayInputStream inputStream = null; + if (Objects.nonNull(signPdf)) { + BASE64Decoder decoder = new BASE64Decoder(); + try { + //转码 + byte[] b = decoder.decodeBuffer(signPdf); + for (int i = 0; i < b.length; ++i) { + if (b[i] < 0) {//调整异常数据 + b[i] += 256; + } + } + inputStream = new ByteArrayInputStream(b); + } catch (Exception e) { + log.error("获取盖章后的pdf文件异常:", e); + } + } + // 转换成MultipartFile + MultipartFile multipartFile; + try { + multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", inputStream); + } catch (IOException e) { + throw new BizException("生成盖章pdf文件失败!"); + } + // 上传OSS + FileResultVO resultVo = fileService.upload(multipartFile, "default"); + // 将返回的文件ID更新到项目库中对应的项目下 + // 根据模版名称判断是预审申请单还是建设方案申请单 + if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || + TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + //放到项目申报书字段 + declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); + declaredProject.setUpdateOn(LocalDateTime.now()); + } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + declaredProject.setConstructFileId(resultVo.getId()); + declaredProject.setConstructFileName(resultVo.getOriginalFileName()); + declaredProject.setUpdateOn(LocalDateTime.now()); + } + projectService.updateById(declaredProject); + return resultVo.getId(); + } + + /** + * 查询流程表单数据及审批的进度步骤 + * + * @param request 请求参数 + * @return 流程进度及表单详情 + */ + public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { + String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); + String instanceId = request.getInstanceId(); + String nodeId = request.getNodeId(); + Long projectId = request.getProjectId(); + String taskId = request.getTaskId(); + ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId, taskId); + + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(progressInstanceDetail)) { + return null; + } + + List progressInfo = progressInstanceDetail.getProgressInfo(); + Boolean isHighLine = Boolean.FALSE; + if (CollUtil.isNotEmpty(progressInfo)) { + buildUserUtils.buildUserByProcessInfo(progressInfo); + isHighLine = checkHighLine(progressInfo, taskId, LoginUserUtil.loginUserDetail()); + } + ProcessProgressDetailVo res = new ProcessProgressDetailVo(); + if(Objects.nonNull(projectInst)){ + Long projectIdThis = projectInst.getProjectId(); + Project project = projectService.getById(projectIdThis); + res.setProjectCode(project.getProjectCode()); + res.setProjectId(projectInst.getProjectId()); + }else{ + res.setProjectId(request.getProjectId()); + } + res.setProcessProgressVo(progressInstanceDetail); + res.setStatus(progressInstanceDetail.getStatus()); + res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId, progressInstanceDetail, request.getTaskId())); + res.setIsHighLine(isHighLine); + res.setConstructionSuggestions(checkConstructionSuggestionsByNodeId(taskId)); + passHandle.checkCanPassOrSeal(request.getInstanceId(), request.getTaskId(), employeeCode, res); + //是不是被 驳回|退回 + res.setIsChange(todoService.isChangeRecord(projectId)); + return res; + } + + private Boolean checkConstructionSuggestionsByNodeId(String taskId) { + if(StringUtils.isNotBlank(taskId)){ + List tasks = taskService.createTaskQuery() + .taskId(taskId) + .orderByTaskId().desc().list(); + if(CollUtil.isNotEmpty(tasks)){ + return tasks.get(0).getTaskDefinitionKey() + .endsWith(StrPool.DASH + ProcessConstant.Field.CONSTRUCTION); + } + } + return Boolean.FALSE; + } + + /** + * 筛选 当前登录人 是不是 上级条线单位的审批 + * + * @param progressInfo + * @param taskId + * @param user + * @return + */ + private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { + if (CollUtil.isEmpty(progressInfo)) { + return Boolean.FALSE; + } + + final Boolean[] res = {Boolean.FALSE}; + progressInfo.forEach(p -> { + //如果是 子流程 + if (Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())) { + //如果不是上级条线单位 根本不用理 + if (!p.getIsHighLine()) { + return; + } + List children = p.getChildren(); + ProgressNode progressNode = children.get(0); + String userId = progressNode.getUserId(); + if (StringUtils.isBlank(userId)) { + return; + } + UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); + if (Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() + .equals(userFullInfoDTO.getEmpPosUnitCode())) { + //说明是此单位的人 + //那么要去看 taskId 是不是 在这个单位内的任务 + Boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); + if (isContainsTask) { + res[0] = Boolean.TRUE; + } + } + } + }); + return res[0]; + } + + + /** + * 待办中心我已处理项目列表查询 + * + * @param param + * @author CMM + * @since 2023/02/03 + */ + public PageVo idoList(ToBeProcessedReq param) { + + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + if (CollUtil.isEmpty(projectIdList)) { + return PageVo.empty(); + } + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + List iDoList = processTaskService.getUserIdoList(req); + if (CollUtil.isEmpty(iDoList)) { + return PageVo.empty(); + } + + List userIdoList = iDoList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List resVos = userIdoList.stream().map(d -> { + ResToBeProcessedVO res = new ResToBeProcessedVO(); + Project projectInfo = projectInfoMap.get(d.getInstanceId()); + BeanUtils.copyProperties(projectInfo, res); + res.setInstCode(d.getInstanceId()); + res.setBuildOrg(projectInfo.getBuildOrgName()); + res.setDeclaredAmount(projectInfo.getDeclareAmount()); + res.setProjectId(projectInfo.getId()); + res.setProcessStatusName(d.getStatus()); + res.setProcessLaunchTime(d.getCreateTime()); + res.setProcessHandleTime(d.getTaskEndTime()); + res.setTaskId(d.getTaskId()); + res.setNodeName(findSubProcessName(d)); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resVos, iDoList.size()); + } + + /** + * 导出我已处理项目列表 + * + * @param response 返回数据流 + * @param param 请求参数 + * @return void + * @author CMM + * @since 2023/02/06 + */ + public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + //因为要解耦 不能把项目和工作流一起查 + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + List userIdoList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + userIdoList = processTaskService.getUserIdoList(req); + } + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + + String fileName = null; + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_我已处理_增补项目列表"; + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_我已处理_非增补项目列表"; + } + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + + List> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userIdoList, projectInfoMap); + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + + } + + /** + * 查询我提交的项目列表 + * + * @param param + * @return com.ningdatech.basic.model.PageVo + * @author CMM + * @since 2023/02/06 + */ + public PageVo mySubmittedList(ToBeProcessedReq param) { + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + if(StringUtils.isBlank(employeeCode)){ + return PageVo.empty(); + } + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + if (CollUtil.isEmpty(projectIdList)) { + return PageVo.empty(); + } + + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + List submittedList = processInstanceService.getUserSubmittedList(req); + + if (CollUtil.isEmpty(submittedList)) { + return PageVo.empty(); + } + + List userSubmittedList = submittedList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List resVos = userSubmittedList.stream().map(d -> { + ResToBeProcessedVO res = new ResToBeProcessedVO(); + Project project = projectInfoMap.get(d.getInstanceId()); + BeanUtils.copyProperties(project, res); + res.setInstCode(d.getInstanceId()); + res.setBuildOrg(project.getBuildOrgName()); + res.setDeclaredAmount(project.getDeclareAmount()); + res.setProjectId(project.getId()); + res.setProcessStatusName(d.getStatus()); + res.setProcessLaunchTime(d.getStartTime()); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resVos, submittedList.size()); + } + + /** + * 待办中心-我发起的项目列表导出 + * + * @param response + * @param param + * @return void + * @author CMM + * @since 2023/02/11 + */ + public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) { + + // 获取登录用户ID + long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + + List userSubmittedList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + + if(StringUtils.isBlank(employeeCode)){ + projects = Collections.emptyList(); + } + + if (CollUtil.isNotEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + userSubmittedList = processInstanceService.getUserSubmittedList(req); + } + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + + String fileName = null; + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_我发起的_增补项目列表"; + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_我发起的_非增补项目列表"; + } + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + // 表体行数据集合 + List> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), userSubmittedList, projectInfoMap); + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + + } + + /** + * 待办中心-抄送我的项目列表查询 + * + * @param param + * @return com.ningdatech.basic.model.PageVo + * @author CMM + * @since 2023/02/11 + */ + public PageVo ccmeList(ToBeProcessedReq param) { + + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + + if (CollUtil.isEmpty(projects)) { + return PageVo.empty(); + } + + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + List ccMeList = processInstanceService.getCcMeList(req); + + if (CollUtil.isEmpty(ccMeList)) { + return PageVo.empty(); + } + + List ccMeInstList = ccMeList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List resVos = ccMeInstList.stream().map(d -> { + ResToBeProcessedVO res = new ResToBeProcessedVO(); + Project project = projectInfoMap.get(d.getInstanceId()); + BeanUtils.copyProperties(project, res); + res.setInstCode(d.getInstanceId()); + res.setNodeId(d.getNodeId()); + res.setProjectId(project.getId()); + res.setBuildOrg(project.getBuildOrgName()); + res.setDeclaredAmount(project.getDeclareAmount()); + res.setProcessStatusName(d.getStatus()); + res.setProcessLaunchTime(d.getStartTime()); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resVos, ccMeList.size()); + } + + /** + * 待办中心-抄送我的项目列表导出 + * + * @param response + * @param param + * @return void + * @author CMM + * @since 2023/02/11 + */ + public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) { + + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + + List ccMeList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::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()); + + // 分页查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + ccMeList = processInstanceService.getCcMeList(req); + } + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + + String fileName = null; + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_抄送我的_增补项目列表"; + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { + fileName = "待办中心_抄送我的_非增补项目列表"; + } + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + // 表体行数据集合 + List> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), ccMeList, projectInfoMap); + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(exportDatas); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(exportDatas); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + + } + + /** + * 被退回项目内容调整并重新通过 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String adjustmentAndHandle(AdjustHandleDTO dto) { + ProjectDTO projectDto = dto.getProjectInfo(); + Project projectInfo = projectService.getById(projectDto.getId()); + + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); + + //项目名称去重 + //项目名称去重 + if (StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())) { + defaultDeclaredProjectManage.checkDuplication(projectDto); + } + projectDto.setProjectCode(projectInfo.getProjectCode()); + defaultDeclaredProjectManage.checkAmount(projectDto); + + //修改项目内容 + if (!modifyProject(projectDto, projectInfo)) { + throw new BusinessException("调整项目失败!"); + } + + //设置 节点的状态 为null 代表继续审核 + List approves = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(dto.getInstanceId()) + .variableNameLike("approve_%") + .list(); + //删除 退回的评论和意见 + handlerManage.deleteBackComments(approves); + + // 更新当前流程状态为审核中 + processTaskService.updateProInstStatus(dto.getInstanceId()); + + return dto.getInstanceId(); + } + + /** + * 要改成 生成新版本号 + * + * @param projectDto + * @return + */ + private Boolean modifyProject(ProjectDTO projectDto, Project oldProject) { + //先修改项目信息 + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projectDto, project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); + project.setId(null); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + projectService.save(project); + + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + + ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class) + .eq(ProjectInst::getProjectId, oldProject.getId()) + .eq(ProjectInst::getInstCode, oldProject.getInstCode())); + + String instCode = oldProject.getInstCode(); + oldInst.setInstCode("EMPTY"); + projectInstService.updateById(oldInst); + + ProjectInst newPi = new ProjectInst(); + newPi.setProjectId(project.getId()); + newPi.setInstType(oldInst.getInstType()); + newPi.setInstCode(instCode); + newPi.setCreatOn(LocalDateTime.now()); + newPi.setUpdateOn(LocalDateTime.now()); + projectInstService.save(newPi); + + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + + //再修改应用信息 + Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() + ? Boolean.TRUE : Boolean.FALSE; + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); + Integer instType = projectInst.getInstType(); + + //批量删除 + List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, project.getVersion()) + .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); + if (CollUtil.isNotEmpty(applicationList)) { + projectApplicationService.removeBatchByIds(applicationList); + List applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList()); +// projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) +// .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); + } + + List applications = projectDto.getApplicationList(); + if (isApp && CollUtil.isNotEmpty(applications)) { + // 添加应用关联的核心业务 + for (ProjectApplicationDTO application : applications) { + ProjectApplication projectApplication = new ProjectApplication(); + BeanUtils.copyProperties(application, projectApplication); + projectApplication.setId(null); + projectApplication.setProjectId(project.getId()); + projectApplication.setProjectCode(project.getProjectCode()); + projectApplication.setProjectVersion(project.getVersion()); + if (!InstTypeEnum.UNIT_INNER_AUDIT.getCode().equals(instType) && + !InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType) && + !InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) { + projectApplication.setIsConstruct(Boolean.TRUE); + } + projectApplication.setProjectVersion(project.getVersion()); + boolean result = projectApplicationService.save(projectApplication); +// // 保存应用关联的核心业务 +// List coreBusinessList = application.getCoreBusinessList(); +// Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; +// if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ +// for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { +// ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); +// BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); +// projectCoreBusinessIndicators.setApplicationId(application.getId()); +// projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); +// } +// } + } + } + return Boolean.TRUE; + } + + /** + * 获取未盖章的预审申请单/建设方案申请单pdf文件 + * + * @param req + * @return java.lang.Long + * @author CMM + * @since 2023/03/16 22:46 + */ + public NotSealedInfoVO getNotSealedPdf(SealInfoDTO req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String empPosUnitCode = user.getEmpPosUnitCode(); + Long projectId = req.getProjectId(); + String auditOpinion = req.getAuditOpinion(); + String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + NotSealedInfoVO notSealedInfoVo = new NotSealedInfoVO(); + // 判断项目盖章审批类型 + Project project = projectService.getById(projectId); + String buildOrgCode = project.getBuildOrgCode(); + String instanceId = project.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + // 如果为预审申报审批 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + // 再根据项目所属区域判断是市级预审还是区县预审 + String areaCode = project.getAreaCode(); + String areaName = project.getArea(); + Long pretrialFileId = project.getPretrialFileId(); + Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, areaCode) + .eq(Region::getRegionName, areaName)); + VUtils.isTrue(Objects.isNull(region)).throwMessage("项目所属区域不存在!"); + Integer regionLevel = region.getRegionLevel(); + if (CommonEnum.LS_SBJ.getDesc().equals(areaName)) { + regionLevel = RegionConst.RL_CITY; + } + // 获取项目申报时是否选择了主管单位和上级条线主管单位 + // 主管单位信息 + Integer isSuperOrg = project.getIsSuperOrg(); + String superOrgCode = project.getSuperOrgCode(); + // 上级条线主管单位信息 + Integer isHigherSuperOrg = project.getIsHigherSuperOrg(); + String higherSuperOrgCode = project.getHigherSuperOrgCode(); + switch (regionLevel) { + // 市级预审(市本级) + case RegionConst.RL_CITY: + // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { + return notSealedInfoVo; + } + String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; + // 设置pdf模板参数 + JSONObject cityParamsMap = assemblyPdfParams(project, cityTemplateName); + // 盖章审核为主管单位审核 + if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 有主管单位信息且登录用户所在单位是主管单位 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, cityParamsMap); + } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, cityParamsMap); + } + Long cityPdfId = generateNotSealedPdf(projectId, cityTemplateName, cityParamsMap); + notSealedInfoVo.setFileId(cityPdfId); + checkAuditOpinion(auditOpinion, notSealedInfoVo); + return notSealedInfoVo; + // 区县预审 + case RegionConst.RL_COUNTY: + String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; + String sealNo = null; + Long notSealedId = null; + // 设置pdf模板参数 + JSONObject countryParamsMap = assemblyPdfParams(project, countryTemplateName); + // 以是否有上级主管单位的维度判断(有上级条线主管单位,才有可能需要盖两次章) + if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) { + // 盖章审核登录用户所在单位为上级条线主管单位,此时为区县预审盖章流程第一个章 + if (empPosUnitCode.equals(higherSuperOrgCode)) { + // 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位, + // 如果项目关联的预审文件ID和上级条线审核意见不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCountryHigherNotSealedInfoVO(pretrialFileId, notSealedInfoVo, + project.getCountryHigherSealAuditOpinion()))) { + return notSealedInfoVo; + } + countryParamsMap.put("higherOrgOpinion", auditOpinion); + countryParamsMap.put("higherOrgAuditDate", auditDate); + // 获取上级条线主管单位印章编号 + CompanySignature companySignature = + companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, higherSuperOrgCode)); + if (Objects.nonNull(companySignature)) { + sealNo = companySignature.getSealSn(); + } + // 保存区县预审上级条线主管单位盖章审核意见、审核日期和盖章编号 + project.setCountryHigherSealNo(sealNo); + project.setCountryHigherSealAuditOpinion(auditOpinion); + project.setCountryHigherSealAuditDate(auditDate); + projectService.updateById(project); + countryParamsMap.put("superOrgOpinion", null); + countryParamsMap.put("superOrgAuditDate", null); + // 直接返回装填了上级条线主管单位意见的未盖章文件 + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + // 盖章审核登录用户所在单位不为上级条线主管单位(可能为选择的主管单位、项目建设单位、其他单位), + // 此时为区县预审盖章流程第二个章 + else if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 有上级条线主管单位信息且有本级主管单位信息 + // 有主管单位信息且登录用户所在单位是主管单位 + // 装配本级主管单位审核意见 + // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, + project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { + return notSealedInfoVo; + } + // 保存区县本级主管单位盖章审核意见、审核日期 + project.setCountrySealAuditOpinion(auditOpinion); + project.setCountrySealAuditDate(auditDate); + projectService.updateById(project); + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); + // 装配上级条线主管单位意见,调用盖章接口, + // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 + SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); + Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); + } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 有上级条线主管单位信息,没有本级主管单位信息 + // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 + // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, + project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { + return notSealedInfoVo; + } + // 保存区县本级主管单位盖章审核意见、审核日期 + project.setCountrySealAuditOpinion(auditOpinion); + project.setCountrySealAuditDate(auditDate); + projectService.updateById(project); + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); + // 装配上级条线主管单位意见,调用盖章接口, + // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 + SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); + Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); + } + } + // 没有上级主管条线单位 + else if (CommonEnum.NO.getCode().equals(isHigherSuperOrg)) { + // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { + return notSealedInfoVo; + } + // 有本级主管单位信息 + if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 登录用户所在单位是本级主管单位,装配本级主管单位审核意见 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); + // 直接返回装配了本级主管单位审核意见的未盖章文件 + countryParamsMap.put("higherOrgOpinion", null); + countryParamsMap.put("higherOrgAuditDate", null); + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + // 没有选主管单位,默认为项目建设单位 + else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); + // 直接返回装配了项目建设单位审核意见的未盖章文件 + countryParamsMap.put("higherOrgOpinion", null); + countryParamsMap.put("higherOrgAuditDate", null); + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + } + notSealedInfoVo.setFileId(notSealedId); + checkAuditOpinion(auditOpinion, notSealedInfoVo); + return notSealedInfoVo; + default: + throw new IllegalStateException("Unexpected value: " + regionLevel); + } + } + // 如果为建设方案申报审批 + else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + Long constructFileId = project.getConstructFileId(); + // 如果项目关联的建设方案文件ID不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCityNotSealedInfoVO(constructFileId, notSealedInfoVo))) { + return notSealedInfoVo; + } + // 设置pdf模板参数 + String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; + JSONObject constructParamsMap = assemblyPdfParams(project, constructTemplateName); + // 审核为指定大数据局盖章 + // 获取流程配置的指定单位信息 + constructParamsMap.put("bigDataBureauOpinion", auditOpinion); + constructParamsMap.put("bigDataBureauAuditDate", auditDate); + Long constructNotFileId = generateNotSealedPdf(projectId, constructTemplateName, constructParamsMap); + notSealedInfoVo.setFileId(constructNotFileId); + checkAuditOpinion(auditOpinion, notSealedInfoVo); + return notSealedInfoVo; + } + return notSealedInfoVo; + } + + private void checkAuditOpinion(String auditOpinion, NotSealedInfoVO notSealedInfoVo) { + if (StringUtils.isNotBlank(auditOpinion)) { + notSealedInfoVo.setIsCommit(Boolean.TRUE); + } + } + + private Boolean getCityNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo) { + if (Objects.nonNull(fileId)) { + notSealedInfoVo.setFileId(fileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return true; + } + return false; + } + + private Boolean getCountryHigherNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String auditOpinion) { + if (Objects.nonNull(fileId) && StringUtils.isNotBlank(auditOpinion)) { + notSealedInfoVo.setFileId(fileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return true; + } + return false; + } + + private Boolean getCountryNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String higherAuditOpinion, + String auditOpinion) { + if (Objects.nonNull(fileId) && StringUtils.isNotBlank(higherAuditOpinion) + && StringUtils.isNotBlank(auditOpinion)) { + notSealedInfoVo.setFileId(fileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return true; + } + return false; + } + + private SealInfoDTO getHigherSealInfoDTO(Project project, JSONObject countryParamsMap) { + String countrySealAuditOpinion = project.getCountryHigherSealAuditOpinion(); + String countrySealAuditDate = project.getCountryHigherSealAuditDate(); + countryParamsMap.put("higherOrgOpinion", countrySealAuditOpinion); + countryParamsMap.put("higherOrgAuditDate", countrySealAuditDate); + SealInfoDTO sealInfoDTO = new SealInfoDTO(); + sealInfoDTO.setPosPage(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_PAGE); + sealInfoDTO.setProjectId(project.getId()); + sealInfoDTO.setPosX(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_X); + sealInfoDTO.setPosY(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_Y); + sealInfoDTO.setSignType(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_SIGN_TYPE); + sealInfoDTO.setSealSn(project.getCountryHigherSealNo()); + return sealInfoDTO; + } + + private void checkEmpPosUnitCode(String empPosUnitCode, String auditOpinion, String auditDate, String orgCode, JSONObject cityParamsMap) { + if (empPosUnitCode.equals(orgCode)) { + cityParamsMap.put("superOrgOpinion", auditOpinion); + cityParamsMap.put("superOrgAuditDate", auditDate); + } else { + cityParamsMap.put("superOrgOpinion", null); + cityParamsMap.put("superOrgAuditDate", null); + } + } + + private Long generateNotSealedPdf(Long projectId, String templateName, JSONObject paramsMap) { + // 获取本地目录的pdf模板 + String fileName; + if (templateName.contains(StrPool.DASH)) { + int index = templateName.indexOf(StrPool.DASH); + fileName = templateName.substring(index + 1); + } else { + fileName = templateName; + } + InputStream htmlInputStream = + this.getClass().getClassLoader().getResourceAsStream("template" + java.io.File.separator + templateName + ".html"); + // 生成pdf字节数组 + byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); + + // 转换成MultipartFile + MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); + + // 上传OSS + FileResultVO resultVo = fileService.upload(multipartFile, "default"); + + // 将带审核意见的返回的文件ID更新到项目库中对应的项目下 + Project declaredProject = projectService.getById(projectId); + // 根据模版名称判断是预审申请单还是建设方案申请单 + String superOrgOpinion = paramsMap.getString("superOrgOpinion"); + String higherOrgOpinion = paramsMap.getString("higherOrgOpinion"); + if (StringUtils.isNotBlank(superOrgOpinion) || StringUtils.isNotBlank(higherOrgOpinion)) { + if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || + TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + //放到项目申报书字段 + declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); + declaredProject.setUpdateOn(LocalDateTime.now()); + } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + declaredProject.setConstructFileId(resultVo.getId()); + declaredProject.setConstructFileName(resultVo.getOriginalFileName()); + declaredProject.setUpdateOn(LocalDateTime.now()); + } + projectService.updateById(declaredProject); + } + try { + if (null != htmlInputStream) { + htmlInputStream.close(); + } + + // 删除输出文件夹下的临时文件 + java.io.File directory = new java.io.File(""); + //pdf输出路径 + String filePath = directory.getAbsolutePath() + java.io.File.separator + "fileout"; + java.io.File directoryPath = new java.io.File(filePath); + FileUtils.cleanDirectory(directoryPath); + } catch (IOException e) { + log.error(e.getMessage()); + } + + // 返回文件id供前端下载 + return resultVo.getId(); + } + + /** + * 装配pdf模板参数 + * + * @param project + * @param templateName + * @return com.alibaba.fastjson.JSONObject + * @author CMM + * @since 2023/03/16 22:28 + */ + private JSONObject assemblyPdfParams(Project project, String templateName) { + // 获取本地目录的pdf模板 + String fileName; + if (templateName.contains(StrPool.DASH)) { + int index = templateName.indexOf(StrPool.DASH); + fileName = templateName.substring(index + 1); + } else { + fileName = templateName; + } + Long projectId = project.getId(); + // 获取表单数据 + PdfGenerateDTO pdfGenerateDTO = new PdfGenerateDTO(); + BeanUtils.copyProperties(project, pdfGenerateDTO); + + JSONObject paramsMap = JSONObject.parseObject(JSONObject.toJSONString(pdfGenerateDTO)); + // 设置title + String title = "【" + project.getProjectName() + "】" + fileName; + paramsMap.put("title", title); + // 获取预审申报的开始时间 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId, projectId) + .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) + .orderByDesc(ProjectInst::getCreatOn) + .last("limit 1")); + LocalDateTime time = null; + if (Objects.nonNull(projectInst)) { + time = projectInst.getCreatOn(); + paramsMap.put("time", NdDateUtils.format(time, "yyyy-MM-dd HH:mm")); + } else { + paramsMap.put("time", null); + } + // 获取是否临时增补项目 + String isTemporaryAugment = IsOrNotEnum.getDescByCode(project.getIsTemporaryAugment()); + paramsMap.put("isTemporaryAugment", isTemporaryAugment); + // 获取项目类型 + String projectType = project.getProjectType(); + paramsMap.put("projectType", ProjectTypeNewEnum.getDesc(projectType)); + // 获取是否首次新建 + String isFirst = IsOrNotEnum.getDescByCode(project.getIsFirst()); + paramsMap.put("isFirst", isFirst); + // 获取是否一地创新全省共享项目 + Boolean isInnovateWholeProvinceShare = project.getIsInnovateWholeProvinceShare(); + paramsMap.put("isInnovateWholeProvinceShare", Boolean.TRUE.equals(isInnovateWholeProvinceShare) ? + IsOrNotEnum.IS.getDesc() : IsOrNotEnum.NOT.getDesc()); + // 获取项目建设起始时间 + String beginTime = project.getBeginTime(); + String endTime = project.getEndTime(); + String beginAndEndTime = beginTime + StrUtil.DASHED + endTime; + paramsMap.put("beginAndEndTime", beginAndEndTime); + // 获取四大体系 + String fourSystem = FourSystemEnum.getDescByCode(project.getFourSystems()); + paramsMap.put("fourSystems", fourSystem); + // 获取是否数字化改革项目 + String isDigitalReform = IsOrNotEnum.getDescByCode(project.getIsDigitalReform()); + paramsMap.put("isDigitalReform", isDigitalReform); + if (IsOrNotEnum.NOT.getDesc().equals(isDigitalReform)) { + paramsMap.put("bizDomain", null); + } else { + paramsMap.put("bizDomain", BizDomainEnum.getDescByCode(project.getBizDomain())); + } + // 获取是否上云 + String isCloud = IsOrNotEnum.getDescByCode(project.getIsCloud()); + paramsMap.put("isCloud", isCloud); + if (IsOrNotEnum.NOT.getDesc().equals(isCloud)) { + paramsMap.put("cloudType", null); + } else { + String cloudType = project.getCloudType(); + String cloudTypeName; + // 云类型为多选 + if (cloudType.contains(StrPool.COMMA)) { + cloudTypeName = Arrays.stream(cloudType.split(StrPool.COMMA)) + .map(s -> CloudTypeEnum.getDescByCode(Integer.valueOf(s))) + .collect(Collectors.joining(StrPool.COMMA)); + + } else { + cloudTypeName = CloudTypeEnum.getDescByCode(Integer.valueOf(cloudType)); + } + paramsMap.put("cloudType", cloudTypeName); + } + // 获取本年计划投资金额 + BigDecimal yearPlanInvest = project.getAnnualPlanAmount(); + paramsMap.put("yearPlanInvest", yearPlanInvest); + // 根据地区编码获取当地大数据局(中心)的名称 + paramsMap.put("bigDataBureauName", null); + // 备注模块如果为空 + if (Objects.isNull(pdfGenerateDTO.getProjectRemarks())) { + paramsMap.put("projectRemarks", null); + } + + // 获取立项依据 + String buildBasis = project.getBuildBasis(); + StringBuilder builder = new StringBuilder(); + List fileArray = JSON.parseArray(buildBasis, JSONObject.class); + for (JSONObject jsonObject : fileArray) { + String titleStr = jsonObject.getString(CommonConst.TITLE); + builder.append(CommonConst.ITEM_BASED); + builder.append(titleStr); + builder.append(StrPool.SPACE); + String fileNameStr = jsonObject.getString(CommonConst.FILE_NAME_STR); + builder.append(CommonConst.ITEM_BASED_FILE_NAME); + builder.append(fileNameStr); + builder.append(StrPool.SPACE); + String fileInfo = jsonObject.getString(CommonConst.FILE_LIST); + List fileInfoArray = JSON.parseArray(fileInfo, JSONObject.class); + List nameList = CollUtils.fieldList(fileInfoArray, w -> w.getString(CommonConst.FILE_NAME)); + String appendixStr = String.join(StrPool.COMMA, nameList); + builder.append(CommonConst.APPENDIX); + builder.append(appendixStr); + builder.append(StrPool.SEMICOLON); + builder.append(StrPool.NEWLINE); + } + String buildBasisList = builder.toString(); + paramsMap.put("buildBasisList", buildBasisList); + + return paramsMap; + } + + public Long getSealedPdf(SealInfoDTO req) { + Long projectId = req.getProjectId(); + Long notSealedFileId = req.getNotSealedFileId(); + Project declaredProject = projectService.getById(projectId); + String instanceId = declaredProject.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + // 如果为预审申报审批 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + // 再根据项目所属区域判断是市级预审还是区县预审 + String areaCode = declaredProject.getAreaCode(); + String areaName = declaredProject.getArea(); + Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, areaCode) + .eq(Region::getRegionName, areaName)); + if (Objects.isNull(region)) { + throw new BizException("项目所属区域不存在!"); + } + Integer regionLevel = region.getRegionLevel(); + if (CommonEnum.LS_SBJ.getDesc().equals(areaName)) { + regionLevel = RegionConst.RL_CITY; + } + switch (regionLevel) { + // 市级预审(市本级) + case RegionConst.RL_CITY: + String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; + return generateSealedPdf(req, declaredProject, cityTemplateName, notSealedFileId); + // 区县预审 + case RegionConst.RL_COUNTY: + String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; + return generateSealedPdf(req, declaredProject, countryTemplateName, notSealedFileId); + default: + throw new IllegalStateException("Unexpected value: " + regionLevel); + } + } + // 如果为建设方案申报审批 + else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + // 设置pdf模板参数 + String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; + return generateSealedPdf(req, declaredProject, constructTemplateName, notSealedFileId); + } + return null; + } + + //获取当前登录人的 待办中心统计数据 + public TodoCenterStatisticsVO todoCenterStatistics(String employeeCode) { + //为了查询效率 还是自己去写统计接口 + TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); + return BeanUtil.copyProperties(statistics, TodoCenterStatisticsVO.class); + } + + public TodoNumVO getTodoNums(ToBeProcessedReq param) { + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取员工浙政钉code + TodoNumVO todoNumVo = new TodoNumVO(); + String employeeCode = userFullInfo.getEmployeeCode(); + if (StringUtils.isBlank(employeeCode)) { + return todoNumVo; + } + + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + BeanUtils.copyProperties(param, projectListReq); + List projects = projectLibManage.projectList(projectListReq); + if (CollUtil.isEmpty(projects)) { + return todoNumVo; + } + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::getProjectId)); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setInstCodes(instCodes); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); + //有待办节点的(不包含退回) + List todoList = processTaskService.getUserTodoList(req); + //有退回待办的 + List backList = processTaskService.getBackTodoList(req); + //合并 并且排序 + List list = Stream.concat(todoList.stream(), backList.stream()) + .filter(Objects::nonNull) + .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime) + .reversed()) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(list)) { + return todoNumVo; + } + + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + 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 projectList = list.stream() + .map(d -> projectInfoMap.get(d.getInstanceId())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(projectList)) { + todoNumVo.setTotalNum(projectList.size()); + } + // 筛选出增补项目和非增补项目 + List appendProjects = projectList.stream() + .filter(p -> IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(appendProjects)) { + todoNumVo.setAppendNum(appendProjects.size()); + } + List notAppendProjects = projectList.stream() + .filter(p -> IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(notAppendProjects)) { + todoNumVo.setNotAppendNum(notAppendProjects.size()); + } + return todoNumVo; + } + + /** + * 寻找下一个审核task + * + * @param instance + * @return + */ + private String findNextTaskId(HistoricProcessInstance instance, String employeeCode, String nodeId, String taskId) { + BpmnModel bpmnModel = repositoryService.getBpmnModel(instance.getProcessDefinitionId()); + Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); + String subProcessId = subNodeMap.get(nodeId); + Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); + List nodeIds = allSubNodeMap.get(subProcessId); + + List tasks = taskService.createTaskQuery() + .processInstanceId(instance.getId()) + .taskAssignee(employeeCode) + .taskDefinitionKeys(nodeIds) + .orderByTaskCreateTime() + .asc() + .list(); + if (CollUtil.isEmpty(tasks)) { + //如果此子单位为空 那就直接再查下 他的其它任务 + List currentTasks = taskService.createTaskQuery() + .processInstanceId(instance.getId()) + .taskAssignee(employeeCode) + .orderByTaskCreateTime() + .asc() + .list(); + if (CollUtil.isNotEmpty(currentTasks)) { + return currentTasks.get(0).getId(); + } + return taskId; + } + return tasks.get(0).getId(); + } + + /** + * 取当前用户的下一个taskId + * + * @param instanceId + * @return + */ + public String todoTaskId(String instanceId) { + String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); + List tasks = taskService.createTaskQuery() + .processInstanceId(instanceId) + .taskAssignee(employeeCode) + .orderByTaskCreateTime() + .asc() + .list(); + if (CollUtil.isEmpty(tasks)) { + return null; + } + return tasks.get(0).getId(); + } + + public Object saveAuditOpinion(ReqAuditOpinionSaveDTO param) { + // 获取登录用户ID + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + // 获取登录用户浙政钉code + String employeeCode = user.getEmployeeCode(); + + //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 + Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); + if (ObjectUtil.isNull(task)) { + return TodoCenterConstant.Handler.TASKID_ERROR; + } + return processTaskService.saveAuditOpinion(param, employeeCode); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.java new file mode 100644 index 0000000..eb1e77a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.todocenter.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.todocenter.model.po.TodoCenterStatisticsPO; +import org.apache.ibatis.annotations.Param; + +public interface StatisticsMapper extends BaseMapper { + + + TodoCenterStatisticsPO getStatistics(@Param("employeeCode") String employeeCode); + + TodoCenterStatisticsPO getTodoOrIdo(@Param("employeeCode") String employeeCode); + + TodoCenterStatisticsPO mysubmitNum(@Param("employeeCode") String employeeCode); + + TodoCenterStatisticsPO ccNums(@Param("employeeCode") String employeeCode); + + TodoCenterStatisticsPO getIdo(@Param("employeeCode") String employeeCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.xml new file mode 100644 index 0000000..83166b1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/mapper/StatisticsMapper.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java new file mode 100644 index 0000000..353fc50 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.todocenter.model.dto; + +import java.io.Serializable; +import java.util.Map; + +import javax.validation.constraints.NotNull; + +import com.google.common.collect.Maps; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; + +import cn.hutool.core.collection.CollUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname DefaultDeclaredDTO + * @Description + * @Date 2023/2/14 17:16 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AdjustHandleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @ApiModelProperty("项目信息") + private ProjectDTO projectInfo; + + @ApiModelProperty("表单信息 新增模块") + private Map formData; + + public Map getFormData(){ + if(CollUtil.isEmpty(this.formData)){ + this.formData = Maps.newHashMap(); + return this.formData; + } + return this.formData; + } + @ApiModelProperty("项目ID") + @NotNull(message = "要处理的项目ID不能为空!") + private Long projectId; + + @NotNull(message = "流程实例ID不能为空!") + private String instanceId; + + @ApiModelProperty("任务ID") + @NotNull(message = "任务ID不能为空!") + private String taskId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/PdfGenerateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/PdfGenerateDTO.java new file mode 100644 index 0000000..bf7e0ec --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/PdfGenerateDTO.java @@ -0,0 +1,149 @@ +package com.hz.pm.api.todocenter.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.math.BigDecimal; + +/** + * pdf生成实体 + * + * @author CMM + * @since 2023/03/13 14:24 + */ +@Data +public class PdfGenerateDTO { + @ApiModelProperty("应用ID") + private Long id; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("是否临时增补 0:否 1:是") + private String isTemporaryAugment; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private String projectType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private String isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("项目建设起止时间") + private String beginAndEndTime; + + @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") + private String fourSystems; + + @ApiModelProperty("是否数字化改革项目 0:否 1:是") + private String isDigitalReform; + + @ApiModelProperty("综合业务领域") + private String bizDomain; + + @ApiModelProperty("立项依据") + private String buildBasisList; + + + @ApiModelProperty("是否上云 0:否 1:是") + private String isCloud; + + private String cloudType; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer protectionLevel; + + @ApiModelProperty("是否密评 0:否 1:是") + private Integer isSecretComments; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("资金申报情况-自有金额(万元)") + private BigDecimal declareHaveAmount; + + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + private BigDecimal declareGovOwnFinanceAmount; + + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + private BigDecimal declareGovSuperiorFinanceAmount; + + @ApiModelProperty("银行贷款(万元)") + private BigDecimal declareBankLendingAmount; + + @ApiModelProperty("其它资金(万元)") + private BigDecimal declareOtherAmount; + + @ApiModelProperty("资金分配情况-软件开发(万元)") + private BigDecimal softwareDevelopmentAmount; + + @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + private BigDecimal cloudHardwarePurchaseAmount; + + @ApiModelProperty("资金分配情况-第三方服务(万元)") + private BigDecimal thirdPartyAmount; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + @ApiModelProperty("年度支付计划-银行贷款(万元)") + private BigDecimal annualPlanBankLendingAmount; + + @ApiModelProperty("年度支付计划-其它资金(万元)") + private BigDecimal annualPlanOtherAmount; + + @ApiModelProperty("备注") + private String projectRemarks; + + @ApiModelProperty("附件-是否开启 false:关闭 true:开启") + private Boolean isAccessories; + + @ApiModelProperty("备注-是否开启 false:关闭 true:开启") + private Boolean isRemarks; + + @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") + private Boolean isAnnualPlanAmount; + + @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") + private Boolean isInnovateWholeProvinceShare; + + @ApiModelProperty("本地区大数据局名称") + private String bidDataBureauName; + + @ApiModelProperty("年度计划投资") + private BigDecimal yearPlanInvest; + + @ApiModelProperty("21位项目编号") + private String projectCode; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java new file mode 100644 index 0000000..f50c314 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.todocenter.model.dto; + +import com.hz.pm.api.sys.model.dto.AbstractMsgExtraDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 项目审核工作通知信息实体 + * + * @author CMM + * @since 2023/04/12 16:13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ProjectAuditMsgExtraDTO extends AbstractMsgExtraDTO { + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("流程实例ID") + private String instanceId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResCcMeExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResCcMeExportDTO.java new file mode 100644 index 0000000..90d0af3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResCcMeExportDTO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.todocenter.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心抄送我的项目列表导出实体 + * + * @author CMM + * @since 2023/01/19 16:42 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ResCcMeExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申报单位") + private String reportUnitName; + + @ExcelProperty("申报金额") + private Integer reportAmount; + + @ExcelProperty("预算年度") + private Integer budgetYear; + + @ExcelProperty("流程状态") + private String processStatusName; + + @ExcelProperty("发起时间") + private LocalDateTime processLaunchTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResHandledExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResHandledExportDTO.java new file mode 100644 index 0000000..6c60966 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResHandledExportDTO.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.todocenter.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心我已处理项目列表导出实体 + * + * @author CMM + * @since 2023/01/19 16:42 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ResHandledExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申报单位") + private String reportUnitName; + + @ExcelProperty("申报金额") + private Integer reportAmount; + + @ExcelProperty("预算年度") + private Integer budgetYear; + + @ExcelProperty("流程状态") + private String processStatusName; + + @ExcelProperty("发起时间") + private LocalDateTime processLaunchTime; + + @ExcelProperty("处理时间") + private LocalDateTime processHandleTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResMySubmittedExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResMySubmittedExportDTO.java new file mode 100644 index 0000000..0426593 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ResMySubmittedExportDTO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.todocenter.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心我发起的项目列表导出实体 + * + * @author CMM + * @since 2023/01/19 16:42 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ResMySubmittedExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申报单位") + private String reportUnitName; + + @ExcelProperty("申报金额") + private Integer reportAmount; + + @ExcelProperty("预算年度") + private Integer budgetYear; + + @ExcelProperty("流程状态") + private String processStatusName; + + @ExcelProperty("发起时间") + private LocalDateTime processLaunchTime; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SealInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SealInfoDTO.java new file mode 100644 index 0000000..948ee89 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SealInfoDTO.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.todocenter.model.dto; + +import lombok.Data; + +/** + * 调用天印外部接口签章所需信息 + * + * @author CMM + * @since 2023/03/16 17:01 + */ +@Data +public class SealInfoDTO { + + /** + * 项目ID + */ + private Long projectId; + /** + * 印章x坐标 + */ + private Float posX; + /** + * 印章y坐标 + */ + private Float posY; + + /** + * 页码 + */ + private String posPage; + + /** + * 签署类型 + */ + private Integer signType; + + /** + * 印章编号 + */ + private String sealSn; + + /** + * 盖章审核意见 + */ + private String auditOpinion; + + /** + * 未盖章文件ID + */ + private Long notSealedFileId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SignReqDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SignReqDTO.java new file mode 100644 index 0000000..e72f4f0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/SignReqDTO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.todocenter.model.dto; + +import lombok.Data; + +/** + * 印章信息及位置坐标 + * + * @author CMM + * @since 2023/03/16 11:56 + */ +@Data +public class SignReqDTO { + + private String pdfEncode64; + + private Float posX; + + private Float posY; + + private String sealSn; + + private String fileName; + + private String posPage; + + private Integer signType; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/po/TodoCenterStatisticsPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/po/TodoCenterStatisticsPO.java new file mode 100644 index 0000000..06cf23c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/po/TodoCenterStatisticsPO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.todocenter.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname TodoCenterStatisticsPO + * @Description + * @Date 2023/3/20 11:51 + * @Author PoffyZhang + */ +@Data +public class TodoCenterStatisticsPO { + + @ApiModelProperty("待处理数") + private Integer todoNum = 0; + @ApiModelProperty("已处理数") + private Integer idoNum = 0; + @ApiModelProperty("我发起数") + private Integer mysubmitNum = 0; + @ApiModelProperty("抄送我数") + private Integer ccmeNum = 0; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ProcessDetailReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ProcessDetailReq.java new file mode 100644 index 0000000..c6af868 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ProcessDetailReq.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.todocenter.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; + +/** + * 流程处理进度详情请求参数 + * + * @author CMM + * @since 2023/02/24 10:15 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ProcessDetailReq { + + @ApiModelProperty("流程实例ID") + @NotNull(message = "流程实例不能为空") + private String instanceId; + + @ApiModelProperty("流程节点ID") + private String nodeId; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("任务ID") + private String taskId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedExportReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedExportReq.java new file mode 100644 index 0000000..6536d59 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedExportReq.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.todocenter.model.req; + +import java.util.List; + +import com.hz.pm.api.common.enumeration.ExportOptionEnum; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心-导出查询实体信息 + * + * @author zpf + * @since 2023/02/18 16:01 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ToBeProcessedExportReq extends ToBeProcessedReq { + + @ApiModelProperty("导出选项") + private List exportOptionList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java new file mode 100644 index 0000000..fb379d5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.todocenter.model.req; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 待办中心-列表查询实体信息 + * + * @author zpf + * @since 2023/02/19 16:01 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ToBeProcessedReq extends PagePo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMin; + + @ApiModelProperty("创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime createOnMax; + + @ApiModelProperty(value = "是否增补项目") + private Integer isTemporaryAugment; + + @ApiModelProperty("流程配置ID") + private String processDefId; + + @ApiModelProperty("登录人员工号") + private String employeeCode; + + private Long loginUserId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/NotSealedInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/NotSealedInfoVO.java new file mode 100644 index 0000000..f016c58 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/NotSealedInfoVO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.todocenter.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取未盖章pdf文件接口返回信息 + * @return + * @author CMM + * @since 2023/07/15 16:53 + */ +@Data +public class NotSealedInfoVO { + + @ApiModelProperty("未盖章PDF文件ID") + private Long fileId; + + @ApiModelProperty("是否提交了审核意见") + private Boolean isCommit = Boolean.FALSE; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ProcessProgressDetailVo.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ProcessProgressDetailVo.java new file mode 100644 index 0000000..77c5bfe --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ProcessProgressDetailVo.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.todocenter.model.vo; + + +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 流程进展详情实体 + * + * @author CMM + * @since 2023/01/30 17:21 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ProcessProgressDetailVo { + + /** + * 流程处理详情 + */ + private ProcessProgressVo processProgressVo; + /** + * 流程状态 + */ + private String status; + /** + * 项目ID + */ + private Long projectId; + + /** + * 项目编号 + */ + private String projectCode; + + /** + * 能否撤回 + */ + private Boolean canWithdraw = Boolean.FALSE; + + /** + * 能否通过 + */ + private Boolean canPass = Boolean.FALSE; + + /** + * 能否盖章 + */ + private Boolean canSeal = Boolean.FALSE; + + /** + * 能否驳回 + */ + private Boolean canReject = Boolean.FALSE; + + /** + * 当前审批人 是不是流程配置里的 上级条线主管 + */ + private Boolean isHighLine = Boolean.FALSE; + + /** + * 当前项目 是不是被 驳回|退回过 + */ + private Boolean isChange = Boolean.FALSE; + + private Boolean constructionSuggestions = Boolean.FALSE; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ResToBeProcessedVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ResToBeProcessedVO.java new file mode 100644 index 0000000..dbf691f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/ResToBeProcessedVO.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.todocenter.model.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 待办中心-待我处理返回实体信息 + * + * @author CMM + * @since 2023/01/12 14:57 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ExcelIgnoreUnannotated +public class ResToBeProcessedVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("流程实例编号") + private String instCode; + + @ApiModelProperty("待处理节点ID") + private String nodeId; + + @ApiModelProperty("任务ID") + private String taskId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("大节点名称(单位配置的名字)") + private String nodeName; + + @ApiModelProperty("建设单位名称") + private String buildOrg; + + @ApiModelProperty("建设单位统一社会信用代码") + private String buildOrgCode; + + @ApiModelProperty("申报金额") + private BigDecimal declaredAmount; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("流程状态") + private Integer processStatus; + + @ApiModelProperty("流程状态名称") + private String processStatusName; + + @ApiModelProperty("流程发起时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private Date processLaunchTime; + + @ApiModelProperty("流程处理时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private Date processHandleTime; + + @ApiModelProperty("流程定义名称") + private String processDefName; + + @ApiModelProperty("项目预审申请单文件ID") + private Long pretrialFileId; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoCenterStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoCenterStatisticsVO.java new file mode 100644 index 0000000..55291bd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoCenterStatisticsVO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.todocenter.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Classname TodoCenterStatistics + * @Description + * @Date 2023/3/20 11:02 + * @Author PoffyZhang + */ +@Data +public class TodoCenterStatisticsVO { + + @ApiModelProperty("待处理数") + private Integer todoNum; + @ApiModelProperty("已处理数") + private Integer idoNum; + @ApiModelProperty("我发起数") + private Integer mysubmitNum; + @ApiModelProperty("抄送我数") + private Integer ccmeNum; + + @ApiModelProperty("待我处理列表 5个") + private List todoList; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoNumVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoNumVO.java new file mode 100644 index 0000000..900c31b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoNumVO.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.todocenter.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心待我处理数量统计 + * + * @author CMM + * @since 2023/04/12 16:51 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TodoNumVO { + + @ApiModelProperty("待我处理总数量") + private Integer totalNum = 0; + + @ApiModelProperty("待我处理非增补项目总数量") + private Integer notAppendNum = 0; + + @ApiModelProperty("待我处理非增补项目总数量") + private Integer appendNum = 0; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoVO.java new file mode 100644 index 0000000..6c65ff2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/vo/TodoVO.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.todocenter.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname TodoVO + * @Description + * @Date 2023/3/20 11:04 + * @Author PoffyZhang + */ +@Data +public class TodoVO { + + @ApiModelProperty("项目工作流nodeId") + private String nodeId; + @ApiModelProperty("项目ID") + private Long projectId; + @ApiModelProperty("项目名称") + private String projectName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java new file mode 100644 index 0000000..c86872e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.todocenter.service; + +import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; +import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVo; + +/** + * @Classname ITodoService + * @Description + * @Date 2023/7/25 15:41 + * @Author PoffyZhang + */ +public interface ITodoService { + /** + * 获取事例详情 + * @param request + * @return + */ + ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) ; + + Boolean isChangeRecord(Long projectId) ; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java new file mode 100644 index 0000000..99726e6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.todocenter.service; + +import com.hz.pm.api.todocenter.model.po.TodoCenterStatisticsPO; + +/** + * @Classname StatisticsService + * @Description + * @Date 2023/3/20 11:20 + * @Author PoffyZhang + */ +public interface StatisticsService { + + //根据用户id 去查询 一些统计数据 + TodoCenterStatisticsPO getStatistics(String employeeCode); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java new file mode 100644 index 0000000..b4e6189 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.todocenter.service.impl; + +import com.hz.pm.api.todocenter.mapper.StatisticsMapper; +import com.hz.pm.api.todocenter.model.po.TodoCenterStatisticsPO; +import com.hz.pm.api.todocenter.service.StatisticsService; +import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; +import com.wflow.workflow.service.ProcessTaskService; +import lombok.AllArgsConstructor; +import org.flowable.engine.TaskService; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @Classname StatisticsService + * @Description + * @Date 2023/3/20 11:20 + * @Author PoffyZhang + */ +@Service +@AllArgsConstructor +public class StatisticsServiceImpl implements StatisticsService { + + private final StatisticsMapper mapper; + + private final ProcessTaskService processTaskService; + + private final TaskService taskService; + + @Override + public TodoCenterStatisticsPO getStatistics(String employeeCode) { + TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); + + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setEmployeeCode(employeeCode); + Integer todoCount = processTaskService.getTodoCount(req); + res.setTodoNum(todoCount); + + Integer idoCount = processTaskService.getUserIdoCount(req); + res.setIdoNum(idoCount); + + TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); + if(Objects.nonNull(submit)){ + res.setMysubmitNum(submit.getMysubmitNum()); + } + + TodoCenterStatisticsPO ccMe = mapper.ccNums(employeeCode); + if(Objects.nonNull(ccMe)){ + res.setCcmeNum(ccMe.getCcmeNum()); + } + + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java new file mode 100644 index 0000000..09c24e2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -0,0 +1,170 @@ +package com.hz.pm.api.todocenter.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.todocenter.handle.PassHandle; +import com.hz.pm.api.todocenter.handle.WithDrawHandle; +import com.hz.pm.api.todocenter.manage.HandlerManage; +import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; +import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVo; +import com.hz.pm.api.todocenter.service.ITodoService; +import com.hz.pm.api.todocenter.utils.BuildUserUtils; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.wflow.workflow.bean.process.ProgressNode; +import com.wflow.workflow.bean.process.enums.NodeTypeEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.service.ProcessInstanceService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + * @Classname TodoService + * @Description + * @Date 2023/7/25 15:41 + * @Author PoffyZhang + */ +@Service +@AllArgsConstructor +@Slf4j +public class TodoServiceImpl implements ITodoService { + + private final ProcessInstanceService processInstanceService; + + private final BuildUserUtils buildUserUtils; + + private final UserInfoHelper userInfoHelper; + + private final WithDrawHandle withDrawHandle; + + private final PassHandle passHandle; + + private final IProjectService projectService; + + private final IProjectInstService projectInstService; + + /** + * 查询流程表单数据及审批的进度步骤 + * + * @param request 请求参数 + * @return 流程进度及表单详情 + */ + @Override + public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { + String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); + String instanceId = request.getInstanceId(); + String nodeId = request.getNodeId(); + Long projectId = request.getProjectId(); + String taskId = request.getTaskId(); + ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId,taskId); + + if(Objects.isNull(progressInstanceDetail)){ + return null; + } + + List progressInfo = progressInstanceDetail.getProgressInfo(); + Boolean isHighLine = Boolean.FALSE; + if (CollUtil.isNotEmpty(progressInfo)){ + buildUserUtils.buildUserByProcessInfo(progressInfo); + isHighLine = checkHighLine(progressInfo,taskId,LoginUserUtil.loginUserDetail()); + } + ProcessProgressDetailVo res = new ProcessProgressDetailVo(); + res.setProcessProgressVo(progressInstanceDetail); + res.setStatus(progressInstanceDetail.getStatus()); + res.setProjectId(projectId); + res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId,progressInstanceDetail,request.getTaskId())); + res.setIsHighLine(isHighLine); + passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); + //是不是被 驳回|退回 + res.setIsChange(isChangeRecord(projectId)); + return res; + } + + /** + * 筛选 当前登录人 是不是 上级条线单位的审批 + * @param progressInfo + * @param taskId + * @param user + * @return + */ + private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { + if(CollUtil.isEmpty(progressInfo)){ + return Boolean.FALSE; + } + + final Boolean[] res = {Boolean.FALSE}; + progressInfo.forEach(p -> { + //如果是 子流程 + if(Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())){ + //如果不是上级条线单位 根本不用理 + if(!p.getIsHighLine()){ + return; + } + List children = p.getChildren(); + ProgressNode progressNode = children.get(0); + String userId = progressNode.getUserId(); + if(StringUtils.isBlank(userId)){ + return; + } + UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); + if(Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() + .equals(userFullInfoDTO.getEmpPosUnitCode())){ + //说明是此单位的人 + //那么要去看 taskId 是不是 在这个单位内的任务 + Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); + if(isContainsTask){ + res[0] = Boolean.TRUE; + return; + } + } + } + }); + return res[0]; + } + + /** + * 判断 当前项目是不是被驳回 或者 退回过 + * @param projectId + * @return + */ + @Override + public Boolean isChangeRecord(Long projectId) { + //1.先判断下 项目存不存在 + Project project = projectService.getById(projectId); + if(Objects.isNull(project)){ + return Boolean.FALSE; + } + + List projectIds = projectService.getAllVersionProjectId(project); + //2.要判断 项目在当前状态 有没有被驳回和退回过 + //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 + List pis = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIds) + .orderByDesc(ProjectInst::getInstType) + .last("limit 2")); + 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; + } + + return Boolean.TRUE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java new file mode 100644 index 0000000..d696ed4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java @@ -0,0 +1,53 @@ +package com.hz.pm.api.todocenter.utils; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Sets; +import com.hz.pm.api.user.manage.UserInfoManage; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import com.wflow.workflow.bean.process.ProgressNode; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 装配节点用户信息工具类 + * + * @author CMM + * @since 2023/03/08 11:52 + */ +@Slf4j +@RequiredArgsConstructor +@Component +public class BuildUserUtils { + + private final UserInfoManage userInfoManage; + + public void buildUserByProcessInfo(List progressInfo) { + Set userSet = Sets.newHashSet(); + progressInfo.forEach(node -> { + if (CollUtil.isNotEmpty(node.getChildren())) { + for (ProgressNode innerNode : node.getChildren()) { + userSet.add(innerNode.getUserId()); + } + } else { + userSet.add(node.getUserId()); + } + }); + Map userMap = userInfoManage.getUserMapByEmployeeCode(userSet); + buildUser(progressInfo,userMap); + } + private void buildUser(List progressInfo, Map userMap) { + for (ProgressNode progressNode : progressInfo) { + progressNode.setUser(userMap.get(progressNode.getUserId())); + if (CollUtil.isNotEmpty(progressNode.getChildren())) { + buildUser(progressNode.getChildren(), userMap); + } + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java new file mode 100644 index 0000000..576fada --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java @@ -0,0 +1,144 @@ +package com.hz.pm.api.todocenter.utils; + + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; +import java.util.UUID; + +import org.springframework.stereotype.Component; +import org.xhtmlrenderer.pdf.ITextFontResolver; +import org.xhtmlrenderer.pdf.ITextRenderer; + +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.BaseFont; +import com.ningdatech.basic.exception.BizException; + +import lombok.extern.slf4j.Slf4j; + +/** + * pdf生成工具类 + * + * @author CMM + * @since 2023/03/13 17:01 + */ +@Slf4j +@Component +public class PdfUtils { + /** + * 生成PDF文件 + * + * @return int + * @author CMM + * @since 2023/03/13 17:07 + */ + public byte[] generatePdf(InputStream templateHtmlInputStream, Map paramsMap){ + FileInputStream inputStream = null; + + try { + File directory = new File(""); + //临时文件输出路径 + String filePath = directory.getAbsolutePath() + File.separator + "fileout"; + //字体格式 + String fontPath = directory.getAbsolutePath() + File.separator + "font" + File.separator + "simsun.ttc"; + if(!new File(filePath).exists()){ + new File(filePath).mkdir(); + } + StringBuilder stringBuilder = new StringBuilder(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8)); + String line; + while ((line = bufferedReader.readLine()) != null) { + stringBuilder.append(line); + } + String htmlInfo = stringBuilder.toString(); + + //替换参数、多个参数多次替换 + for (String fieldName : paramsMap.keySet()) { + if (paramsMap.get(fieldName) == null) { + // 没有值的字段使用-覆盖 + htmlInfo = htmlInfo.replace("#" + fieldName + "#", ""); + }else { + // 设置占位字段 + htmlInfo = htmlInfo.replace("#" + fieldName + "#", paramsMap.get(fieldName).toString()); + } + } + + //生成临时文件 + String htmlFileName = UUID.randomUUID().toString().replace("-","") + ".html"; + String htmlFilePath = filePath + File.separator + htmlFileName; + File file = new File(htmlFilePath); + FileOutputStream fop = new FileOutputStream(file); + if (!file.exists()) { + file.createNewFile(); + } + byte[] contentInBytes = htmlInfo.getBytes(); + fop.write(contentInBytes); + fop.flush(); + fop.close(); + + //生成pdf + String fileName = UUID.randomUUID().toString().replace("-","") + ".pdf"; + String pdfFilePath = filePath + File.separator + fileName; + String url = new File(htmlFilePath).toURI().toURL().toString(); + OutputStream os = Files.newOutputStream(Paths.get(pdfFilePath)); + + ITextRenderer renderer = new ITextRenderer(); + renderer.setDocument(url); + ITextFontResolver fontResolver = renderer.getFontResolver(); + fontResolver.addFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); + renderer.layout(); + renderer.createPDF(os); + os.flush(); + os.close(); + + inputStream = new FileInputStream(pdfFilePath); + + // 返回生成的pdf文件字节数组 + return readBytes(inputStream); + } catch (IOException e) { + throw new BizException("生成pdf文件失败!" + e.getMessage()); + } catch (DocumentException e) { + throw new BizException("生成pdf文件失败!" +e.getMessage()); + } finally { + try { + if (null != inputStream) { + + inputStream.close(); + } + } catch (IOException e) { + log.error("close resource error", e.getMessage()); + } + } + } + + + /** + * 读取输入流到字节数组 + * + * @param in + * @return + * @throws IOException + */ + private byte[] readBytes(InputStream in) throws IOException { + //读取字节的缓冲 + byte[] buffer = new byte[1024]; + //最终的数据 + byte[] result = new byte[0]; + int size = 0; + while ((size = in.read(buffer)) != -1) { + int oldLen = result.length; + byte[] tmp = new byte[oldLen + size]; + if (oldLen > 0) {//copy 旧字节 + System.arraycopy(result, 0, tmp, 0, oldLen); + } + //copy 新字节 + System.arraycopy(buffer, 0, tmp, oldLen, size); + + result = tmp; + } + return result; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/LoginTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/LoginTypeEnum.java new file mode 100644 index 0000000..a09ce3f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/LoginTypeEnum.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.user.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/8/17 下午5:55 + */ +@AllArgsConstructor +@Getter +@ApiModel("登陆类型") +public enum LoginTypeEnum { + /** + * 浙政钉扫码登陆 + */ + DING_QR_LOGIN, + + DING_MD_LOGIN, + + /** + * 手机号验证码登陆 + */ + PHONE_VERIFICATION_CODE_LOGIN, + + /** + * 账号密码登陆 + */ + USERNAME_PASSWORD_LOGIN; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/UserAvailableEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/UserAvailableEnum.java new file mode 100644 index 0000000..b8e9043 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/constant/UserAvailableEnum.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.user.constant; + +/** + * @author liuxinxin + * @date 2023/2/15 下午5:13 + */ + +public enum UserAvailableEnum { + /** + * 启用 + */ + ENABLE, + + /** + * 禁用 + */ + DISABLE +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java new file mode 100644 index 0000000..9f5d872 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.user.controller; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + *

+ * 用户鉴权表 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-01-04 + */ + +@RestController +@RequestMapping("/api/v1/user/auth") +@Api(tags = {"用户鉴权-相关接口"}) +@RequiredArgsConstructor +public class UserAuthController { + + private final ObjectMapper objectMapper; + + @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @ApiOperation(value = "登陆") + @ApiImplicitParams({ + @ApiImplicitParam(name = "identifier", value = "账号", required = true, paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆" + , required = true, paramType = "form", dataType = "String")}) + public void credentialLogin(@RequestParam(value = "identifier", required = false) String identifier, + @RequestParam(value = "credential", required = false) String credential, + @RequestParam("loginType") String loginType) { + // 不实现任何内容,只是为了出api文档 + } + + @PostMapping(value = "/logout") + @ApiOperation(value = "退出登陆") + public void logout() { + // 不实现任何内容,具体实现交由Spring Security进行管理 + } + + /** + * 当需要身份认证时,跳转到这里 + */ + @GetMapping("/auth-require") + @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) + public void requireAuthentication(HttpServletResponse response) throws IOException { + response.setContentType(StrPool.CONTENT_TYPE); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); + } + + /** + * 设置session失效 + */ + @GetMapping("/invalid-session") + @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) + public void invalidSession(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType(StrPool.CONTENT_TYPE); + Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null); + cookie.setPath(request.getContextPath() + "/"); + cookie.setMaxAge(SessionTimeConstant.SESSION_EXPIRED); + response.addCookie(cookie); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); + } + + @PostMapping(value = "/agent-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @ApiOperation(value = "代登陆") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "账号", required = true, paramType = "form", dataType = "String")}) + public void agentLogin(@RequestParam(value = "userId", required = true) String userId) { + // 不实现任何内容,只是为了出api文档 + } + + @PostMapping(value = "/common-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @ApiOperation(value = "公共登陆接口,目前适用于省局跳转登陆") + @ApiImplicitParams({ + @ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "platform", value = "平台 PROVINCIAL_BUREAU,省局", required = true, paramType = "form", dataType = "String") + }) + public void commonLogin(@RequestParam(value = "credential", required = true) String credential + , @RequestParam(value = "platform", required = true) String platform) { + // 不实现任何内容,只是为了出api文档 + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java new file mode 100644 index 0000000..17dfa6f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.user.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.user.manage.UserInfoManage; +import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; +import com.hz.pm.api.user.model.po.ReqUserDetailPO; +import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; +import com.hz.pm.api.user.model.po.ReqUserInfoListPO; +import com.hz.pm.api.user.model.vo.ResUserDetailVO; +import com.hz.pm.api.user.model.vo.ResUserInfoListVO; +import com.hz.pm.api.user.model.vo.UserRoleVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +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; +import java.util.List; + +/** + * @author Liuxinxin + * @since 2023-01-04 + */ +@RestController +@RequestMapping("/api/v1/user-info") +@RequiredArgsConstructor +@Api(value = "UserInfoController", tags = "用户管理") +public class UserInfoController { + + private final UserInfoManage userInfoManage; + + @ApiOperation(value = "用户列表搜索", notes = "用户列表搜索") + @PostMapping("/list") + public PageVo userInfoList(@Valid @RequestBody ReqUserInfoListPO req) { + return userInfoManage.list(req); + } + + @ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") + @PostMapping("/disable-enable") + public void disableOrEnable(@Valid @RequestBody ReqUserDisableOrEnablePO req) { + userInfoManage.disableOrEnable(req); + } + + @ApiOperation(value = "用户详情", notes = "用户详情") + @PostMapping("/detail") + public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO req) { + return userInfoManage.userInfoDetail(req); + } + + @ApiOperation(value = "用户详情编辑", notes = "用户详情编辑") + @PostMapping("/detail/edit") + @WebLog("用户详情编辑") + public void userInfoDetailEdit(@Valid @RequestBody ReqUserDetailEditPO req) { + userInfoManage.userInfoDetailEdit(req); + } + + @ApiOperation(value = "获取当前登陆用户详情信息", notes = "用户详情") + @PostMapping("/current-user-info") + public ResUserDetailVO currentUserInfo() { + return userInfoManage.currentUserInfo(); + } + + @ApiOperation(value = "获取当前用户可控角色列表") + @PostMapping("/controlled/role-list") + public List getControlledRoleList() { + return userInfoManage.getControlledRoleList(); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java new file mode 100644 index 0000000..ccb1640 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.user.convert; + +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; + +/** + *

+ * UserInfoConvertor + *

+ * + * @author WendyYang + * @since 2023/5/5 + **/ +public class UserInfoConvertor { + + private UserInfoConvertor() { + + } + + public static UserInfoDetails toUserInfoDetails(UserFullInfoDTO userFullInfo) { + UserInfoDetails userInfoDetails = new UserInfoDetails(); + userInfoDetails.setUserId(userFullInfo.getUserId()); + userInfoDetails.setUsername(userFullInfo.getUsername()); + userInfoDetails.setRealName(userFullInfo.getRealName()); + userInfoDetails.setUserRoleList(userFullInfo.getUserRoleList()); + userInfoDetails.setRegionCode(userFullInfo.getRegionCode()); + userInfoDetails.setRegionLevel(userFullInfo.getRegionLevel()); + userInfoDetails.setIdentifier(userFullInfo.getIdentifier()); + userInfoDetails.setPassword(userFullInfo.getCredential()); + userInfoDetails.setEmployeeCode(userFullInfo.getEmployeeCode()); + userInfoDetails.setOrganizationCode(userFullInfo.getOrganizationCode()); + userInfoDetails.setOrganizationName(userFullInfo.getOrganizationName()); + userInfoDetails.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); + userInfoDetails.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); + userInfoDetails.setMobile(userFullInfo.getMobile()); + return userInfoDetails; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java new file mode 100644 index 0000000..e1238ab --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@TableName("nd_user_auth") +@Data +@ApiModel(value = "NdUserAuth对象") +public class UserAuth implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String authType; + + private String identifier; + + private String credential; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java new file mode 100644 index 0000000..09e975d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java @@ -0,0 +1,67 @@ +package com.hz.pm.api.user.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@TableName("nd_user_info") +@Builder +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "NdUserInfo对象") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String username; + + private String mobile; + + private String realName; + + private Long accountId; + + private String available; + + private String employeeCode; + + private String regionCode; + + private String empPosUnitCode; + private String empPosUnitName; + + @ApiModelProperty("头像") + private String avatar; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/enumeration/RoleEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/enumeration/RoleEnum.java new file mode 100644 index 0000000..ad91e99 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/enumeration/RoleEnum.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.user.entity.enumeration; + +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 系统角色枚举(内置角色) + *

+ * + * @author WendyYang + * @since 14:15 2023/1/13 + */ +@Getter +public enum RoleEnum { + + /** + * 系统角色枚举 + */ + NORMAL_MEMBER("普通用户", 8), + HIGH_MEMBER("高级用户", 7), + + EXPERT("专家", 6), + + COMPANY_MANAGER("单位管理员", 5), + + EXPERT_ADMIN("专家管理员", 3), + + REGION_MANAGER("区域管理员", 4), + + SUPER_ADMIN("超级管理员", 1), + + VISITOR("访客", 2), + + DASHBOARD("工作台", 9); + + private final String desc; + + /** + * 角色优先级 + */ + private final Integer level; + + RoleEnum(String desc, Integer level) { + this.desc = desc; + this.level = level; + } + + public boolean eq(String name) { + return this.name().equals(name); + } + + public static RoleEnum mathByName(String name) { + if (StringUtils.isBlank(name)) { + return null; + } + for (RoleEnum roleEnum : RoleEnum.values()) { + if (roleEnum.name().equals(name)) { + return roleEnum; + } + } + return null; + } + + public static RoleEnum checkHigherRole(List roleCodes) { + RoleEnum res = null; + for (String roleCode : roleCodes) { + RoleEnum roleEnum = mathByName(roleCode); + if (Objects.isNull(res) || + (Objects.nonNull(roleEnum) && roleEnum.getLevel() < res.getLevel())) { + res = roleEnum; + } + } + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserAuthManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserAuthManage.java new file mode 100644 index 0000000..1529f13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserAuthManage.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.user.manage; + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.user.convert.UserInfoConvertor; +import com.hz.pm.api.user.security.auth.credential.CredentialAuthToken; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import lombok.AllArgsConstructor; +import org.springframework.security.core.context.SecurityContextImpl; +import org.springframework.session.Session; +import org.springframework.session.SessionRepository; +import org.springframework.session.data.redis.RedisIndexedSessionRepository; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * UserAuthHelper + *

+ * + * @author WendyYang + * @since 2023/5/5 + **/ +@Component +@AllArgsConstructor +public class UserAuthManage { + + private final UserInfoHelper userInfoHelper; + private final RedisIndexedSessionRepository redisSessionRepository; + + @SuppressWarnings({"rawtypes", "unchecked"}) + public void refreshSession(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + if (userFullInfo == null) { + return; + } + List sessionIds = getSessionIds(userFullInfo.getUsername()); + if (sessionIds.isEmpty()) { + return; + } + SessionRepository sessionRepository = redisSessionRepository; + UserInfoDetails details = UserInfoConvertor.toUserInfoDetails(userFullInfo); + CredentialAuthToken cat = new CredentialAuthToken(details, details.getPassword(), details.getAuthorities()); + sessionIds.forEach(sessionId -> { + Session session = redisSessionRepository.findById(sessionId); + SecurityContextImpl context = session.getAttribute("SPRING_SECURITY_CONTEXT"); + context.setAuthentication(cat); + session.setAttribute("SPRING_SECURITY_CONTEXT", context); + sessionRepository.save(session); + }); + } + + private List getSessionIds(String username) { + return new ArrayList<>(redisSessionRepository.findByPrincipalName(username).keySet()); + } + + public void kickOff(Long userId) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + List sessionIds = getSessionIds(userFullInfo.getUsername()); + sessionIds.forEach(redisSessionRepository::deleteById); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java new file mode 100644 index 0000000..81827c0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -0,0 +1,627 @@ +package com.hz.pm.api.user.manage; + +import cn.hutool.core.collection.CollUtil; +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.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.ding.constants.DingOrganizationContant; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.UserRole; +import com.hz.pm.api.sys.service.IRoleService; +import com.hz.pm.api.sys.service.IUserRoleService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; +import com.hz.pm.api.user.model.po.ReqUserDetailPO; +import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; +import com.hz.pm.api.user.model.po.ReqUserInfoListPO; +import com.hz.pm.api.user.model.vo.ResUserDetailVO; +import com.hz.pm.api.user.model.vo.ResUserInfoListVO; +import com.hz.pm.api.user.model.vo.UserRoleVO; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.service.IUserInfoService; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.zwdd.ZwddIntegrationProperties; +import com.ningdatech.zwdd.client.ZwddClient; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/13 上午9:09 + */ +@Component +@RequiredArgsConstructor +public class UserInfoManage { + + private final UserAuthManage userAuthManage; + private final IUserInfoService iUserInfoService; + private final IRoleService iRoleService; + private final IDingOrganizationService iDingOrganizationService; + private final IDingEmployeeInfoService iDingEmployeeInfoService; + private final IUserRoleService iUserRoleService; + private final UserInfoHelper userInfoHelper; + private final RegionCacheHelper regionCacheHelper; + + private final ZwddIntegrationProperties zwddIntegrationProperties; + + private final ZwddClient zwddClient; + + public PageVo list(ReqUserInfoListPO req) { + PageVo pageVo = new PageVo<>(); + + String phoneNo = req.getPhoneNo(); + String orgCode = req.getOrgCode(); + String name = req.getName(); + String orgName = req.getOrgName(); + Long regionId = req.getRegionId(); + + List userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); + if (userIdList != null && userIdList.size() == 0) { + pageVo.setRecords(new ArrayList<>()); + pageVo.setTotal(0L); + return pageVo; + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserInfo.class) + .like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) + .like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) + .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) + .eq(Objects.nonNull(regionId), UserInfo::getRegionCode, regionId) + .like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) + .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) + .orderByDesc(UserInfo::getUpdateOn); + + Page page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper); + List records = page.getRecords(); + long total = page.getTotal(); + List result = new ArrayList<>(); + if (records != null && records.size() > 0) { + List employeeCodeList = records.stream().map(UserInfo::getEmployeeCode) + .distinct().collect(Collectors.toList()); + + List employeeInfoList = iDingEmployeeInfoService.getEmployeeList(employeeCodeList); + Map empCodeOrgMap = iDingOrganizationService.getEmpCodeOrgMap(employeeInfoList); + + records.forEach(r -> { + ResUserInfoListVO item = new ResUserInfoListVO(); + item.setName(r.getRealName()); + String employeeCode = r.getEmployeeCode(); + if (StringUtils.isNotBlank(employeeCode)) { + DingOrganization dingOrganization = empCodeOrgMap.get(employeeCode); + if (Objects.nonNull(dingOrganization)) { + item.setOrgName(dingOrganization.getOrganizationName()); + item.setOrgCode(dingOrganization.getOrganizationCode()); + String regionCode = dingOrganization.getDivisionCode(); + item.setRegionCode(regionCode); + if (Objects.nonNull(regionCode)) { + item.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); + } + } + + } + userStatusAssembler(item, r); + item.setUpdateTime(r.getUpdateOn()); + item.setEmployeeCode(r.getEmployeeCode()); + item.setUserRoleList(getUserRoleVOList(item.getUserId())); + result.add(item); + }); + } + pageVo.setTotal(total); + pageVo.setRecords(result); + return pageVo; + } + + private List getCompliantOrgEmpCodeList(String orgName, String orgCode) { + if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode)) { + return null; + } + List compliantOrgCodeList = new ArrayList<>(); + + // 查重符合筛选条件的组织列表 + if (StringUtils.isNotBlank(orgName)) { + List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .like(DingOrganization::getOrganizationName, orgName) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) + ); + + List compliantOrgNameCodeList = dingOrganizationList.stream() + .map(DingOrganization::getOrganizationCode) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(compliantOrgNameCodeList)) { + return new ArrayList<>(); + } + + // 取交集 + List tempCompliantOrgCodeList = new ArrayList<>(); + for (String compliantOrgNameCode : compliantOrgNameCodeList) { + if (compliantOrgCodeList.contains(compliantOrgNameCode)) { + tempCompliantOrgCodeList.add(compliantOrgNameCode); + } + } + compliantOrgCodeList = tempCompliantOrgCodeList; + if (CollUtil.isEmpty(compliantOrgCodeList)) { + return new ArrayList<>(); + } + } + + if (StringUtils.isNotBlank(orgCode)) { + compliantOrgCodeList.add(orgCode); + } + if (CollUtil.isEmpty(compliantOrgCodeList)) { + return new ArrayList<>(); + } + + // 查重符合筛选条件的用户code列表 + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .in(DingEmployeeInfo::getEmpPosUnitCode, compliantOrgCodeList)); + + List compliantOrgEmpCodeList = dingEmployeeInfoList.stream() + .map(DingEmployeeInfo::getEmployeeCode).distinct().collect(Collectors.toList()); +// if (compliantOrgEmpCodeList.size() > 500) { +// throw new BizException("搜索结果过多请缩小搜索范围"); +// } + return compliantOrgEmpCodeList; + } + + /** + * 获取符合查询条件的 用户 userId + * + * @param userRoleList + */ + private List getRoleCompliantUserIdList(List userRoleList) { + if (CollUtil.isNotEmpty(userRoleList)) { + userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); + } + if (CollUtil.isEmpty(userRoleList)) { + return null; + } + List roleIdList = userRoleList.stream().map(UserRoleVO::getId).collect(Collectors.toList()); + + List compliantUserIdList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .in(UserRole::getRoleId, roleIdList)).stream().map(UserRole::getUserId).distinct().collect(Collectors.toList()); + if (CollUtil.isEmpty(compliantUserIdList)) { + return new ArrayList<>(); + } + return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getId, compliantUserIdList)) + .stream().map(UserInfo::getId).collect(Collectors.toList()); + + } + + /** + * 装配用户状态 及 userId + * + * @param resListVO + * @param userInfo + */ + private void userStatusAssembler(ResUserInfoListVO resListVO, UserInfo userInfo) { + if (Objects.nonNull(userInfo)) { + resListVO.setPhoneNo(userInfo.getMobile()); + if (StringUtils.isNotBlank(userInfo.getAvailable()) + && UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { + resListVO.setStatus(UserAvailableEnum.ENABLE.name()); + } else { + resListVO.setStatus(UserAvailableEnum.DISABLE.name()); + } + resListVO.setUserId(userInfo.getId()); + } else { + resListVO.setStatus(UserAvailableEnum.DISABLE.name()); + } + } + + + private List getUserRoleVOList(Long userId) { + List userRoleInfoList = new ArrayList<>(); + if (Objects.isNull(userId)) { + return userRoleInfoList; + } + List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId).orderByAsc(UserRole::getCreateOn)); + if (CollUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); + List roleList = iRoleService.listByIds(roleIdList); + roleList.forEach(r -> { + UserRoleVO userRoleVO = new UserRoleVO(); + userRoleVO.setId(r.getId()); + userRoleVO.setName(r.getName()); + userRoleVO.setCreateOn(r.getCreateOn()); + userRoleInfoList.add(userRoleVO); + }); + } + return userRoleInfoList; + } + + @Transactional(rollbackFor = Exception.class) + public void disableOrEnable(ReqUserDisableOrEnablePO req) { + Long userId; + if (req.getUserId() != null) { + userId = req.getUserId(); + } else if (StrUtils.isNotBlank(req.getEmployeeCode())) { + UserInfoManage proxy = (UserInfoManage) AopContext.currentProxy(); + userId = proxy.generateUserId(req.getEmployeeCode()); + } else { + throw BizException.wrap("用户参数缺失"); + } + UserInfo userInfo = iUserInfoService.getById(userId); + userInfo.setAvailable(req.getOperation()); + iUserInfoService.updateById(userInfo); + if ("DISABLE".equals(userInfo.getAvailable())) { + userAuthManage.kickOff(userId); + } + + } + + public ResUserDetailVO userInfoDetail(ReqUserDetailPO reqUserDetailPO) { + Long userId = reqUserDetailPO.getUserId(); + String employeeCode = reqUserDetailPO.getEmployeeCode(); + if (StringUtils.isBlank(employeeCode) && Objects.isNull(userId)) { + throw new BizException("employeeCode and userId can't not be null"); + } + if (Objects.isNull(userId)) { + userId = generateUserId(reqUserDetailPO.getEmployeeCode()); + } + + UserInfo userInfo = iUserInfoService.getById(userId); + if (Objects.isNull(userInfo)) { + return null; + } + ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); + resUserDetailVO.setRealName(userInfo.getRealName()); + resUserDetailVO.setUserId(userInfo.getId()); + resUserDetailVO.setPhoneNo(userInfo.getMobile()); + resUserDetailVO.setStatus(userInfo.getAvailable()); + + // 装配用户角色信息列表 + List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + List userRoleInfoList = new ArrayList<>(); + if (CollUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); + List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); + userRoleInfoList = roleList.stream().map(r -> { + UserRoleVO userRoleVO = new UserRoleVO(); + userRoleVO.setId(r.getId()); + userRoleVO.setName(r.getName()); + return userRoleVO; + }).collect(Collectors.toList()); + } + resUserDetailVO.setUserRoleInfoList(userRoleInfoList); + return resUserDetailVO; + } + + @Transactional(rollbackFor = Exception.class) + public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) { + Long userId = reqUserDetailEditPO.getUserId(); + if (Objects.isNull(userId)) { + String employeeCode = reqUserDetailEditPO.getEmployeeCode(); + if (StringUtils.isBlank(employeeCode)) { + throw new IllegalArgumentException("employeeCode can't be null"); + } + userId = generateUserId(employeeCode); + } + UserInfo userInfo = iUserInfoService.getById(userId); + String oldUserStatus = userInfo.getAvailable(); + // 绑定用户手机号 + bandUserMobile(userInfo, reqUserDetailEditPO); + + userInfo.setAvailable(reqUserDetailEditPO.getStatus()); + userInfo.setUpdateOn(LocalDateTime.now()); + userInfo.setUpdateBy(LoginUserUtil.getUserId()); + iUserInfoService.updateById(userInfo); + + List userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList(); + iUserRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); + if (CollUtil.isNotEmpty(userRoleInfoList)) { + Long finalUserId = userId; + List userRoleList = userRoleInfoList.stream().map(r -> { + UserRole saveRecord = new UserRole(); + saveRecord.setRoleId(r.getId()); + saveRecord.setUserId(finalUserId); + return saveRecord; + }).collect(Collectors.toList()); + iUserRoleService.saveBatch(userRoleList); + } + // 刷新用户权限 仅原状态为正常才需要刷新session + if ("ENABLE".equals(oldUserStatus)) { + if (oldUserStatus.equals(userInfo.getAvailable())) { + userAuthManage.refreshSession(userId); + } else { + userAuthManage.kickOff(userId); + } + } + } + + /** + * 绑定用户手机号 + * + * @param userInfo + * @param reqUserDetailEditPO + */ + @Transactional(rollbackFor = Exception.class) + public void bandUserMobile(UserInfo userInfo, ReqUserDetailEditPO reqUserDetailEditPO) { + String employeeCode = reqUserDetailEditPO.getEmployeeCode(); + String mobile = userInfo.getMobile(); + Long userId = userInfo.getId(); +// if (StringUtils.isBlank(mobile)) { + // 校验手机号是否重复 + UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); + if (Objects.nonNull(repeatMobileUserInfo)) { + throw new BizException("该手机号码已被绑定,请问重复绑定"); + } + + String phoneNo = reqUserDetailEditPO.getPhoneNo(); + userInfo.setMobile(phoneNo); + // 更新浙政钉相关数据 + if (StringUtils.isNotBlank(phoneNo)) { + iDingEmployeeInfoService + .update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .set(DingEmployeeInfo::getBindUserMobile, phoneNo)); + iUserInfoService.updateById(userInfo); + } +// } + + } + + @Transactional(rollbackFor = Exception.class) + public Long generateUserId(String employeeCode) { + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode)); + if (Objects.isNull(userInfo)) { + List dingEmployeeInfoList = iDingEmployeeInfoService + .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .eq(DingEmployeeInfo::getMainJob, "true")); + if (CollUtil.isEmpty(dingEmployeeInfoList)) { + throw new BizException("员工账号不存在"); + } + DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); + userInfo = UserInfo.builder() + .accountId(dingEmployeeInfo.getAccountId()) + .username(dingEmployeeInfo.getEmployeeName()) + .realName(dingEmployeeInfo.getEmployeeName()) + .employeeCode(dingEmployeeInfo.getEmployeeCode()) + .available(UserAvailableEnum.DISABLE.name()) + .createBy(-1L) + .updateBy(-1L) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .build(); + iUserInfoService.save(userInfo); + } + return userInfo.getId(); + } + + + public ResUserDetailVO currentUserInfo() { + Long userId = LoginUserUtil.getUserId(); + UserInfo userInfo = iUserInfoService.getById(userId); + if (Objects.isNull(userInfo)) { + return null; + } + ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); + resUserDetailVO.setRealName(userInfo.getRealName()); + resUserDetailVO.setUserId(userInfo.getId()); + resUserDetailVO.setPhoneNo(userInfo.getMobile()); + resUserDetailVO.setStatus(userInfo.getAvailable()); + resUserDetailVO.setEmployeeCode(userInfo.getEmployeeCode()); + resUserDetailVO.setAvatar(makeAvatar(userInfo.getAvatar())); + + // 装配用户角色信息列表 + List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + List userRoleInfoList = new ArrayList<>(); + if (CollUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); + List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); + userRoleInfoList = roleList.stream().map(r -> { + UserRoleVO userRoleVO = new UserRoleVO(); + userRoleVO.setId(r.getId()); + userRoleVO.setName(r.getName()); + userRoleVO.setCode(r.getCode()); + return userRoleVO; + }).collect(Collectors.toList()); + } + resUserDetailVO.setUserRoleInfoList(userRoleInfoList); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + if (Objects.nonNull(userFullInfo)) { + resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); + resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); + resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); + resUserDetailVO.setRegionLevel(userFullInfo.getRegionLevel()); + resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() + , RegionConst.RL_COUNTY)); + resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); + resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); + } + return resUserDetailVO; + } + + //生成头像 链接 + private String makeAvatar(String avatar) { + try { + GenericResult accessToken = zwddClient.getAccessToken(); + String token = accessToken.getData(); + String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + + "access_token=" + token + "&media_id=" + avatar; + return res; + } catch (Exception e) { + } + return org.apache.commons.lang3.StringUtils.EMPTY; + } + + public Map getUserMapByIds(Set staterUsers) { + List userInfos = iUserInfoService.listByIds(staterUsers); + return userInfos.stream().map(u -> { + ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); + userInfo.setUserId(u.getEmployeeCode()); + userInfo.setUserName(u.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); + if (Objects.nonNull(userFullInfo)) { + userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); + userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return userInfo; + }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + } + + public Map getUserMapByEmployeeCode(Set staterUsers) { + if (CollUtil.isEmpty(staterUsers)) { + return Collections.emptyMap(); + } + List userInfos = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getEmployeeCode, staterUsers)); + if (CollUtil.isEmpty(userInfos)) { + return Collections.emptyMap(); + } + return userInfos.stream().map(u -> { + ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); + userInfo.setUserId(u.getEmployeeCode()); + userInfo.setUserName(u.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); + if (Objects.nonNull(userFullInfo)) { + userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); + userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return userInfo; + }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + } + + public ProcessInstanceUserDto getUserInfo(String userId) { + UserInfo userInfo = iUserInfoService.getById(userId); + ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto(); + processInstanceUserDto.setUserId(String.valueOf(userInfo.getId())); + processInstanceUserDto.setUserName(userInfo.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); + if (Objects.nonNull(userFullInfo)) { + processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); + processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return processInstanceUserDto; + } + + /** + * 获取当前用户可控角色列表 + * + * @return + */ + public List getControlledRoleList() { + Long userId = LoginUserUtil.getUserId(); + // 装配用户角色信息列表 + List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + + List controlledRoleVOList = new ArrayList<>(); + List controlledRoleIdList = new ArrayList<>(); + if (CollUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList()); + + List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); + + for (Role role : roleList) { + List manageRoleIdList = BizUtils.splitToLong(role.getManageRoleIds()); + if (CollUtil.isNotEmpty(manageRoleIdList)) { + controlledRoleIdList.addAll(manageRoleIdList); + } + } + controlledRoleIdList = controlledRoleIdList.stream().distinct().collect(Collectors.toList()); + List controlledRoleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, controlledRoleIdList)); + + controlledRoleVOList = controlledRoleList.stream().map(r -> { + UserRoleVO userRoleVO = new UserRoleVO(); + userRoleVO.setId(r.getId()); + userRoleVO.setName(r.getName()); + userRoleVO.setCode(r.getCode()); + return userRoleVO; + }).collect(Collectors.toList()); + } + return controlledRoleVOList; + } + + /** + * 根据用户名获取 + * + * @param username / + * @return / + */ + public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) { + // TODO 目前账号密码登陆测试使用 强制用户登录 userId 1L + UserInfo userInfo = iUserInfoService.getById(username); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + return userInfoHelper.getUserFullInfo(userInfo); + } + + /** + * 根据手机号获取 + * + * @param phoneNo / + * @return / + */ + public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) { + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getMobile, phoneNo)); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + return userInfoHelper.getUserFullInfo(userInfo); + } + + /** + * 根据accountId(浙政钉扫码登陆) + * + * @param accountId / + * @return / + */ + public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) { + + // 获取用户信息 + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getAccountId, accountId)); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + return userInfoHelper.getUserFullInfo(userInfo); + } + + public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode).last("limit 1")); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + return userInfoHelper.getUserFullInfo(userInfo); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java new file mode 100644 index 0000000..1e467d6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.user.mapper; + +import com.hz.pm.api.user.entity.UserInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +public interface NdUserInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.xml new file mode 100644 index 0000000..a4f96f2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java new file mode 100644 index 0000000..fc4a4a2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.user.mapper; + +import com.hz.pm.api.user.entity.UserAuth; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +public interface UserAuthMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.xml new file mode 100644 index 0000000..68ebdd4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqGenerationLoginPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqGenerationLoginPO.java new file mode 100644 index 0000000..944e945 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqGenerationLoginPO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.user.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2023/2/21 下午3:39 + */ +@Data +@ApiModel("代登陆请求PO") +public class ReqGenerationLoginPO { + + @NotNull(message = "用户id 不能为空") + @ApiModelProperty("用户id") + private Long userId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java new file mode 100644 index 0000000..d6ec9c0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.user.model.po; + +import com.hz.pm.api.user.model.vo.UserRoleVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/2/15 上午8:43 + */ +@Data +@ApiModel("用户详情编辑请求") +public class ReqUserDetailEditPO { + + @NotNull(message = "用户id 不能为空") + @ApiModelProperty("userId") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @NotBlank(message = "用户手机号不能为空") + @ApiModelProperty("手机号") + private String phoneNo; + + @NotBlank(message = "状态不能为空") + @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") + private String status; + + @ApiModelProperty("用户角色信息列表") + private List userRoleInfoList; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java new file mode 100644 index 0000000..4608f2f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.user.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/15 上午8:43 + */ +@Data +@ApiModel("获取用户详情请求") +public class ReqUserDetailPO { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDisableOrEnablePO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDisableOrEnablePO.java new file mode 100644 index 0000000..16af37b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDisableOrEnablePO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.user.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2023/2/13 上午9:31 + */ + +@Data +@ApiModel("用户禁用/启用 PO") +public class ReqUserDisableOrEnablePO { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @NotBlank(message = "操作 不能为空") + @ApiModelProperty("操作 启用 ENABLE/禁用 DISABLE") + private String operation; + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java new file mode 100644 index 0000000..1764949 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.user.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.user.model.vo.UserRoleVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/2/13 上午9:10 + */ +@Data +@ApiModel("用户管理查询 请求入参") +public class ReqUserInfoListPO extends PagePo { + + @ApiModelProperty("姓名") + private String name; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("所在单位(主职)") + private String orgName; + + @ApiModelProperty("所在单位Code(主职)") + private String orgCode; + + @ApiModelProperty("所属区域") + private Long regionId; + + @ApiModelProperty("所属区域名称") + private Long regionName; + + @ApiModelProperty("用户角色") + private List userRoleList; + + @ApiModelProperty("状态") + private String status; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java new file mode 100644 index 0000000..bdb236d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.user.model.vo; + +import com.hz.pm.api.common.constant.RegionConst; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/15 上午8:43 + */ +@Data +@ApiModel("获取用户详情请求") +public class ResUserDetailVO { + + @ApiModelProperty("userId") + private Long userId; + + @ApiModelProperty("用户姓名") + private String realName; + + @ApiModelProperty("手机号") + private String phoneNo; + + @ApiModelProperty("用户角色信息列表") + private List userRoleInfoList; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("所在单位(主职)") + private String orgName; + + @ApiModelProperty("所在单位(主职)code") + private String orgCode; + + @ApiModelProperty("所属区域") + private Long regionId; + private String regionCode; + private Integer regionLevel; + private String regionName; + + @ApiModelProperty("用户任职所在单位code") + private String empPosUnitCode; + + @ApiModelProperty("用户任职所在单位") + private String empPosUnitName; + + @ApiModelProperty("用户角色") + private List userRoleList; + + @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") + private String status; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty("头像") + private String avatar; + + //是否是市级单位 + public Boolean getIsMunicipalOrg(){ + //如果是丽水市本级的code 就是 + if(RegionConst.RC_LS.equals(this.regionCode)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java new file mode 100644 index 0000000..abdb677 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.user.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/2/13 上午9:10 + */ +@Data +@ApiModel("用户管理查询 请求response") +public class ResUserInfoListVO { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("姓名") + private String name; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("所在单位(主职)") + private String orgName; + + @ApiModelProperty("所在单位(主职)code") + private String orgCode; + + @ApiModelProperty("所属区域") + private Long regionId; + private Integer regionLevel; + private String regionCode; + private String regionName; + + @ApiModelProperty("用户角色") + private List userRoleList; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserRoleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserRoleVO.java new file mode 100644 index 0000000..d282b82 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserRoleVO.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.user.model.vo; + +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/2/15 下午5:47 + */ + +@Data +@ApiModel("用户角色VO") +public class UserRoleVO { + + @ApiModelProperty(value = "角色id") + private Long id; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "角色code") + private String code; + + private transient LocalDateTime createOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthProperties.java new file mode 100644 index 0000000..8442133 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthProperties.java @@ -0,0 +1,74 @@ +package com.hz.pm.api.user.security.auth; + +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.basic.factory.PropertySourceFactory; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +import java.util.*; + +/** + * @Author LiuXinXin + * @Date 2020/8/1 6:06 下午 + * @Version 1.0 + **/ +@Configuration +@PropertySource(value = "classpath:security/auth-${spring.profiles.active}.yml" + , encoding = "utf-8", factory = PropertySourceFactory.class) +@ConfigurationProperties(prefix = "security.auth") +@Component +@Data +public class AuthProperties { + + private String authRequireUrl; + + private String invalidSessionUrl; + + private String passwordLoginUrl; + + /** + * 代登陆接口 + */ + private String agentLoginUrl; + + /** + * 跳转登陆接口(目前只有省局跳转) + */ + private String commonLoginUrl; + + private String logoutUrl; + + private List ignoreAuthUrls; + + private List ignoreCsrfUrls; + + private Map> roleMap = new HashMap<>(); + + public String[] getIgnoreAuthUrlsArray() { + String[] stringArray = new String[ignoreAuthUrls.size()]; + return ignoreAuthUrls.toArray(stringArray); + } + + public String[] getIgnoreCsrfUrlsArray() { + String[] stringArray = new String[ignoreCsrfUrls.size()]; + return ignoreCsrfUrls.toArray(stringArray); + } + + public Map getRoleArrayMap() { + Map roleArrayMap = new HashMap<>(); + if (Objects.nonNull(roleMap)) { + Set keySet = roleMap.keySet(); + for (String key : keySet) { + List urls = roleMap.get(key); + if (CollectionUtil.isNotEmpty(urls)) { + String[] stringArray = new String[urls.size()]; + roleArrayMap.put(key, urls.toArray(stringArray)); + } + } + } + return roleArrayMap; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthenticationBeanConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthenticationBeanConfig.java new file mode 100644 index 0000000..b6b1ed5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/AuthenticationBeanConfig.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.user.security.auth; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.session.SessionRegistry; +import org.springframework.security.core.session.SessionRegistryImpl; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +/** + * @Author LiuXinXin + * @Date 2020/7/28 1:00 下午 + * @Version 1.0 + **/ +@Configuration +public class AuthenticationBeanConfig { + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public SessionRegistry sessionRegistry() { + return new SessionRegistryImpl(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/WebSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/WebSecurityConfig.java new file mode 100644 index 0000000..eac704d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/WebSecurityConfig.java @@ -0,0 +1,97 @@ +package com.hz.pm.api.user.security.auth; + +import com.ningdatech.basic.util.NdJsonUtil; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; +import com.hz.pm.api.user.security.auth.agent.AgentAuthSecurityConfig; +import com.hz.pm.api.user.security.auth.common.CommonAuthSecurityConfig; +import com.hz.pm.api.user.security.auth.credential.CredentialAuthSecurityConfig; +import com.hz.pm.api.user.security.auth.handler.DefaultExpiredSessionStrategy; +import com.hz.pm.api.user.security.auth.handler.DefaultLogoutSuccessHandler; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import org.springframework.security.web.csrf.CookieCsrfTokenRepository; + +import java.io.PrintWriter; +import java.util.Map; +import java.util.Set; + +/** + * @Author LiuXinXin + * @Date 2020/7/28 4:14 下午 + * @Version 1.0 + */ +@Configuration +@RequiredArgsConstructor +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + private final AuthProperties authProperties; + private final CredentialAuthSecurityConfig credentialAuthSecurityConfig; + private final DefaultLogoutSuccessHandler logoutSuccessHandler; + private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; + private final AgentAuthSecurityConfig agentAuthSecurityConfig; + private final CommonAuthSecurityConfig commonAuthSecurityConfig; + + @Override + protected void configure(HttpSecurity http) throws Exception { + assemblerPreAuthUrls(http); + http.formLogin() + .loginPage(authProperties.getAuthRequireUrl()) + .and().apply(credentialAuthSecurityConfig) + .and().apply(agentAuthSecurityConfig) + .and().apply(commonAuthSecurityConfig) + .and() + .authorizeRequests() + .antMatchers(authProperties.getIgnoreAuthUrlsArray()) + .permitAll() + .anyRequest() + .authenticated().and() + // 防止固定会话攻击,Spring security的默认配置就是如此: + // 登陆成功之后会创建一个新的会话,然后将旧的session信息复制到新的session中(客户端的sessionId变了) + .sessionManagement() + .invalidSessionUrl(authProperties.getInvalidSessionUrl()) + .sessionFixation() + .migrateSession() + .maximumSessions(10) + .maxSessionsPreventsLogin(true) + .expiredSessionStrategy(defaultExpiredSessionStrategy) + .and().and() + .logout() + .logoutUrl(authProperties.getLogoutUrl()) + .logoutSuccessHandler(logoutSuccessHandler) + .deleteCookies(CommonConst.COOKIE_KEY) + .and() + // 开启csrf验证,需要前端同步传入token + .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) + .ignoringAntMatchers(authProperties.getIgnoreCsrfUrlsArray()); + } + + private AuthenticationEntryPoint authenticationEntryPoint() { + return (request, response, authException) -> { + response.setContentType(StrPool.CONTENT_TYPE); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + PrintWriter writer = response.getWriter(); + writer.write(NdJsonUtil.getInstance().writeValueAsString(BizConst.UNAUTHENTICATED)); + writer.flush(); + writer.close(); + }; + } + + private void assemblerPreAuthUrls(HttpSecurity http) throws Exception { + Map roleArrayMap = authProperties.getRoleArrayMap(); + Set roleSet = roleArrayMap.keySet(); + for (String role : roleSet) { + String[] urlsArray = roleArrayMap.get(role); + if (urlsArray != null && urlsArray.length > 0) { + http.authorizeRequests().antMatchers(urlsArray).hasAuthority(role); + } + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java new file mode 100644 index 0000000..bead658 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.user.security.auth.agent; + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.user.security.auth.model.WebRequestDetails; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.InternalAuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:46 下午 + * @Version 1.0 + **/ +public class AgentAuthFilter extends AbstractAuthenticationProcessingFilter { + + private boolean postOnly = true; + + private static final String USER_ID_PARAMETER = "userId"; + + // ~ Constructors + // =================================================================================================== + + public AgentAuthFilter(String processingUrl) { + super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); + } + + // ~ Methods + // ======================================================================================================== + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException { + if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { + throw new AuthenticationServiceException("请求方法错误"); + } + String userId = request.getParameter(USER_ID_PARAMETER); + if (StringUtils.isBlank(userId)) { + throw new BadCredentialsException("用户id 不能为空"); + } + + userId = trim(userId); + try { + AgentAuthToken authRequest = new AgentAuthToken(userId, userId); + authRequest.setDetails(new WebRequestDetails(request)); + return this.getAuthenticationManager().authenticate(authRequest); + } catch (AuthenticationException e) { + throw new BadCredentialsException("用户id 不能为空"); + } catch (BizException e) { + throw new BadCredentialsException(e.getMessage()); + } catch (Exception e) { + throw new InternalAuthenticationServiceException("授权失败:", e); + } + } + + private String trim(String trimStr) { + if (StringUtils.isNotBlank(trimStr)) { + return trimStr.trim(); + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java new file mode 100644 index 0000000..cf1d7d2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.user.security.auth.agent; + +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:55 下午 + * @Version 1.0 + **/ +public class AgentAuthProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + if (!(authentication instanceof AgentAuthToken)) { + throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); + } + AgentAuthToken authenticationToken = (AgentAuthToken) authentication; + String principal = (String) authenticationToken.getPrincipal(); + + UserDetails user = userDetailsService.loadUserByUsername(principal); + // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 + return new AgentAuthToken(user, user.getPassword(), user.getAuthorities()); + } + + @Override + public boolean supports(Class authentication) { + return AgentAuthToken.class.isAssignableFrom(authentication); + } + + public void setUserDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java new file mode 100644 index 0000000..9fdeb20 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.user.security.auth.agent; + +import com.hz.pm.api.user.security.auth.AuthProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.stereotype.Component; + +/** + * 账号密码登陆的认证配置 + */ +@Component +public class AgentAuthSecurityConfig + extends SecurityConfigurerAdapter { + + @Autowired + @Qualifier(value = "defaultLoginSuccessHandler") + protected AuthenticationSuccessHandler defaultLoginSuccessHandler; + + @Autowired + @Qualifier(value = "defaultLoginFailureHandler") + protected AuthenticationFailureHandler defaultLoginFailureHandler; + + @Autowired + @Qualifier(value = "agentLoginUserDetailService") + private UserDetailsService agentLoginUserDetailService; + + @Autowired + private AuthProperties authProperties; + + private AuthenticationManager authenticationManager; + + @Override + public void configure(HttpSecurity http) throws Exception { + AgentAuthFilter agentAuthFilter = + new AgentAuthFilter(authProperties.getAgentLoginUrl()); + authenticationManager = http.getSharedObject(AuthenticationManager.class); + agentAuthFilter.setAuthenticationManager(authenticationManager); + agentAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); + agentAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); + + AgentAuthProvider authenticationProvider = new AgentAuthProvider(); + authenticationProvider.setUserDetailsService(agentLoginUserDetailService); + + http.authenticationProvider(authenticationProvider).addFilterAfter(agentAuthFilter, + UsernamePasswordAuthenticationFilter.class); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java new file mode 100644 index 0000000..52777b7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java @@ -0,0 +1,76 @@ +package com.hz.pm.api.user.security.auth.agent; + +import com.hz.pm.api.user.constant.LoginTypeEnum; +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +import java.util.Collection; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:52 下午 + * @Version 1.0 + **/ +public class AgentAuthToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + private final Object principal; + + private final Object credentials; + + /** + * This constructor can be safely used by any code that wishes to create a + * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return + * false. + */ + public AgentAuthToken(String principal, String credentials) { + super(null); + this.principal = principal; + this.credentials = credentials; + setAuthenticated(false); + } + + /** + * This constructor should only be used by AuthenticationManager or AuthenticationProvider + * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) + * authentication token. + * + * @param principal + * @param authorities + */ + public AgentAuthToken(Object principal, Object credentials, + Collection authorities) { + super(authorities); + this.principal = principal; + this.credentials = credentials; + // must use super, as we override + super.setAuthenticated(true); + } + + @Override + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java new file mode 100644 index 0000000..ab936f8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.user.security.auth.agent; + + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午9:49 + */ + +@Service("agentLoginUserDetailService") +@RequiredArgsConstructor +public class AgentLoginUserDetailService implements UserDetailsService { + + private final UserInfoHelper userInfoHelper; + + @Override + public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { + + final Long userId = Long.parseLong(username); + + UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfo(userId); + + if (Objects.isNull(userFullInfoDTO)) { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } + + UserInfoDetails userInfoDetails = new UserInfoDetails(); + userInfoDetails.setUserId(userFullInfoDTO.getUserId()); + userInfoDetails.setUsername(userFullInfoDTO.getUsername()); + userInfoDetails.setRealName(userFullInfoDTO.getRealName()); + userInfoDetails.setUserRoleList(userFullInfoDTO.getUserRoleList()); + userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode()); + userInfoDetails.setRegionLevel(userFullInfoDTO.getRegionLevel()); + userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); + userInfoDetails.setPassword(userFullInfoDTO.getCredential()); + userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); + userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); + userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); + userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); + userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName()); + return userInfoDetails; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthFilter.java new file mode 100644 index 0000000..d123ad2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthFilter.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.user.security.auth.common; + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.user.security.auth.model.WebRequestDetails; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.InternalAuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:46 下午 + * @Version 1.0 + **/ +public class CommonAuthFilter extends AbstractAuthenticationProcessingFilter { + + private boolean postOnly = true; + + private static final String CREDENTIAL_PARAMETER = "credential"; + private static final String PLATFORM_PARAMETER = "platform"; + + // ~ Constructors + // =================================================================================================== + + public CommonAuthFilter(String processingUrl) { + super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); + } + + // ~ Methods + // ======================================================================================================== + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException { + if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { + throw new AuthenticationServiceException("请求方法错误"); + } + String credential = request.getParameter(CREDENTIAL_PARAMETER); + String platform = request.getParameter(PLATFORM_PARAMETER); + if (StringUtils.isBlank(credential)) { + throw new CommonLoginException("凭证 不能为空"); + } + if (StringUtils.isBlank(platform)) { + throw new CommonLoginException("平台 不能为空"); + } + + platform = trim(platform); + credential = trim(credential); + try { + CommonAuthToken authRequest = new CommonAuthToken(platform, credential); + authRequest.setDetails(new WebRequestDetails(request)); + return this.getAuthenticationManager().authenticate(authRequest); + } catch (AuthenticationException e) { + throw new BadCredentialsException("用户状态"); + } catch (BizException e) { + throw new BadCredentialsException(e.getMessage()); + } catch (Exception e) { + throw new InternalAuthenticationServiceException("授权失败:", e); + } + } + + private String trim(String trimStr) { + if (StringUtils.isNotBlank(trimStr)) { + return trimStr.trim(); + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthProvider.java new file mode 100644 index 0000000..a581b7e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthProvider.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.user.security.auth.common; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.hz.pm.api.common.model.ZwddTokenUser; +import com.hz.pm.api.common.util.JwtTokenUtil; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; + +import java.util.Objects; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:55 下午 + * @Version 1.0 + **/ +public class CommonAuthProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + if (!(authentication instanceof CommonAuthToken)) { + throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); + } + CommonAuthToken authenticationToken = (CommonAuthToken) authentication; + // 平台 目前只有省局项管跳转 + String platform = (String) authenticationToken.getPrincipal(); + // 密钥 + String credential = (String) authenticationToken.getCredentials(); + + ZwddTokenUser zwddTokenUser = JwtTokenUtil.parseJwt(credential); + if (Objects.isNull(zwddTokenUser)) { + throw new CommonLoginException("用户信息校验失败"); + } + String employeeCode = zwddTokenUser.getEmployeeCode(); + if (StringUtils.isBlank(employeeCode)) { + throw new CommonLoginException("当前用户尚未创建应用账号,请联系管理员创建账号"); + } + UserDetails user = userDetailsService.loadUserByUsername(zwddTokenUser.getEmployeeCode()); + + // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 + return new CommonAuthToken(user, user.getPassword(), user.getAuthorities()); + } + + @Override + public boolean supports(Class authentication) { + return CommonAuthToken.class.isAssignableFrom(authentication); + } + + public void setUserDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthSecurityConfig.java new file mode 100644 index 0000000..59be254 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthSecurityConfig.java @@ -0,0 +1,55 @@ +package com.hz.pm.api.user.security.auth.common; + +import com.hz.pm.api.user.security.auth.AuthProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.stereotype.Component; + +/** + * 账号密码登陆的认证配置 + */ +@Component +public class CommonAuthSecurityConfig + extends SecurityConfigurerAdapter { + + @Autowired + @Qualifier(value = "defaultLoginSuccessHandler") + protected AuthenticationSuccessHandler defaultLoginSuccessHandler; + + @Autowired + @Qualifier(value = "defaultLoginFailureHandler") + protected AuthenticationFailureHandler defaultLoginFailureHandler; + + @Autowired + @Qualifier(value = "commonLoginUserDetailService") + private UserDetailsService commonLoginUserDetailService; + + @Autowired + private AuthProperties authProperties; + + private AuthenticationManager authenticationManager; + + @Override + public void configure(HttpSecurity http) throws Exception { + CommonAuthFilter commonAuthFilter = + new CommonAuthFilter(authProperties.getCommonLoginUrl()); + authenticationManager = http.getSharedObject(AuthenticationManager.class); + commonAuthFilter.setAuthenticationManager(authenticationManager); + commonAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); + commonAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); + + CommonAuthProvider authenticationProvider = new CommonAuthProvider(); + authenticationProvider.setUserDetailsService(commonLoginUserDetailService); + + http.authenticationProvider(authenticationProvider).addFilterAfter(commonAuthFilter, + UsernamePasswordAuthenticationFilter.class); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthToken.java new file mode 100644 index 0000000..cc6d95c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonAuthToken.java @@ -0,0 +1,75 @@ +package com.hz.pm.api.user.security.auth.common; + +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +import java.util.Collection; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:52 下午 + * @Version 1.0 + **/ +public class CommonAuthToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + private final Object principal; + + private final Object credentials; + + /** + * This constructor can be safely used by any code that wishes to create a + * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return + * false. + */ + public CommonAuthToken(String principal, String credentials) { + super(null); + this.principal = principal; + this.credentials = credentials; + setAuthenticated(false); + } + + /** + * This constructor should only be used by AuthenticationManager or AuthenticationProvider + * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) + * authentication token. + * + * @param principal + * @param authorities + */ + public CommonAuthToken(Object principal, Object credentials, + Collection authorities) { + super(authorities); + this.principal = principal; + this.credentials = credentials; + // must use super, as we override + super.setAuthenticated(true); + } + + @Override + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonLoginUserDetailService.java new file mode 100644 index 0000000..ab6ab3a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/common/CommonLoginUserDetailService.java @@ -0,0 +1,54 @@ +package com.hz.pm.api.user.security.auth.common; + + +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.manage.UserInfoManage; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午9:49 + */ + +@Service("commonLoginUserDetailService") +@RequiredArgsConstructor +public class CommonLoginUserDetailService implements UserDetailsService { + + private final UserInfoManage userInfoManage; + + @Override + public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { + final String employeeCode = username; + UserFullInfoDTO userFullInfoDTO = userInfoManage.getUserFullInfoByEmployeeCode(employeeCode); + + if (Objects.isNull(userFullInfoDTO)) { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } + UserInfoDetails userInfoDetails = new UserInfoDetails(); + userInfoDetails.setUserId(userFullInfoDTO.getUserId()); + userInfoDetails.setUsername(userFullInfoDTO.getUsername()); + userInfoDetails.setRealName(userFullInfoDTO.getRealName()); + userInfoDetails.setUserRoleList(userFullInfoDTO.getUserRoleList()); + userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode()); + userInfoDetails.setRegionLevel(userFullInfoDTO.getRegionLevel()); + userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); + userInfoDetails.setPassword(userFullInfoDTO.getCredential()); + userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); + userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); + userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); + userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); + userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName()); + return userInfoDetails; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/RedisSessionConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/RedisSessionConfig.java new file mode 100644 index 0000000..2a80976 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/RedisSessionConfig.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.security.auth.config;//package com.hz.pm.api.user.security.auth.config; + +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.http.CookieHttpSessionIdResolver; +import org.springframework.session.web.http.DefaultCookieSerializer; + +/** + *

+ * 设置session的过期时间为一天 + *

+ * + * @Author LiuXinXin + * @Date 2020/7/29 9:46 上午 + * @Version 1.0 + **/ +@Configuration +@EnableRedisHttpSession +public class RedisSessionConfig { + + @Bean + public CookieHttpSessionIdResolver sessionIdResolver() { + // 创建 CookieHttpSessionIdResolver 对象 + CookieHttpSessionIdResolver sessionIdResolver = new CookieHttpSessionIdResolver(); + + // 创建 DefaultCookieSerializer 对象 + DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); + sessionIdResolver.setCookieSerializer(cookieSerializer); + // 设置到 sessionIdResolver 中 + cookieSerializer.setCookieName(BizConst.COOKIE_KEY); + cookieSerializer.setCookieMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); + return sessionIdResolver; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/SessionTimeoutConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/SessionTimeoutConfig.java new file mode 100644 index 0000000..fc2c34b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/SessionTimeoutConfig.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.security.auth.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.RedisIndexedSessionRepository; +import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; + +import javax.annotation.PostConstruct; + +/** + *

+ * 设置session的过期时间为一天 + *

+ * + * @Author LiuXinXin + * @Date 2020/7/29 9:46 上午 + * @Version 1.0 + **/ +@Configuration +@RequiredArgsConstructor +@AutoConfigureAfter(RedisHttpSessionConfiguration.class) +public class SessionTimeoutConfig { + + @Value("${spring.session.timeout:14400}") + private Integer springSessionTimeout; + + private final RedisHttpSessionConfiguration redisHttpSessionConfiguration; + private final RedisIndexedSessionRepository redisIndexedSessionRepository; + + @PostConstruct + public void sessionTimeoutTime() { + redisHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(springSessionTimeout); + redisIndexedSessionRepository.setDefaultMaxInactiveInterval(springSessionTimeout); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/AuthTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/AuthTypeEnum.java new file mode 100644 index 0000000..516bfe8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/AuthTypeEnum.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.user.security.auth.constants; + +/** + * @author Liuxinxin + * @date 2021/7/30 下午2:10 + */ + +public enum AuthTypeEnum { + + /** + * 手机 + 密码的认证方式 + */ + PHONE_PASSWORD("phone_password"), + + /** + * 子账号 账号 + 密码的认证方式 + */ + ACCOUNT_PASSWORD("account_password"); + + private final String key; + + AuthTypeEnum(String key) { + this.key = key; + } + + public static boolean contains(String key) { + for (AuthTypeEnum value : AuthTypeEnum.values()) { + if (key.equals(value.getKey())) { + return true; + } + } + return false; + } + + public String getKey() { + return key; + } + + public static AuthTypeEnum of(String key) { + for (AuthTypeEnum value : AuthTypeEnum.values()) { + if (key.equals(value.getKey())) { + return value; + } + } + throw new RuntimeException(String.format("invalid AuthTypeEnum = %s", key)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/PlatformTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/PlatformTypeEnum.java new file mode 100644 index 0000000..13706e5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/PlatformTypeEnum.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.user.security.auth.constants; + +/** + * @author liuxinxin + * @date 2023/5/4 上午10:53 + */ + +public enum PlatformTypeEnum { + + /** + * 省局 + */ + PROVINCIAL_BUREAU + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java new file mode 100644 index 0000000..33f6971 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java @@ -0,0 +1,14 @@ +package com.hz.pm.api.user.security.auth.constants; + +/** + * @Author LiuXinXin + * @Date 2022/2/17 12:59 上午 + * @Version 1.0 + **/ +public class SessionTimeConstant { + + public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; + public static final Integer SESSION_EXPIRED = 0; + + public static final String UNIVERSAL_VERIFICATION_CODE = "9527"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/UserDeatilsServiceConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/UserDeatilsServiceConstant.java new file mode 100644 index 0000000..2ca4b78 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/UserDeatilsServiceConstant.java @@ -0,0 +1,11 @@ +package com.hz.pm.api.user.security.auth.constants; + +/** + * @author liuxinxin + * @date 2023/2/14 上午11:29 + */ + +public class UserDeatilsServiceConstant { + + public static final String USER_DETAILS_SERVICE_SEPARATOR = "@###@"; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthFilter.java new file mode 100644 index 0000000..3ea0c10 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthFilter.java @@ -0,0 +1,110 @@ +package com.hz.pm.api.user.security.auth.credential; + +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.user.constant.LoginTypeEnum; +import com.hz.pm.api.user.security.auth.model.WebRequestDetails; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.InternalAuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:46 下午 + * @Version 1.0 + **/ +public class CredentialAuthFilter extends AbstractAuthenticationProcessingFilter { + + private boolean postOnly = true; + + private static final String IDENTIFIER_PARAMETER = "identifier"; + private static final String CREDENTIAL_PARAMETER = "credential"; + private static final String LOGIN_TYPE_PARAMETER = "loginType"; + + + // ~ Constructors + // =================================================================================================== + + public CredentialAuthFilter(String processingUrl) { + super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); + } + + // ~ Methods + // ======================================================================================================== + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException { + if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { + throw new AuthenticationServiceException("请求方法错误"); + } + String identifier = request.getParameter(IDENTIFIER_PARAMETER); + String credential = request.getParameter(CREDENTIAL_PARAMETER); + String loginType = request.getParameter(LOGIN_TYPE_PARAMETER); + if (StringUtils.isBlank(loginType)) { + throw new BadCredentialsException("登陆类型不能为空"); + } + paramValid(identifier, credential, loginType); + + identifier = trim(identifier); + credential = trim(credential); + loginType = trim(loginType); + try { + CredentialAuthToken authRequest = new CredentialAuthToken(identifier, credential, loginType); + authRequest.setDetails(new WebRequestDetails(request)); + return this.getAuthenticationManager().authenticate(authRequest); + } catch (CommonLoginException e) { + throw new CommonLoginException(e.getMessage()); + } catch (BadCredentialsException | BizException e) { + throw new BadCredentialsException(e.getMessage()); + } catch (AuthenticationException e) { + throw new BadCredentialsException("账号或密码错误"); + } catch (Exception e) { + throw new InternalAuthenticationServiceException("授权失败:", e); + } + } + + protected void setDetails(HttpServletRequest request, CredentialAuthToken authRequest) { + authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); + } + + private void paramValid(String identifier, String credential, String loginType) { + LoginTypeEnum loginTypeEnum = LoginTypeEnum.valueOf(loginType); + switch (loginTypeEnum) { + case DING_QR_LOGIN: { + if (StringUtils.isBlank(credential)) { + throw new CommonLoginException("浙政钉扫码登陆 授权码 不能为空 credential"); + } + } + break; + case USERNAME_PASSWORD_LOGIN: { + if (StringUtils.isBlank(identifier) || StringUtils.isBlank(credential)) { + throw new CommonLoginException("账号密码登陆 账号密码不能为空 identifier credential"); + } + } + break; + case PHONE_VERIFICATION_CODE_LOGIN: { + if (StringUtils.isBlank(identifier) || StringUtils.isBlank(credential)) { + throw new CommonLoginException("手机号验证码登陆 手机号或验证码不能为空 identifier credential"); + } + } + break; + } + } + + private String trim(String trimStr) { + if (StringUtils.isNotBlank(trimStr)) { + return trimStr.trim(); + } + return null; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java new file mode 100644 index 0000000..0d53b65 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java @@ -0,0 +1,134 @@ +package com.hz.pm.api.user.security.auth.credential; + +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; +import com.hz.pm.api.user.constant.LoginTypeEnum; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import com.hz.pm.api.user.security.auth.constants.UserDeatilsServiceConstant; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import com.ningdatech.zwdd.client.ZwddAuthClient; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.password.PasswordEncoder; + +import java.util.Objects; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:55 下午 + * @Version 1.0 + **/ +public class CredentialAuthProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + + private PasswordEncoder passwordEncoder; + + private ZwddAuthClient zwddAuthClient; + + private Boolean phoneVerifyCodeSkip; + + private VerifyCodeCheckHelper verifyCodeCheckHelper; + + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + if (!(authentication instanceof CredentialAuthToken)) { + throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); + } + CredentialAuthToken authenticationToken = (CredentialAuthToken) authentication; + String principal = (String) authenticationToken.getPrincipal(); + + UserDetails user = null; + LoginTypeEnum loginTypeEnum = authenticationToken.getLoginTypeEnum(); + String credentials = (String) authenticationToken.getCredentials(); + switch (loginTypeEnum) { + case DING_QR_LOGIN: { + String code = (String) authenticationToken.getCredentials(); + GenericResult accountResult = zwddAuthClient.getAccountId(code); + if (!accountResult.isSuccess()) { + throw new BadCredentialsException("login fail! 浙政钉校验失败"); + } + String accountId = accountResult.getData(); + if (Objects.isNull(accountId)) { + throw new BadCredentialsException("login fail! 浙政钉校验失败"); + } + user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); + } + break; + case DING_MD_LOGIN: { + String code = (String) authenticationToken.getCredentials(); + GenericResult accountResult = zwddAuthClient.getMobileAccountId(code); + if (!accountResult.isSuccess()) { + throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); + } + String accountId = accountResult.getData(); + if (Objects.isNull(accountId)) { + throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); + } + user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); + } + break; + case PHONE_VERIFICATION_CODE_LOGIN: { + if (!phoneVerifyCodeSkip) { + // 校验短信验证码 + boolean verificationResult = verifyCodeCheckHelper.verification(VerificationCodeType.LOGIN, principal, credentials); + if (!verificationResult && !SessionTimeConstant.UNIVERSAL_VERIFICATION_CODE.equals(credentials)) { + throw new CommonLoginException("验证码错误"); + } + } + user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); + } + break; + case USERNAME_PASSWORD_LOGIN: { + user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); + } + break; + } + // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 + return new CredentialAuthToken(user, user.getPassword(), user.getAuthorities()); + } + + protected void additionalAuthenticationChecks(UserDetails userDetails, CredentialAuthToken authentication) + throws AuthenticationException { + if (authentication.getCredentials() == null) { + throw new BadCredentialsException("login fail! password is null"); + } + String presentedPassword = authentication.getCredentials().toString(); + if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { + throw new BadCredentialsException("login fail! password is error"); + } + } + + + @Override + public boolean supports(Class authentication) { + return CredentialAuthToken.class.isAssignableFrom(authentication); + } + + public void setUserDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } + + public void setPasswordEncoder(PasswordEncoder passwordEncoder) { + this.passwordEncoder = passwordEncoder; + } + + public void setZwddAuthClient(ZwddAuthClient zwddAuthClient) { + this.zwddAuthClient = zwddAuthClient; + } + + public void setVerifyCodeCheckHelper(VerifyCodeCheckHelper verifyCodeCheckHelper) { + this.verifyCodeCheckHelper = verifyCodeCheckHelper; + } + + public void setPhoneVerifyCodeSkip(Boolean phoneVerifyCodeSkip) { + this.phoneVerifyCodeSkip = phoneVerifyCodeSkip; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthSecurityConfig.java new file mode 100644 index 0000000..1d0d0b9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthSecurityConfig.java @@ -0,0 +1,80 @@ +package com.hz.pm.api.user.security.auth.credential; + +import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; +import com.hz.pm.api.user.security.auth.AuthProperties; +import com.ningdatech.zwdd.client.ZwddAuthClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.stereotype.Component; + +/** + * 账号密码登陆的认证配置 + */ +@Component +public class CredentialAuthSecurityConfig + extends SecurityConfigurerAdapter { + @Value("${login.phone-verify-code.skip:false}") + private Boolean skipLoginVerifyCodeCheck; + + @Autowired + @Qualifier(value = "defaultLoginSuccessHandler") + protected AuthenticationSuccessHandler defaultLoginSuccessHandler; + + @Autowired + @Qualifier(value = "defaultLoginFailureHandler") + protected AuthenticationFailureHandler defaultLoginFailureHandler; + + @Autowired + @Qualifier(value = "credentialLoginUserDetailService") + private UserDetailsService credentialLoginUserDetailService; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Autowired + private AuthProperties authProperties; + + private AuthenticationManager authenticationManager; + + @Autowired + private ZwddAuthClient zwddAuthClient; + + @Autowired + private VerifyCodeCheckHelper verifyCodeCheckHelper; + + @Override + public void configure(HttpSecurity http) throws Exception { + CredentialAuthFilter credentialAuthFilter = + new CredentialAuthFilter(authProperties.getPasswordLoginUrl()); + authenticationManager = http.getSharedObject(AuthenticationManager.class); + credentialAuthFilter.setAuthenticationManager(authenticationManager); + credentialAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); + credentialAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); + + CredentialAuthProvider authenticationProvider = new CredentialAuthProvider(); + authenticationProvider.setPhoneVerifyCodeSkip(skipLoginVerifyCodeCheck); + authenticationProvider.setUserDetailsService(credentialLoginUserDetailService); + // 确保对密码进行加密的encoder和解密的encoder相同 + authenticationProvider.setPasswordEncoder(passwordEncoder); + // 传入浙政钉client + authenticationProvider.setZwddAuthClient(zwddAuthClient); + authenticationProvider.setVerifyCodeCheckHelper(verifyCodeCheckHelper); + + http.authenticationProvider(authenticationProvider).addFilterAfter(credentialAuthFilter, + UsernamePasswordAuthenticationFilter.class); + } + + public AuthenticationManager getAuthenticationManager() { + return authenticationManager; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthToken.java new file mode 100644 index 0000000..14b5a13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthToken.java @@ -0,0 +1,84 @@ +package com.hz.pm.api.user.security.auth.credential; + +import com.hz.pm.api.user.constant.LoginTypeEnum; +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +import java.util.Collection; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:52 下午 + * @Version 1.0 + **/ +public class CredentialAuthToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + private final Object principal; + + private final Object credentials; + + private final LoginTypeEnum loginTypeEnum; + + /** + * This constructor can be safely used by any code that wishes to create a + * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return + * false. + */ + public CredentialAuthToken(String principal, String credentials, String loginTypeEnum) { + super(null); + this.principal = principal; + this.credentials = credentials; + this.loginTypeEnum = LoginTypeEnum.valueOf(loginTypeEnum); + setAuthenticated(false); + } + + /** + * This constructor should only be used by AuthenticationManager or AuthenticationProvider + * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) + * authentication token. + * + * @param principal + * @param authorities + */ + public CredentialAuthToken(Object principal, Object credentials, + Collection authorities) { + super(authorities); + this.principal = principal; + this.credentials = credentials; + this.loginTypeEnum = null; + // must use super, as we override + super.setAuthenticated(true); + } + + public LoginTypeEnum getLoginTypeEnum() { + return this.loginTypeEnum; + } + + @Override + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialLoginUserDetailService.java new file mode 100644 index 0000000..f40f33c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialLoginUserDetailService.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.user.security.auth.credential; + + +import com.hz.pm.api.user.constant.LoginTypeEnum; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.convert.UserInfoConvertor; +import com.hz.pm.api.user.manage.UserInfoManage; +import com.hz.pm.api.user.security.auth.constants.UserDeatilsServiceConstant; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午9:49 + */ + +@Service("credentialLoginUserDetailService") +@RequiredArgsConstructor +public class CredentialLoginUserDetailService implements UserDetailsService { + + private final UserInfoManage userInfoManage; + + @Override + public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { + String[] split = username.split(UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR); + username = split[0]; + String loginTypeStr = split[1]; + LoginTypeEnum loginTypeEnum = LoginTypeEnum.valueOf(loginTypeStr); + + UserFullInfoDTO userFullInfo; + switch (loginTypeEnum) { + case PHONE_VERIFICATION_CODE_LOGIN: { + userFullInfo = userInfoManage.queryUserInfoInPhoneNoAuth(username); + if (Objects.isNull(userFullInfo)) { + throw new CommonLoginException("该手机号未绑定用户"); + } + } + break; + case USERNAME_PASSWORD_LOGIN: { + userFullInfo = userInfoManage.queryUserInfoInPasswordAuth(username); + if (Objects.isNull(userFullInfo)) { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + } + break; + case DING_MD_LOGIN: + case DING_QR_LOGIN: { + userFullInfo = userInfoManage.queryUserInfoInAccountIdAuth(username); + if (Objects.isNull(userFullInfo)) { + throw new CommonLoginException("浙政钉账号无法登陆"); + } + } + break; + default: { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + } + + if (UserAvailableEnum.DISABLE.equals(userFullInfo.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } + return UserInfoConvertor.toUserInfoDetails(userFullInfo); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/errorcode/AuthErrorCodeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/errorcode/AuthErrorCodeEnum.java new file mode 100644 index 0000000..b4735c9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/errorcode/AuthErrorCodeEnum.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.user.security.auth.errorcode; + + +import com.hz.pm.api.common.errorcode.AppErrorCode; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author LiuXinXin + * @date 2021/7/30 上午10:59 + */ + +@AllArgsConstructor +@Getter +public enum AuthErrorCodeEnum { + + USERNAME_OR_PASSWORD_ERROR(AppErrorCode.AUTH.getCode() + "100000" + , "登陆时用户名或者密码错误"), + + ACCOUNT_ALREADY_EXIST_WHEN_REGISTER(AppErrorCode.AUTH.getCode() + "100001" + , "账号已经存在"), + + SESSION_EXPIRED(AppErrorCode.AUTH.getCode() + "100002" + , "用户session过期,登陆状态失效"); + + + private final String code; + + private final String msg; + + public Integer getCode() { + return Integer.valueOf(code); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultExpiredSessionStrategy.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultExpiredSessionStrategy.java new file mode 100644 index 0000000..8cefa5e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultExpiredSessionStrategy.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.hz.pm.api.user.security.auth.errorcode.AuthErrorCodeEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.security.web.session.SessionInformationExpiredEvent; +import org.springframework.security.web.session.SessionInformationExpiredStrategy; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/20 11:15 上午 + * @Version 1.0 + **/ +@Component +public class DefaultExpiredSessionStrategy implements SessionInformationExpiredStrategy { + + public static final Logger LOG = LoggerFactory.getLogger(DefaultExpiredSessionStrategy.class); + + @Autowired + private ObjectMapper objectMapper; + + @Override + public void onExpiredSessionDetected(SessionInformationExpiredEvent sessionInformationExpiredEvent) + throws IOException { + HttpServletResponse response = sessionInformationExpiredEvent.getResponse(); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write(objectMapper.writeValueAsString( + ApiResponse.of(AuthErrorCodeEnum.SESSION_EXPIRED.getCode(), AuthErrorCodeEnum.SESSION_EXPIRED.getMsg(), null))); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginFailureHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginFailureHandler.java new file mode 100644 index 0000000..ec5edb1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginFailureHandler.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.hz.pm.api.user.security.auth.errorcode.AuthErrorCodeEnum; +import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:32 下午 + * @Version 1.0 + **/ +@Component("defaultLoginFailureHandler") +public class DefaultLoginFailureHandler extends SimpleUrlAuthenticationFailureHandler { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, + AuthenticationException exception) throws IOException, ServletException { + response.setContentType("application/json;charset=UTF-8"); + int errorCode; + String errorMsg; + // 所有的认证异常都可以在这里添加,目前只支持用户名密码错误异常 + + if (exception instanceof CommonLoginException) { + errorCode = 400; + errorMsg = exception.getMessage(); + } else if (exception instanceof BadCredentialsException || exception instanceof UsernameNotFoundException) { + errorCode = AuthErrorCodeEnum.USERNAME_OR_PASSWORD_ERROR.getCode(); + errorMsg = exception.getMessage(); + } else { + errorCode = ApiResponse.ERROR_CODE; + errorMsg = ApiResponse.ERROR_MSG; + } + response.setStatus(400); + response.getWriter() + .write(objectMapper.writeValueAsString(ApiResponse.of(errorCode, errorMsg, null))); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginSuccessHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginSuccessHandler.java new file mode 100644 index 0000000..a9f775a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLoginSuccessHandler.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.http.MediaType; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:32 下午 + * @Version 1.0 + **/ +@Component("defaultLoginSuccessHandler") +@Primary +public class DefaultLoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { + + @Autowired + private ObjectMapper objectMapper; + + @Override + public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, + Authentication authentication) throws IOException { + response.setContentType(MediaType.APPLICATION_JSON_VALUE); + response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofMessage(ApiResponse.SUCCESS_MSG))); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLogoutSuccessHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLogoutSuccessHandler.java new file mode 100644 index 0000000..e9aa364 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/handler/DefaultLogoutSuccessHandler.java @@ -0,0 +1,28 @@ +package com.hz.pm.api.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 默认的退出成功处理器 + */ +@Component("defaultLogoutSuccessHandler") +public class DefaultLogoutSuccessHandler implements LogoutSuccessHandler { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException { + // 退出成功后返回 和前端约定的Json + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofSuccess())); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/lisenter/AuthorizationEventListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/lisenter/AuthorizationEventListener.java new file mode 100644 index 0000000..c22a59b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/lisenter/AuthorizationEventListener.java @@ -0,0 +1,71 @@ +package com.hz.pm.api.user.security.auth.lisenter; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.ningdatech.log.model.OptLogDTO; +import com.ningdatech.log.model.enumeration.LogType; +import com.ningdatech.log.service.OptLogService; +import com.ningdatech.log.util.AddressUtil; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import com.hz.pm.api.user.security.auth.model.WebRequestDetails; +import lombok.RequiredArgsConstructor; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.security.authentication.event.AbstractAuthenticationEvent; +import org.springframework.security.authentication.event.AuthenticationSuccessEvent; +import org.springframework.security.authentication.event.LogoutSuccessEvent; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +/** + *

+ * AuthorizationEventListener + *

+ * + * @author WendyYang + * @since 2023/6/7 + **/ +@Component +@RequiredArgsConstructor +public class AuthorizationEventListener { + + private final OptLogService optLogService; + + @Async + @EventListener(AuthenticationSuccessEvent.class) + public void loginSuccessListener(AuthenticationSuccessEvent event) { + optLogService.save(buildOptLog("用户登录", event)); + } + + @Async + @EventListener(LogoutSuccessEvent.class) + public void logoutSuccessListener(LogoutSuccessEvent event) { + optLogService.save(buildOptLog("退出登录", event)); + } + + private OptLogDTO buildOptLog(String description, AbstractAuthenticationEvent event) { + Authentication authentication = event.getAuthentication(); + UserInfoDetails userDetails = (UserInfoDetails) authentication.getPrincipal(); + WebRequestDetails webDetails = (WebRequestDetails) authentication.getDetails(); + LocalDateTime now = LocalDateTime.now(); + OptLogDTO optLog = new OptLogDTO(); + optLog.setActionMethod(webDetails.getServletPath()); + optLog.setDescription(description); + optLog.setStartTime(LocalDateTimeUtil.of(event.getTimestamp())); + optLog.setFinishTime(now); + optLog.setCreateOn(now); + long consumingTime = System.currentTimeMillis() - event.getTimestamp(); + optLog.setConsumingTime(consumingTime); + optLog.setHttpMethod(webDetails.getMethod()); + optLog.setUserName(userDetails.getUsername()); + optLog.setCreateBy(userDetails.getUserId()); + optLog.setRequestIp(webDetails.getRequestIp()); + optLog.setRequestUri(webDetails.getRequestUri()); + optLog.setRegionByIp(AddressUtil.getRegion(optLog.getRequestIp())); + optLog.setUa(webDetails.getUserAgent()); + optLog.setType(LogType.OPT.name()); + return optLog; + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserFullInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserFullInfoDTO.java new file mode 100644 index 0000000..33d854e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserFullInfoDTO.java @@ -0,0 +1,138 @@ +package com.hz.pm.api.user.security.auth.model; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import lombok.Data; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/1/4 下午5:07 + */ + +@Data +public class UserFullInfoDTO { + + private Long userId; + + private String realName; + + private String username; + + private String identifier; + + private String credential; + + /** + * 所属区域编码 + */ + private String regionCode; + /** + * 所属区域编码 + */ + private Integer regionLevel; + + /** + * 浙政钉扫码 员工code + */ + private String employeeCode; + + /** + * 浙政钉组织code + */ + private String organizationCode; + + /** + * 手机号码 + */ + private String mobile; + + /** + * 浙政钉组织名称 + */ + private String organizationName; + + /** + * 任职所在单位code + */ + private String empPosUnitCode; + + /** + * 任职所在单位 + */ + private String empPosUnitName; + + /** + * 用户角色 + */ + private List userRoleList; + + private Long accountId; + + /** + * 用户是否可用 + */ + private UserAvailableEnum available; + + + /** + * 取最高的权限 + * + * @return + */ + public RoleEnum getRoleCode() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + return RoleEnum.checkHigherRole(this.userRoleList.stream() + .map(Role::getCode).collect(Collectors.toList())); + } + return null; + } + + public Boolean getIsOrgAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } + + public Boolean getSuperAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { + return Boolean.TRUE; + } + } + } + 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 notAdmin() { + if(!getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin()){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserInfoDetails.java new file mode 100644 index 0000000..3f0a224 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/UserInfoDetails.java @@ -0,0 +1,182 @@ +package com.hz.pm.api.user.security.auth.model; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.basic.auth.AbstractLoginUser; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author LiuXinXin + * @date 2022/8/1 下午3:32 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class UserInfoDetails extends AbstractLoginUser implements UserDetails { + + private static final long serialVersionUID = -8219907690673456440L; + + private String realName; + + private String password; + + /** + * 所属区域编码 + */ + private String regionCode; + + /** + * 所属区域层级 + */ + private Integer regionLevel; + + /** + * 浙政钉扫码 员工code + */ + private String employeeCode; + + /** + * 浙政钉组织code + */ + private String organizationCode; + + /** + * 浙政钉组织名称 + */ + private String organizationName; + + /** + * 用户角色 + */ + private List userRoleList; + + /** + * 任职所在单位code + */ + private String empPosUnitCode; + + /** + * 任职所在单位 + */ + private String empPosUnitName; + + + private String mobile; + + + /** + * 获取用户权限 + * + * @return + */ + @Override + public Collection getAuthorities() { + if (CollectionUtil.isNotEmpty(this.userRoleList)) { + List authorities = new ArrayList<>(); + for (Role role : this.userRoleList) { + authorities.add(new SimpleGrantedAuthority(role.getCode())); + } + return authorities; + } + return new ArrayList<>(); + } + + @Override + public String getPassword() { + return password; + } + + @Override + public String getUsername() { + return getIdentifier(); + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } + + /** + * 取最高的权限 + * + * @return + */ + public RoleEnum getRoleCode() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + return RoleEnum.checkHigherRole(this.userRoleList.stream() + .map(Role::getCode).collect(Collectors.toList())); + } + return null; + } + + public Boolean getIsOrgAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } + + public Boolean getSuperAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { + return Boolean.TRUE; + } + } + } + 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)) { + return Boolean.TRUE; + } + return Boolean.FALSE; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/WebRequestDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/WebRequestDetails.java new file mode 100644 index 0000000..5f96d0a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/model/WebRequestDetails.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.user.security.auth.model; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import org.springframework.security.web.authentication.WebAuthenticationDetails; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * WebRequestDetails + *

+ * + * @author WendyYang + * @since 2023/6/7 + **/ +public class WebRequestDetails extends WebAuthenticationDetails { + + private static final long serialVersionUID = -4466339683132696235L; + + private final String requestIp; + + private final String requestUri; + + private final String method; + + private final String servletPath; + + private final String requestUrl; + + private final String userAgent; + + /** + * Records the remote address and will also set the session Id if a session already + * exists (it won't create one). + * + * @param request that the authentication request was received from + */ + public WebRequestDetails(HttpServletRequest request) { + super(request); + this.requestUri = request.getRequestURI(); + this.method = request.getMethod(); + this.servletPath = request.getServletPath(); + this.requestUrl = request.getRequestURL().toString(); + this.requestIp = ServletUtil.getClientIP(request); + this.userAgent = StrUtil.sub(request.getHeader("user-agent"), 0, 500); + } + + public String getRequestIp() { + return requestIp; + } + + public String getRequestUri() { + return requestUri; + } + + public String getMethod() { + return method; + } + + public String getServletPath() { + return servletPath; + } + + public String getRequestUrl() { + return requestUrl; + } + + public String getUserAgent() { + return userAgent; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/CommonLoginException.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/CommonLoginException.java new file mode 100644 index 0000000..a661889 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/CommonLoginException.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.user.security.auth.validate; + +import org.springframework.security.core.AuthenticationException; + +/** + * @author liuxinxin + * @date 2023/3/24 上午11:47 + * 通用登陆错误 + */ +public class CommonLoginException extends AuthenticationException { + + public CommonLoginException(String message) { + super(message); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/DingQrLoginException.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/DingQrLoginException.java new file mode 100644 index 0000000..12fcd96 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/validate/DingQrLoginException.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.user.security.auth.validate; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/3/24 上午11:47 + * 浙政钉扫码登陆错误 + */ + +@Data +public class DingQrLoginException extends RuntimeException { + + private Integer code; + + private String message; + + public DingQrLoginException(int code, String message) { + this.code = code; + this.message = message; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java new file mode 100644 index 0000000..b9ed11c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.user.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.user.entity.UserAuth; +import com.hz.pm.api.user.entity.UserInfo; + +import java.util.Map; +import java.util.Set; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +public interface IUserAuthService extends IService { + + Map getUserMapByIds(Set staterUsers); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java new file mode 100644 index 0000000..16e5d82 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.user.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.user.entity.UserInfo; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +public interface IUserInfoService extends IService { + + UserInfo getUserInfoByPhoneNo(String phoneNo); + + UserInfo getUserInfoByEmployeeCode(String employeeCode); + + UserInfo getUserInfoByAccountId(Long accountId); + + List getUserInfoByEmployeeCodes(Collection employeeCodes); +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java new file mode 100644 index 0000000..05493d0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.user.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.user.entity.UserAuth; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.mapper.NdUserInfoMapper; +import com.hz.pm.api.user.mapper.UserAuthMapper; +import com.hz.pm.api.user.service.IUserAuthService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@Service +@RequiredArgsConstructor +public class UserAuthServiceImpl extends ServiceImpl implements IUserAuthService { + + private final NdUserInfoMapper userInfoMapper; + + @Override + public Map getUserMapByIds(Set staterUsers) { + List userInfos = userInfoMapper.selectBatchIds(staterUsers); + return userInfos.stream().collect(Collectors.toMap(UserInfo::getId, u -> u)); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java new file mode 100644 index 0000000..f2a277b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java @@ -0,0 +1,58 @@ +package com.hz.pm.api.user.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.mapper.NdUserInfoMapper; +import com.hz.pm.api.user.service.IUserInfoService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@Service +@RequiredArgsConstructor +public class UserInfoServiceImpl extends ServiceImpl implements IUserInfoService { + + @Override + public UserInfo getUserInfoByPhoneNo(String phoneNo) { + if (StringUtils.isEmpty(phoneNo)) { + return null; + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getMobile, phoneNo); + return getOne(query); + } + + @Override + public UserInfo getUserInfoByAccountId(Long accountId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getAccountId, accountId); + return getOne(query); + } + + @Override + public UserInfo getUserInfoByEmployeeCode(String employeeCode) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode); + return getOne(query); + } + + @Override + public List getUserInfoByEmployeeCodes(Collection employeeCodes) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getEmployeeCode, employeeCodes); + return list(query); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java new file mode 100644 index 0000000..1de3f81 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.user.util; + +import com.ningdatech.basic.auth.AbstractLoginUserUtil; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; + +import java.util.List; +import java.util.stream.Collectors; + + +/** + * @Author liuxinxin + * @Date 2022/9/30 12:26 下午 + * @Version 1.0 + **/ +public class LoginUserUtil extends AbstractLoginUserUtil { + + public static UserInfoDetails loginUserDetail() { + return getLoginUserPrincipal(); + } + + public static List getRoleIdList() { + UserInfoDetails userInfoDetails = loginUserDetail(); + List userRoleList = userInfoDetails.getUserRoleList(); + return userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + } + + public static boolean isExpert() { + UserInfoDetails detail = loginUserDetail(); + return detail.getUserRoleList().stream().anyMatch(w -> RoleEnum.EXPERT.eq(w.getCode())); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java new file mode 100644 index 0000000..da144d8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.workbench.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.hz.pm.api.workbench.manage.WorkbenchManage; +import com.hz.pm.api.workbench.model.vo.WorkbenchVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + * 工作台前端控制器 + * @author ZPF + * @since 2023/03/17 15:35 + */ +@RestController +@AllArgsConstructor +@Api(tags = "工作台控制器") +@RequestMapping("/api/v1/workbench") +public class WorkbenchController { + + private WorkbenchManage workbenchManage; + + /** + * @param year + * @return + */ + @GetMapping + public WorkbenchVO workbench(@RequestParam(defaultValue = "2023") Integer year){ + return workbenchManage.getWorkbenchData(year); + } + + @ApiOperation(value = "催办", notes = "催办") + @PostMapping("/urging/{recordId}") + @WebLog("催办") + public String urging(@PathVariable Long recordId){ + return workbenchManage.urging(recordId); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java new file mode 100644 index 0000000..0f01312 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.workbench.converter; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; +import com.hz.pm.api.sys.model.vo.NoticeListItemVO; +import com.hz.pm.api.todocenter.model.vo.ResToBeProcessedVO; +import com.hz.pm.api.todocenter.model.vo.TodoVO; +import com.hz.pm.api.workbench.model.vo.WorkbenchVO; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * @Classname WorkbenchConverter + * @Description + * @Date 2023/3/20 17:23 + * @Author PoffyZhang + */ +public class WorkbenchConverter { + + public static WorkbenchVO.DeclaredStatistics convert(DeclaredProjectStatisticsPO po,DeclaredProjectStatisticsPO lastYearPo) { + WorkbenchVO.DeclaredStatistics res = BeanUtil.copyProperties(po,WorkbenchVO.DeclaredStatistics.class); + if(Objects.nonNull(lastYearPo)){ + res.setDeclaredAmountLastYear(lastYearPo.getDeclaredAmount()); + res.setApprovalAmountLastYear(lastYearPo.getApprovalAmount()); + } + return res; + } + + public static TodoVO convert(ResToBeProcessedVO vo) { + TodoVO res = new TodoVO(); + res.setNodeId(vo.getNodeId()); + res.setProjectId(vo.getProjectId()); + res.setProjectName(vo.getProjectName()); + return res; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java new file mode 100644 index 0000000..58e52fb --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -0,0 +1,355 @@ +package com.hz.pm.api.workbench.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +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.google.common.collect.Sets; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.sys.enumeration.ProjectEarlyWarningStatusEnum; +import com.hz.pm.api.sys.manage.EarlyWarningManage; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; +import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; +import com.hz.pm.api.sys.model.req.NoticeListReq; +import com.hz.pm.api.sys.model.vo.ProjectEarlyWarningVO; +import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; +import com.hz.pm.api.sys.service.IProjectEarlyWarningService; +import com.hz.pm.api.sys.utils.EarlyWarningUtil; +import com.hz.pm.api.todocenter.manage.TodoCenterManage; +import com.hz.pm.api.todocenter.model.req.ToBeProcessedReq; +import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO; +import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.hz.pm.api.workbench.converter.WorkbenchConverter; +import com.hz.pm.api.workbench.model.vo.WorkbenchVO; +import com.wflow.bean.entity.WflowEarlyWarning; +import com.wflow.enums.WarningNoticeTypeEnum; +import com.wflow.enums.WarningRuleTypeEnum; +import com.wflow.service.IEarlyWarningService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.record.DVALRecord; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; + +/** + * @Classname WorkbenchManage + * @Description + * @Date 2023/3/20 10:56 + * @Author PoffyZhang + */ +@Component +@AllArgsConstructor +@Slf4j +public class WorkbenchManage { + + private final TodoCenterManage todoCenterManage; + + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + + private final IEarlyWarningRecordsService earlyWarningRecordsService; + + private final IEarlyWarningService earlyWarningService; + + private final IProjectEarlyWarningService projectEarlyWarningService; + + private final NoticeManage noticeManage; + + private final UserInfoHelper userInfoHelper; + + private final ProjectLibManage projectLibManage; + + private final EarlyWarningManage earlyWarningManage; + + private final IProjectService projectService; + + public WorkbenchVO getWorkbenchData(Integer year) { + WorkbenchVO res = new WorkbenchVO(); + Long userId = LoginUserUtil.getUserId(); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); + + CompletableFuture.allOf( + CompletableFuture.runAsync(() -> { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + //1.待办中心数据 + TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); + ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); + toBeProcessedReq.setPageNumber(1); + toBeProcessedReq.setPageSize(5); + toBeProcessedReq.setLoginUserId(userId); + toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); + statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() + .stream().map(WorkbenchConverter::convert).collect(Collectors.toList())); + res.setTodoCerter(statisticsVO); + stopWatch.stop(); + log.info("待办中心数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + //2.项目统计数据 + res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage + .declaredProjectOrgStatistics(year, user),defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); + if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { + res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage + .declaredProjectRegionStatistics(year, user),defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); + }else{ + res.setRegionDeclared(new WorkbenchVO.DeclaredStatistics()); + } + stopWatch.stop(); + log.info("项目统计数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + //3.所有公告按类型分 + NoticeListReq noticeListReq = new NoticeListReq(); + noticeListReq.setPageNumber(1); + noticeListReq.setPageSize(1000); + res.setNoticeList(noticeManage.listToMapByManager(noticeListReq,user)); + stopWatch.stop(); + log.info("公告 耗时,{} s",stopWatch.getTotalTimeSeconds()); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + //4.项目预警记录 + res.setProjectEarlyWarning(getProjectEarlyWarning(user)); + log.info("项目预警记录 耗时,{} s",stopWatch.getTotalTimeSeconds()); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + // 项目列表 + ProjectListReq projectListReq = new ProjectListReq(); + projectListReq.setPageNumber(1); + projectListReq.setPageSize(2000); + projectListReq.setProjectYear(year); + res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); + log.info("工作台 项目列表 耗时,{} s",stopWatch.getTotalTimeSeconds()); + }, ForkJoinPool.commonPool()) + ).join(); + + return res; + } + + private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) { + WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); + LambdaQueryWrapper projectWrapper = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE); + EarlyWarningUtil.buildPermissonProjectWrapper(projectWrapper,user); + List projects = projectService.list(projectWrapper); + Set projectCodeS = Sets.newHashSet(); + Map projectNameMap = projects.stream() + .filter(p -> projectCodeS.add(p.getProjectCode())) + .collect(Collectors.toMap(Project::getProjectCode,Project::getProjectName)); + + //4.1 + //累积预警统计 + WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); + LambdaQueryWrapper overWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) + .or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)); + EarlyWarningUtil.buildPermissonFullWrapper(overWrapper,user); + Long overCount = earlyWarningRecordsService.count(overWrapper); + accumulate.setOver(overCount.intValue()); + LambdaQueryWrapper adventWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode()); + EarlyWarningUtil.buildPermissonFullWrapper(adventWrapper,user); + Long adventCount = earlyWarningRecordsService.count(adventWrapper); + accumulate.setAdvent(adventCount.intValue()); + projectEarlyWarning.setAccumulate(accumulate); + + //4.2 + //当前 + //4.2.1 超期 + Page overPage = Page.of(1,1000); + Page adventPage = Page.of(1,1000); + Page normalPage = Page.of(1,1000); + LambdaQueryWrapper overPWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) + .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()) + .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) + .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); + projectEarlyWarningService.page(overPage,overPWrapper); + LambdaQueryWrapper adventPWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) + .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()) + .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) + .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); + projectEarlyWarningService.page(adventPage,adventPWrapper); + LambdaQueryWrapper normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) + .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) + .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) + .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); + projectEarlyWarningService.page(normalPage,normalWrapper); + + WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); + Long overTotal = overPage.getTotal(); + Long adventTotal = adventPage.getTotal(); + Long normalTotal = normalPage.getTotal(); + cuurent.setAdvent(adventTotal.intValue()); + cuurent.setOver(overTotal.intValue()); + cuurent.setNormal(normalTotal.intValue()); + projectEarlyWarning.setCurrent(cuurent); + + List warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) + .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) + .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()) + .orderByDesc(WflowEarlyWarningRecords::getWarningTime)); + Set projectCodeSet = Sets.newHashSet(); + Map warningMap = warningRecords.stream() + .filter(w -> projectCodeSet.add(w.getProjectCode())) + .collect(Collectors.toMap(WflowEarlyWarningRecords::getProjectCode, w -> w)); + + if(CollUtil.isNotEmpty(overPage.getRecords())){ + List overVos = overPage.getRecords().stream().map(o -> { + ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); + //取最新一条预警信息 + if(warningMap.containsKey(vo.getProjectCode())){ + WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(record.getWarningTime()); + vo.setInstStart(record.getInstStart()); + vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setNoticeMethod(record.getNoticeMethod()); + vo.setNoticeContent(record.getNoticeContent()); + vo.setPath(record.getPath()); + vo.setBatchEmployees(record.getBatchEmployees()); + vo.setRecordId(record.getId()); + } + vo.setProjectName(projectNameMap.get(o.getProjectCode())); + return vo; + }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getWarningTime).reversed()) + .collect(Collectors.toList()); + projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); + }else{ + projectEarlyWarning.setOvers(PageVo.empty()); + } + + if(CollUtil.isNotEmpty(adventPage.getRecords())){ + List adventVos = adventPage.getRecords().stream().map(o -> { + ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); + //取最新一条预警信息 + if(warningMap.containsKey(vo.getProjectCode())){ + WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(record.getWarningTime()); + vo.setInstStart(record.getInstStart()); + vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setNoticeMethod(record.getNoticeMethod()); + vo.setNoticeContent(record.getNoticeContent()); + vo.setPath(record.getPath()); + vo.setBatchEmployees(record.getBatchEmployees()); + vo.setRecordId(record.getId()); + } + vo.setProjectName(projectNameMap.get(o.getProjectCode())); + return vo; + }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getWarningTime).reversed()) + .collect(Collectors.toList()); + projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); + }else{ + projectEarlyWarning.setAdvents(PageVo.empty()); + } + + if(CollUtil.isNotEmpty(normalPage.getRecords())){ + List normalVos = normalPage.getRecords().stream().map(o -> { + ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); + //取最新一条预警信息 + if(warningMap.containsKey(vo.getProjectCode())){ + WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(record.getWarningTime()); + vo.setInstStart(record.getInstStart()); + vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setNoticeMethod(record.getNoticeMethod()); + vo.setNoticeContent(record.getNoticeContent()); + vo.setPath(record.getPath()); + vo.setBatchEmployees(record.getBatchEmployees()); + vo.setRecordId(record.getId()); + } + vo.setProjectName(projectNameMap.get(o.getProjectCode())); + return vo; + }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getId).reversed()) + .collect(Collectors.toList()); + projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); + }else{ + projectEarlyWarning.setNormals(PageVo.empty()); + } + return projectEarlyWarning; + } + + /** + * 催办 + * @param recordId + * @return + */ + public String urging(Long recordId) { + WflowEarlyWarningRecords record = earlyWarningRecordsService.getById(recordId); + + VUtils.isTrue(Objects.isNull(record)) + .throwMessage("催办失败,id不存在!"); + String noticeMethod = record.getNoticeMethod(); + Integer noticeType = record.getNoticeType(); + String projectCode = record.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + String batchEmployees = record.getBatchEmployees(); + Integer ruleType = record.getRuleType(); + String areaCode = record.getAreaCode(); + //如果是临期 可以取到 超期的小时数 + Integer overTime = record.getOverTime(); + String path = record.getPath(); + LocalDateTime instStart = record.getInstStart(); + Integer biz = record.getBiz(); + VUtils.isTrue(Objects.isNull(project)).throwMessage("催办失败,项目不存在!"); + if(StringUtils.isBlank(batchEmployees)){ + //如果批次员工号不存在 就取当前 + batchEmployees = record.getWarningEmployeecode(); + } + String noticeContent = record.getNoticeContent(); + //查出配置的模板 + WflowEarlyWarning config = earlyWarningService.getOne(Wrappers.lambdaQuery(WflowEarlyWarning.class) + .eq(WflowEarlyWarning::getAreaCode, areaCode) + .eq(WflowEarlyWarning::getRuleType, ruleType) + .last(BizConst.LIMIT_1)); + //如果配置能取到 就取模板的 + if(Objects.nonNull(config)){ + noticeContent = config.getNoticeContent(); + } + + VUtils.isTrue(StringUtils.isBlank(batchEmployees)) + .throwMessage("催办失败,员工为空!"); + String[] employees = batchEmployees.split(StrPool.COMMA); + //算出 当前和他的 小时差 临期 + Long adventBetween = ChronoUnit.HOURS.between(instStart,LocalDateTime.now()); + Integer times = 0; + for(String employee : employees){ + earlyWarningManage.urging(noticeMethod,noticeContent,adventBetween.intValue() + ,adventBetween.intValue(),biz, + instStart,employee,project, + ruleType,noticeType,path,batchEmployees,record.getNodeId()); + times++; + } + + return "催办成功了" + times + "个人"; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java new file mode 100644 index 0000000..6572068 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java @@ -0,0 +1,165 @@ +package com.hz.pm.api.workbench.model.vo; + +import com.ningdatech.basic.model.PageVo; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; +import com.hz.pm.api.sys.model.vo.NoticeListItemVO; +import com.hz.pm.api.sys.model.vo.ProjectEarlyWarningVO; +import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; +import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname WorkbenchVO + * @Description + * @Date 2023/3/20 9:33 + * @Author PoffyZhang + */ +@Data +public class WorkbenchVO implements Serializable { + + @ApiModelProperty("待办中心统计数据 以及代办处理") + public TodoCenterStatisticsVO todoCerter; + + @ApiModelProperty("单位申报管理统计数据") + public DeclaredStatistics orgDeclared; + + @ApiModelProperty("区域申报管理统计数据 只有区域管理员才有数据") + public DeclaredStatistics regionDeclared; + + @ApiModelProperty("项目动态") + public List projects; + + @ApiModelProperty("公告列表") + public Map> noticeList; + + @ApiModelProperty("预警记录") + public List earlyWarning; + + @ApiModelProperty("项目预警记录") + public ProjectEarlyWarning projectEarlyWarning; + + @Data + public static class ProjectEarlyWarning { + @ApiModelProperty("统计数据-累积") + private WarningStatistics accumulate; + + @ApiModelProperty("统计数据-当前") + private WarningStatistics current; + + @ApiModelProperty("超期项目预警") + private PageVo overs; + + @ApiModelProperty("临期项目预警") + private PageVo advents; + + @ApiModelProperty("正常项目") + private PageVo normals; + } + + @Data + public static class WarningStatistics { + @ApiModelProperty("正常") + private Integer normal = 0; + + @ApiModelProperty("临期") + private Integer advent = 0; + + @ApiModelProperty("超期") + private Integer over = 0; + } + + @Data + public static class EarlyWarning { + @ApiModelProperty("类型") + private Integer type; + + @ApiModelProperty("类型名称") + private String typeName; + + @ApiModelProperty("总数") + private Integer total; + + @ApiModelProperty("预警记录") + private List records; + } + + @Data + public static class DeclaredStatistics { + @ApiModelProperty("总项目数") + private Integer totalNum = 0; + @ApiModelProperty("建设项目数") + private Integer buildNum = 0; + @ApiModelProperty("运维项目数") + private Integer operationNum = 0; + + @ApiModelProperty("待立项数") + private Integer notApprovedNum = 0; + @ApiModelProperty("已立项数") + private Integer approvedNum = 0; + @ApiModelProperty("建设中数") + private Integer constructionNum = 0; + @ApiModelProperty("待验收数") + private Integer tobeInspectedNum = 0; + @ApiModelProperty("已归档数") + private Integer archivedNum = 0; + + @ApiModelProperty("申报总金额") + private BigDecimal declaredAmount = BigDecimal.ZERO; + @ApiModelProperty("立项总金额") + private BigDecimal approvalAmount = BigDecimal.ZERO; + + + @ApiModelProperty("申报总金额-去年") + private BigDecimal declaredAmountLastYear = BigDecimal.ZERO; + @ApiModelProperty("立项总金额-去年") + private BigDecimal approvalAmountLastYear = BigDecimal.ZERO; + @ApiModelProperty("申报总金额-较去年 增长") + private BigDecimal declaredAmountGrowthRate = BigDecimal.ZERO; + @ApiModelProperty("立项总金额-较去年 增长") + private BigDecimal approvalAmountGrowthRate = BigDecimal.ZERO; + + public BigDecimal getDeclaredAmountGrowthRate(){ + if(Objects.isNull(declaredAmount)){ + this.declaredAmount = BigDecimal.ZERO; + } + +// if((Objects.nonNull(declaredAmount)&&declaredAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(declaredAmountLastYear) || +// declaredAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ +// return BigDecimal.valueOf(100); +// } + + if(Objects.nonNull(declaredAmountLastYear) && declaredAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ + return declaredAmount.subtract(declaredAmountLastYear).multiply(BigDecimal.valueOf(100)) + .divide(declaredAmountLastYear,BigDecimal.ROUND_CEILING) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); + } + return BigDecimal.ZERO; + } + + public BigDecimal getApprovalAmountGrowthRate(){ + if(Objects.isNull(approvalAmount)){ + this.approvalAmount = BigDecimal.ZERO; + } +// if((Objects.nonNull(approvalAmount)&&approvalAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(approvalAmountLastYear) || +// approvalAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ +// return BigDecimal.valueOf(100); +// } + + if(Objects.nonNull(declaredAmountLastYear) && approvalAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ + return approvalAmount.subtract(approvalAmountLastYear).multiply(BigDecimal.valueOf(100)) + .divide(approvalAmountLastYear,BigDecimal.ROUND_CEILING) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); + } + return BigDecimal.ZERO; + } + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/wps/contants/WpsContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/wps/contants/WpsContant.java new file mode 100644 index 0000000..d3a1ff2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/wps/contants/WpsContant.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.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/hz-pm-api/src/main/java/com/hz/pm/api/wps/controller/WpsConvertController.java b/hz-pm-api/src/main/java/com/hz/pm/api/wps/controller/WpsConvertController.java new file mode 100644 index 0000000..0f6ee48 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/wps/controller/WpsConvertController.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.wps.controller; + +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.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, 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/hz-pm-api/src/main/java/com/hz/pm/api/wps/manage/WpsConvertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/wps/manage/WpsConvertManage.java new file mode 100644 index 0000000..70d2d24 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/wps/manage/WpsConvertManage.java @@ -0,0 +1,213 @@ +package com.hz.pm.api.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.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.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.stereotype.Component; +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +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; + + //2、定义方法实现 多个文件合并转为1个pdf文件 + public String offs2Pdf() { + AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE); + + try { + //2-1、传参文件对象转换输出PDF文件 + //1)、定义集合,存储待转换的原文件 + List fileList =new ArrayList(); + //2)、定义转换后的pdf文件输出流 + OutputStream out = null; + //3)、添加原文件到集合 + fileList.add(new File("/temp/111.xlsx")); + //4)、赋值转换后的pdf文件输出流 + out=new FileOutputStream(new File("/temp/offices2_pdf.pdf")); + //5)、调用方法,执行将多个文件转为pdf文件 + ha.OFDToPDF(fileList, 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); + } + + public byte[] downloadToPdfStream(Long fileId) { + com.ningdatech.file.entity.File file = fileService.getById(fileId); + return downloadAndToPdf(file); + } + + 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转换服务器 + // 或者 已经是PDF文件 也不用转PDF + if(BizConst.DEV.equals(active) || + file.getOriginalFileName().endsWith(BizProjectContant.ProjectCollection.PDF_SUFFIX)){ + 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(); + } + }else{ + log.info("都不满足条件 并且 没有转换文件!"); + } + outputStream.flush(); + }catch (Exception e){ + log.error(e.getMessage()); + }finally { + oss.shutdown(); + try { + ha.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + + private byte[] downloadAndToPdf(com.ningdatech.file.entity.File file) { + 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();) { + int read; + //测试环境 转不了PDF 请求不了 WPS转换服务器 + if(BizConst.DEV.equals(active)){ + byte[] byt = new byte[stream.available()]; + stream.read(byt); + return byt; + }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); + for(File f : fileList){ + //用完就删 + f.deleteOnExit(); + } + byte[] byt = new byte[fileInputStream.available()]; + fileInputStream.read(byt); + return byt; + } + }catch (Exception e){ + log.error(e.getMessage()); + }finally { + oss.shutdown(); + try { + ha.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + return null; + } + + 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/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/IConvertService.java b/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/IConvertService.java new file mode 100644 index 0000000..cd3523a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/IConvertService.java @@ -0,0 +1,5 @@ +package com.hz.pm.api.wps.service; + +public interface IConvertService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/impl/ConvertService.java b/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/impl/ConvertService.java new file mode 100644 index 0000000..8ce1e44 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/wps/service/impl/ConvertService.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.wps.service.impl; + +import com.hz.pm.api.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/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml new file mode 100644 index 0000000..7dd3b85 --- /dev/null +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -0,0 +1,248 @@ +server: + port: 38888 + servlet: + context-path: /hzpm + +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + timeout: 864000 + redis: + timeout: 5000 + host: 47.98.125.47 + port: 26379 + database: 4 + password: Ndkj1234 + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: pm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + jpa: + properties: + hibernate: + default_schema: PUBLIC + hbm2ddl: + auto: update + show_sql: true + show-sql: true + hibernate: + ddl-auto: update + datasource: + type: com.zaxxer.hikari.HikariDataSource + driverClassName: com.kingbase8.Driver + url: jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + username: SYSTEM + password: Ndkj1234 + # 数据源 + hikari: + # 是客户端等待连接池连接的最大毫秒数 + connection-timeout: 30000 + # 是允许连接在连接池中空闲的最长时间 + minimum-idle: 5 + # 配置最大池大小 + maximum-pool-size: 300 + # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) + idle-timeout: 60000 + # 池中连接关闭后的最长生命周期(以毫秒为单位) + max-lifetime: 600000 + # 配置从池返回的连接的默认自动提交行为。默认值为true。 + auto-commit: true + # 开启连接监测泄露 + leak-detection-threshold: 5000 + # 测试连接数据库 + connection-test-query: SELECT 1 + #设置上传 单个文件的大小 + servlet: + multipart: + max-file-size: 100MB + max-request-size: 150MB +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + logic-delete-value: true + logic-not-delete-value: false +logging: + config: classpath:logback-spring.xml + #日志配置 + level: + root: info + file: + path: logs +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: pm + log: + enabled: true + type: DB + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: https:// + bucket: devplat + urlPrefix: oss-cn-hangzhou.aliyuncs.com + endpoint: oss-cn-hangzhou.aliyuncs.com + accessKeyId: LTAI4GL7uypycnBjiRn55rMG + accessKeySecret: qwYC7bW9bkStsko7qkLVnToAzj0Y98 +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 5 + total-size: 200MB + error: + file-size: 10MB + max-size: 5 + total-size: 50MB + +swagger: + enabled: true + +flowable: + async-executor-activate: true + #关闭一些不需要的功能服务 + rest-api-enabled: false + idm: + enabled: false + common: + enabled: false + dmn: + enabled: false + form: + enabled: false + app: + enabled: false + +wflow: + file: + max-size: 20 #最大文件上传大小,MB + +sa-token: + # token 名称 (同时也是cookie名称) + token-name: wflowToken + # token 有效期,单位s 默认30天, -1代表永不过期 + timeout: 172800 + # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: -1 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false +#浙政钉公司顶级organizationCode +organization: + dept-visible-scopes: + - GO_ff70e47bae684fdba0d64f4acab85661 + +yxt: +# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl + wsdl-url: classpath:/wsdl.xml + #账号 + user-code: hzndkj + #密码 + password: hzndkj@2021 + #音信通开关 + sms-enable: true + tel-enable: true + +#省局联审 请求信息 +provincial: +# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign + host: http://223.4.72.75/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + domainUrl: /api/v1/foreign/dominantUnit + key: 7fb48b518c6044a5a44deddd11b445e3 + secret: ced8fff70018413c9516c58f95885624 + + +#天印服务器接口信息 +irs: + is-search-app: false + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interface-name: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 + seal-platform: + project-id: 330001110 + project-secret: 70e512d40c8f440484db4acab181570a + access-key: 42bcb49bea174986a3bfdfba7d005566 + secret-key: bebff29877d4443abd67fc4f8fb335d8 + api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b + push-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + search-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + province-gov: + can-search: false + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm + interfaceName: 62vd5jAdM0b7Gr00 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + push-project-detail: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm + 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm + refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm + interface-local-refresh: + method: GET + request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} + refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} +hostname: iZbp13nwyvib53j4j1p2xoZ +project: + push-url: http://120.26.44.207:38088/open/api/v1/project-receive/save + no-effective-url: http://120.26.44.207:38088/open/api/v1/project-receive/not-effective + delete-all-url: http://120.26.44.207:38088/open/api/v1/project-receive/delete-all +login: + phone-verify-code: + skip: true + url: http://lspm.ningdatech.com/login +web: + url: http://lspm.ningdatech.com +# 专家报名验证码校验 +expert-registration: + verify-code: + check: false + + diff --git a/hz-pm-api/src/main/resources/application-pre.yml b/hz-pm-api/src/main/resources/application-pre.yml new file mode 100644 index 0000000..57c8c9f --- /dev/null +++ b/hz-pm-api/src/main/resources/application-pre.yml @@ -0,0 +1,248 @@ +server: + port: 38888 + servlet: + context-path: /hzpm + #最大并发数,默认200 + tomcat: + threads: + max: 600 +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 5000 + host: localhost + port: 6379 + database: 0 + password: Ndkj1234 + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: pm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + jpa: + properties: + hibernate: + default_schema: PUBLIC + hbm2ddl: + auto: update + show_sql: true + show-sql: true + hibernate: + ddl-auto: update + datasource: + type: com.zaxxer.hikari.HikariDataSource + driverClassName: com.kingbase8.Driver + url: jdbc:kingbase8://10.53.168.41:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&nullCatalogMeansCurrent=true + username: SYSTEM + password: Ndkj1234 + # 数据源 + hikari: + # 是客户端等待连接池连接的最大毫秒数 + connection-timeout: 30000 + # 是允许连接在连接池中空闲的最长时间 + minimum-idle: 10 + # 配置最大池大小 + maximum-pool-size: 300 + # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) + idle-timeout: 60000 + # 池中连接关闭后的最长生命周期(以毫秒为单位) + max-lifetime: 600000 + # 配置从池返回的连接的默认自动提交行为。默认值为true。 + auto-commit: true + # 开启连接监测泄露 + leak-detection-threshold: 5000 + # 测试连接数据库 + connection-test-query: SELECT 1 + #设置上传 单个文件的大小 + servlet: + multipart: + max-file-size: 100MB + max-request-size: 150MB +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + logic-delete-value: true + logic-not-delete-value: false +logging: + config: classpath:logback-spring.xml + #日志配置 + level: + root: info + file: + path: logs +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: pm + log: + enabled: true + type: DB + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: http:// + bucket: projectmangmentoss + urlPrefix: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn + endpoint: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn + accessKeyId: XS3kNLtfW5i41SaC + accessKeySecret: 2cywvSZWANml7pZXxRAeAiHfisIhqm +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 5 + total-size: 200MB + error: + file-size: 10MB + max-size: 5 + total-size: 50MB + +swagger: + enabled: true + +flowable: + async-executor-activate: true + #关闭一些不需要的功能服务 + rest-api-enabled: false +# database-schema-update: false + idm: + enabled: false + common: + enabled: false + dmn: + enabled: false + form: + enabled: false + app: + enabled: false + +wflow: + file: + max-size: 20 #最大文件上传大小,MB + +sa-token: + # token 名称 (同时也是cookie名称) + token-name: wflowToken + # token 有效期,单位s 默认30天, -1代表永不过期 + timeout: 172800 + # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: -1 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false +#浙政钉公司顶级organizationCode +organization: + dept-visible-scopes: + - GO_c1a6f8d5338e4a468337b08da76e2e31 + +yxt: + wsdl-url: classpath:wsdl-prod.xml + #账号 + user-code: Lssdsjj + #密码 + password: Lssdsjj@2021 + #音信通开关 + sms-enable: true + tel-enable: true + +#省局联审 请求信息 +provincial: + host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + domainUrl: /api/v1/foreign/dominantUnit + key: b5b2096953534a53991be4ea95f8cffa + secret: 1bec9b77134d4962ac466fbe9696b897 +# host: http://223.4.72.75/prometheus-zhejiang_foreign +# pushUrl: /api/v1/foreign/importantPro +# detailUrl: /api/v1/foreign/importantProView +# key: b5b2096953534a53991be4ea95f8cffa +# secret: 1bec9b77134d4962ac466fbe9696b897 + + +#天印服务器接口信息 +irs: + is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 + seal-platform: + project-id: 330001110 + project-secret: 70e512d40c8f440484db4acab181570a + access-key: 42bcb49bea174986a3bfdfba7d005566 + secret-key: bebff29877d4443abd67fc4f8fb335d8 + api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b + push-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + search-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + province-gov: + can-search: true + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm + interfaceName: 62vd5jAdM0b7Gr00 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + push-project-detail: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm + 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm + refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm + interface-local-refresh: + method: GET + request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} + refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} +hostname: iZ6mx01asxnsmennpzoxooZ +project: + push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save + no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective + delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all +login: + phone-verify-code: + skip: true + url: http://60.188.225.145:8080/login +web: + url: http://60.188.225.145:8080 \ No newline at end of file diff --git a/hz-pm-api/src/main/resources/application-prod.yml b/hz-pm-api/src/main/resources/application-prod.yml new file mode 100644 index 0000000..592b8f2 --- /dev/null +++ b/hz-pm-api/src/main/resources/application-prod.yml @@ -0,0 +1,248 @@ +server: + port: 38888 + servlet: + context-path: /hzpm + #最大并发数,默认200 + tomcat: + threads: + max: 600 +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 5000 + host: localhost + port: 6379 + database: 0 + password: Ndkj1234 + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: pm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + jpa: + properties: + hibernate: + default_schema: PUBLIC + hbm2ddl: + auto: update + show_sql: true + show-sql: true + hibernate: + ddl-auto: update + datasource: + type: com.zaxxer.hikari.HikariDataSource + driverClassName: com.kingbase8.Driver + url: jdbc:kingbase8://10.53.172.221:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&nullCatalogMeansCurrent=true + username: SYSTEM + password: Ndkj1234 + # 数据源 + hikari: + # 是客户端等待连接池连接的最大毫秒数 + connection-timeout: 30000 + # 是允许连接在连接池中空闲的最长时间 + minimum-idle: 10 + # 配置最大池大小 + maximum-pool-size: 300 + # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) + idle-timeout: 60000 + # 池中连接关闭后的最长生命周期(以毫秒为单位) + max-lifetime: 600000 + # 配置从池返回的连接的默认自动提交行为。默认值为true。 + auto-commit: true + # 开启连接监测泄露 + leak-detection-threshold: 5000 + # 测试连接数据库 + connection-test-query: SELECT 1 + #设置上传 单个文件的大小 + servlet: + multipart: + max-file-size: 100MB + max-request-size: 150MB +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + logic-delete-value: true + logic-not-delete-value: false +logging: + config: classpath:logback-spring.xml + #日志配置 + level: + root: info + file: + path: logs +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: pm + log: + enabled: true + type: DB + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: http:// + bucket: projectmangmentoss + urlPrefix: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn + endpoint: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn + accessKeyId: XS3kNLtfW5i41SaC + accessKeySecret: 2cywvSZWANml7pZXxRAeAiHfisIhqm +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 30 + total-size: 2048MB + error: + file-size: 10MB + max-size: 30 + total-size: 300MB + +swagger: + enabled: true + +flowable: + async-executor-activate: true + #关闭一些不需要的功能服务 + rest-api-enabled: false + # database-schema-update: false + idm: + enabled: false + common: + enabled: false + dmn: + enabled: false + form: + enabled: false + app: + enabled: false + +wflow: + file: + max-size: 20 #最大文件上传大小,MB + +sa-token: + # token 名称 (同时也是cookie名称) + token-name: wflowToken + # token 有效期,单位s 默认30天, -1代表永不过期 + timeout: 172800 + # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: -1 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false +#浙政钉公司顶级organizationCode +organization: + dept-visible-scopes: + - GO_c1a6f8d5338e4a468337b08da76e2e31 + +yxt: + wsdl-url: classpath:wsdl-prod.xml + #账号 + user-code: Lssdsjj + #密码 + password: Lssdsjj@2021 + #音信通开关 + sms-enable: true + tel-enable: true + +#省局联审 请求信息 +provincial: + host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + domainUrl: /api/v1/foreign/dominantUnit + key: b5b2096953534a53991be4ea95f8cffa + secret: 1bec9b77134d4962ac466fbe9696b897 +# host: http://223.4.72.75/prometheus-zhejiang_foreign +# pushUrl: /api/v1/foreign/importantPro +# detailUrl: /api/v1/foreign/importantProView +# key: b5b2096953534a53991be4ea95f8cffa +# secret: 1bec9b77134d4962ac466fbe9696b897 + + +#天印服务器接口信息 +irs: + is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 + seal-platform: + project-id: 330001110 + project-secret: 70e512d40c8f440484db4acab181570a + access-key: 42bcb49bea174986a3bfdfba7d005566 + secret-key: bebff29877d4443abd67fc4f8fb335d8 + api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b + push-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + search-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + province-gov: + can-search: true + interfaceName: 62vd5jAdM0b7Gr00 + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + push-project-detail: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm + 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm + refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm + interface-local-refresh: + method: GET + request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} + refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} +hostname: iZ6mx01gyeodd80imxd2gbZ +project: + push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save + no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective + delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all +login: + phone-verify-code: + skip: false + url: http://60.188.225.145/login +web: + url: http://60.188.225.145 \ No newline at end of file diff --git a/hz-pm-api/src/main/resources/application.yml b/hz-pm-api/src/main/resources/application.yml new file mode 100644 index 0000000..caf4dfc --- /dev/null +++ b/hz-pm-api/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + profiles: + active: dev \ No newline at end of file diff --git a/pmapi/src/main/resources/integration/zwdd-dev.yml b/hz-pm-api/src/main/resources/integration/zwdd-dev.yml similarity index 100% rename from pmapi/src/main/resources/integration/zwdd-dev.yml rename to hz-pm-api/src/main/resources/integration/zwdd-dev.yml diff --git a/pmapi/src/main/resources/integration/zwdd-pre.yml b/hz-pm-api/src/main/resources/integration/zwdd-pre.yml similarity index 100% rename from pmapi/src/main/resources/integration/zwdd-pre.yml rename to hz-pm-api/src/main/resources/integration/zwdd-pre.yml diff --git a/pmapi/src/main/resources/integration/zwdd-prod.yml b/hz-pm-api/src/main/resources/integration/zwdd-prod.yml similarity index 100% rename from pmapi/src/main/resources/integration/zwdd-prod.yml rename to hz-pm-api/src/main/resources/integration/zwdd-prod.yml diff --git a/pmapi/src/main/resources/logback-spring.xml b/hz-pm-api/src/main/resources/logback-spring.xml similarity index 100% rename from pmapi/src/main/resources/logback-spring.xml rename to hz-pm-api/src/main/resources/logback-spring.xml diff --git a/pmapi/src/main/resources/security/auth-dev.yml b/hz-pm-api/src/main/resources/security/auth-dev.yml similarity index 100% rename from pmapi/src/main/resources/security/auth-dev.yml rename to hz-pm-api/src/main/resources/security/auth-dev.yml diff --git a/pmapi/src/main/resources/security/auth-pre.yml b/hz-pm-api/src/main/resources/security/auth-pre.yml similarity index 100% rename from pmapi/src/main/resources/security/auth-pre.yml rename to hz-pm-api/src/main/resources/security/auth-pre.yml diff --git a/pmapi/src/main/resources/security/auth-prod.yml b/hz-pm-api/src/main/resources/security/auth-prod.yml similarity index 100% rename from pmapi/src/main/resources/security/auth-prod.yml rename to hz-pm-api/src/main/resources/security/auth-prod.yml diff --git a/pmapi/src/main/resources/template/meeting/专家抽取表.ftl b/hz-pm-api/src/main/resources/template/meeting/专家抽取表.ftl similarity index 100% rename from pmapi/src/main/resources/template/meeting/专家抽取表.ftl rename to hz-pm-api/src/main/resources/template/meeting/专家抽取表.ftl diff --git a/pmapi/src/main/resources/template/meeting/专家评审单.ftl b/hz-pm-api/src/main/resources/template/meeting/专家评审单.ftl similarity index 100% rename from pmapi/src/main/resources/template/meeting/专家评审单.ftl rename to hz-pm-api/src/main/resources/template/meeting/专家评审单.ftl diff --git a/pmapi/src/main/resources/template/meeting/专家费.ftl b/hz-pm-api/src/main/resources/template/meeting/专家费.ftl similarity index 100% rename from pmapi/src/main/resources/template/meeting/专家费.ftl rename to hz-pm-api/src/main/resources/template/meeting/专家费.ftl diff --git a/pmapi/src/main/resources/template/meeting/劳务费发放.ftl b/hz-pm-api/src/main/resources/template/meeting/劳务费发放.ftl similarity index 100% rename from pmapi/src/main/resources/template/meeting/劳务费发放.ftl rename to hz-pm-api/src/main/resources/template/meeting/劳务费发放.ftl diff --git a/pmapi/src/main/resources/template/simsun.ttc b/hz-pm-api/src/main/resources/template/simsun.ttc similarity index 100% rename from pmapi/src/main/resources/template/simsun.ttc rename to hz-pm-api/src/main/resources/template/simsun.ttc diff --git a/pmapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls b/hz-pm-api/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls similarity index 100% rename from pmapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls rename to hz-pm-api/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表(空).xls diff --git a/pmapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls b/hz-pm-api/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls similarity index 100% rename from pmapi/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls rename to hz-pm-api/src/main/resources/template/丽水市2023年数字化项目年度计划编辑表.xls diff --git a/pmapi/src/main/resources/template/区县-预审申请单.html b/hz-pm-api/src/main/resources/template/区县-预审申请单.html similarity index 100% rename from pmapi/src/main/resources/template/区县-预审申请单.html rename to hz-pm-api/src/main/resources/template/区县-预审申请单.html diff --git a/pmapi/src/main/resources/template/市级-预审申请单.html b/hz-pm-api/src/main/resources/template/市级-预审申请单.html similarity index 100% rename from pmapi/src/main/resources/template/市级-预审申请单.html rename to hz-pm-api/src/main/resources/template/市级-预审申请单.html diff --git a/pmapi/src/main/resources/template/建设方案申请单.html b/hz-pm-api/src/main/resources/template/建设方案申请单.html similarity index 100% rename from pmapi/src/main/resources/template/建设方案申请单.html rename to hz-pm-api/src/main/resources/template/建设方案申请单.html diff --git a/pmapi/src/main/resources/wsdl-prod.xml b/hz-pm-api/src/main/resources/wsdl-prod.xml similarity index 100% rename from pmapi/src/main/resources/wsdl-prod.xml rename to hz-pm-api/src/main/resources/wsdl-prod.xml diff --git a/pmapi/src/main/resources/wsdl.xml b/hz-pm-api/src/main/resources/wsdl.xml similarity index 100% rename from pmapi/src/main/resources/wsdl.xml rename to hz-pm-api/src/main/resources/wsdl.xml diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/common/helper/RegionCacheHelperTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/common/helper/RegionCacheHelperTest.java new file mode 100644 index 0000000..3d295f2 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/common/helper/RegionCacheHelperTest.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.common.helper; + +import com.hz.pm.api.AppTests; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.jupiter.api.Assertions.*; + +/** + *

+ * RegionCacheHelperTest + *

+ * + * @author WendyYang + * @since 15:52 2023/3/7 + */ +class RegionCacheHelperTest extends AppTests { + + @Autowired + private RegionCacheHelper regionCacheHelper; + + @Test + void listChildren() { + regionCacheHelper.listChildren("331100", 2).forEach(System.out::println); + } +} \ No newline at end of file diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/expert/ExpertTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/expert/ExpertTest.java new file mode 100644 index 0000000..949530f --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/expert/ExpertTest.java @@ -0,0 +1,73 @@ +package com.hz.pm.api.expert; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; +import com.hz.pm.api.expert.service.IExpertUserFullInfoService; +import com.hz.pm.api.meta.model.entity.ExpertTag; +import com.hz.pm.api.meta.service.IExpertTagService; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Classname ExpertTest + * @Description + * @Date 2023/11/24 9:35 + * @Author PoffyZhang + */ +public class ExpertTest extends AppTests { + + @Autowired + private IExpertTagService expertTagService; + + @Autowired + private IExpertUserFullInfoService expertUserFullInfoService; + + @Test + public void test(){ + List lsRegionCodes = RegionConst.LS_ARR; + List experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .in(ExpertUserFullInfo::getRegionCode,lsRegionCodes) + .eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); + + List goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); + Map> tagMap = goodAt.stream() + .collect(Collectors.groupingBy(ExpertTag::getUserId)); + + String networkCode = "1030000"; + String xinchuangCode = "2040000"; + String fanganCode = "2030000"; + String jishuCode = "2010000"; + String dangzhengCode = "1020000"; + String ruanyingCode = "2020000"; + String caiwuCode = "5600000"; + List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, + dangzhengCode,ruanyingCode,caiwuCode); + + List users = Lists.newArrayList(); + for(ExpertUserFullInfo e : experts) { + if (tagMap.containsKey(e.getUserId())) { + List expertTags = tagMap.get(e.getUserId()); + Boolean isContain = Boolean.FALSE; + for (ExpertTag expertTag : expertTags) { + if (specialTags.contains(expertTag.getTagCode())) { + isContain = Boolean.TRUE; + } + } + if (!isContain) { + users.add(e.getUserId()); + } + } + } + System.out.println(users); + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/CoreTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/CoreTest.java new file mode 100644 index 0000000..2aca077 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/CoreTest.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.irs; + +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import com.hz.pm.api.common.util.Md5Utils; +import com.hz.pm.api.common.util.RefreshKeyUtil; +import com.hz.pm.api.gov.model.req.ProjectPushReq; +import com.hz.pm.api.irs.model.dto.ForwardDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname CoreTest + * @Description + * @Date 2023/8/31 17:21 + * @Author PoffyZhang + */ +@Slf4j +public class CoreTest {//extends AppTests + +// @Value("${irs.core-biz.appKey}") + private String appKey = "A331101453557202109017383"; + +// @Value("${irs.core-biz.appSecret}") + private String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + +// @Value("${irs.core-biz.url}") + private String coreBizUrl = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm"; + +// @Value("${irs.core-biz.interfaceName}") + private String interfaceName = "Fc3re2cq7r64Qfa7"; + + @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 searchCoreBiz() { + long requestTime = System.currentTimeMillis(); + String businessName = ""; + String orgCode = ""; + Integer limit = 10; + Integer page = 1; + + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, + HttpMethod.POST.name()); +// String secret = "15345863c0fb4a85a28b2b467e5e6253"; +// String secret = appSecret; +// String secret = RefreshKeyUtil.getRequestSecret(appKey, appSecret,requestTime); +// String secret = RefreshKeyUtil.refreshSecret(appKey, "78cde959148b4335b8eba556f9c8c7bf",requestTime); + System.out.println("secret:" + secret); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + ForwardDTO dto = new ForwardDTO(); + Map map = Maps.newHashMap(); + map.put("dingCode",orgCode); + map.put("matterName",(StringUtils.isNotBlank(businessName)?businessName:StringUtils.EMPTY)); + map.put("useState",1); + map.put("limit",limit); + map.put("page",page); + map.put("appKey",appKey); + dto.setData(map); + dto.setUrl(coreBizUrl); + dto.setSecret(secret); + dto.setAppKey(appKey); + dto.setSecret(secret); + dto.setRequestTime(requestTime); + String sign = Md5Utils.hash(appKey + secret + requestTime); + dto.setSign(sign); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); + headers.setContentType(type); + headers.add("Accept", MediaType.APPLICATION_JSON.toString()); + HttpEntity formEntity = new HttpEntity(dto, headers); + String url = "http://10.53.168.41:38088/open/api/v1/project-receive/forward"; + ResponseEntity forEntity = restTemplate.postForEntity(url,formEntity, String.class); + String body = forEntity.getBody(); + System.out.println(body); + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/CurrentTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/CurrentTest.java new file mode 100644 index 0000000..dd7a63a --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/CurrentTest.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.irs; + +import org.junit.Test; + +/** + * @Classname CurrentTest + * @Description + * @Date 2023/9/4 9:26 + * @Author PoffyZhang + */ +public class CurrentTest { + + @Test + public void currentTime(){ + System.out.println(System.currentTimeMillis()); + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java new file mode 100644 index 0000000..0a4bbf2 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java @@ -0,0 +1,224 @@ +package com.hz.pm.api.irs; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.user.constant.UserAvailableEnum; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.zwdd.ZwddIntegrationProperties; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; +import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; +import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; +import org.junit.Test; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname EmployeeTest + * @Description + * @Date 2023/9/11 10:59 + * @Author PoffyZhang + */ +public class EmployeeTest extends AppTests { + + @Autowired + private IDingOrganizationService iDingOrganizationService; + + @Autowired + private ZwddIntegrationProperties zwddIntegrationProperties; + + @Autowired + private IDingEmployeeInfoService iDingEmployeeInfoService; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private IUserInfoService iUserInfoService; + + @Test + public void test(){ + String orgCode = "GO_3663776dcc2c414db2ed947e225bfc5b"; + DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, orgCode) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); + System.out.println("所属单位 {} 要更新员工信息了:" + org.getOrganizationName()); + + List allOrganizationEmployeePositionList = new ArrayList<>(); + String organizationCode = orgCode; + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(zwddIntegrationProperties.getTenantId()); + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(100); + + // 查询组织下 用户信息 + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + if (Objects.isNull(data)){ + System.out.println("响应为空:{}" + organizationCode); + return; + } + System.out.println(JSON.toJSONString(data.getData())); + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + Long totalSize = data.getTotalSize(); + + System.out.println("dingOrganization :{}" + JSON.toJSONString(org)); + + System.out.println("totalSize :{},{}" + totalSize + "," + org.getOrganizationName()); + + List dingEmployeeInfoSaveRecordList = new ArrayList<>(); + assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); + System.out.println("dingEmployeeInfoSaveRecordList :{}" + JSON.toJSONString(dingEmployeeInfoSaveRecordList)); + // 批量保存用户信息 + saveBatch(dingEmployeeInfoSaveRecordList); + } + + private void saveBatch(List dingEmployeeInfoSaveRecordList) { + dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() + .filter(r -> ("true".equals(r.getMainJob()) + && "A".equals(r.getEmpStatus()) + && StringUtils.isNotBlank(r.getEmpPosUnitCode()) + && StringUtils.isNotBlank(r.getEmployeeCode())) + || "GE_48606ed7c10d4d15b0f931a9a4b89f21".equals(r.getEmployeeCode()) + ).collect(Collectors.toList()); + + Set uniqueKeySet = new HashSet(); + + List saveList = new ArrayList<>(); + + for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { + if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { + saveList.add(dingEmployeeInfo); + } + } + + List organizations = iDingOrganizationService.list(); + Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); + + System.out.println("saveList:" + JSON.toJSONString(saveList)); + for (DingEmployeeInfo dingEmployeeInfo : saveList) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + + DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .last(BizConst.LIMIT_1)); + if (Objects.isNull(employeeInfo)) { + iDingEmployeeInfoService.save(dingEmployeeInfo); + } else { + dingEmployeeInfo.setId(employeeInfo.getId()); + iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); + } + generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); + } + } + + private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { + List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); + GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); + List employeeAccountIdDTOList = listGenericResult.getData(); + if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { + Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) + .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); + + List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); + + dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { + r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); + return r; + }).collect(Collectors.toList()); + dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); + } + } + private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { + List saveRecordList = new ArrayList<>(); + for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { + List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); + if (CollUtil.isNotEmpty(govEmployeePositions)) { + List segmentSaveRecordList = new ArrayList<>(); + for (OrganizationEmployeePosition.GovEmployeePosition govEmployeePosition : govEmployeePositions) { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); + dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); + dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); + dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); + dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); + dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); + dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); + dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); + dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); + dingEmployeeInfo.setCreateOn(LocalDateTime.now()); + dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); + dingEmployeeInfo.setCreateBy(-1L); + dingEmployeeInfo.setUpdateBy(-1L); + segmentSaveRecordList.add(dingEmployeeInfo); + } + saveRecordList.addAll(segmentSaveRecordList); + } else { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + saveRecordList.add(dingEmployeeInfo); + } + } + return saveRecordList; + } + + public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode)); + if (Objects.isNull(userInfo)) { + userInfo = UserInfo.builder() + .accountId(dingEmployeeInfo.getAccountId()) + .username(dingEmployeeInfo.getEmployeeName()) + .realName(dingEmployeeInfo.getEmployeeName()) + .employeeCode(dingEmployeeInfo.getEmployeeCode()) + .available(UserAvailableEnum.DISABLE.name()) + .createBy(-1L) + .updateBy(-1L) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) + .avatar(dingEmployeeInfo.getAvatar()) + .build(); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.save(userInfo); + }else{ + userInfo.setAvatar(dingEmployeeInfo.getAvatar()); + userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.updateById(userInfo); + } + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest.java new file mode 100644 index 0000000..abcc0f0 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest.java @@ -0,0 +1,235 @@ +package com.hz.pm.api.irs; + +import com.alibaba.fastjson.JSON; +import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; +import com.alibaba.xxpt.gateway.shared.client.http.GetClient; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HmacAuthUtil; +import com.hz.pm.api.common.util.RefreshKeyUtil; +import com.hz.pm.api.irs.manage.AppIrsManage; +import com.ningdatech.zwdd.ZwddIntegrationProperties; +import com.ningdatech.zwdd.client.ZwddAuthClient; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.NoSuchAlgorithmException; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname IrsTest + * @Description + * @Date 2023/6/26 17:42 + * @Author PoffyZhang + */ +public class IrsTest extends AppTests { + + @Autowired + private ZwddAuthClient zwddAuthClient; + + @Autowired + private ZwddClient zwddClient; + @Autowired + private AppIrsManage appIrsManage; + + @Test + public void test1() { + String method = "GET"; + String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + + "?appCode=A331123467587202210014168"; + String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; + String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; + + Map header = HmacAuthUtil.generateHeader(url, method, appKey, appScret); + //请求头 + HttpHeaders headers = new HttpHeaders(); + + for (Map.Entry entry : header.entrySet()) { + headers.add(entry.getKey(), entry.getValue()); + } + //封装请求头 + HttpEntity> formEntity = new HttpEntity>(headers); + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void testApp() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331123"; + String appScret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String appCode = "A331123467587202307014177";//A331123467587202307014171 + + String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret,timestamp); + String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm?" + + "requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&name=&" + + "pageSize=10&deptCode=&areaCode=" + areaCode + "&pageNum=1&appCode=" + appCode; + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void test2() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331123"; + String appKey = "A331101453557202109017383"; + String appScret = "496f0f2a19994f76b4fd9dae087366c7"; + String baseProjSys = "初次建设的应用21"; + String baseProjSysCode = "A331123467587202307014177"; + String baseProjName = "遂昌县-nsl-项目测试004"; + String baseProjId = "331123230130123412186"; + String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret,timestamp); + + String capCode = CryptUtils.MD5Encode(timestamp + areaCode); + String capTime = String.valueOf(timestamp); + String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + + "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + + "&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId + + "&isEffective=1&baseProjSysCode=" + baseProjSysCode; + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void test3() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331121"; + System.out.println(CryptUtils.MD5Encode(timestamp + areaCode)); + } + + @Test + public void test4() { + CloseableHttpResponse response = null; + try { + String api = "/media/download"; + GetClient getClient = getZwddExecutableClient().newGetClient(api); + //设置参数 + getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); + getClient.addParameter("media_id", "$hQHNKaUCo2pwZwMGDAEN2gBAK2Z2YUVMb0xYZnFJSGRuZ1h3OVZGd3hadDNrTXlYNWlQOXF0OERrZTc0b2M5UU0xeExsUVFkalBQNFVJakZ0aA"); + //调用API + //String result = getClient.get(); + //System.err.println(result); + response = getClient.getB(); + org.apache.http.HttpEntity entity = response.getEntity(); + InputStream is = entity.getContent(); + System.out.println(is); + File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); + OutputStream fos = new FileOutputStream(voice); + int cache = 10 * 1024; + byte[] buffer = new byte[cache]; + int ch = 0; + StringBuffer sb = new StringBuffer(); + while ((ch = is.read(buffer)) != -1) { + fos.write(buffer, 0, ch); + sb.append(buffer); + } + System.out.println(sb.toString()); + is.close(); + fos.flush(); + fos.close(); + } catch (Exception e) { + System.out.println(e); + } finally { + if (response != null) { + try { + //特别提醒:需要调用response的close方法关闭网络连接!!! + response.close(); + } catch (Exception e) { + System.out.println(e); + } + } + } + } + + @Test + public void test5() { + CloseableHttpResponse response = null; + try { + String api = "/media/download"; + GetClient getClient = getZwddExecutableClient().newGetClient(api); + //设置参数 + getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); + getClient.addParameter("media_id", "$hQHNxoECo2pwZwMGDAEN2gAsOEkvNENaMmZ5UUVncDduWERralJxRW5aem45ODN5UHpKRjErcUxFeUkvTT0"); + //调用API + //String result = getClient.get(); + //System.err.println(result); + response = getClient.getB(); + org.apache.http.HttpEntity entity = response.getEntity(); + InputStream is = entity.getContent(); + System.out.println(is); + File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); + OutputStream fos = new FileOutputStream(voice); + int cache = 10 * 1024; + byte[] buffer = new byte[cache]; + int ch = 0; + StringBuffer sb = new StringBuffer(); + while ((ch = is.read(buffer)) != -1) { + fos.write(buffer, 0, ch); + sb.append(buffer); + } + System.out.println(sb.toString()); + is.close(); + fos.flush(); + fos.close(); + } catch (Exception e) { + System.out.println(e); + } finally { + if (response != null) { + try { + //特别提醒:需要调用response的close方法关闭网络连接!!! + response.close(); + } catch (Exception e) { + System.out.println(e); + } + } + } + } + + private static ExecutableClient zwddExecutableClient; + @Autowired + private ZwddIntegrationProperties zwddProperties; + + public ExecutableClient getZwddExecutableClient() { + if (Objects.isNull(zwddExecutableClient)) { + synchronized (ZwddAuthClientProvider.class) { + if (Objects.isNull(zwddExecutableClient)) { + zwddExecutableClient = ExecutableClient.getInstance(); + //DomainName不同环境对应不同域名,示例为sass域名 + zwddExecutableClient.setDomainName(zwddProperties.getDomain()); + zwddExecutableClient.setProtocal("https"); + //应用App Key + zwddExecutableClient.setAccessKey(zwddProperties.getAppKey()); + //应用App Secret + zwddExecutableClient.setSecretKey(zwddProperties.getAppSecret()); + zwddExecutableClient.init(); + } + } + } + return zwddExecutableClient; + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest2.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest2.java new file mode 100644 index 0000000..046b3dc --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest2.java @@ -0,0 +1,80 @@ +package com.hz.pm.api.irs; + +import com.alibaba.fastjson.JSON; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import liquibase.util.MD5Util; +import org.junit.Test; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + * @Classname IrsTest2 + * @Description + * @Date 2023/7/20 10:48 + * @Author PoffyZhang + */ +public class IrsTest2 { + + @Test + public void test() throws UnsupportedEncodingException, NoSuchAlgorithmException { + String appSecret = "e066f496194540afa829c66983d4710e"; + String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; + String dataName = URLEncoder.encode("丽水市大数据","UTF-8"); + long timestamp = System.currentTimeMillis(); + String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp); + String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey + + "&sign=" + sign + "&requestTime=" + timestamp; + RestTemplate restTemplate = new RestTemplate(); + System.out.println("url:" + url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void refreshToken() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appSecret = "e066f496194540afa829c66983d4710e"; + String appKey = "8fb070a1f1194b2ebffdc6f596bb8a96"; + String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + String url = "https://interface.ls.local/a/api/refreshTokenKey?appKey=" + appKey + + "&requestTime=" + timestamp + "&sign=" + sign; + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + System.out.println(forEntity.getBody()); + } + + @Test + public void test3() throws NoSuchAlgorithmException { + String timestamp = "1689841393364"; + String appSecret = "f12a6f2e9fc143fcbe4622295db097fd"; + String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; + String sign1 = MD5Util.computeMD5(appkey + appSecret + timestamp); + String sign2 = CryptUtils.MD5Encode(appkey + appSecret + timestamp); + System.out.println(sign1); + System.out.println(sign2); + } + + @Test + public void test4(){ + long timestamp = 1690354109541L; + + long now = System.currentTimeMillis(); + + System.out.println( (timestamp - now)/1000 + "s"); + + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest3.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest3.java new file mode 100644 index 0000000..10ff289 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest3.java @@ -0,0 +1,90 @@ +package com.hz.pm.api.irs; + +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.common.util.HttpUtil; +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Value; +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 irsTest3 extends AppTests { + + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-local-refresh.request-token-url}") + private String requestTokenUrl; + @Value("${irs.interface-local-refresh.refresh-token-url}") + private String refreshTokenUrl; + + @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 sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + + String url = "https://interface.ls.local/a/api/shared/1689239219101?" + + "data_name=" + dataName + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; + + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + System.out.println(forEntity.getBody()); + } + + @Test + public void test2() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String method = "POST"; + String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); + 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 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/" + + "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + + "&sign=" + sign + "&appKey=" + appKey + + "&capCode=abc&appId=abc&capTime=" + timestamp + + "&appId=" + appId + "&updateTime=" + updateTime; + log.info("url :{}",url); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest4.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest4.java new file mode 100644 index 0000000..20a461c --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/irsTest4.java @@ -0,0 +1,59 @@ +package com.hz.pm.api.irs; + +import com.ningdatech.irs.service.IRefreshTokenService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.util.CryptUtils; +import com.hz.pm.api.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, 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/hz-pm-api/src/test/java/com/hz/pm/api/organization/OrganizationTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/organization/OrganizationTest.java new file mode 100644 index 0000000..c6f59e7 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/organization/OrganizationTest.java @@ -0,0 +1,201 @@ +package com.hz.pm.api.organization; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.ding.model.DingOrgInfoTreeDTO; +import com.hz.pm.api.ding.task.EmployeeBatchGetTask; +import com.hz.pm.api.ding.task.GovBusinessStripsTask; +import com.hz.pm.api.ding.task.OrganizationBatchGetTask; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.*; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/9 下午3:54 + */ +@Slf4j +class OrganizationTest extends AppTests { + + @Autowired + private OrganizationBatchGetTask organizationBatchGetTask; + + @Autowired + private EmployeeBatchGetTask employeeBatchGetTask; + + @Autowired + private GovBusinessStripsTask govBusinessStripsTask; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private IDingOrganizationService organizationService; + + private static final Integer GROUP_SIZE = 100; + + @Test + public void testBatchGetOrganization() { + organizationBatchGetTask.batchGetOrganizationTask(); + } + + @Test + public void testEmployeeBatchGetTask() { + employeeBatchGetTask.batchGetEmployeeTask(); + } + + @Test + public void testGovBusinessStripsTask() { + govBusinessStripsTask.batchGetGovBusinessStripsTask(); + } + + @Test + public void getEmployeeInfo() { + GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile("13164388876"); +// GenericResult ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_809a061236b941d281446df6f14dc8f0"); + GenericResult ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_e68c7af513474eaa959b7ce7141a4d9f"); + + System.out.println("---"); + } + + @Test + public void test2() { + // 获取顶级组织code + GenericResult scopesV2Result = zwddClient.getScopesV2(); + DingScopesV2DTO scopesV2 = scopesV2Result.getData(); + + if (Objects.nonNull(scopesV2)) { + List currentAllOrganizationList = organizationService.list(); + + // 顶级组织code + List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); + log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); + // 获取顶级节点信息 + GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); + log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); + List dingOrgInfoDtos = listGenericResult.getData(); + for (String orgCode : deptVisibleScopes) { + List treeDTOList = new ArrayList<>(); + + DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + //设置节点详情 + if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { + for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { + if (orgInfo.getOrganizationCode().equals(orgCode)) { + childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); + } + } + } + childDingOrgInfoTreeDTO.setCode(orgCode); + childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(childDingOrgInfoTreeDTO); + treeDTOList.add(childDingOrgInfoTreeDTO); + if (CollectionUtils.isNotEmpty(treeDTOList)) { + List saveRecordList = new ArrayList<>(); + buildSaveRecordList(treeDTOList, saveRecordList,currentAllOrganizationList); + // 批量保存 + if (saveRecordList.size() <= GROUP_SIZE) { + organizationService.saveOrUpdateBatch(saveRecordList); + } else { + List> split = Lists.partition(saveRecordList, GROUP_SIZE); + for (List segment : split) { + organizationService.saveOrUpdateBatch(segment); + } + } + } + log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); + } + } + } + + private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { + String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); + DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); + boolean leaf = orgInfoDTO.getLeaf(); + if (!leaf) { + int currentPage = 1; + int pageSize = 100; + GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); + + if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { + List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); + Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); + + while (totalSize > (long) currentPage * pageSize) { + GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient + .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); + if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { + subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); + } + } + + if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { + GenericResult> listGenericResult = zwddClient + .listOrganizationsByCodes(subOrganizationCodeList); + List dingOrgInfoDtos = listGenericResult.getData(); + List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { + DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); + dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); + dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(dingOrgInfoTreeDTO); + return dingOrgInfoTreeDTO; + }).collect(Collectors.toList()); + parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); + } + } + } + } + + private void buildSaveRecordList(List treeDTOList, List saveRecordList, + List oldList) { + Set set = new HashSet(); + Map map = oldList.stream() + .filter(o -> set.add(o.getOrganizationCode())) + .collect(Collectors.toMap(DingOrganization::getOrganizationCode,o -> o)); + if (CollectionUtils.isEmpty(treeDTOList)) { + return; + } + for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { + DingOrganization saveRecord = new DingOrganization(); + DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); + List childCodes = dingOrgInfoTreeDTO.getChildCodes(); + if(map.containsKey(dingOrgInfoDTO.getOrganizationCode())) { + DingOrganization organization = map.get(dingOrgInfoDTO.getOrganizationCode()); + saveRecord.setId(organization.getId()); + if (CollectionUtils.isNotEmpty(childCodes)) { + buildSaveRecordList(childCodes, saveRecordList,oldList); + } + continue; + } + + saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); +// saveRecord.setEnabled("1"); + saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); + saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); + saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); + saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); +// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); + saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); + saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode()); + saveRecordList.add(saveRecord); + if (CollectionUtils.isNotEmpty(childCodes)) { + buildSaveRecordList(childCodes, saveRecordList,oldList); + } + } + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java new file mode 100644 index 0000000..fa09314 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java @@ -0,0 +1,129 @@ +package com.hz.pm.api.provincial; + +import cn.hutool.crypto.SecureUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.ProjectDeclareConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; +import com.hz.pm.api.projectdeclared.manage.PrequalificationDeclaredProjectManage; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; +import com.hz.pm.api.staging.contants.StagingContant; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.wflow.exception.BusinessException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname Test + * @Description + * @Date 2023/3/2 16:14 + * @Author PoffyZhang + */ +@Slf4j +public class Test extends AppTests{// + + @Autowired + private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; + + @Autowired + private IProjectService projectService; + + @Autowired + private IProjectApplicationService applicationService; + + @Autowired + private FileService fileService; + + @Autowired + private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + + @Autowired + private IProjectStagingService projectStagingService; + + @org.junit.Test + public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { +// Long timeStamp = System.currentTimeMillis()/1000; + Long timeStamp = 1677750055L; + String key = "7196317343a64e67895dc0375c098fe7"; + String url = "/api/v1/foreign/importantProView"; + String methed = "POST"; + String bytesToSign = methed + "\n" + url + "\n" + timeStamp + "\n" + key; + + log.info("" + bytesToSign); + + String secret = "75152a97f20e4c4c854dc6301cf72ad4"; + String str = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); + log.info("" + str); + } + + @org.junit.Test + public void Test222(){ + Project project = projectService.getById(340); + prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId(),Boolean.FALSE); + } + + @org.junit.Test + public void Test3333(){ + String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D"; + String s = "Expires"; + System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY)); + } + + @Value("${spring.profiles.active}") + private String active; + + @org.junit.Test + public void Test4444(){ + // 对接省级联审的接口 + Project p = projectService.getById(448); + + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, p.getId())); + if(!joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(p,applications,fileService,active))){ + throw new BusinessException("提交省级部门联审失败"); + } + System.out.println("成功"); + } + + @org.junit.Test + public void test5(){ + //1. 定时取 项目暂存表的数据 去进行状态继续流转 + List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) + .eq(ProjectStaging::getDead,Boolean.FALSE) + .le(ProjectStaging::getNextTime, LocalDateTime.now()) + .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(ProjectStaging::getProjectId)); + + log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); + } + + @org.junit.Test + public void test6(){ + List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) + .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) + .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) + .eq(Project::getAreaCode, RegionConst.RC_LS) + .orderByAsc(Project::getCreateOn)); + + log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/Node.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/Node.java new file mode 100644 index 0000000..9ce0e5e --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/Node.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.sys.processDef; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class Node implements Serializable { + private static final long serialVersionUID = -45475579271153023L; + + private String id; + + private String parentId; + + private String name; + + private T props; + + private Node children; + + private List> branchs; +} \ No newline at end of file diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java new file mode 100644 index 0000000..68580af --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java @@ -0,0 +1,162 @@ +package com.hz.pm.api.sys.processDef; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.scheduler.contants.TaskContant; +import com.hz.pm.api.sys.model.dto.RegionDTO; +import com.hz.pm.api.sys.service.IRegionService; +import com.wflow.bean.dto.WflowModelHistorysInsertDto; +import com.wflow.bean.entity.WflowForms; +import com.wflow.workflow.bean.process.ProcessNode; +import com.wflow.workflow.service.ProcessModelService; +import com.wflow.workflow.service.WflowFormsService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * @Classname ProcessTest + * @Description + * @Date 2023/2/4 9:54 + * @Author PoffyZhang + */ +@Slf4j +public class ProcessDefTest extends AppTests { + @Resource + private ProcessModelService processModelService; + @Resource + private WflowFormsService formsService; + @Resource + private RegionCacheHelper regionCacheHelper; + @Test + public void test() { + String processStr = "{\"id\":\"node_039152532706\",\"name\":\"审批单位\",\"type\":\"ORG\",\"props\":{\"regionCode\":\"\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\",\"subNode\":[]},\"children\":{},\"parentId\":\"root\"}"; + + Node node = JSON.parseObject(processStr, Node.class); + + OrgProps props = JSON.parseObject(node.getProps().toString(), OrgProps.class); + System.out.println(props.getOrgCode()); + } + + @Test + public void date(){ + System.out.println(LocalDateTime.parse("2023-02-05 10:25", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); + } + + @Test + public void apply() { + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 + List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + + if(CollUtil.isEmpty(regions)){ + throw new BizException("丽水地区数据为空 任务结束!"); + } + + for(RegionDTO region : regions){ + log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); + + Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; + for(Integer processType : processTypeList){ + String formName = ProjectProcessStageEnum.getDesc(processType); + WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); + + models.setGroupId(1); + models.setProcessDefId("pd" + IdUtil.objectId()); + models.setFormName(formName); + models.setProcessType(processType); + models.setRegionCode(region.getRegionCode()); + String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; + ProcessNode processNode = JSON.parseObject(process,ProcessNode.class); + models.setProcess(processNode); + models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); + models.setFormItems("[]"); + + String formId = processModelService.insertProcess(models); + if(StringUtils.isNotBlank(formId)){ + //初始的流程在部署表也存一份,用来查询 + if(StringUtils.isNotBlank(processModelService.deployProcess(formId,null))){ + log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getRegionName(),formName); + }else{ + log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getRegionName(),formName); + } + }else{ + log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getRegionName(),formName); + } + } + } + + stopWatch.stop(); + log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + } + + public static class OrgProps { + private String regionCode; + + private String orgCode; + + private String type; + + private String processDefId; + + private List subNode; + + public String getRegionCode() { + return regionCode; + } + + public void setRegionCode(String regionCode) { + this.regionCode = regionCode; + } + + public String getOrgCode() { + return orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getProcessDefId() { + return processDefId; + } + + public void setProcessDefId(String processDefId) { + this.processDefId = processDefId; + } + + public List getSubNode() { + return subNode; + } + + public void setSubNode(List subNode) { + this.subNode = subNode; + } + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/DraftTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/DraftTest.java new file mode 100644 index 0000000..bfacb8b --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/DraftTest.java @@ -0,0 +1,30 @@ +package com.hz.pm.api.sys.project; + +import com.alibaba.fastjson.JSON; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; +import com.hz.pm.api.projectdeclared.service.IProjectDraftService; +import org.junit.Test; + +import javax.annotation.Resource; + +/** + * @Classname DraftTest + * @Description + * @Date 2023/2/7 10:56 + * @Author PoffyZhang + */ +public class DraftTest extends AppTests { + + @Resource + private IProjectDraftService projectDraftService; + + @Test + public void one(){ + + ProjectDraft byId = projectDraftService.getById(1); + + System.out.println(JSON.toJSONString(byId)); + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java new file mode 100644 index 0000000..5ff21ff --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.sys.project; + +import cn.hutool.core.date.StopWatch; +import com.alibaba.fastjson.JSON; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import org.junit.Test; + +import javax.annotation.Resource; + +/** + * @Classname ProjectStateTest + * @Description + * @Date 2023/2/8 11:12 + * @Author PoffyZhang + */ +public class ProjectStateTest extends AppTests { + + @Resource + private StateMachineUtils stateMachineUtils; + + @Resource + private IProjectService projectService; + + @Test + public void execute() throws Exception { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + System.out.println("调用状态机开始"); + + Project project = new Project(); + project.setInstCode("1"); + project.setId(1L); + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + //调用状态机 进入下一个通过状态 + stateMachineUtils.pass(project); + + stopWatch.stop(); + System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); + } + + @Test + public void getProject() { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + Project project = projectService.getById(1); + + stopWatch.stop(); + System.out.println("project :" + JSON.toJSONString(project)); + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java new file mode 100644 index 0000000..ef7ac74 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java @@ -0,0 +1,113 @@ +package com.hz.pm.api.sys.service; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.db.Db; +import cn.hutool.db.Entity; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.sys.model.entity.Menu; +import com.hz.pm.api.sys.model.entity.Role; +import com.hz.pm.api.sys.model.entity.RoleMenu; +import com.hz.pm.api.user.entity.enumeration.RoleEnum; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.sql.SQLException; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicLong; + +/** + *

+ * IMenuServiceTest + *

+ * + * @author WendyYang + * @since 11:18 2023/1/29 + */ +class IMenuServiceTest extends AppTests { + + @Autowired + private IMenuService menuService; + @Autowired + private IRoleService roleService; + + /** + * 初始化固定角色 + */ + @Test + public void roleService() { + roleService.remove(null); + AtomicLong integer = new AtomicLong(0); + Arrays.stream(RoleEnum.values()).map(w -> { + Role role = new Role(); + role.setId(integer.incrementAndGet()); + role.setCode(w.name()); + role.setName(w.getDesc()); + role.setDescribe(w.getDesc()); + role.setFixed(true); + role.setCreateOn(LocalDateTime.now()); + return role; + }).forEach(roleService::save); + } + + @Test + public void test() throws SQLException { + menuService.remove(null); + List menu = Db.use().findAll("nd_menu"); + menu.forEach(System.out::println); + menu.forEach(w -> { + Menu bean = w.toBean(Menu.class); + menuService.save(bean); + }); + } + + + @Autowired + private IRoleMenuService roleMenuService; + + @Test + public void initMenu() { + menuService.remove(null); + roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class) + .eq(RoleMenu::getRoleId, 1)); + String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); + List obj = JSONUtil.toList(str, JSONObject.class); + save(obj, 0); + menuService.list().forEach(w -> { + roleMenuService.save(new RoleMenu() {{ + setRoleId(1L); + setMenuId(w.getId()); + }}); + }); + } + + public void save(List objs, long parentId) { + objs.forEach(w -> { + Menu menu = new Menu(); + menu.setActiveMenu(w.getStr("activeMenu")); + menu.setComponent(w.getStr("component")); + menu.setIcon(w.getStr("icon")); + menu.setPath(w.getStr("path")); + menu.setName(w.getStr("path").replace("/", "")); + menu.setTopMenu(w.getStr("topMenu")); + menu.setTitle(w.getStr("title")); + menu.setHidden(w.getInt("hidden")); + menu.setPid(parentId); + menu.setRedirect(w.getStr("redirect")); + menu.setSort(w.getInt("sort")); + menu.setDataScopeOption(""); + menu.setHasDataScope(false); + menuService.save(menu); + List children = w.getBeanList("children", JSONObject.class); + if (CollUtil.isNotEmpty(children)) { + save(children, menu.getId()); + } + }); + } + +} \ No newline at end of file diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IRegionServiceTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IRegionServiceTest.java new file mode 100644 index 0000000..400a8b5 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IRegionServiceTest.java @@ -0,0 +1,64 @@ +package com.hz.pm.api.sys.service; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.sys.model.entity.Region; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +/** + *

+ * IRegionServiceTest + *

+ * + * @author WendyYang + * @since 16:57 2023/3/1 + */ +class IRegionServiceTest extends AppTests { + + @Autowired + private RegionCacheHelper regionCacheHelper; + @Autowired + private IRegionService regionService; + + @Test + public void test1() { + AtomicLong idIncr = new AtomicLong(1); + Map> map = CollUtils.group(regionService.list(), Region::getRegionLevel); + regionService.remove(null); + map.keySet().stream().sorted().forEach(w -> { + List list = new ArrayList<>(); + List regions = map.get(w); + for (Region region : regions) { + if (w == 1) { + region.setRegionCodePath(region.getParentCode() + "," + region.getRegionCode()); + region.setParentId(0L); + } else { + Region parent = regionService.getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, region.getParentCode()) + .eq(Region::getRegionLevel, region.getRegionLevel() - 1)); + region.setRegionCodePath(parent.getRegionCodePath() + "," + region.getRegionCode()); + region.setParentId(parent.getId()); + } + region.setId(idIncr.getAndIncrement()); + list.add(region); + } + regionService.saveBatch(list); + System.out.println("============================================================================"); + }); + } + + @Test + public void test2() { + System.out.println(regionCacheHelper.getDisplayName("330100", 2)); + System.out.println(regionCacheHelper.getFullDisplayName("330102", 3)); + } + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java new file mode 100644 index 0000000..c14d806 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java @@ -0,0 +1,273 @@ +package com.hz.pm.api.todocenter; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.hz.pm.api.AppTests; +import com.wflow.bean.entity.WflowCcTasks; +import com.wflow.mapper.WflowCcTasksMapper; +import com.wflow.utils.CodeUtil; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; +import com.wflow.workflow.enums.ProcessHandlerEnum; +import com.wflow.workflow.mapper.CustomHisActInstMapper; +import com.wflow.workflow.utils.ProcessTaskUtils; +import lombok.extern.slf4j.Slf4j; +import org.assertj.core.util.Lists; +import org.flowable.bpmn.model.BpmnModel; +import org.flowable.bpmn.model.FlowElement; +import org.flowable.common.engine.impl.cmd.CustomSqlExecution; +import org.flowable.engine.*; +import org.flowable.engine.history.HistoricActivityInstance; +import org.flowable.engine.impl.cmd.AbstractCustomSqlExecution; +import org.flowable.engine.runtime.Execution; +import org.flowable.task.api.Task; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname FlowableTest + * @Description + * @Date 2023/5/14 9:12 + * @Author PoffyZhang + */ +@Slf4j +public class FlowableTest extends AppTests { + + @Autowired + private RuntimeService runtimeService; + + @Autowired + private HistoryService historyService; + + @Autowired + private RepositoryService repositoryService; + + @Autowired + private TaskService taskService; + + @Autowired + private ManagementService managementService; + + @Autowired + private WflowCcTasksMapper ccTasksMapper; + + @Test + public void withdrawTest(){ + String taskId = "cc3d7536-f1f3-11ed-b9e0-02426daa406d"; + + // 不是流程发起人撤回 + HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() + .taskId(taskId) + .singleResult(); + if (Objects.isNull(handledTaskInstance)){ + throw new BizException("获取任务实例失败!"); + } + + String processInstanceId = handledTaskInstance.getProcessInstanceId(); + + // 获取已处理历史活跃实例节点ID + String handledNodeId = handledTaskInstance.getTaskDefinitionKey(); + + BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); + + //先得到 其所在子流程 + Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); + String subProcessId = subNodeMap.get(handledNodeId); + //然后得到 子流程下的所有 nodeId + Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); + List nodeIds = allSubNodeMap.get(subProcessId); + + // 获取待处理历史活跃实例节点ID(会签/或签会有多个) + // 获取当前流程实例待审核任务信息 + List taskList = taskService.createTaskQuery() + .processInstanceId(processInstanceId) + .taskDefinitionKeys(nodeIds) + .list(); + //保证是此子流程下的任务 那第一个就是当前操作节点了 + Task currentTask = taskList.get(0); + String currentNodeId = currentTask.getTaskDefinitionKey(); + + // 传节点定义key 获取撤回操作人在流程配置中所在的节点 + FlowElement beforeFlowElement = bpmnModel.getFlowElement(handledNodeId); + // 获取执行撤回操作的节点所在子流程所有节点ID + List actIdList = Lists.newArrayList(handledNodeId,currentNodeId); + + List historicActivityInstanceList = historyService + .createHistoricActivityInstanceQuery() + .processInstanceId(processInstanceId) + .list(); + + // 标记执行撤回操作节点及当前待处理节点(userTask类型)为被撤回(使用DELETE_REASON_标志) + List activityInstances = historicActivityInstanceList.stream() + .filter(a -> actIdList.contains(a.getActivityId())) + .collect(Collectors.toList()); + + // 先查出当前撤回节点所在子流程节点的节点ID + List subProcessActIds = historicActivityInstanceList.stream() + .filter(a -> "subProcess".equals(a.getActivityType())) + .map(HistoricActivityInstance::getActivityId) + .collect(Collectors.toList()); + List executions = runtimeService.createExecutionQuery() + .processInstanceId(processInstanceId).onlyChildExecutions().list(); + List actIds = executions.stream().map(Execution::getActivityId).collect(Collectors.toList()); + // 去除子流程节点ID + actIds.removeAll(subProcessActIds); + // 强制流程指向前一个审核人节点 + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(processInstanceId) + .moveActivityIdsToSingleActivityId(actIds,handledNodeId) + .changeState(); + + // 如果是从会签节点撤回,执行会签节点的节点ID和当前待处理节点ID相同,只需要标记当前会签节点为被撤回 + if (handledNodeId.equals(currentNodeId)){ + activityInstances = activityInstances.stream().filter(a -> currentNodeId.equals(a.getActivityId())).collect(Collectors.toList()); + } + for (HistoricActivityInstance activityInstance : activityInstances) { + String executionId = activityInstance.getExecutionId(); + // 备注子流程已处理节点为被撤回 + CustomSqlExecution customSqlExecution = new AbstractCustomSqlExecution(CustomHisActInstMapper.class) { + @Override + public Integer execute(CustomHisActInstMapper customHisActInstMapper) { + // 更新历史活跃实例表中删除原因为被撤回 + return customHisActInstMapper.deleteHisActInst(processInstanceId, executionId); + } + }; + managementService.executeCustomSql(customSqlExecution); + taskService.deleteTask(activityInstance.getTaskId()); + historyService.deleteHistoricTaskInstance(activityInstance.getTaskId()); + } + } + + @Test + public void testWithDraw(){ + ReqProcessHandlerDTO param = new ReqProcessHandlerDTO(); + param.setProjectId(633L); + param.setTaskId("8e3e9329-f544-11ed-91fd-02426daa406d"); + param.setAction(ProcessHandlerEnum.WITHDRAW); + param.setInstanceId("93877c57-f542-11ed-91fd-02426daa406d"); + + // 不是流程发起人撤回 + HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() + .taskId(param.getTaskId()) + .singleResult(); + if (Objects.isNull(handledTaskInstance)){ + throw new BizException("获取任务实例失败!"); + } + + String processInstanceId = handledTaskInstance.getProcessInstanceId(); + + // 获取已处理历史活跃实例节点ID + String handledNodeId = handledTaskInstance.getTaskDefinitionKey(); + Date handleCreateTime = handledTaskInstance.getCreateTime(); + + BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); + + //先得到 其所在子流程 + Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); + String subProcessId = subNodeMap.get(handledNodeId); + //然后得到 子流程下的所有 nodeId + Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); + List nodeIds = allSubNodeMap.get(subProcessId); + + // 获取待处理历史活跃实例节点ID(会签/或签会有多个) + // 获取当前流程实例待审核任务信息 + List taskList = taskService.createTaskQuery() + .processInstanceId(processInstanceId) + .taskDefinitionKeys(nodeIds) + .list(); + //保证是此子流程下的任务 那第一个就是当前操作节点了 + Task currentTask = taskList.get(0); + Date currentCreateTime = currentTask.getCreateTime(); + String currentNodeId = currentTask.getTaskDefinitionKey(); + + // 传节点定义key 获取撤回操作人在流程配置中所在的节点 + FlowElement beforeFlowElement = bpmnModel.getFlowElement(handledNodeId); + // 获取执行撤回操作的节点所在子流程所有节点ID + List actIdList = Lists.newArrayList(handledNodeId,currentNodeId); + + List historicActivityInstanceList = historyService + .createHistoricActivityInstanceQuery() + .processInstanceId(processInstanceId) + .list(); + + // 标记执行撤回操作节点及当前待处理节点(userTask类型)为被撤回(使用DELETE_REASON_标志) + List activityInstances = historicActivityInstanceList.stream() + .filter(a -> { + if(actIdList.contains(a.getActivityId())){ + if(a.getActivityId().equals(handledNodeId)){ + return (CodeUtil.computationTime(a.getStartTime(),handleCreateTime) == 0L); + }else if(a.getActivityId().equals(currentNodeId)){ + return (CodeUtil.computationTime(a.getStartTime(),currentCreateTime) == 0L); + } + } + return Boolean.FALSE; + }) + .collect(Collectors.toList()); + + // 先查出当前撤回节点所在子流程节点的节点ID + List subProcessActIds = historicActivityInstanceList.stream() + .filter(a -> "subProcess".equals(a.getActivityType())) + .map(HistoricActivityInstance::getActivityId) + .collect(Collectors.toList()); + List executions = runtimeService.createExecutionQuery() + .processInstanceId(processInstanceId).onlyChildExecutions().list(); + List actIds = executions.stream().map(Execution::getActivityId).collect(Collectors.toList()); + // 去除子流程节点ID + actIds.removeAll(subProcessActIds); + // 强制流程指向前一个审核人节点 + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(processInstanceId) +// .moveActivityIdTo(currentNodeId,handledNodeId) + .moveActivityIdsToSingleActivityId(actIds,handledNodeId) + .changeState(); + + // 如果是从会签节点撤回,执行会签节点的节点ID和当前待处理节点ID相同,只需要标记当前会签节点为被撤回 + if (handledNodeId.equals(currentNodeId)){ + activityInstances = activityInstances.stream().filter(a -> currentNodeId.equals(a.getActivityId())).collect(Collectors.toList()); + } + for (HistoricActivityInstance activityInstance : activityInstances) { + String executionId = activityInstance.getExecutionId(); + // 备注子流程已处理节点为被撤回 + CustomSqlExecution customSqlExecution = new AbstractCustomSqlExecution(CustomHisActInstMapper.class) { + @Override + public Integer execute(CustomHisActInstMapper customHisActInstMapper) { + // 更新历史活跃实例表中删除原因为被撤回 + return customHisActInstMapper.deleteHisActInst(processInstanceId, executionId); + } + }; + managementService.executeCustomSql(customSqlExecution); + taskService.deleteTask(activityInstance.getTaskId()); + historyService.deleteHistoricTaskInstance(activityInstance.getTaskId()); + } + // 如果当前执行撤回操作的节点后有抄送节点,撤回后,需将抄送任务节点删除 + String ccNodeId = param.getCcNodeId(); + ccTasksMapper.delete(Wrappers.lambdaQuery(WflowCcTasks.class).eq(WflowCcTasks::getNodeId,ccNodeId)); + } + + @Test + public void reject(){ + String instCode = "0e63faec-08ff-11ee-9663-00163e000353"; + String nodeId1 = "node_6486ddcbe4b0ab4a27ccfdbd"; + String nodeId2 = "node_6486ddcbe4b0ab4a27ccfdc1"; + String nodeId3 = "node_6486ddcbe4b0ab4a27ccfdc3"; + + List executions = runtimeService.createExecutionQuery() + .processInstanceId(instCode) + .onlyChildExecutions().list(); + //强制流程指向驳回 + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(instCode) + .moveActivityIdsToSingleActivityId(Lists.newArrayList(nodeId1,nodeId2,nodeId3), "refuse-end") + .moveExecutionsToSingleActivityId(executions.stream().map(Execution::getId) + .collect(Collectors.toList()), "refuse-end") + .changeState(); + + log.info("操作成功!"); + } +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java new file mode 100644 index 0000000..38097f1 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java @@ -0,0 +1,225 @@ +package com.hz.pm.api.todocenter; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.file.entity.vo.result.FileResultVO; +import com.ningdatech.file.service.FileService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; +import com.hz.pm.api.sys.manage.NoticeManage; +import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.hz.pm.api.todocenter.manage.TodoCenterManage; +import com.hz.pm.api.todocenter.model.dto.PdfGenerateDTO; +import com.hz.pm.api.todocenter.utils.PdfUtils; +import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.zwdd.client.ZwddClient; +import com.wflow.contants.ProcessConstant; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; +import org.flowable.task.api.Task; +import org.flowable.task.api.TaskQuery; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; +import org.junit.Test; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; +import java.io.InputStream; +import java.time.LocalDateTime; +import java.util.List; +import java.util.concurrent.*; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; + +/** + * 待办中心测试 + * + * @author CMM + * @since 2023/02/15 22:03 + */ +@Slf4j +public class TodoCenterTest extends AppTests { + @Autowired + private TodoCenterManage todoCenterManage; + @Autowired + private IUserInfoService userInfoService; + @Autowired + private ZwddClient zwddClient; + @Autowired + private INdWorkNoticeStagingService workNoticeStagingService; + @Autowired + private ProjectLibManage projectLibManage; + @Autowired + private FileService fileService; + @Autowired + private IProjectService projectService; + @Autowired + private PdfUtils pdfUtils; + + @Autowired + private TaskService taskService; + + @Autowired + private HistoryService historyService; + + @Autowired + private NoticeManage handlerManage; + + @Test + public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { + //String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); + //log.info("开始发送工作通知"); + //zwddClient.sendWorkNotice("846085", "0223-00", msg); + //// zwddClient.sendWorkNotice("829728","0216-5",msg); + //log.info("发送工作通知结束"); + + //ApplicationContext ac = new AnnotationConfigApplicationContext(BeanConfig.class); + // + ////若没有指定属性名,则默认为方法名 + //TaskExecutor taskExecutor = (TaskExecutor) ac.getBean("executor"); + + String userId = "4"; + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo workNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); + // workNoticeInfo.setBizMsgId("1"); + String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-02-测试项目"); + + //// 先创建1个活动线程的线程池 + //ExecutorService executor = Executors.newFixedThreadPool(1); + + // 初始化线程池 + ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, + 60, TimeUnit.SECONDS, new ArrayBlockingQueue(20), new ThreadPoolExecutor.AbortPolicy()); + + // 将发送工作通知交给异步任务Future + CompletableFuture future = CompletableFuture.supplyAsync(() -> { + // 调用浙政钉的接口发送工作通知 + long startTime = System.currentTimeMillis(); + GenericResult result = + zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); + String resultMsg = result.getMsg(); + if (resultMsg.equals("success")) { + log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); + long endTime = System.currentTimeMillis(); + log.info("方法执行完成返回,耗时:" + (endTime - startTime)); + }else { + return "发送工作通知失败!"; + } + return "发送工作通知成功!"; + }, threadPool); + String s = future.get(); + threadPool.shutdown(); + while (threadPool.isTerminated()) { + log.info(s); + break; + } + } + + @Test + public void sendWorkNoticeTest2(){ + String userId = "2"; + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); + String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); + passWorkNoticeInfo.setMsg(passMsg); + // 放入工作通知暂存表中,通过扫表异步发送 +// workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); + } + + @Test + public void GeneratePdf(){ + // 获取本地目录的pdf模板 + String fileName = "预审申请单"; + InputStream htmlInputStream = + this.getClass().getClassLoader().getResourceAsStream("template/" + fileName + ".html"); + // 获取表单数据 + ProjectDetailVO projectDetail = projectLibManage.getProjectDetail(44L); + PdfGenerateDTO pdfGenerateDTO = new PdfGenerateDTO(); + BeanUtils.copyProperties(projectDetail, pdfGenerateDTO); + // 设置pdf模板参数 + JSONObject paramsMap = JSONObject.parseObject(JSONObject.toJSONString(pdfGenerateDTO)); + paramsMap.put("time", NdDateUtils.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm")); + paramsMap.put("isTemporaryAugment", "否"); + String projectType = projectDetail.getProjectType(); + paramsMap.put("projectType", ProjectTypeNewEnum.getDesc(projectType)); + Integer isFirst = projectDetail.getIsFirst(); + paramsMap.put("isFirst", "是"); + Boolean isInnovateWholeProvinceShare = projectDetail.getIsInnovateWholeProvinceShare(); + paramsMap.put("isInnovateWholeProvinceShare", Boolean.TRUE.equals(isInnovateWholeProvinceShare) ? "是" : "否"); + String beginTime = projectDetail.getBeginTime(); + String endTime = projectDetail.getEndTime(); + String beginAndEndTime = beginTime + StrUtil.DASHED + endTime; + paramsMap.put("beginAndEndTime", beginAndEndTime); + Integer fourSystems = projectDetail.getFourSystems(); + paramsMap.put("fourSystems", "业务应用"); + Integer isDigitalReform = projectDetail.getIsDigitalReform(); + paramsMap.put("isDigitalReform", "否"); + Integer isCloud = projectDetail.getIsCloud(); + paramsMap.put("isCloud", "否"); + paramsMap.put("yearPlanInvest",null); + paramsMap.put("bigDataBureauName",null); + + // 生成pdf字节数组 + byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); + + // 转换成MultipartFile + MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); + + // 上传OSS + FileResultVO resultVO = fileService.upload(multipartFile, "default"); + + // 将返回的文件ID保存到项目库中 + Project project = projectService.getById(44L); + project.setPretrialFileId(resultVO.getId()); + + try { + if (null != htmlInputStream) { + htmlInputStream.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void todo(){ + //测试 有多少个 + TaskQuery taskQuery = taskService.createTaskQuery(); + taskQuery.active() + .taskCandidateOrAssigned(String.valueOf(2)); + List taskList = taskQuery.list(); + + System.out.println(taskList.size()); + } + + public void ido(){ + String userId = "2"; + // 自定义sql查询所有已办的任务实例 + String nativeSql = "SELECT\n" + + "\taht.*\n" + + "FROM\n" + + "\tACT_HI_TASKINST AS aht\n" + + "LEFT JOIN ACT_HI_VARINST AS ahv ON\n" + + "\tSUBSTRING(ahv.NAME_, 9) = aht.ID_\n" + + "\tAND ahv.NAME_ LIKE 'approve_%'\n" + + "WHERE\n" + + "\taht.ASSIGNEE_ = '" + userId + + "'AND ahv.NAME_ IS NOT NULL\n" + + "\tOR aht.DELETE_REASON_ = '" + ProcessConstant.Field.CANCEL + "'"; + NativeHistoricTaskInstanceQuery taskInstanceQuery = + historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); + List taskInstances = taskInstanceQuery.list(); + + System.out.println(taskInstances.size()); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/AppTests.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/AppTests.java new file mode 100644 index 0000000..ca7791d --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/AppTests.java @@ -0,0 +1,19 @@ +package com.hz.pm.api; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + *

+ * AppRunTests + *

+ * + * @author WendyYang + * @since 19:27 2022/5/10 + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = App.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class AppTests { + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java new file mode 100644 index 0000000..50828da --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.cctask; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.wflow.bean.entity.WflowCcTasks; +import com.wflow.service.WflowCcTasksService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * @Classname CcTaskTest + * @Description + * @Date 2023/6/30 16:52 + * @Author PoffyZhang + */ +public class CcTaskTest extends AppTests { + + @Autowired + private WflowCcTasksService wflowCcTasksService; + + @Test + public void test(){ + String nodeId = "node_649e9620711424df271ba98c"; + String instanceId = "72fffd9c-1722-11ee-b7f5-02426daa406d"; + List ccTasks = wflowCcTasksService.list(Wrappers.lambdaQuery(WflowCcTasks.class) + .eq(WflowCcTasks::getNodeId,nodeId) + .eq(WflowCcTasks::getInstanceId,instanceId)); + System.out.println(JSON.toJSONString(ccTasks)); + } + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java new file mode 100644 index 0000000..e5c1d49 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java @@ -0,0 +1,145 @@ +package com.hz.pm.api.collection; + +import com.alibaba.fastjson.JSON; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import java.io.*; +import java.time.LocalDateTime; +import java.util.*; + +/** + * @Classname SaveCollectionTest + * @Description + * @Date 2023/9/4 17:43 + * @Author PoffyZhang + */ +public class SaveCollectionTest extends AppTests {// + + @Autowired + private GovProjectCollectionManage manage; + + @Autowired + private GenerateProjectCodeUtil projectCodeUtil; + + @Test + public void importData() throws Exception { + Workbook wb; + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.xlsx"); + wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ + break; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + + GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); + // + String projName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjName(projName); + baseinfoDTO.setBaseAreaCode(RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + baseinfoDTO.setBaseAreaName("丽水市"); + baseinfoDTO.setAreaCode(RegionConst.RC_LS); + baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + baseinfoDTO.setTongTime(LocalDateTime.now()); + baseinfoDTO.setBizTime(LocalDateTime.now()); + baseinfoDTO.setOp("insert"); + String principal = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjPrincipal(principal); + String contacts = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjContacts(contacts); + String contactsCall = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjContactsCall(contactsCall); + String baseProvManDeprt = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProvManDeprt(baseProvManDeprt); + String baseProvManDeprtDing = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProvManDeprtDing(baseProvManDeprtDing); + String baseManDeprt = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseManDeprt(baseManDeprt); + String baseManDeprtDing = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseManDeprtDing(baseManDeprtDing); + String baseProjType = Objects.nonNull(row.getCell(15)) ? row.getCell(15).toString() : StringUtils.EMPTY; + if("0".equals(baseProjType)){ + baseProjType = "01"; + }else if("1".equals(baseProjType)){ + baseProjType = "04"; + } + baseinfoDTO.setBaseProjType(baseProjType); + String baseProjSetProg = Objects.nonNull(row.getCell(17)) ? row.getCell(17).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjSetProg(baseProjSetProg); + + saveDTO.setBaseinfo(baseinfoDTO); + + GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); + String baseProjSetYear = Objects.nonNull(row.getCell(22)) ? row.getCell(22).toString() : StringUtils.EMPTY; + applyDTO.setBaseProjSetYear(baseProjSetYear); + String baseProjIntro = Objects.nonNull(row.getCell(23)) ? row.getCell(23).toString() : StringUtils.EMPTY; + applyDTO.setBaseProjIntro(baseProjIntro); + saveDTO.setApply(applyDTO); + //生产编号 + String projId = projectCodeUtil.generateProjectCode(saveDTO); + saveDTO.setBaseProjId(projId); + saveDTO.getBaseinfo().setBaseProjId(projId); + saveDTO.getApply().setBaseProjId(projId); + UserInfoDetails user = new UserInfoDetails(); + user.setRegionCode(RegionConst.RC_LS); + user.setUsername("系统导入"); + String save = ""; + try{ + save = manage.save(saveDTO, user); + }catch (Exception e){ + e.printStackTrace(); + } + System.out.println(JSON.toJSONString(save)); + } + } + + System.out.println("导入完成"); + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java new file mode 100644 index 0000000..892b128 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java @@ -0,0 +1,256 @@ +package com.hz.pm.api.collection; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.manage.GovProjectCollectionManage; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.*; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname SaveCollectionTest + * @Description + * @Date 2023/9/4 17:43 + * @Author PoffyZhang + */ +public class SaveCollectionTest331125 extends AppTests {// + + @Autowired + private GovProjectCollectionManage manage; + + @Autowired + private GenerateProjectCodeUtil projectCodeUtil; + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + @Autowired + private IGovBizProjectApplyService applyService; + @Autowired + private IGovBizProjectApproveService approveService; + @Autowired + private IGovBizProjectCimplementService cimplementService; + @Autowired + private IGovBizProjectMimplementService mimplementService; + @Autowired + private IGovBizProjectProcureService procureService; + + @Test + public void importData() throws Exception { + Workbook wb; + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx"); + wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ + break; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + + GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); + // + String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjName(projName); + baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST); + baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME); + baseinfoDTO.setAreaCode(RegionConst.RC_LS); + baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + baseinfoDTO.setTongTime(LocalDateTime.now()); + baseinfoDTO.setBizTime(LocalDateTime.now()); + baseinfoDTO.setOp("insert"); + String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjPrincipal(principal); + String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjContacts(contacts); + baseinfoDTO.setBaseProjType("01"); + saveDTO.setBaseinfo(baseinfoDTO); + + GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); + String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString() : StringUtils.EMPTY; + applyDTO.setBaseProjSetYear(baseProjSetYear); + saveDTO.setApply(applyDTO); + //生产编号 + String projId = projectCodeUtil.generateProjectCode(saveDTO); + saveDTO.setBaseProjId(projId); + saveDTO.getBaseinfo().setBaseProjId(projId); + saveDTO.getApply().setBaseProjId(projId); + UserInfoDetails user = new UserInfoDetails(); + user.setRegionCode(RegionConst.LS_KF); + user.setUsername("系统导入"); + String save = ""; + try{ + GovBizProjectBaseinfo old = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjName, projName) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(old)){ + save = manage.save(saveDTO, user); + }else{ + System.out.println(projName + ",重复了 要改到经开区里"); + String newProjId = old.getBaseProjId().replace("331100000","331118000"); + baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjName, projName) + .eq(GovBizProjectBaseinfo::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectBaseinfo::getBaseAreaCode,RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST) + .set(GovBizProjectBaseinfo::getBaseProjId,newProjId)); + applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjName, projName) + .eq(GovBizProjectApply::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectApply::getBaseProjId,newProjId)); + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjName, projName) + .eq(GovBizProjectApprove::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectApprove::getBaseProjId,newProjId)); + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjName, projName) + .eq(GovBizProjectCimplement::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectCimplement::getBaseProjId,newProjId)); + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjName, projName) + .eq(GovBizProjectMimplement::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectMimplement::getBaseProjId,newProjId)); + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjName, projName) + .eq(GovBizProjectProcure::getBaseProjId, old.getBaseProjId()) + .set(GovBizProjectProcure::getBaseProjId,newProjId)); + } + }catch (Exception e){ + e.printStackTrace(); + } + System.out.println(JSON.toJSONString(save)); + } + } + + System.out.println("导入完成"); + } + + @Test + public void test2() throws FileNotFoundException { + //先删除 开发区的 + List lss = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseAreaCode, RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST)); + List codes = lss.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); + applyService.remove(Wrappers.lambdaQuery(GovBizProjectApply.class) + .in(GovBizProjectApply::getBaseProjId,codes)); + approveService.remove(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .in(GovBizProjectApprove::getBaseProjId,codes)); + cimplementService.remove(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .in(GovBizProjectCimplement::getBaseProjId,codes)); + mimplementService.remove(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .in(GovBizProjectMimplement::getBaseProjId,codes)); + procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .in(GovBizProjectProcure::getBaseProjId,codes)); + baseinfoService.remove(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .in(GovBizProjectBaseinfo::getBaseProjId,codes)); + + Workbook wb; + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx"); + wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + if (Objects.isNull(row) || Objects.isNull(row.getCell(0))) { + break; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + + GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); + // + String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjName(projName); + baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST); + baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME); + baseinfoDTO.setAreaCode(RegionConst.RC_LS); + baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + baseinfoDTO.setTongTime(LocalDateTime.now()); + baseinfoDTO.setBizTime(LocalDateTime.now()); + baseinfoDTO.setOp("insert"); + String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjPrincipal(principal); + String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + baseinfoDTO.setBaseProjContacts(contacts); + baseinfoDTO.setBaseProjType("01"); + saveDTO.setBaseinfo(baseinfoDTO); + + GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); + String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString().substring(0,4) : StringUtils.EMPTY; + applyDTO.setBaseProjSetYear(baseProjSetYear); + saveDTO.setApply(applyDTO); + //生产编号 + String projId = projectCodeUtil.generateProjectCode(saveDTO); + saveDTO.setBaseProjId(projId); + saveDTO.getBaseinfo().setBaseProjId(projId); + saveDTO.getApply().setBaseProjId(projId); + UserInfoDetails user = new UserInfoDetails(); + user.setRegionCode(RegionConst.LS_KF); + user.setUsername("系统导入"); + String save = ""; + try { + save = manage.save(saveDTO, user); + }catch (Exception e){ + e.printStackTrace(); + } + System.out.println(JSON.toJSONString(save)); + } + } + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java new file mode 100644 index 0000000..0c62563 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.cpu; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class CPUTest { + public static ExecutorService executorService = Executors.newFixedThreadPool(10); + + public static volatile boolean flag = true; + + public static void main(String[] args) { + for(int i = 0;i < 10;i++){ + executorService.execute(() -> { + while (flag) { + // 一个复杂的计算任务 + long x = 123456789123456789L; + for (int j = 0; j < 10000; j++) { + if(!flag){ + break; + } + x = (x * 123456789123456789L) % 123456789; + } + } + }); + } + + try{ + Thread.sleep(10000); + executorService.shutdownNow(); + flag = false; + }catch (Exception e){ + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java new file mode 100644 index 0000000..b5dcacb --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.employee; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.ding.task.EmployeeBatchGetTask; +import com.hz.pm.api.ding.task.OrganizationBatchGetTask; +import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingEmployeeInfoService; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.service.IUserInfoService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @Classname EmployeeTest + * @Description + * @Date 2023/9/6 14:34 + * @Author PoffyZhang + */ +public class EmployeeTest extends AppTests { + + @Autowired + private IDingEmployeeInfoService dingEmployeeInfoService; + + @Autowired + private IDingOrganizationService dingOrganizationService; + + @Autowired + private IUserInfoService userInfoService; + + @Autowired + private OrganizationBatchGetTask organizationBatchGetTask; + + @Autowired + private EmployeeBatchGetTask employeeBatchGetTask; + + @Test + public void test(){ + List employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeName, "吴玉斌")); + + for(DingEmployeeInfo employee : employees){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employee.getEmployeeCode()) + .last(BizConst.LIMIT_1)); + + if(Objects.nonNull(user)){ + DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode()) + .last(BizConst.LIMIT_1)); + user.setRegionCode(RegionConst.LS_KF); + user.setEmpPosUnitCode(employee.getEmpPosUnitCode()); + user.setEmpPosUnitName(organization.getOrganizationName()); + userInfoService.updateById(user); + }else{ + DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode()) + .last(BizConst.LIMIT_1)); + UserInfo saveUser = new UserInfo(); + saveUser.setRegionCode(RegionConst.LS_KF); + saveUser.setEmpPosUnitCode(employee.getEmpPosUnitCode()); + saveUser.setEmpPosUnitName(organization.getOrganizationName()); + saveUser.setCreateOn(LocalDateTime.now()); + saveUser.setUsername("吴玉斌"); + saveUser.setRealName("吴玉斌"); + saveUser.setUpdateOn(LocalDateTime.now()); + saveUser.setAccountId(employee.getAccountId()); + saveUser.setEmployeeCode(employee.getEmployeeCode()); + userInfoService.save(saveUser); + } + + } + } + + @Test + public void test2(){ + String orgCode = "GO_4e6be07f25594df88e7bd1b7b7cdf9a8"; + organizationBatchGetTask.organizationGetSubs(orgCode); + } + + @Test + public void test3(){ + String orgCode = "GO_1aceac0b3a664afbb31ea0d627189781"; + employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); + } + + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java new file mode 100644 index 0000000..d6845e1 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.file; + +import com.hz.pm.api.common.util.CommonInputStreamResource; +import org.junit.Test; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.FileInputStream; + +import org.apache.http.entity.ContentType; +import java.io.*; + +/** + * @Classname ProvinceOssTest + * @Description + * @Date 2023/9/5 14:21 + * @Author PoffyZhang + */ +public class ProvinceOssTest { + + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.xlsx"); + String url = "https://pms.zj.gov.cn/prometheus-zhejiang_file_service/api/v1/file/uploadFile"; + MultiValueMap params = new LinkedMultiValueMap<>(); + byte[] fileBytes = getBytesByFile(f); + ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes); + CommonInputStreamResource commonInputStreamResource = new CommonInputStreamResource(inputStream,fileBytes.length,f.getName()); + params.add("file",commonInputStreamResource); + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("multipart/form-data"); + headers.setContentType(type); + HttpEntity formEntity = new HttpEntity(params, headers); + ResponseEntity res = restTemplate.postForEntity(url, formEntity, String.class); + System.out.println(res.getBody()); + } + + public static MultipartFile getMultipartFile(File file) { + try{ + FileInputStream fileInputStream = new FileInputStream(file); + MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(),ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); + return multipartFile; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + //将文件转换成Byte数组 + public static byte[] getBytesByFile(File file) { + try { + FileInputStream fis = new FileInputStream(file); + ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); + byte[] b = new byte[1000]; + int n; + while ((n = fis.read(b)) != -1) { + bos.write(b, 0, n); + } + fis.close(); + byte[] data = bos.toByteArray(); + bos.close(); + return data; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java new file mode 100644 index 0000000..856ee94 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java @@ -0,0 +1,190 @@ +package com.hz.pm.api.instance; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import com.hz.pm.api.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; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.runtime.ActivityInstance; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname InstanceTest + * @Description + * @Date 2023/2/16 14:44 + * @Author PoffyZhang + */ +@Slf4j +public class InstanceTest extends AppTests { + + @Autowired + private RuntimeService runtimeService; + + @Autowired + private HistoryService historyService; + + @Autowired + private ProjectLibManage projectLibManage; + + @Autowired + private IProjectInstService projectInstService; + + @Test + public void test() { + String instanceId = "896fa188-96d8-11ed-9539-e2d4e8f16b2f"; + Object user = runtimeService.getVariable(instanceId, + "owner"); + System.out.println(JSON.toJSONString(user)); + } + + @Test + public void testHistory() { + //如果有已经被审核过的 节点 + List finished = historyService.createHistoricActivityInstanceQuery() + .processInstanceId("085af7ef-d133-11ed-a3f6-02426daa406d").finished() + .activityType("userTask") + .orderByHistoricActivityInstanceEndTime().asc().list(); + HistoricActivityInstance historicActivityInstance = finished.get(0); + System.out.println(finished); + } + + @Test + public void testRuntime() { + //如果有已经被审核过的 节点 + List userTask = runtimeService.createActivityInstanceQuery() + .processInstanceId("1709ebe3-d148-11ed-9351-02426daa406d") + .activityType("userTask") + .orderByActivityInstanceStartTime().asc().list(); + System.out.println(userTask); + } + + @Test + public void testTodo() { + String employeeCode = "GE_e9d5c7917acd4eeea04ff2a9454af62e"; + // 查出项目库项目 + ProjectListReq projectListReq = new ProjectListReq(); + List projects = projectLibManage.projectList(projectListReq); + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + if (CollUtil.isEmpty(projectIdList)) { + System.out.println("没有项目"); + return; + } + 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()))); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setEmployeeCode(employeeCode); + req.setInstCodes(instCodes); + + // 自定义sql查询所有已办的任务实例 + String nativeSql = "SELECT ht.* FROM act_hi_taskinst ht WHERE assignee_ = '" + employeeCode + + "' and end_time_ is not NULL"; + NativeHistoricTaskInstanceQuery taskInstanceQuery = + historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); + List taskInstances = taskInstanceQuery.list(); + + Set set = new HashSet<>(); + List taskInstanceList = taskInstances.stream() + .filter(t -> instCodes.contains(t.getProcessInstanceId())) + .sorted(Comparator.comparing(HistoricTaskInstance::getEndTime)).collect(Collectors.toList()) + .stream() + .filter(v -> set.add(v.getProcessInstanceId())) + .collect(Collectors.toList()); + + System.out.println(taskInstanceList.size()); + } + + @Test + public void test2() { + // 获取节点处理结果 +// Map varMap = historyService.createHistoricVariableInstanceQuery() +// .processInstanceId("e99fe24c-d21c-11ed-af5d-02426daa406d") +// .variableNameLike("approve_%") +// .list().stream() +// .collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); + runtimeService.removeVariable("564102ce-d1ff-11ed-b694-02424b2b849f", "approve_7d2a191a-d1ff-11ed-b694-02424b2b849f"); + System.out.println(1); + } + + @Test + public void usageTimeStat() { + // 查询所有已完成的流程实例 + List processInstanceList = historyService.createHistoricProcessInstanceQuery() + .orderByProcessInstanceStartTime() + .desc() + .finished() + .list(); + + // 统计每个流程实例的审批耗时 + for (HistoricProcessInstance processInstance : processInstanceList) { + System.out.println("流程实例ID:" + processInstance.getId()); + System.out.println("流程开始时间:" + processInstance.getStartTime()); + System.out.println("流程结束时间:" + processInstance.getEndTime()); + System.out.println("流程耗时(ms):" + processInstance.getDurationInMillis() / 1000); + System.out.println("================================================================"); + } + } + + @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/hz-pm-api/src/test/java/com/ningdatech/pmapi/org/OrgTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/org/OrgTest.java new file mode 100644 index 0000000..45b2750 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/org/OrgTest.java @@ -0,0 +1,113 @@ +package com.hz.pm.api.org; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.SpringUtils; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.gov.entity.BelongOrg; +import com.hz.pm.api.gov.enumeration.BelongTypeEnum; +import com.hz.pm.api.gov.service.IBelongOrgService; +import com.hz.pm.api.organization.model.entity.DingOrganization; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +/** + * @Classname RegionTest + * @Description + * @Date 2023/6/8 14:44 + * @Author PoffyZhang + */ +public class OrgTest extends AppTests { + + @Autowired + private IDingOrganizationService organizationService; + @Autowired + private IBelongOrgService belongOrgService; + + @Test + public void test() { + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getDivisionCode, "331199")); + + for (DingOrganization org : orgs) { + List inners = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getParentCode, org.getOrganizationCode())); + for (DingOrganization inner : inners) { + mergeRegionCode(inner); + } + } + } + + private void mergeRegionCode(DingOrganization inner) { + inner.setDivisionCode("331199"); + organizationService.updateById(inner); + + List is = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getParentCode, inner.getOrganizationCode())); + if (CollUtil.isEmpty(is)) { + return; + } + for (DingOrganization i : is) { + mergeRegionCode(i); + } + } + + @Test + public void businessStrip() { + String path = "/Users/wendy/Desktop/省市县条线单位梳理202303016.xlsx"; + ExcelReader reader = ExcelUtil.getReader(path); + Set orgCodes = new HashSet<>(); + List belongOrgs = new ArrayList<>(); + for (int i = 0; i < reader.getSheetCount(); i++) { + reader.setSheet(i); + List> maps = reader.readAll(); + for (Map map : maps) { + String cityName = MapUtil.getStr(map, "市级组织名称"); + if (cityName == null || !cityName.contains("丽水")) { + continue; + } + String cityCode = MapUtil.getStr(map, "市级组织机构代码"); + if (StrUtil.isBlank(cityCode)) { + continue; + } + String countyName = MapUtil.getStr(map, "区县组织名称"); + if (StrUtil.isBlank(countyName)) { + continue; + } + String countyCode = MapUtil.getStr(map, "区县组织机构代码"); + if (StrUtil.isBlank(countyCode)) { + continue; + } + System.out.printf("市级:%s -> %s 区县:%s -> %s\n", cityName, cityCode, countyName, countyCode); + BelongOrg county = new BelongOrg(); + county.setBelongCode(cityCode); + county.setBelongName(cityName); + county.setOrgCode(countyCode); + county.setOrgName(countyName); + county.setOrgType(BelongTypeEnum.ORGANIZATION.name()); + belongOrgs.add(county); + if (!orgCodes.add(cityCode)) { + continue; + } + BelongOrg city = new BelongOrg(); + city.setBelongCode(cityCode); + city.setBelongName(cityName); + city.setOrgCode(cityCode); + city.setOrgName(cityName); + city.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name()); + belongOrgs.add(city); + } + belongOrgs.forEach(System.out::println); + } + belongOrgService.saveBatch(belongOrgs); + } + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java new file mode 100644 index 0000000..78d7d9b --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.password; + +import org.junit.Test; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +/** + * @Classname PasswordTest + * @Description + * @Date 2023/8/2 17:39 + * @Author PoffyZhang + */ +public class PasswordTest { + + @Test + public void password(){ + String mingwen = "ELgaCeHteZA8VJK8"; + + String miwen = "$2a$10$MT82RbInrIkRVL/GRS01Vew8AO6ICngOpbAGbdkWgSnYFhog5n8.q"; + + String encode = new BCryptPasswordEncoder().encode(mingwen); + boolean matches = new BCryptPasswordEncoder().matches(mingwen, encode); + System.out.println(encode); + System.out.println(matches); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java new file mode 100644 index 0000000..e3599fb --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java @@ -0,0 +1,161 @@ +package com.hz.pm.api.projectCollection; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCollectionTest + * @Description + * @Date 2023/9/7 15:08 + * @Author PoffyZhang + */ +public class ProjectCollection2Test extends AppTests { + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + + @Autowired + private IGovBizProjectApplyService applyService; + + @Autowired + private IGovBizProjectApproveService approveService; + + @Autowired + private IGovBizProjectCimplementService cimplementService; + + @Autowired + private IGovBizProjectMimplementService mimplementService; + + @Autowired + private IGovBizProjectProcureService procureService; + + @Autowired + private GenerateProjectCodeUtil generateProjectCodeUtil; + + @Autowired + private IProjectService projectService; + + @Test + public void test(){ + List baseinfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)); + + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE)); + + List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + + //查出重复的 重新去生成编号 + List baseProjIds = baseinfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .filter(code -> projectCodes.contains(code)) + .collect(Collectors.toList()); + + for(String baseProjId : baseProjIds){ + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(baseinfo)){ + System.out.println("项目不存在 直接下一个"); + continue; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + applyService.updateById(apply); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } + } + } + + @Test + public void test2(){ + //恢复误删 + String baseProjId = "33110000020220400117"; + + baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId,baseProjId) + .set(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)); + + applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId,baseProjId) + .set(GovBizProjectApply::getDeleted,Boolean.FALSE)); + + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .set(GovBizProjectApprove::getDeleted,Boolean.FALSE)); + + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) + .set(GovBizProjectCimplement::getDeleted,Boolean.FALSE)); + + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) + .set(GovBizProjectMimplement::getDeleted,Boolean.FALSE)); + + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId) + .set(GovBizProjectProcure::getDeleted,Boolean.FALSE)); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java new file mode 100644 index 0000000..c50c3b5 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java @@ -0,0 +1,179 @@ +package com.hz.pm.api.projectCollection; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.RegionConst; +import com.hz.pm.api.gov.contants.BizProjectContant; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.auth.model.UserInfoDetails; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.*; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCollection3Test + * @Description + * @Date 2023/9/7 15:08 + * @Author PoffyZhang + */ +@Slf4j +public class ProjectCollection3Test extends AppTests { + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + + @Autowired + private IGovBizProjectApplyService applyService; + + @Autowired + private IGovBizProjectApproveService approveService; + + @Autowired + private IGovBizProjectCimplementService cimplementService; + + @Autowired + private IGovBizProjectMimplementService mimplementService; + + @Autowired + private IGovBizProjectProcureService procureService; + + @Autowired + private GenerateProjectCodeUtil generateProjectCodeUtil; + + @Autowired + private IProjectService projectService; + + @Test + public void importData() throws Exception { + Workbook wb; + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\恢复清单.xlsx"); + wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + Integer successed = 0; + List failed = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 0; i < rownum; i++) { + row = sheet.getRow(i); + if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ + break; + } + + GovBizProjectBaseinfo baseinfo = new GovBizProjectBaseinfo(); + // + String projName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + log.info("projName :{}",projName); + GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjName, projName) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(base)){ + log.info("没有匹配项目 :{}",projName); + failed.add(projName); + continue; + } + //否则 就去恢复 + String baseProjId = base.getBaseProjId(); + base.setDeleted(Boolean.FALSE); + baseinfoService.updateById(base); + + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(apply)){ + apply.setDeleted(Boolean.FALSE); + applyService.updateById(apply); + } + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setDeleted(Boolean.FALSE); + approveService.updateById(approve); + } + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setDeleted(Boolean.FALSE); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setDeleted(Boolean.FALSE); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + if(CollUtil.isNotEmpty(procures)){ + for(GovBizProjectProcure procure : procures){ + procure.setDeleted(Boolean.FALSE); + procureService.updateById(procure); + } + } + + successed ++; + } + } + + log.info("导入完成 :{}个",successed); + log.info("导入失败 :{}",failed); + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java new file mode 100644 index 0000000..72ef75f --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -0,0 +1,246 @@ +package com.hz.pm.api.projectCollection; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.log.model.domain.OptLog; +import com.ningdatech.log.service.OptLogService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.scheduler.task.SynProjectCollectionTask; +import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.net.UnknownHostException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * @Classname ProjectCollectionTest + * @Description + * @Date 2023/9/7 15:08 + * @Author PoffyZhang + */ +public class ProjectCollectionTest extends AppTests { + + @Autowired + private IGovBizProjectBaseinfoService baseinfoService; + + @Autowired + private IGovBizProjectApplyService applyService; + + @Autowired + private IGovBizProjectApproveService approveService; + + @Autowired + private IGovBizProjectCimplementService cimplementService; + + @Autowired + private IGovBizProjectMimplementService mimplementService; + + @Autowired + private IGovBizProjectProcureService procureService; + + @Autowired + private GenerateProjectCodeUtil generateProjectCodeUtil; + + @Autowired + private SynProjectCollectionTask collectionTask; + + @Autowired + private OptLogService optLogService; + + @Autowired + private SynProjectCoreBizTask projectCoreBizTask; + + @Test + public void test(){ + List baseProjIds = Lists.newArrayList("33118100020200100002"); + for(String baseProjId : baseProjIds){ + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(baseinfo)){ + System.out.println("项目不存在 直接下一个"); + continue; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + applyService.updateById(apply); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } + } + } + + @Test + public void test2() throws UnknownHostException { + collectionTask.doTask(); + } + + @Test + public void test3() throws UnknownHostException { + collectionTask.stagingConvertPdf("33112200020230100008"); + } + + /** + * 去补文件 + */ + @Test + public void test4(){ + List approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getApprovalFile,"null")); + + System.out.println("approves size :" + approves.size()); + + for(GovBizProjectApprove approve : approves){ + //https://sjxmglxt-oss.oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn/20230912/6a5c00def2db41b199d8cc99ff04728e.pdf + String baseProjId = approve.getBaseProjId(); + + List opLogs = optLogService.list(Wrappers.lambdaQuery(OptLog.class) + .like(OptLog::getParams, approve.getBaseProjName()) + .like(OptLog::getParams, "\"approvalFile\"") + .last(BizConst.LIMIT_1)); + if(CollUtil.isEmpty(opLogs)){ + System.out.println("没有这个记录"); + continue; + } + + for(OptLog opLog : opLogs){ + System.out.println(opLog.getParams()); + + if(StringUtils.isNotBlank(opLog.getParams())){ + StringJoiner sj = new StringJoiner(";"); + JSONArray jsonArray = JSON.parseArray(opLog.getParams()); + jsonArray.forEach(j -> { + JSONObject json = JSON.parseObject(JSON.toJSONString(j)); + JSONObject approveJson = json.getJSONObject("approve"); + if(Objects.nonNull(approveJson)){ + String approvalFile = approveJson.getString("approvalFile"); + System.out.println("approvalFile:" + approvalFile); + if(StringUtils.isBlank(approvalFile) || "null".equals(approvalFile)){ + return; + } + sj.add(approvalFile); + } + }); + if(StringUtils.isNotBlank(sj.toString())){ + approve.setApprovalFile(sj.toString()); + approveService.updateById(approve); + break; + } + } + } + } + } + + @Test + public void test5(){ + List list = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .isNotNull(GovBizProjectApply::getBaseProjStartTime) + .isNotNull(GovBizProjectApply::getBaseProjEndTime) + .isNull(GovBizProjectApply::getBaseProjDuration)); + + for(GovBizProjectApply apply : list){ + apply.setBaseProjDuration(convertMonth(apply.getBaseProjStartTime(),apply.getBaseProjEndTime())); + applyService.updateById(apply); + } + } + + public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { + Temporal temporal1 = baseProjStartTime.toLocalDate(); + Temporal temporal2 = baseProjEndTime.toLocalDate(); + // 方法返回为相差月份 + Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); + return ll.toString(); + } + + @Test + public void test6(){ + List list = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getDeleted,Boolean.FALSE)); + + for(GovBizProjectProcure procure : list){ + try{ + String index = procure.getBaseBidCode().split("-")[1]; + procure.setBaseBidCode(procure.getBaseProjId() + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,Integer.parseInt(index))); + procureService.updateById(procure); + }catch (Exception e){ + e.printStackTrace(); + } + } + } + + @Test + public void test7() throws UnknownHostException { + String orgCode = "GO_5f1f6f28a6f7484ea3b9991d8d02599f"; + projectCoreBizTask.doTask(orgCode); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java new file mode 100644 index 0000000..5f1b96b --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java @@ -0,0 +1,188 @@ +package com.hz.pm.api.projectCollection; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.log.model.domain.OptLog; +import com.ningdatech.log.service.OptLogService; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO; +import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; +import com.hz.pm.api.gov.model.entity.*; +import com.hz.pm.api.gov.service.*; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.model.entity.*; +import com.hz.pm.api.projectlib.service.*; +import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; +import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; +import com.hz.pm.api.safety.service.IPersonSafetyInfoService; +import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; +import com.hz.pm.api.scheduler.task.SynProjectCollectionTask; +import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask; +import com.hz.pm.api.staging.model.entity.ProjectStaging; +import com.hz.pm.api.staging.service.IProjectStagingService; +import com.wflow.bean.entity.WflowCcTasks; +import com.wflow.service.WflowCcTasksService; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RuntimeService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCollectionTest + * @Description + * @Date 2023/9/7 15:08 + * @Author PoffyZhang + */ +public class ProjectRemoveTest extends AppTests { + + @Autowired + private IProjectService projectService; + + @Autowired + private IProjectApplicationService applicationService; + + @Autowired + private IProjectInstService projectInstService; + + @Autowired + private IProjectStagingService stagingService; + + @Autowired + private INdProjectStatusChangeService statusChangeService; + + @Autowired + private ISupplierSafetyQualificationService supplierSafetyQualificationService; + + @Autowired + private IPersonSafetyInfoService personService; + + @Autowired + private IOperationService operationService; + + @Autowired + private IPurchaseService purchaseService; + + @Autowired + private IProjectTagService projectTagService; + + @Autowired + private IPreInsAcceptancePersonService preInsAcceptancePersonService; + + @Autowired + private IProjectRenewalFundDeclarationService renewalFundDeclarationService; + + @Autowired + private HistoryService historyService; + + @Autowired + private RuntimeService runtimeService; + + @Autowired + private WflowCcTasksService ccTasksService; + + @Test + public void test(){ + List projectCodes = Lists.newArrayList("33110000020230100078","33110000020230100077"); + + for(String projectCode : projectCodes){ + //项目 + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + + List projectIds = projects.stream().map(Project::getId).collect(Collectors.toList()); + + //1.删除应用 + applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode,projectCode)); + + //2.删除相关流程 + List projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIds)); + for(ProjectInst projectInst : projectInsts){ + //实例 + try{ + runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); + }catch (Exception e){ + + } + try{ + historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); + }catch (Exception e){ + + } + //抄送 + ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) + .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); + } + projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); + + //3.删除实施表 + operationService.remove(Wrappers.lambdaQuery(Operation.class) + .eq(Operation::getProjectCode,projectCode)); + + //4.删除续建项目资金表 + renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); + + //5.暂存表 + stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) + .in(ProjectStaging::getProjectId,projectIds)); + + //6.状态变更表 + statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId,projectIds)); + + //7.采购表 + purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId,projectIds)); + + //8.标签 + projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) + .eq(ProjectTag::getProjectCode,projectCode)); + + //9.初验人员 + preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .in(PreInsAcceptancePerson::getProjectId,projectIds)); + + //10.供应商安全质量 + supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) + .eq(SupplierSafetyQualification::getProjectCode,projectCode)); + + //11.安全人员 + personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) + .eq(PersonSafetyInfo::getProjectCode,projectCode)); + + //12.最后删除项目 + projectService.remove(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, projectCode)); + } + } + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java new file mode 100644 index 0000000..c1893ce --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.redis; + +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.AppTests; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Classname RedisTest + * @Description + * @Date 2023/8/31 17:45 + * @Author PoffyZhang + */ +public class RedisTest extends AppTests { + + @Autowired + private CachePlusOps cachePlusOps; + + @Test + public void test1(){ + Object o = cachePlusOps.get("irs:A331101453557202109017383:Fc3re2cq7r64Qfa7:refresh"); + System.out.println(o.toString()); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java new file mode 100644 index 0000000..5fec50b --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java @@ -0,0 +1,42 @@ +package com.hz.pm.api.refund; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; +import com.hz.pm.api.projectlib.service.IProjectService; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; +import java.util.Objects; + +/** + * @Classname ProjectRefundTest + * @Description + * @Date 2023/9/7 15:08 + * @Author PoffyZhang + */ +public class ProjectRefundTest extends AppTests { + + @Autowired + private IProjectRenewalFundDeclarationService renewalFundDeclarationService; + + @Autowired + private IProjectService projectService; + + @Test + public void test(){ + List funds = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)); + for(ProjectRenewalFundDeclaration fund : funds){ + if(StringUtils.isBlank(fund.getProjectCode())){ + Project project = projectService.getById(fund.getProjectId()); + if(Objects.nonNull(project)){ + fund.setProjectCode(project.getProjectCode()); + renewalFundDeclarationService.updateById(fund); + } + } + } + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/region/RegionTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/region/RegionTest.java new file mode 100644 index 0000000..dfbdaaa --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/region/RegionTest.java @@ -0,0 +1,85 @@ +package com.hz.pm.api.region; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.util.ExpertRegisterUtil; +import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; +import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; +import com.hz.pm.api.expert.controller.ExpertController; +import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; +import com.hz.pm.api.expert.entity.ExpertMetaApply; +import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; +import com.hz.pm.api.expert.service.IExpertMetaApplyService; +import com.hz.pm.api.meta.helper.DictionaryCache; +import com.hz.pm.api.meta.helper.TagCache; +import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.sys.model.entity.Region; +import com.hz.pm.api.sys.service.IRegionService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @Classname RegionTest + * @Description + * @Date 2023/6/8 14:44 + * @Author PoffyZhang + */ +public class RegionTest extends AppTests { + + @Autowired + private IRegionService regionService; + + @Test + public void test() { + Set set = regionService.list().stream().collect(Collectors.toSet()); + + Set ids = set.stream().map(Region::getId).collect(Collectors.toSet()); + + regionService.removeByIds(ids); + + regionService.saveBatch(set); + } + + @Autowired + private RegionCacheHelper regionCacheHelper; + @Autowired + private IDingOrganizationService organizationService; + @Autowired + private DictionaryCache dictionaryCache; + @Autowired + private TagCache tagCache; + @Autowired + private ExpertController expertController; + + @Test + public void test1() { + System.out.println(regionCacheHelper.getByRegionName("浙江省-杭州市-滨江区")); + } + + @Test + public void test2() { + String[] paths = {"/Users/wendy/Desktop/景宁县专家(1).xlsx", + "/Users/wendy/Desktop/专家基础信息归集表(遂昌县).xlsx", + "/Users/wendy/Desktop/专家基础信息归集表-缙云县.xlsx", + "/Users/wendy/Desktop/松阳专家汇总.xlsx", + "/Users/wendy/Desktop/青田县---专家基础信息归集表.xlsx"}; + ExpertRegisterUtil.regionCacheHelper = regionCacheHelper; + ExpertRegisterUtil.tagCache = tagCache; + ExpertRegisterUtil.dictionaryCache = dictionaryCache; + ExpertRegisterUtil.organizationService = organizationService; + ExpertRegisterUtil.expertController = expertController; + for (String path : paths) { + ExpertRegisterUtil.registerExpertBatch(path); + } + } + +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java new file mode 100644 index 0000000..8f60fb6 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.statemachine; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.IProjectService; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 状态机测试 + * + * @author CMM + * @since 2023/02/08 11:46 + */ + +public class StateMachineTest extends AppTests { + @Autowired + private StateMachineUtils stateMachineUtils; + + @Autowired + private IProjectService projectService; + + @Test + public void stateMachineTest() { + Project project = projectService.getById(485); + stateMachineUtils.pass(project); + System.out.println(String.format("project:%s", JSON.toJSONString(project))); + projectService.updateById(project); + } + + @Test + public void yyyyyy(){ + Project project = projectService.getById(400); + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest,Boolean.FALSE) + .ne(Project::getId,project.getId()) + .eq(Project::getProjectCode,project.getProjectCode())); + System.out.println(project); + } +} diff --git a/hz-pm-api/src/test/java/com/ningdatech/pmapi/stream/stream.java b/hz-pm-api/src/test/java/com/ningdatech/pmapi/stream/stream.java new file mode 100644 index 0000000..7ac96f3 --- /dev/null +++ b/hz-pm-api/src/test/java/com/ningdatech/pmapi/stream/stream.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.stream; + +import org.flowable.task.api.history.HistoricTaskInstance; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @Classname stream + * @Description + * @Date 2023/4/3 14:52 + * @Author PoffyZhang + */ +public class stream { + + @Test + public void test(){ + List list = new ArrayList<>(); + list.add(1); + list.add(2); + list.add(2); + list.add(3); + list.add(3); + list.add(1); + list.add(1); + list.add(1); + + Set set = list.stream().collect(Collectors.toSet()); + System.out.println(set); + } + +} diff --git a/pmapi/src/test/resources/application-dev.yml b/hz-pm-api/src/test/resources/application-dev.yml similarity index 100% rename from pmapi/src/test/resources/application-dev.yml rename to hz-pm-api/src/test/resources/application-dev.yml diff --git a/pmapi/src/test/resources/application-pre.yml b/hz-pm-api/src/test/resources/application-pre.yml similarity index 100% rename from pmapi/src/test/resources/application-pre.yml rename to hz-pm-api/src/test/resources/application-pre.yml diff --git a/pmapi/src/test/resources/application-prod.yml b/hz-pm-api/src/test/resources/application-prod.yml similarity index 100% rename from pmapi/src/test/resources/application-prod.yml rename to hz-pm-api/src/test/resources/application-prod.yml diff --git a/pmapi/src/test/resources/application.yml b/hz-pm-api/src/test/resources/application.yml similarity index 100% rename from pmapi/src/test/resources/application.yml rename to hz-pm-api/src/test/resources/application.yml diff --git a/pmapi/src/test/resources/integration/zwdd-dev.yml b/hz-pm-api/src/test/resources/integration/zwdd-dev.yml similarity index 100% rename from pmapi/src/test/resources/integration/zwdd-dev.yml rename to hz-pm-api/src/test/resources/integration/zwdd-dev.yml diff --git a/pmapi/src/test/resources/integration/zwdd-prod.yml b/hz-pm-api/src/test/resources/integration/zwdd-prod.yml similarity index 100% rename from pmapi/src/test/resources/integration/zwdd-prod.yml rename to hz-pm-api/src/test/resources/integration/zwdd-prod.yml diff --git a/pmapi/src/test/resources/logback-spring.xml b/hz-pm-api/src/test/resources/logback-spring.xml similarity index 100% rename from pmapi/src/test/resources/logback-spring.xml rename to hz-pm-api/src/test/resources/logback-spring.xml diff --git a/pmapi/src/test/resources/security/auth-dev.yml b/hz-pm-api/src/test/resources/security/auth-dev.yml similarity index 100% rename from pmapi/src/test/resources/security/auth-dev.yml rename to hz-pm-api/src/test/resources/security/auth-dev.yml diff --git a/pmapi/src/test/resources/security/auth-prod.yml b/hz-pm-api/src/test/resources/security/auth-prod.yml similarity index 100% rename from pmapi/src/test/resources/security/auth-prod.yml rename to hz-pm-api/src/test/resources/security/auth-prod.yml diff --git a/pmapi/src/test/resources/template/simsun.ttc b/hz-pm-api/src/test/resources/template/simsun.ttc similarity index 100% rename from pmapi/src/test/resources/template/simsun.ttc rename to hz-pm-api/src/test/resources/template/simsun.ttc diff --git a/pmapi/src/test/resources/template/预审申请单.html b/hz-pm-api/src/test/resources/template/预审申请单.html similarity index 100% rename from pmapi/src/test/resources/template/预审申请单.html rename to hz-pm-api/src/test/resources/template/预审申请单.html diff --git a/pmapi/src/test/resources/wsdl-prod.xml b/hz-pm-api/src/test/resources/wsdl-prod.xml similarity index 100% rename from pmapi/src/test/resources/wsdl-prod.xml rename to hz-pm-api/src/test/resources/wsdl-prod.xml diff --git a/pmapi/src/test/resources/wsdl.xml b/hz-pm-api/src/test/resources/wsdl.xml similarity index 100% rename from pmapi/src/test/resources/wsdl.xml rename to hz-pm-api/src/test/resources/wsdl.xml diff --git a/hz-pm-gen/pom.xml b/hz-pm-gen/pom.xml new file mode 100644 index 0000000..f7a1d34 --- /dev/null +++ b/hz-pm-gen/pom.xml @@ -0,0 +1,43 @@ + + + + hz-project-management + com.hz.pm + 1.0.0 + + 4.0.0 + + hz-pm-gen + + + + com.baomidou + mybatis-plus-boot-starter + + + com.baomidou + mybatis-plus-generator + 3.5.3.2 + + + org.freemarker + freemarker + + + + com.kingbase8 + kingbase8-8.2.0 + system + ${project.basedir}/lib/kingbase8-8.2.0.jar + + + + com.kingbase.dialect + kingbase8-8.2.0 + system + ${project.basedir}/lib/kingbase8-8.2.0.jar + + + diff --git a/hz-pm-gen/src/main/java/com/hz/pm/gen/config/GeneratorCodeKingbaseConfig.java b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/GeneratorCodeKingbaseConfig.java new file mode 100644 index 0000000..596df78 --- /dev/null +++ b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/GeneratorCodeKingbaseConfig.java @@ -0,0 +1,63 @@ +package com.hz.pm.gen.config; + +import com.baomidou.mybatisplus.generator.FastAutoGenerator; +import com.baomidou.mybatisplus.generator.config.OutputFile; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; + +import java.util.Collections; + +/** + * @description: 自动生成code代码 + * @author: zpf + * @date: 2023/01/03 09:20 + */ +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/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"; + + private static final String URL = "jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; + private static final String USER_NAME = "SYSTEM"; + private static final String PASSWORD = "Ndkj1234"; + + private static void generate(String author, String packageName, String path, String... tableNames) { + FastAutoGenerator.create(URL, USER_NAME, PASSWORD) + .globalConfig(builder -> { + // 设置作者 + builder.author(author) + // 开启 swagger 模式 + .enableSwagger() + // 覆盖已生成文件 + .fileOverride() + // 指定输出目录 + .outputDir(path); + }) + .packageConfig(builder -> { + // 设置父包名 + builder.parent("com.ningdatech") + // 设置父包模块名 + .moduleName("pmapi." + packageName) + // 设置mapperXml生成路径 + .pathInfo(Collections.singletonMap(OutputFile.xml, + //设置自己的生成路径 + path + "/com/ningdatech/pmapi/" + packageName + "/mapper")); + }) + .strategyConfig(builder -> { + builder.addTablePrefix(""); + // 设置需要生成的表名 + builder.addInclude(tableNames); + }) + // 使用Freemarker引擎模板,默认的是Velocity引擎模板 + .templateEngine(new FreemarkerTemplateEngine()) + .execute(); + } + + public static void main(String[] args) { + //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); + generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_score_info"); + } + +} diff --git a/hz-pm-sync/pom.xml b/hz-pm-sync/pom.xml new file mode 100644 index 0000000..0b9931b --- /dev/null +++ b/hz-pm-sync/pom.xml @@ -0,0 +1,198 @@ + + + + hz-project-management + com.hz.pm + 1.0.0 + + 4.0.0 + + hz-pm-sync + + + 8 + 8 + + + + + com.google.guava + guava + + + cn.hutool + hutool-all + 5.8.5 + + + + mysql + mysql-connector-java + + + + org.projectlombok + lombok + + + + com.baomidou + mybatis-plus-boot-starter + + + org.apache.commons + commons-lang3 + + + com.alibaba + fastjson + + + org.apache.tomcat.embed + tomcat-embed-core + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.springframework.boot + spring-boot-devtools + true + true + + + org.springframework.boot + spring-boot-starter-aop + + + com.ningdatech + nd-swagger2-starter + + + org.slf4j + slf4j-log4j12 + + + + + com.ningdatech + nd-basic + + + org.slf4j + slf4j-log4j12 + + + spring-boot-starter-security + org.springframework.boot + + + spring-security-config + org.springframework.security + + + spring-security-web + org.springframework.security + + + spring-security-core + org.springframework.security + + + com.baomidou + mybatis-plus-boot-starter + + + + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + + + + + + dev + + + dev + + + + test + + test + + + + pre + + pre + + + + prod + + prod + + + + + + + + src/main/resources + + **/* + + + + src/main/java + + **/*.xml + + + + src/main/lib + BOOT-INF/lib/ + + **/*.jar + + + + src/main/resources + BOOT-INF/classes/ + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.8 + + true + + + + + repackage + + + + + + + \ No newline at end of file diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java new file mode 100644 index 0000000..65344c7 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java @@ -0,0 +1,34 @@ +package com.hz.pm.sync; + + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + *

+ * SynDataTaskApp + *

+ * + * @author WendyYang + * @since 10:44 2023/12/12 + */ +@SpringBootApplication +@EnableAsync +@MapperScan(SynDataTaskApp.MAPPER_PACKAGES) +@EnableScheduling +@EnableTransactionManagement +@EnableAspectJAutoProxy(exposeProxy = true) +public class SynDataTaskApp { + + protected static final String MAPPER_PACKAGES = "com.hz.pm.sync.**.mapper"; + + public static void main(String[] args) { + SpringApplication.run(SynDataTaskApp.class, args); + } +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java new file mode 100644 index 0000000..ed2f2dc --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java @@ -0,0 +1,106 @@ +package com.hz.pm.sync.common.constant; + +import com.ningdatech.basic.model.ApiResponse; + +import java.math.BigDecimal; + +/** + *

+ * 业务常量 + *

+ * + * @author WendyYang + * @since 13:42 2022/12/1 + */ +public interface BizConst { + + /** + * SQL查询一条 + */ + String LIMIT_1 = "limit 1"; + + String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; + + /** + * 一小时秒数 + **/ + BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); + + /** + * 十分钟的毫秒数 + */ + long MILLS_10_MIN = 1000L * 60 * 10; + + /** + * 中国行政区划编码 + */ + long ROOT_REGION_CODE = 100000L; + + /** + * 一级行政区划数量 + */ + int NUM_PROVINCE = 34; + + /** + * 默认的父id + */ + long PARENT_ID = 0L; + + /** + * 默认树层级 + */ + int TREE_GRADE = 0; + + /** + * 默认的排序 + */ + int SORT_VALUE = 0; + + /** + * 浙江省的region_id + */ + long ZJ_REGION_CODE = 330000L; + String NINE_AREA_CODE_LAST = "000"; + + /** + * 省/直辖市 level + */ + int GOV_L1 = 1; + + /** + * 市 level + */ + int GOV_L2 = 2; + + /** + * 区/县 level + */ + int GOV_L3 = 3; + + /** + * 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 + */ + String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; + + ApiResponse UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); + + int MAX_EXPORT_COUNT = 5000; + + String RESPONSE_KEY_DATA = "data"; + String ORG_NAME = "organizationName"; + String ORG_CODE = "organizationCode"; + + String DEV = "dev"; + String PRE = "pre"; + String PROD = "prod"; + + String SAVE_SUCCESS = "保存成功"; + String OP_SUCCESS = "操作成功"; + String SAVE_FAIL = "保存失败"; + String NOT_EFFECTIVE = "1"; + + String OP_INSERT = "insert"; + String OP_UPDATE = "update"; + String OP_DELETE = "delete"; + String OP_FAIL = "操作失败"; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java new file mode 100644 index 0000000..d7f2745 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java @@ -0,0 +1,85 @@ +package com.hz.pm.sync.common.utils; + +import org.apache.commons.codec.binary.Hex; + +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * 加密工具 + * @author hank + */ +public class CryptUtils { + + /** + * 默认的算法 + */ + private static final String DE_KEY_MAC = "HmacMD5"; + + /** + * 默认的字符集 + */ + private static final Charset DE_CHARSET = StandardCharsets.UTF_8; + + + /** + * 使用默认的算法(HmacMD5) 得到hmac 16进制字符串 + * @param inputStr 需要加密的串 + * @param key key + * @return 16进制字符串 + * @throws Exception + */ + public static String encryptHMAC(String inputStr, String key) throws Exception { + return encryptHMAC(inputStr, key, DE_KEY_MAC); + } + /** + * 使用指定的算法得到hmac 16进制字符串 + * @param inputStr 需要加密的串 + * @param key key + * @param keyMac hmac算法 + * @return 16进制字符串 + * @throws Exception + */ + public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception { + return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac)); + } + + public static String MD5Encode(String origin) throws NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET))); + } + + private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception { + + SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac); + Mac mac = Mac.getInstance(secretKey.getAlgorithm()); + mac.init(secretKey); + return mac.doFinal(data); + } + + /** + * 生成HMAC-MD5值 + * @param data 消息数据 + * @param key 密钥 + * @return HMAC-MD5值 + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + */ + public static byte[] hmacMd5(byte[] data, byte[] key) + throws NoSuchAlgorithmException, InvalidKeyException { + SecretKeySpec signingKey = new SecretKeySpec(key, "HmacMD5"); + Mac mac = Mac.getInstance("HmacMD5"); + mac.init(signingKey); + return mac.doFinal(data); + } + + public static void main(String[] args) throws Exception{ + System.out.println("HMACStr:\n" + encryptHMAC("a", "hank")); + } +} \ No newline at end of file diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java new file mode 100644 index 0000000..d15a267 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java @@ -0,0 +1,55 @@ +package com.hz.pm.sync.open.controller; + +import com.hz.pm.sync.open.manage.IrsManage; +import com.hz.pm.sync.open.manage.ProjectReceiveManage; +import com.hz.pm.sync.scheduler.model.dto.ForwardDTO; +import com.hz.pm.sync.scheduler.model.dto.ProjectBaseInfoDTO; +import com.hz.pm.sync.scheduler.model.dto.ProjectSaveDTO; +import com.ningdatech.basic.model.ApiResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * @Classname ProjectCollectionController + * @Description + * @Date 2023/6/25 9:11 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "项目归集控制器") +@RequestMapping("/open/api/v1/project-receive") +public class ProjectReceiveController { + + private final ProjectReceiveManage receiveManage; + + private final IrsManage irsManage; + + @PostMapping("/save") + @ApiOperation("项目归集接收") + public ApiResponse save(@Valid @RequestBody ProjectSaveDTO dto) { + return ApiResponse.ofSuccess(receiveManage.save(dto)); + } + + @PostMapping("/not-effective") + @ApiOperation("项目归集置为无效") + public ApiResponse notEffective(@Valid @RequestBody ProjectBaseInfoDTO baseinfo) { + return ApiResponse.ofSuccess(receiveManage.notEffective(baseinfo)); + } + + @PostMapping("/delete-all") + @ApiOperation("清空当前表数据") + public ApiResponse deleteAll() { + return ApiResponse.ofSuccess(receiveManage.deleteAll()); + } + + @ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于") + @PostMapping("/forward") + public String forward(@Valid @RequestBody ForwardDTO dto) { + return irsManage.forward(dto); + } +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java new file mode 100644 index 0000000..be78df5 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java @@ -0,0 +1,59 @@ +package com.hz.pm.sync.open.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * GovProjectStatusEnum + * + * @return + * @author ZPF + * @since 2023/10/24 16:27 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum GovProjectStatusEnum { + /** + * 项目归集 状态 + */ + APPROVAL("01", "评审中"), + PENDING("02", "待立项"), + REJECTED("03","已驳回"), + APPROVED("04","已立项"), + PURCHASED("05","已采购"), + HAS_PRE_INS("06","已初验"), + HAS_FINAL_INS("07","已终验"), + TERMINATED("00","已终止"); + + private String code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static GovProjectStatusEnum match(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java new file mode 100644 index 0000000..9f75bec --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java @@ -0,0 +1,56 @@ +package com.hz.pm.sync.open.manage; + +import com.google.common.base.Joiner; +import com.hz.pm.sync.scheduler.model.dto.ForwardDTO; +import com.hz.pm.sync.common.constant.BizConst; +import com.hz.pm.sync.common.utils.CryptUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * @Classname IrsManage + * @Description + * @Date 2023/9/1 15:15 + * @Author PoffyZhang + */ +@Component +@Slf4j +public class IrsManage { + + + /** + * 转发IRS请求 + * @param dto + * @return + */ + public String forward(ForwardDTO dto) { + try{ + String url = dto.getUrl(); + String appkey = dto.getAppKey(); + long timestamp = System.currentTimeMillis(); + String requestSecret = dto.getSecret(); + String sign = CryptUtils.MD5Encode(appkey + requestSecret + timestamp); + url = url + "?requestTime=" + timestamp + "&sign=" + sign + "&" + asUrlParams(dto.getData()); + log.info("url :{}",url); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + }catch (Exception e){ + log.error("e:" + e); + } + return BizConst.OP_FAIL; + } + + public static String asUrlParams(Map source){ + return Joiner.on("&") + // 用指定符号代替空值,key 或者value 为null都会被替换 + .useForNull("") + .withKeyValueSeparator("=") + .join(source); + } +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java new file mode 100644 index 0000000..4c19254 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java @@ -0,0 +1,314 @@ +package com.hz.pm.sync.open.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.sync.scheduler.model.dto.ProjectBaseInfoDTO; +import com.hz.pm.sync.scheduler.model.dto.ProjectSaveDTO; +import com.hz.pm.sync.scheduler.model.entity.*; +import com.hz.pm.sync.scheduler.service.*; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.StrPool; +import com.hz.pm.sync.common.constant.BizConst; +import com.hz.pm.sync.open.enumeration.GovProjectStatusEnum; +import com.ningdatech.syndataapi.scheduler.model.entity.*; +import com.ningdatech.syndataapi.scheduler.service.*; +import lombok.RequiredArgsConstructor; +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; + +/** + * @Classname ProjectReceiveManage + * @Description + * @Date 2023/8/25 9:11 + * @Author PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ProjectReceiveManage { + + private final IProjectBaseInfoService baseInfoService; + + private final IProjectApplyService applyService; + + private final IProjectApproveService approveService; + + private final IProjectCimplementService cimplementService; + + private final IProjectMimplementService mimplementService; + + private final IProjectProcureService procureService; + + /** + * 接收保存 项目 + * @param dto + * @return + */ + public String save(ProjectSaveDTO dto) { + + //1.保存项目基本信息 + ProjectBaseInfo baseInfo = dto.getBaseinfo(); + String baseProjId = baseInfo.getBaseProjId(); + VUtils.isTrue(StringUtils.isBlank(baseProjId)) + .throwMessage("项目编号不能为空!"); + + ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) + .eq(ProjectBaseInfo::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class); + + //项目状态 + String baseProjSetProg = saveBase.getBaseProjSetProg(); + if(StringUtils.isBlank(baseProjSetProg)){ + return "无状态不保存"; + } + //评审中 基本信息和申报信息 + GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg); + if(Objects.isNull(match)){ + return "状态不对 不保存"; + } + switch (match){ + case APPROVAL: + log.info("评审中状态 保存基本信息和申报信息 :{}",baseProjId); + saveBase(oldBaseInfo,saveBase,baseInfo); + saveApply(dto, baseProjId); + break; + case PENDING: + case APPROVED: + log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}",baseProjId); + saveBase(oldBaseInfo,saveBase,baseInfo); + saveApply(dto, baseProjId); + saveApprove(dto, baseProjId); + break; + case PURCHASED: + log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}",baseProjId); + saveBase(oldBaseInfo,saveBase,baseInfo); + saveApply(dto, baseProjId); + saveApprove(dto, baseProjId); + saveProcure(dto, baseProjId); + break; + case HAS_PRE_INS: + case HAS_FINAL_INS: + case TERMINATED: + log.info("初验 终验状态 终止 保存所有信息 :{}",baseProjId); + saveBase(oldBaseInfo,saveBase,baseInfo); + saveApply(dto, baseProjId); + saveApprove(dto, baseProjId); + saveProcure(dto, baseProjId); + saveCimplementOrMimplement(dto, baseProjId); + break; + case REJECTED: + log.info("驳回终止状态 啥都不保存 :{}",baseProjId); + break; + default: + log.info("没有匹配任何状态 保存失败 :{}",baseProjId); + } + + return BizConst.SAVE_SUCCESS; + } + + private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) { + // 4.保存 建设项目 实施信息 + ProjectCimplement cimplement = dto.getCimplement(); + if(Objects.nonNull(cimplement)){ + ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) + .eq(ProjectCimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,ProjectCimplement.class); + saveCimplement.setBaseProjId(baseProjId); + if(Objects.isNull(oldCimplement)){ + //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update + if(StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())){ + saveCimplement.setOp(BizConst.OP_UPDATE); + }else{ + saveCimplement.setOp(BizConst.OP_INSERT); + } + saveCimplement.setTongTime(LocalDateTime.now()); + }else{ + saveCimplement.setOp(BizConst.OP_INSERT); + saveCimplement.setTongID(oldCimplement.getTongID()); + saveCimplement.setTongTime(LocalDateTime.now()); + } + saveCimplement.setBizTime(LocalDateTime.now()); + cimplementService.saveOrUpdate(saveCimplement); + } + + // 5.保存 运维项目 实施信息 + ProjectMimplement mimplement = dto.getMimplement(); + if(Objects.nonNull(mimplement)){ + ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) + .eq(ProjectMimplement::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,ProjectMimplement.class); + saveMimplement.setBaseProjId(baseProjId); + if(Objects.isNull(oldMimplement)){ + //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update + if(StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())){ + saveMimplement.setOp(BizConst.OP_UPDATE); + }else{ + saveMimplement.setOp(BizConst.OP_INSERT); + } + saveMimplement.setTongTime(LocalDateTime.now()); + }else{ + saveMimplement.setOp(BizConst.OP_INSERT); + saveMimplement.setTongID(oldMimplement.getTongID()); + saveMimplement.setTongTime(LocalDateTime.now()); + } + saveMimplement.setBizTime(LocalDateTime.now()); + mimplementService.saveOrUpdate(saveMimplement); + } + } + + private void saveProcure(ProjectSaveDTO dto, String baseProjId) { + // 6.保存 采购信息 + List procures = dto.getProcures(); + if(Objects.nonNull(procures)){ + List olds = procureService.list(Wrappers.lambdaQuery(ProjectProcure.class) + .eq(ProjectProcure::getBaseProjId, baseProjId) + .orderByAsc(ProjectProcure::getBaseBidCode)); + Integer index = 0; + for(ProjectProcure old : olds){ + if(StringUtils.isNotBlank(old.getBaseBidCode())){ + try{ + String bidCode = old.getBaseBidCode().split(StrPool.DASH)[1]; + index = Integer.parseInt(bidCode); + }catch (Exception e){} + } + //删除标记 + old.setOp(BizConst.OP_DELETE); + procureService.updateById(old); + } + index ++; + for(ProjectProcure procure : procures){ + //添加标记 + ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); + saveProcure.setBaseProjId(baseProjId); + saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); + saveProcure.setTongID(null); + saveProcure.setTongTime(LocalDateTime.now()); + saveProcure.setBizTime(LocalDateTime.now()); + saveProcure.setOp(BizConst.OP_INSERT); + procureService.save(saveProcure); + index ++; + } + } + } + + private void saveApprove(ProjectSaveDTO dto, String baseProjId) { + // 3.保存 审批信息 + ProjectApprove approve = dto.getApprove(); + + ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class) + .eq(ProjectApprove::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class); + saveApprove.setBaseProjId(baseProjId); + if(Objects.isNull(oldApprove)){ + //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update + if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){ + saveApprove.setOp(BizConst.OP_UPDATE); + }else{ + saveApprove.setOp(BizConst.OP_INSERT); + } + saveApprove.setTongTime(LocalDateTime.now()); + }else{ + saveApprove.setOp(BizConst.OP_INSERT); + saveApprove.setTongID(oldApprove.getTongID()); + saveApprove.setTongTime(LocalDateTime.now()); + } + saveApprove.setBizTime(LocalDateTime.now()); + approveService.saveOrUpdate(saveApprove); + } + + private void saveApply(ProjectSaveDTO dto, String baseProjId) { + // 2.保存 申报信息 + ProjectApply apply = dto.getApply(); + + ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class) + .eq(ProjectApply::getBaseProjId, baseProjId) + .last(BizConst.LIMIT_1)); + + ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class); + saveApply.setBaseProjId(baseProjId); + if(Objects.isNull(oldApply)){ + //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update + if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){ + saveApply.setOp(BizConst.OP_UPDATE); + }else{ + saveApply.setOp(BizConst.OP_INSERT); + } + saveApply.setTongTime(LocalDateTime.now()); + }else{ + saveApply.setOp(BizConst.OP_INSERT); + saveApply.setTongID(oldApply.getTongID()); + saveApply.setTongTime(LocalDateTime.now()); + } + + saveApply.setBizTime(LocalDateTime.now()); + applyService.saveOrUpdate(saveApply); + } + + //保存基本信息 + private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase,ProjectBaseInfo baseInfo) { + if(Objects.isNull(oldBaseInfo)){ + //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update + if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){ + saveBase.setOp(BizConst.OP_UPDATE); + }else{ + saveBase.setOp(BizConst.OP_INSERT); + } + saveBase.setTongTime(LocalDateTime.now()); + }else { + saveBase.setOp(BizConst.OP_INSERT); + saveBase.setTongID(oldBaseInfo.getTongID()); + saveBase.setTongTime(LocalDateTime.now()); + } + saveBase.setBizTime(LocalDateTime.now()); + baseInfoService.saveOrUpdate(saveBase); + } + + /** + * 置为无效 + * @param dto + * @return + */ + public String notEffective(ProjectBaseInfoDTO dto) { + ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) + .eq(ProjectBaseInfo::getBaseProjId, dto.getBaseProjId()) + .last(BizConst.LIMIT_1)); + + ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto,ProjectBaseInfo.class); + saveBaseinfo.setIsEffective(BizConst.NOT_EFFECTIVE); + if(Objects.isNull(oldBaseInfo)){ + saveBaseinfo.setTongTime(LocalDateTime.now()); + } + saveBaseinfo.setBizTime(LocalDateTime.now()); + saveBaseinfo.setOp(BizConst.OP_UPDATE); + baseInfoService.saveOrUpdate(saveBaseinfo); + + return BizConst.OP_SUCCESS; + } + + /** + * 删除表里的所有数据 + * @return + */ + public String deleteAll() { + baseInfoService.remove(Wrappers.lambdaQuery(ProjectBaseInfo.class)); + applyService.remove(Wrappers.lambdaQuery(ProjectApply.class)); + approveService.remove(Wrappers.lambdaQuery(ProjectApprove.class)); + cimplementService.remove(Wrappers.lambdaQuery(ProjectCimplement.class)); + mimplementService.remove(Wrappers.lambdaQuery(ProjectMimplement.class)); + procureService.remove(Wrappers.lambdaQuery(ProjectProcure.class)); + log.info("删除所有前置表数据成功"); + return BizConst.OP_SUCCESS; + } +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java new file mode 100644 index 0000000..5cb3e9a --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.hz.pm.sync.scheduler.model.entity.ProjectApply; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 项目申报信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectApplyMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml new file mode 100644 index 0000000..13197ca --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java new file mode 100644 index 0000000..a0dbf57 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; + +/** + *

+ * 项目立项评审信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectApproveMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml new file mode 100644 index 0000000..0ba621e --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java new file mode 100644 index 0000000..d9f414b --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; + +/** + *

+ * 项目基本信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectBaseInfoMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml new file mode 100644 index 0000000..9d77aff --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java new file mode 100644 index 0000000..ebd3d1b --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; + +/** + *

+ * 建设项目实施信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectCimplementMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml new file mode 100644 index 0000000..4015338 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java new file mode 100644 index 0000000..bdeb37c --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; + +/** + *

+ * 运维项目实施信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectMimplementMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml new file mode 100644 index 0000000..1e96c07 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java new file mode 100644 index 0000000..d9e4792 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; + +/** + *

+ * 项目采购信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface ProjectProcureMapper extends BaseMapper { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml new file mode 100644 index 0000000..b0ed754 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java new file mode 100644 index 0000000..fee47b6 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java @@ -0,0 +1,26 @@ +package com.hz.pm.sync.scheduler.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Classname ForwardDTO + * @Description + * @Date 2023/7/13 18:03 + * @Author PoffyZhang + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ForwardDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String url; + private String secret; + private String appKey; + private Map data; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java new file mode 100644 index 0000000..bcb3a46 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java @@ -0,0 +1,103 @@ +package com.hz.pm.sync.scheduler.model.dto; + +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 javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 项目基本信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") +public class ProjectBaseInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + @NotBlank(message = "项目编号不能为空") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("所属区划") + private String baseAreaName; + + @ApiModelProperty("所属区划编码") + private String baseAreaCode; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位浙政钉ID") + private String baseProvManDeprtDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位浙政钉ID") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位统一社会信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位(申报单位)") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位浙政钉ID") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位统一社会信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人手机号") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java new file mode 100644 index 0000000..603cf1c --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java @@ -0,0 +1,35 @@ +package com.hz.pm.sync.scheduler.model.dto; + +import com.hz.pm.sync.scheduler.model.entity.*; +import com.ningdatech.syndataapi.scheduler.model.entity.*; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Classname ProjectSaveDTO + * @Description + * @Date 2023/8/25 9:45 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "SProjectSaveDTO", description = "项目保存") +public class ProjectSaveDTO { + + @NotNull(message = "项目基本信息不能为空") + private ProjectBaseInfo baseinfo; + + @NotNull(message = "项目申报信息不能为空") + private ProjectApply apply; + + @NotNull(message = "项目审批信息不能为空") + private ProjectApprove approve; + + private ProjectCimplement cimplement; + + private ProjectMimplement mimplement; + + private List procures; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java new file mode 100644 index 0000000..63ad0f2 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java @@ -0,0 +1,138 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目申报信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_apply") +@ApiModel(value = "SzlsDaBiz331100ProjectApply对象", description = "项目申报信息") +public class ProjectApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("历年项目名称") + private String baseHistorProjName; + + @ApiModelProperty("历年项目代码") + private String baseHistorProjId; + + @ApiModelProperty("关联IRS应用名称") + private String baseProjSys; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("一本账重大应用名称") + private String baseAccountAppName; + + @ApiModelProperty("“领域大脑”一本账名称") + private String baseBrainName; + + @ApiModelProperty("单位核心业务名称") + private String baseCoreBusiness; + + @ApiModelProperty("单位核心业务编码") + private String baseCoreBusinessCode; + + @ApiModelProperty("项目起始时间") + private String baseProjStartTime; + + @ApiModelProperty("项目终止时间") + private String baseProjEndTime; + + @ApiModelProperty("项目期限") + private String baseProjDuration; + + @ApiModelProperty("预算年度") + private String baseProjSetYear; + + @ApiModelProperty("预算来源") + private String baseProjAmountOri; + + @ApiModelProperty("预算来源说明") + private String baseBasisAmountOri; + + @ApiModelProperty("项目总投资") + private String baseProjTotalAmount; + + @ApiModelProperty("申报年度预算") + private String baseProjDeclAmount; + + @ApiModelProperty("建设层级") + private String baseProjConsClass; + + @ApiModelProperty("贯通层级") + private String baseLowestLevel; + + @ApiModelProperty("立项依据") + private String baseProjBasis; + + @ApiModelProperty("立项依据说明") + private String baseBasisEstablish; + + @ApiModelProperty("立项依据证明材料") + private String baseProjBasisFile; + + @ApiModelProperty("项目概述") + private String baseProjIntro; + + @ApiModelProperty("项目内容与预期成效") + private String beseExpectedResults; + + @ApiModelProperty("可行性研究报告") + private String baseResearchReportFile; + + @ApiModelProperty("项目申报书") + private String baseProjApplyFile; + + @ApiModelProperty("运维方案") + private String baseOperatMaintenFile; + + @ApiModelProperty("其他附件") + private String baseProjOtherFile; + + @ApiModelProperty("备注") + private String baseProjRemark; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java new file mode 100644 index 0000000..1a7e3db --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java @@ -0,0 +1,90 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目立项评审信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_approve") +@ApiModel(value = "SzlsDaBiz331100ProjectApprove对象", description = "项目立项评审信息") +public class ProjectApprove implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("评审结果") + private String baseReviewResults; + + @ApiModelProperty("评审意见") + private String baseReviewOpinion; + + @ApiModelProperty("评审意见附件") + private String baseReviewCommentsFile; + + @ApiModelProperty("建议总投资") + private String baseExpertTotalMoney; + + @ApiModelProperty("建议年度预算") + private String baseExpertYearMoney; + + @ApiModelProperty("立项批复文件") + private String approvalFile; + + @ApiModelProperty("建议批复总投资") + private String baseInitialReviewTotalMoney; + + @ApiModelProperty("建议批复年度预算") + private String baseProjReplyAmount; + + @ApiModelProperty("等保定级") + private String equalProtectionLevel; + + @ApiModelProperty("初步设计方案") + private String preliminaryDesignScheme; + + @ApiModelProperty("初步设计方案批复函") + private String preliminaryDesignFile; + + @ApiModelProperty("年度预算下达金额") + private String releaseYearMoney; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java new file mode 100644 index 0000000..5a9df05 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java @@ -0,0 +1,105 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目基本信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_baseinfo") +@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") +public class ProjectBaseInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("所属区划") + private String baseAreaName; + + @ApiModelProperty("所属区划编码") + private String baseAreaCode; + + @ApiModelProperty("是否涉密") + private String baseProjIsConfidentiality; + + @ApiModelProperty("项目类型") + private String baseProjType; + + @ApiModelProperty("内容类别") + private String baseConstructionType; + + @ApiModelProperty("项目状态") + private String baseProjSetProg; + + @ApiModelProperty("信息是否有效") + private String isEffective; + + @ApiModelProperty("上级主管单位") + private String baseProvManDeprt; + + @ApiModelProperty("上级主管单位浙政钉ID") + private String baseProvManDeprtDing; + + @ApiModelProperty("本级主管单位") + private String baseManDeprt; + + @ApiModelProperty("本级主管单位浙政钉ID") + private String baseManDeprtDing; + + @ApiModelProperty("本级主管单位统一社会信用代码") + private String baseManDepartUsci; + + @ApiModelProperty("建设单位(申报单位)") + private String baseBuildDeprt; + + @ApiModelProperty("建设单位浙政钉ID") + private String baseBuildDeprtDing; + + @ApiModelProperty("建设单位统一社会信用代码") + private String baseBuildDepartUsci; + + @ApiModelProperty("项目负责人") + private String baseProjPrincipal; + + @ApiModelProperty("项目负责人手机号") + private String baseProjPrincipalCall; + + @ApiModelProperty("项目联系人") + private String baseProjContacts; + + @ApiModelProperty("项目联系人手机号") + private String baseProjContactsCall; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java new file mode 100644 index 0000000..b626085 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java @@ -0,0 +1,108 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 建设项目实施信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_cimplement") +@ApiModel(value = "SzlsDaBiz331100ProjectCimplement对象", description = "建设项目实施信息") +public class ProjectCimplement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("初验意见") + private String baseInitialOpinionFile; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("商业密码应用评估报告") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("建设核查表") + private String baseCheckFile; + + @ApiModelProperty("财务审计报告") + private String baseFinanlAuditFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("IRS应用试运行报告") + private String baseIrsTestRunFile; + + @ApiModelProperty("项目总结报告") + private String baseSummReportFile; + + @ApiModelProperty("是否完成日志数据归集") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终验意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更申请单") + private String baseChangeFormFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java new file mode 100644 index 0000000..607898f --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java @@ -0,0 +1,96 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 运维项目实施信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_mimplement") +@ApiModel(value = "SzlsDaBiz331100ProjectMimplement对象", description = "运维项目实施信息") +public class ProjectMimplement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("发改项目代码") + private String baseDevelopCode; + + @ApiModelProperty("关联IRS应用编码") + private String baseProjSysCode; + + @ApiModelProperty("信息安全等级保护测评报告") + private String baseInforLevelFile; + + @ApiModelProperty("商业密码应用评估报告") + private String basePasswAssessFile; + + @ApiModelProperty("第三方验收测试报告") + private String baseThirdAcceptFile; + + @ApiModelProperty("用户使用报告") + private String baseUserConsFile; + + @ApiModelProperty("监理总结报告") + private String baseEstaSummFile; + + @ApiModelProperty("运维总结报告") + private String baseOperatMaintenSummFile; + + @ApiModelProperty("是否完成日志数据归集") + private String baseLogAggregation; + + @ApiModelProperty("实际成效指标") + private String baseBusinessMetrics; + + @ApiModelProperty("终验意见") + private String baseFinalExpertOpinionFile; + + @ApiModelProperty("项目延期申请表") + private String baseEngineerPostpoFile; + + @ApiModelProperty("变更报告") + private String baseEngineerAlterFile; + + @ApiModelProperty("变更批复文件") + private String baseChanFile; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java new file mode 100644 index 0000000..4af08b2 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java @@ -0,0 +1,96 @@ +package com.hz.pm.sync.scheduler.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 项目采购信息 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Data +@TableName("szls_da_biz_331100_project_procure") +@ApiModel(value = "SzlsDaBiz331100ProjectProcure对象", description = "项目采购信息") +public class ProjectProcure implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标段代码") + private String baseBidCode; + + @ApiModelProperty("标段名称") + private String baseBidName; + + @ApiModelProperty("项目代码") + private String baseProjId; + + @ApiModelProperty("项目名称") + private String baseProjName; + + @ApiModelProperty("财政项目代码") + private String setProjCodeFinan; + + @ApiModelProperty("采购方式") + private String baseProjPurchaseWay; + + @ApiModelProperty("预算执行确认书编号") + private String basePurchaseCode; + + @ApiModelProperty("招标(采购)文件") + private String purchaseFile; + + @ApiModelProperty("采购代理机构") + private String basePurchasingAgencies; + + @ApiModelProperty("采购代理机构统一社会信用代码") + private String baseUnifiedCreditCode; + + @ApiModelProperty("中标(成交)时间") + private String baseWinningBidTime; + + @ApiModelProperty("中标(成交)金额") + private String baseProjPurchaseAmount; + + @ApiModelProperty("中标(成交)通知书") + private String biddingFile; + + @ApiModelProperty("中标(成交)供应商名称") + private String baseConsDeprt; + + @ApiModelProperty("中标(成交)供应商统一社会信用代码") + private String baseConsDeprtUsci; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("项目款支付时间") + private String basePaymentTime; + + @ApiModelProperty("项目款支付金额") + private String paymentProgress; + + @ApiModelProperty("数据来源") + private String areaCode; + + @ApiModelProperty("出生产库时间") + private LocalDateTime bizTime; + + @ApiModelProperty("操作标记") + private String op; + + @ApiModelProperty("数据入库时间") + private LocalDateTime tongTime; + + @ApiModelProperty("发送端自增列") + @TableId(value = "tongID", type = IdType.AUTO) + private Integer tongID; +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java new file mode 100644 index 0000000..5fead1c --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.hz.pm.sync.scheduler.model.entity.ProjectApply; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 项目申报信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectApplyService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java new file mode 100644 index 0000000..59ef487 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; + +/** + *

+ * 项目立项评审信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectApproveService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java new file mode 100644 index 0000000..7ae12ef --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; + +/** + *

+ * 项目基本信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectBaseInfoService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java new file mode 100644 index 0000000..bdc0f5e --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; + +/** + *

+ * 建设项目实施信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectCimplementService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java new file mode 100644 index 0000000..75b3eb0 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; + +/** + *

+ * 运维项目实施信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectMimplementService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java new file mode 100644 index 0000000..ef0fdcc --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java @@ -0,0 +1,16 @@ +package com.hz.pm.sync.scheduler.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; + +/** + *

+ * 项目采购信息 服务类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +public interface IProjectProcureService extends IService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java new file mode 100644 index 0000000..1ee3a38 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.mapper.ProjectCimplementMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; +import com.hz.pm.sync.scheduler.service.IProjectCimplementService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + *

+ * 建设项目实施信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class IProjectCimplementServiceImpl extends ServiceImpl implements IProjectCimplementService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java new file mode 100644 index 0000000..2cf1a89 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.mapper.ProjectApplyMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectApply; +import com.hz.pm.sync.scheduler.service.IProjectApplyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 项目申报信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class ProjectApplyServiceImpl extends ServiceImpl implements IProjectApplyService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java new file mode 100644 index 0000000..2ae0e27 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.mapper.ProjectApproveMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; +import com.hz.pm.sync.scheduler.service.IProjectApproveService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + *

+ * 项目立项评审信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class ProjectApproveServiceImpl extends ServiceImpl implements IProjectApproveService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java new file mode 100644 index 0000000..3efac91 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.mapper.ProjectBaseInfoMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; +import com.hz.pm.sync.scheduler.service.IProjectBaseInfoService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + *

+ * 项目基本信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class ProjectBaseInfoServiceImpl extends ServiceImpl implements IProjectBaseInfoService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java new file mode 100644 index 0000000..6e912fa --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.mapper.ProjectMimplementMapper; +import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.sync.scheduler.service.IProjectMimplementService; + +/** + *

+ * 运维项目实施信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class ProjectMimplementServiceImpl extends ServiceImpl implements IProjectMimplementService { + +} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java new file mode 100644 index 0000000..9ad8713 --- /dev/null +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java @@ -0,0 +1,21 @@ +package com.hz.pm.sync.scheduler.service.impl; + +import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.sync.scheduler.mapper.ProjectProcureMapper; +import com.hz.pm.sync.scheduler.service.IProjectProcureService; + +/** + *

+ * 项目采购信息 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-22 + */ +@Service +public class ProjectProcureServiceImpl extends ServiceImpl implements IProjectProcureService { + +} diff --git a/syn-data-task/src/main/resources/application-dev.yml b/hz-pm-sync/src/main/resources/application-dev.yml similarity index 100% rename from syn-data-task/src/main/resources/application-dev.yml rename to hz-pm-sync/src/main/resources/application-dev.yml diff --git a/syn-data-task/src/main/resources/application-pre.yml b/hz-pm-sync/src/main/resources/application-pre.yml similarity index 100% rename from syn-data-task/src/main/resources/application-pre.yml rename to hz-pm-sync/src/main/resources/application-pre.yml diff --git a/pmapi/src/main/resources/application.yml b/hz-pm-sync/src/main/resources/application.yml similarity index 100% rename from pmapi/src/main/resources/application.yml rename to hz-pm-sync/src/main/resources/application.yml diff --git a/syn-data-task/src/main/resources/logback-spring.xml b/hz-pm-sync/src/main/resources/logback-spring.xml similarity index 100% rename from syn-data-task/src/main/resources/logback-spring.xml rename to hz-pm-sync/src/main/resources/logback-spring.xml diff --git a/ningda-generator/pom.xml b/ningda-generator/pom.xml deleted file mode 100644 index 61c61c4..0000000 --- a/ningda-generator/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - project-management - com.ningdatech - 1.0.0 - - 4.0.0 - - ningda-generator - - - - com.baomidou - mybatis-plus-boot-starter - - - com.baomidou - mybatis-plus-generator - 3.5.3.2 - - - org.freemarker - freemarker - - - - com.kingbase8 - kingbase8-8.2.0 - system - ${project.basedir}/lib/kingbase8-8.2.0.jar - - - - com.kingbase.dialect - kingbase8-8.2.0 - system - ${project.basedir}/lib/kingbase8-8.2.0.jar - - - 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 deleted file mode 100644 index 4c74385..0000000 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.generator.config; - -import com.baomidou.mybatisplus.generator.FastAutoGenerator; -import com.baomidou.mybatisplus.generator.config.OutputFile; -import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; - -import java.util.Collections; - -/** - * @description: 自动生成code代码 - * @author: zpf - * @date: 2023/01/03 09:20 - */ -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/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"; - - private static final String URL = "jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; - private static final String USER_NAME = "SYSTEM"; - private static final String PASSWORD = "Ndkj1234"; - - private static void generate(String author, String packageName, String path, String... tableNames) { - FastAutoGenerator.create(URL, USER_NAME, PASSWORD) - .globalConfig(builder -> { - // 设置作者 - builder.author(author) - // 开启 swagger 模式 - .enableSwagger() - // 覆盖已生成文件 - .fileOverride() - // 指定输出目录 - .outputDir(path); - }) - .packageConfig(builder -> { - // 设置父包名 - builder.parent("com.ningdatech") - // 设置父包模块名 - .moduleName("pmapi." + packageName) - // 设置mapperXml生成路径 - .pathInfo(Collections.singletonMap(OutputFile.xml, - //设置自己的生成路径 - path + "/com/ningdatech/pmapi/" + packageName + "/mapper")); - }) - .strategyConfig(builder -> { - builder.addTablePrefix(""); - // 设置需要生成的表名 - builder.addInclude(tableNames); - }) - // 使用Freemarker引擎模板,默认的是Velocity引擎模板 - .templateEngine(new FreemarkerTemplateEngine()) - .execute(); - } - - public static void main(String[] args) { - //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); - generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_score_info"); - } - -} diff --git a/pmapi/pom.xml b/pmapi/pom.xml deleted file mode 100644 index 19811fa..0000000 --- a/pmapi/pom.xml +++ /dev/null @@ -1,463 +0,0 @@ - - - 4.0.0 - - com.ningdatech - project-management - 1.0.0 - - pmapi - 1.0.0 - - 0.11.5 - - - - - com.google.guava - guava - - - cn.hutool - hutool-all - 5.8.5 - - - - org.projectlombok - lombok - - - - com.baomidou - mybatis-plus-boot-starter - - - - org.springframework.boot - spring-boot-starter-data-redis - - - com.baomidou - mybatis-plus-extension - - - org.springframework.session - spring-session-data-redis - - - org.springframework.boot - spring-boot-starter-freemarker - - - - org.apache.commons - commons-pool2 - ${commons-pool2.version} - - - org.apache.commons - commons-lang3 - - - com.alibaba - fastjson - - - org.apache.tomcat.embed - tomcat-embed-core - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.springframework.boot - spring-boot-devtools - true - true - - - org.springframework.boot - spring-boot-starter-aop - - - - com.github.ben-manes.caffeine - caffeine - - - org.apache.httpcomponents - httpclient - - - org.apache.poi - poi - - - org.apache.poi - poi-ooxml - - - - com.aliyun.oss - aliyun-sdk-oss - 3.15.0 - - - junit - junit - test - - - org.aspectj - aspectjweaver - - - - org.springframework.boot - spring-boot-starter-test - - - - com.auth0 - java-jwt - 3.10.3 - - - org.springframework.boot - spring-boot-configuration-processor - - - com.ningdatech - nd-log-starter - 1.0.0 - - - com.ningdatech - nd-basic - - - org.slf4j - slf4j-log4j12 - - - - - com.ningdatech - nd-swagger2-starter - - - org.slf4j - slf4j-log4j12 - - - - - - com.ningdatech - nd-zwdd-starter - - - org.slf4j - slf4j-log4j12 - - - 1.0.0 - - - - - com.kingbase8 - kingbase8-8.2.0 - 8.2.0 - system - ${project.basedir}/src/lib/kingbase8-8.2.0.jar - - - com.ningdatech - nd-cache-starter - - - com.ningdatech - nd-irs-starter - - - com.ningdatech - nd-yxt-starter - 1.0.0 - - - com.alibaba - easyexcel-core - - - com.ningdatech - nd-file-starter - - - com.ningdatech - nd-flowable-starter - - - com.baomidou - mybatis-plus-boot-starter - - - com.alibaba - druid-spring-boot-starter - - - - - - com.alibaba.xxpt - zwdd - 1.2.0 - system - ${basedir}/src/lib/zwdd-sdk-java-1.2.0.jar - - - joda-time - joda-time - - - - org.springframework.statemachine - spring-statemachine-core - - - - - com.itextpdf - itextpdf - - - com.itextpdf - itext-asian - - - com.itextpdf.tool - xmlworker - - - org.xhtmlrenderer - flying-saucer-pdf-itext5 - - - - com.itextpdf - html2pdf - - - - 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 - - - - - - - dev - - - dev - - - - test - - test - - - - pre - - pre - - - - prod - - prod - - - - - - - - src/main/resources - - **/* - - - - src/main/java - - **/*.xml - - - - src/main/lib - BOOT-INF/lib/ - - **/*.jar - - - - src/main/resources - BOOT-INF/classes/ - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - 2.6.8 - - true - - - - - repackage - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/App.java b/pmapi/src/main/java/com/ningdatech/pmapi/App.java deleted file mode 100644 index e61d48b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/App.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi; - -import com.ningdatech.basic.util.SpringUtils; -import com.ningdatech.pmapi.common.util.SpringContextHolder; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -/** - * @author liuxinxin - */ -@SpringBootApplication -@EnableAsync -@MapperScan(App.MAPPER_PACKAGES) -@EnableScheduling -@EnableTransactionManagement -@EnableAspectJAutoProxy(exposeProxy = true) -@ComponentScan(basePackages = {"com.ningdatech.pmapi", "com.ningdatech.irs"}) -public class App { - - protected static final String MAPPER_PACKAGES = "com.ningdatech.pmapi.**.mapper"; - - public static void main(String[] args) { - ApplicationContext context = SpringApplication.run(App.class, args); - // 设置applicationContext - SpringUtils.setApplicationContext(context); - } - - @Bean - public SpringContextHolder springContextHolder() { - return new SpringContextHolder(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/Compare.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/Compare.java deleted file mode 100644 index 0a56775..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/Compare.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.common.compare; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 字段标记注解 - * - * @author zpf - * @since 2023/07/21 - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Compare { - - /** - * 字段名称 - */ - String value(); -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareNode.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareNode.java deleted file mode 100644 index 737331d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareNode.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.common.compare; - -/** - * @author zpf - * @since 2023/07/21 - */ -public class CompareNode { - - /** - * 字段 - */ - private String fieldKey; - - /** - * 字段值 - */ - private Object fieldValue; - - /** - * 字段名称 - */ - private String fieldName; - - public String getFieldKey() { - return fieldKey; - } - - public void setFieldKey(String fieldKey) { - this.fieldKey = fieldKey; - } - - public Object getFieldValue() { - return fieldValue; - } - - public void setFieldValue(Object fieldValue) { - this.fieldValue = fieldValue; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareUtils.java deleted file mode 100644 index cfafd5c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/compare/CompareUtils.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.ningdatech.pmapi.common.compare; - -import com.alibaba.fastjson.JSONObject; - -import java.lang.reflect.Field; -import java.util.*; - -/** - * 使用须知:
- * (1)该工具类主要用于两个同类对象的属性值比较;
- * (2)使用本工具类前,请将对应的类属性上打上 @Compare("xxx") 注解,其中xxx为字段的表达名称;
- * (3)为了比较灵活,只有打了该注解才会进行比较,不打的字段则不会进行比较
- * (4)比较后,只会返回有变化的字段,无变化的字符则不返回
- * - * @author zpf - * @since 2023/07/21 - */ -public class CompareUtils { - - private static final String COMMA = ","; - - /** - * 属性比较 - * - * @param source 源数据对象 - * @param target 目标数据对象 - * @return 对应属性值的比较变化 - */ - public String compare(T source, T target) { - return compare(source, target, null); - } - - - /** - * 属性比较 - * - * @param source 源数据对象 - * @param target 目标数据对象 - * @param ignoreCompareFields 忽略比较的字段 - * @return 对应属性值的比较变化 - */ - public String compare(T source, T target, List ignoreCompareFields) { - if (Objects.isNull(source) && Objects.isNull(target)) { - return ""; - } - Map sourceMap = this.getFiledValueMap(source); - Map targetMap = this.getFiledValueMap(target); - if (sourceMap.isEmpty() && targetMap.isEmpty()) { - return ""; - } - // 如果源数据为空,则只显示目标数据,不显示属性变化情况 - if (sourceMap.isEmpty()) { - return doEmpty(targetMap, ignoreCompareFields); - } - // 如果源数据为空,则显示属性变化情况 - String s = doCompare(sourceMap, targetMap, ignoreCompareFields); - if (!s.endsWith(COMMA)) { - return s; - } - return s.substring(0, s.length() - 1); - } - - public JSONObject compareToJson(T source, T target, List ignoreCompareFields) { - JSONObject res = new JSONObject(); - if (Objects.isNull(source) && Objects.isNull(target)) { - return res; - } - Map sourceMap = this.getFiledValueMap(source); - Map targetMap = this.getFiledValueMap(target); - if (sourceMap.isEmpty() && targetMap.isEmpty()) { - return res; - } - // 如果源数据为空,则只显示目标数据,不显示属性变化情况 - if (sourceMap.isEmpty()) { - return res; - } - - return doCompareJson(sourceMap, targetMap, ignoreCompareFields); - } - - private String doEmpty(Map targetMap, List ignoreCompareFields) { - StringBuilder sb = new StringBuilder(); - Collection values = targetMap.values(); - int size = values.size(); - int current = 0; - for (CompareNode node : values) { - current++; - Object o = Optional.ofNullable(node.getFieldValue()).orElse(""); - if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(node.getFieldKey())) { - continue; - } - if (o.toString().length() > 0) { - sb.append("[" + node.getFieldName() + ":" + o + "]"); - if (current < size) { - sb.append(COMMA); - } - } - } - return sb.toString(); - } - - private String doCompare(Map sourceMap, Map targetMap, List ignoreCompareFields) { - StringBuilder sb = new StringBuilder(); - Set keys = sourceMap.keySet(); - int size = keys.size(); - int current = 0; - for (String key : keys) { - current++; - CompareNode sn = sourceMap.get(key); - CompareNode tn = targetMap.get(key); - if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(sn.getFieldKey())) { - continue; - } - String sv = Optional.ofNullable(sn.getFieldValue()).orElse("").toString(); - String tv = Optional.ofNullable(tn.getFieldValue()).orElse("").toString(); - // 只有两者属性值不一致时, 才显示变化情况 - if (!sv.equals(tv)) { - sb.append(String.format("[%s:%s -> %s]", sn.getFieldName(), sv, tv)); - if (current < size) { - sb.append(COMMA); - } - } - } - return sb.toString(); - } - - private JSONObject doCompareJson(Map sourceMap, Map targetMap, List ignoreCompareFields) { - JSONObject res = new JSONObject(); - Set keys = sourceMap.keySet(); - int size = keys.size(); - int current = 0; - for (String key : keys) { - current++; - CompareNode sn = sourceMap.get(key); - CompareNode tn = targetMap.get(key); - if (Objects.nonNull(ignoreCompareFields) && ignoreCompareFields.contains(sn.getFieldKey())) { - continue; - } - String sv = Optional.ofNullable(sn.getFieldValue()).orElse("").toString(); - String tv = Optional.ofNullable(tn.getFieldValue()).orElse("").toString(); - // 只有两者属性值不一致时, 才显示变化情况 - if (!sv.equals(tv)) { - JSONObject valueChange = new JSONObject(); - valueChange.put("fieldKey",sn.getFieldKey()); - valueChange.put("old",tv); - valueChange.put("new",sv); - res.put(sn.getFieldName(),valueChange); - } - } - return res; - } - - private Map getFiledValueMap(T t) { - if (Objects.isNull(t)) { - return Collections.emptyMap(); - } - Field[] fields = t.getClass().getDeclaredFields(); - if (Objects.isNull(fields) || fields.length == 0) { - return Collections.emptyMap(); - } - Map map = new LinkedHashMap(); - for (Field field : fields) { - Compare compareAnnotation = field.getAnnotation(Compare.class); - if (Objects.isNull(compareAnnotation)) { - continue; - } - field.setAccessible(true); - try { - String fieldKey = field.getName(); - CompareNode node = new CompareNode(); - node.setFieldKey(fieldKey); - node.setFieldValue(field.get(t)); - node.setFieldName(compareAnnotation.value()); - map.put(field.getName(), node); - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - } - return map; - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java deleted file mode 100644 index d850df4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.ningdatech.pmapi.common.config; - -import lombok.extern.slf4j.Slf4j; -import org.apache.http.Header; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; -import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.message.BasicHeader; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; -import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.StringHttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.web.client.RestTemplate; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * @Classname BeanConfig - * @Description - * @Date 2023/3/2 9:42 - * @Created by PoffyZhang - */ -@Configuration -@Slf4j -public class BeanConfig { - - - @Bean - public RestTemplate restTemplate() { - // 添加内容转换器,使用默认的内容转换器 - RestTemplate restTemplate = new RestTemplate(httpRequestFactory()); - // 设置编码格式为UTF-8,解决中文乱码问题 - List> converterList = restTemplate.getMessageConverters(); - HttpMessageConverter converterTarget = null; - for (HttpMessageConverter item : converterList) { - if (item.getClass() == StringHttpMessageConverter.class) { - converterTarget = item; - break; - } - } - if (converterTarget != null) { - converterList.remove(converterTarget); - } - HttpMessageConverter converter = new StringHttpMessageConverter(StandardCharsets.UTF_8); - converterList.add(1,converter); - - MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); - mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList( - MediaType.TEXT_HTML, - MediaType.TEXT_PLAIN)); - restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter); - - log.info("-----restTemplate-----初始化完成"); - return restTemplate; - } - - @Bean - public ClientHttpRequestFactory httpRequestFactory() { - return new HttpComponentsClientHttpRequestFactory(httpClient()); - } - - @Bean - public HttpClient httpClient() { - // 长连接保持30秒 - PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(30, TimeUnit.SECONDS); - //设置整个连接池最大连接数 根据自己的场景决定 - connectionManager.setMaxTotal(500); - //同路由的并发数,路由是对maxTotal的细分 - connectionManager.setDefaultMaxPerRoute(500); - - //requestConfig - RequestConfig requestConfig = RequestConfig.custom() - //服务器返回数据(response)的时间,超过该时间抛出read timeout - .setSocketTimeout(10000) - //连接上服务器(握手成功)的时间,超出该时间抛出connect timeout - .setConnectTimeout(5000) - //从连接池中获取连接的超时时间,超过该时间未拿到可用连接,会抛出org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool - .setConnectionRequestTimeout(500) - .build(); - //headers - List
headers = new ArrayList<>(); - headers.add(new BasicHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36")); - headers.add(new BasicHeader("Accept-Encoding", "gzip,deflate")); - headers.add(new BasicHeader("Accept-Language", "zh-CN")); - headers.add(new BasicHeader("Connection", "Keep-Alive")); - headers.add(new BasicHeader("Content-type", "application/json;charset=UTF-8")); - - return HttpClientBuilder.create() - .setDefaultRequestConfig(requestConfig) - .setConnectionManager(connectionManager) - .setDefaultHeaders(headers) - // 保持长连接配置,需要在头添加Keep-Alive - .setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy()) - //重试次数,默认是3次,没有开启 - .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) - .build(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ConfigurerAdapter.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ConfigurerAdapter.java deleted file mode 100644 index 553ba4f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ConfigurerAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.common.config; - -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.alibaba.fastjson.support.config.FastJsonConfig; -import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; -import com.ningdatech.pmapi.common.interceptor.LogInterceptor; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.lang.NonNull; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -/** - * @author qinxianyun - */ -@EnableWebMvc -@Configuration -public class ConfigurerAdapter implements WebMvcConfigurer { - - @Override - public void configureMessageConverters(List> converters) { - // 使用 fastjson 序列化,会导致 @JsonIgnore 失效,可以使用 @JSONField(serialize = false) 替换 - FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); - List supportMediaTypeList = new ArrayList<>(); - supportMediaTypeList.add(MediaType.APPLICATION_JSON); - FastJsonConfig config = new FastJsonConfig(); - config.setDateFormat("yyyy-MM-dd HH:mm:ss"); - config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); - converter.setFastJsonConfig(config); - converter.setSupportedMediaTypes(supportMediaTypeList); - converter.setDefaultCharset(StandardCharsets.UTF_8); - converters.add(converter); - } - - @Override - public void addInterceptors(@NonNull InterceptorRegistry registry) { - registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**").order(-100); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java deleted file mode 100644 index d6cd0e7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.common.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/9/9 下午5:37 - */ -@Data -@Configuration -@ConfigurationProperties(prefix = "organization") -public class DingOrganizationProperties { - private List deptVisibleScopes = new ArrayList<>(); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ProvincialProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ProvincialProperties.java deleted file mode 100644 index 1fdee25..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/ProvincialProperties.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.common.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author zpf - * @date 2023/3/2 下午5:37 - */ -@Data -@Configuration -@ConfigurationProperties(prefix = "provincial") -public class ProvincialProperties { - private String host; - - private String pushUrl; - - private String detailUrl; - - private String domainUrl; - - private String key; - - private String secret; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BaseFieldConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BaseFieldConst.java deleted file mode 100644 index 9b10e39..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BaseFieldConst.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - *

- * 创建人修改人基础字段 - *

- * - * @author WendyYang - * @since 17:17 2023/01/29 - */ -public interface BaseFieldConst { - - String CREATE_BY = "createBy"; - String UPDATE_BY = "updateBy"; - String CREATE_ON = "createOn"; - String UPDATE_ON = "updateOn"; - -} 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 deleted file mode 100644 index ec6bd0f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -import com.ningdatech.basic.model.ApiResponse; - -import java.math.BigDecimal; - -/** - *

- * 业务常量 - *

- * - * @author WendyYang - * @since 13:42 2022/12/1 - */ -public interface BizConst { - - /** - * SQL查询一条 - */ - String LIMIT_1 = "limit 1"; - - String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; - - /** - * 一小时秒数 - **/ - BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); - - /** - * 十分钟的毫秒数 - */ - long MILLS_10_MIN = 1000L * 60 * 10; - - /** - * 中国行政区划编码 - */ - long ROOT_REGION_CODE = 100000L; - - /** - * 一级行政区划数量 - */ - int NUM_PROVINCE = 34; - - /** - * 默认的父id - */ - long PARENT_ID = 0L; - - /** - * 默认树层级 - */ - int TREE_GRADE = 0; - - /** - * 默认的排序 - */ - int SORT_VALUE = 0; - - /** - * 浙江省的region_id - */ - long ZJ_REGION_CODE = 330000L; - String NINE_AREA_CODE_LAST = "000"; - - /** - * 省/直辖市 level - */ - int GOV_L1 = 1; - - /** - * 市 level - */ - int GOV_L2 = 2; - - /** - * 区/县 level - */ - int GOV_L3 = 3; - - /** - * 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 - */ - String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; - - ApiResponse UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); - - int MAX_EXPORT_COUNT = 5000; - - String RESPONSE_KEY_DATA = "data"; - String RESPONSE_KEY_ID = "id"; - String RESPONSE_KEY_DING_CODE = "dingCode"; - String RESPONSE_KEY_MATTER_NAME = "matterName"; - String RESPONSE_KEY_ORG_NAME = "orgName"; - String RESPONSE_KEY_USER_STATE = "userState"; - - String RESPONSE_KEY_AREA_NAME = "areaName"; - String ORG_NAME = "organizationName"; - String ORG_CODE = "organizationCode"; - - String DEV = "dev"; - String PRE = "pre"; - String PROD = "prod"; - - String SAVE_SUCCESS = "保存成功"; - String OP_SUCCESS = "操作成功"; - String OP_FAIL = "操作失败"; - String SAVE_FAIL = "保存失败"; -} 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 deleted file mode 100644 index e0b10df..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * @description: 常量 - * @author: LiuXinXin - * @date: 2022/5/5 17:31 - */ -public interface CommonConst { - - String COOKIE_KEY = "ND_JSESSION"; - - Integer EXPORT_PAGE_NUMBER = 1; - Integer EXPORT_PAGE_SIZE = 100000; - String CALL_STATUS = "status"; - String CALL_STATUS_OK_VALUE = "ok"; - - Integer COMMENT_MAX_SIZE = 163; - Integer SUB_COMMENT_SIZE_MIN = 0; - Integer SUB_COMMENT_SIZE_MAX = 160; - - String PROJECT_DECLARE = "项目申报"; - String UNIT_INNER_AUDIT = "单位内部审核"; - String PRELIMINARY_PREVIEW = "项目预审"; - - String DEPT_UNITED_REVIEW = "部门联审"; - String PROVINCE_UNITED_REVIEW = "省级部门联审"; - String ANNUAL_PLAN = "年度计划"; - String CONSTRUCTION_PLAN_REVIEW = "建设方案评审"; - String PROJECT_APPROVAL = "立项批复"; - String TENDER_PURCHASE = "招标采购"; - String PROJECT_PRELIMINARY_INSPECTION = "项目初验"; - String PROJECT_FINAL_INSPECTION = "项目终验"; - - String ARCHIVED = "归档"; - - String FILE_NAME = "name"; - String BASIS_FILE_NAME = "fileName"; - - String NULL = "null"; - - String TITLE = "title"; - - String FILE_NAME_STR = "fileName"; - String FILE_ID_STR = "fileId"; - String ID_STR = "id"; - String FILE_LIST = "fileList"; - String ITEM_BASED = "依据项:"; - String ITEM_BASED_FILE_NAME = "依据文件名:"; - String APPENDIX = "文件:"; - String NEW_CONSTRUCTION = "新建"; - String CONTINUED_CONSTRUCTION = "续建"; - String MONTH = "月"; - String ZHI = "至"; - String YEAR = "年"; - - Integer VERSION_ONE = 1; - Integer VERSION_SIZE = 2; - Integer VERSION_JUDGE = -1; - - String COPY = "副本"; - String PROJECT_REPEAT = " 项目已在其他评价计划中,请勿重复添加!"; - String APP_REPEAT = " 应用已在其他评价计划中,请勿重复添加!"; - Integer REAPPRAISAL_TYPE = 1; - Integer VERIFY_TYPE = 2; - String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!"; - - String NORMAL_TIME_PATTERN = "yyyy-MM-dd"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java deleted file mode 100644 index 9646f75..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - - -import com.ningdatech.basic.util.StrPool; - -/** - * 默认值 - * - * @author PoffyZhang - */ -public interface DefValConst { - - /** - * 默认的根节点path - */ - String ROOT_PATH = StrPool.COMMA; - /** - * 默认树层级 - */ - Integer TREE_GRADE = 0; - /** - * 默认的父id - */ - Long PARENT_ID = 0L; - /** - * 默认的排序 - */ - Integer SORT_VALUE = 0; - /** - * 字典占位符 - */ - String DICT_PLACEHOLDER = "###"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java deleted file mode 100644 index 4fbf071..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * 浙政钉常量 - * - * @author CMM - * @since 2023/02/01 14:49 - */ -public interface DingConst { - /** - * 工作通知 - */ - String WORKING_NOTICE = "/message/workNotification"; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java deleted file mode 100644 index 317247b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -import java.math.BigDecimal; - -/** - * 项目申报表单数据常量key - * @return - * @author CMM - * @since 2023/01/19 10:31 - */ -public interface ProjectDeclareConst { - - /** - * 基本信息 - */ - class BasicInformation { - // 项目名称 - public static final String PROJECT_NAME = "projectName"; - // 是否一地创新全省共享项目 - public static final String INNOVATION_SHARING_PROJECT = "innovationSharingProject"; - // 是否临时增补 - public static final String TEMPORARY_SUPPLEMENT = "temporarySupplement"; - // 项目负责人 - public static final String PROJECT_LEADER = "projectLeader"; - // 项目负责人手机号 - public static final String PROJECT_LEADER_PHONE_NUMBER = "projectLeaderPhoneNumber"; - // 项目联系人 - public static final String PROJECT_CONTACT = "projectContact"; - // 项目联系人手机号 - public static final String PROJECT_CONTACT_PHONE_NUMBER = "projectContactPhoneNumber"; - // 建设单位 - public static final String CONSTRUCTION_UNIT = "constructionUnit"; - // 建设单位统一信用代码 - public static final String CONSTRUCTION_UNIT_UNIFIED_CREDIT_CODE = "constructionUnitUnifiedCreditCode"; - // 项目类型 - public static final String PROJECT_TYPE = "projectType"; - // 是否首次新建 - public static final String FIRST_NEW_CONSTRUCTION = "firstNewConstruction"; - // 预算年度 - public static final String BUDGET_YEAR = "projectYear"; - // 建设开始时间 - public static final String CONSTRUCTION_START_TIME = "constructionStartTime"; - // 建设结束时间 - public static final String CONSTRUCTION_END_TIME = "constructionEndTime"; - // 四大体系 - public static final String FOUR_SYSTEM = "fourSystem"; - // 是否数字化改革项目 - public static final String DIGITAL_REFORM_PROJECT = "digitalReformProject"; - // 建设层级 - public static final String CONSTRUCTION_HIERARCHY = "constructionHierarchy"; - // 立项依据材料 - public static final String PROJECT_BASIS_MATERIAL = "projectBasisMaterial"; - // 发改编码 - public static final String CHANGE_CODE = "changeCode"; - // 财政编码 - public static final String FISCAL_CODE = "fiscalCode"; - // 是否上云 - public static final String ON_CLOUD = "onCloud"; - // 项目简介 - public static final String PROJECT_INTRODUCTION = "projectIntroduction"; - } - - /** - * 资金申报情况 - */ - class FundDeclareInfo { - // 申报金额 - public static final String DECLARE_AMOUNT = "declareAmount"; - // 自有资金 - public static final String OWN_FUND = "ownFund"; - // 政府投资-本级财政资金 - public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; - // 政府投资-上级补助资金 - public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; - // 银行贷款 - public static final String BANK_LOAN = "bankLoan"; - // 其他资金 - public static final String OTHER_FUND = "otherFund"; - } - - /** - * 总投资分配情况 - */ - class TotalInvestmentAllocations { - // 软件开发 - public static final String SOFTWARE_DEVELOPMENT = "softwareDevelopment"; - // 云资源、硬件配置 - public static final String CLOUD_RESOURCE_HARDWARE_CONFIGURATION = "cloudResourceHardwareConfiguration"; - // 第三方服务 - public static final String THIRD_PARTY_SERVICE = "thirdPartyService"; - } - /** - * 年度支付计划 - */ - class AnnualPaymentPlan { - // 年度支付金额 - public static final String ANNUAL_PAYMENT_AMOUNT = "annualPaymentAmount"; - // 自有资金 - public static final String OWN_FUND = "ownFund"; - // 政府投资-本级财政资金 - public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; - // 政府投资-上级补助资金 - public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; - // 银行贷款 - public static final String BANK_LOAN = "bankLoan"; - // 其他 - public static final String OTHER = "other"; - } - /** - * 核心业务 - */ - class CoreBusiness { - - } - /** - * 安全投入 - */ - class SafetyInput { - // 投入项 - public static final String INPUT_ITEM = "inputItem"; - // 内容描述 - public static final String CONTENT_DESCRIPTION = "contentDescription"; - // 金额 - public static final String AMOUNT = "amount"; - } - /** - * 工程形象进度 - */ - class ProjectImageProgress { - // 第一季度 - public static final String FIRST_QUARTER = "firstQuarter"; - // 第二季度 - public static final String SECOND_QUARTER = "secondQuarter"; - // 第三季度 - public static final String THIRD_QUARTER = "thirdQuarter"; - // 第四季度 - public static final String FOURTH_QUARTER = "fourthQuarter"; - } - /** - * 附件 - */ - class Appendix { - - } - /** - * 备注 - */ - class Remark { - - } - /** - * 应用信息 - */ - class ApplicationInformation { - - } - - class Number { - public static final BigDecimal DECLARE_AMOUNT_JUDGEMENT = BigDecimal.valueOf(1000); - - //区县是500万 - public static final BigDecimal DECLARE_COUNTY_AMOUNT_JUDGEMENT = BigDecimal.valueOf(500); - - public static final Integer COUNTRY_BUILD_LEVEL = 1; - public static final Integer PROVINCE_BUILD_LEVEL = 2; - public static final Integer PROVINCE_SELF_BUILD_LEVEL = 3; - public static final Integer CITY_BUILD_LEVEL = 4; - public static final Integer CITY_SELF_BUILD_LEVEL = 5; - public static final Integer DISTRICTS_COUNTRIES_BUILD_LEVEL = 6; - public static final Integer VILLAGES_TOWNS_BUILD_LEVEL = 7; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java deleted file mode 100644 index 87854aa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -import com.google.common.collect.Lists; - -import java.util.List; - -/** - *

- * RegionConst - *

- * - * @author WendyYang - * @since 13:57 2023/3/1 - */ -public interface RegionConst { - - //---------------------------------------地区层级(缩写RL)------------------------------------------------------------- - - int RL_PROVINCE = 1; - - int RL_CITY = 2; - - int RL_COUNTY = 3; - - //---------------------------------------地区编码(缩写RC)------------------------------------------------------------- - - /** - * 丽水行政区划编码 - */ - String RC_LS = "331100"; - //丽水开发区 - String LS_KF = "331118"; - String LS_KF_IRS = "331151"; - String RC_LS_SBJ_IRS = "331101"; - //遂昌县 - String RC_SC = "331123"; - String LS_KF_NAME = "开发区"; - - /** - * 中国行政区划编码 - */ - String RC_CHINA = "100000"; - - - /** - * 浙江行政区划编码 - */ - String RC_ZJ = "330000"; - - String NINE_CODE_LAST = "000"; - //莲都 - String LD = "331102"; - //青田 - String QT = "331121"; - //缙云 - String JY = "331122"; - //遂昌 - String SC = "331123"; - //松阳 - String SY = "331124"; - //云和 - String YH = "331125"; - //庆元 - String QY = "331126"; - String QN = "331127"; - String LQ = "331181"; - - List LS_ARR = Lists.newArrayList(RC_LS,LS_KF,LD,QT,JY,SC,SY,YH,QY,QN,LQ); - - //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- - - long PID_CHINA = 0; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java deleted file mode 100644 index 43c8877..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * @author CMM - * @since 2023/02/07 16:24 - */ - -public class StateMachineConst { - - public static final String PROJECT_DECLARE = "projectDeclare"; - public static final String APPLICATION_DECLARE = "applicationDeclare"; - public static final String LI_SHUI_CITY_AREA_CODE = "331100"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java deleted file mode 100644 index 29415af..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.common.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/7/26 上午9:21 - */ -@AllArgsConstructor -@Getter -public enum BoolDisplayEnum { - - /** - * true - */ - Y, - - /** - * false - */ - N; - - public static boolean judgeBoolean(String key) { - return Y.name().equals(key); - } - - public static BoolDisplayEnum judgeBoolean(boolean key) { - return key ? Y : N; - } - -} 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 deleted file mode 100644 index be73781..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.common.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author zpf - * @date 2023/3/12 上午9:21 - */ -@AllArgsConstructor -@Getter -public enum CommonEnum { - /** - * 公共的一些枚举 - */ - YES(1,"是",1), - NO(0,"否",1), - - LS_SBJ(331100,"市本级",2), - LS_LD(331102,"莲都区",2), - LS_QT(331121,"青田县",2), - LS_JY(331122,"缙云县",2), - LS_SC(331123,"遂昌县",2), - LS_SY(331124,"松阳县",2), - LS_YH(331125,"云和县",2), - LS_QY(331126,"庆元县",2), - LS_JN(331127,"景宁畲族自治县",2), - LS_LQ(331181,"龙泉市",2), - LS_KFQ(331199,"开发区",2), - ZWDD(0,"浙政钉",3), - MOBILE(1,"短信",3); - - private Integer code; - private String desc; - private Integer groupId; - - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java deleted file mode 100644 index e246973..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.ningdatech.pmapi.common.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - - -/** - * 导出选项枚举 - * - * @author CMM - * @since 2023/02/10 16:38 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ExportOptionEnum { - /** - * 导出选项 - */ - id(1, "项目ID"), - - projectName(2, "项目名称"), - - areaCode(3, "行政区划编码"), - - area(4, "行政区划名称"), - - responsibleMan(5, "项目负责人"), - - responsibleManMobile(6, "项目负责人手机号"), - - contactName(7, "项目联系人"), - - contactPhone(8, "项目联系人手机号"), - - higherSuperOrg(9, "上级业务主管单位"), - - higherSuperOrgCode(10, "上级主管单位浙政钉ID"), - - superOrg(11, "本级主管部门"), - - superOrgCode(12, "本级主管部门浙政钉ID"), - - buildOrgName(13, "建设单位名称"), - - buildOrgZheJiangGovDingId(14, "建设单位浙政钉ID"), - - orgCreditCode(15, "建设单位统一信用代码"), - - projectType(16, "项目类型"), - - isFirst(17, "是否首次新建"), - - relatedExistsApplication(18, "关联应用"), - - relatedExistsApplicationCode(19, "关联应用IRS编码"), - - declareAmount(20, "申报金额"), - - approvedTotalInvestmentIncrease(21, "批复金额"), - - /** - * 表里没有 - */ - budgetSource(22, "预算来源"), - - projectYear(23, "预算年度"), - - projectIntroduction(24, "项目简介"), - - buildBasis(25, "立项依据"), - - buildLevel(26, "建设层级"), - - developCode(27, "发改编码"), - - financialCode(28, "财政编码"), - - /** - * 表里没有 - */ - informationValidity(29, "信息是否有效"), - - - isDigitalReform(30, "是否数字化改革项目"), - - bizDomain(31, "综合应用领域"), - - isCloud(32, "是否上云"), - - cloudType(33, "云类型"), - - fourSystems(34, "四大体系"), - isTemporaryAugment(35, "是否临时增补"), - - protectionLevel(36, "等保级别"), - - isSecretComments(37, "是否密评"), - - businessNumber(38, "业务编号"), - - businessName(39, "业务名称"), - - orgName(40, "单位名称"), - - softwareDevelopmentAmount(41, "软件开发"), - - cloudHardwarePurchaseAmount(42, "云资源、硬件购置"), - - thirdPartyAmount(43, "第三方服务"), - - safetyInputTitle(44, "投入项"), - - safetyInputDescribe(45, "内容描述"), - - safetyInputAmount(46, "金额"), - - annualPlanAmount(47, "年度支付金额"), - - annualPlanHaveAmount(48, "自有资金"), - - declareGovOwnFinanceAmount(49, "政府投资-本级财政资金"), - - declareGovSuperiorFinanceAmount(50, "政府投资-上级补助资金"), - - declareBankLendingAmount(51, "银行贷款"), - - declareOtherAmount(52, "其它资金"), - - engineeringSpeedOne(53, "第一季度"), - - engineeringSpeedTwo(54, "第二季度"), - - engineeringSpeedThree(55, "第三季度"), - - engineeringSpeedFour(56, "第四季度"), - - preliminaryPlanFile(57, "初步方案"), - - supportingMaterialsFile(58, "附件-佐证材料"), - - projectRemarks(59, "备注"), - processStatusName(60, "流程状态名称"), - processLaunchTime(61,"流程发起时间"), - processHandleTime(62,"流程处理时间"), - - projectStatusName(63,"项目状态名称"), - - createOn(64,"创建时间"), - - updateOn(65,"更新时间"); - - - private Integer code; - private String desc; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java deleted file mode 100644 index 5b8986b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.common.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectProcessStageEnum { - /** - * 项目流程配置 阶段枚举 - */ - ORG_INTERNAL_APPROVAL_PROCESS(1,"单位内部审批流程"), - PROJECT_PREQUALIFICATION_APPROVAL_PROCESS(2,"项目预审审批流程"), - DEPARTMENT_JOINT_APPROVAL_PROCESS(3,"部门联合审批流程"), - CONSTRUCTION_PROJECT_APPROVAL_PROCESS(4,"建设方案审批流程"), - ACCEPTANCE_DECLARATION_APPROVAL_PROCESS(5,"验收申报审批流程"), - APPLY_DELAY(6,"申请延期审批流程"), - APPLY_BORROW(7,"申请借阅审批流程"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectProcessStageEnum t : ProjectProcessStageEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/errorcode/AppErrorCode.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/errorcode/AppErrorCode.java deleted file mode 100644 index 52f809b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/errorcode/AppErrorCode.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.common.errorcode; - -import lombok.Getter; - -/** - * @author LiuXinXin - */ -@Getter -public enum AppErrorCode { - USER(100), - - AUTH(101); - - private final Integer code; - - AppErrorCode(Integer code) { - this.code = code; - } - - public Integer getCode() { - return code; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/BaseFieldFillHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/BaseFieldFillHandler.java deleted file mode 100644 index 2a8f4fe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/BaseFieldFillHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.common.handler; - -import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.reflection.MetaObject; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; - -import static com.ningdatech.pmapi.common.constant.BaseFieldConst.*; - -/** - *

- * 字段自动填充处理 - *

- * - * @author WendyYang - * @since 17:20 2022/11/24 - */ -@Slf4j -@Component -public class BaseFieldFillHandler implements MetaObjectHandler { - - private Long getUserId() { - if (LoginUserUtil.isLogin()) { - return LoginUserUtil.getUserId(); - } - return 0L; - } - - @Override - public void insertFill(MetaObject metaObject) { - long userId = getUserId(); - LocalDateTime now = LocalDateTime.now(); - this.fillStrategy(metaObject, CREATE_BY, userId); - this.fillStrategy(metaObject, CREATE_ON, now); - this.fillStrategy(metaObject, UPDATE_BY, userId); - this.fillStrategy(metaObject, UPDATE_ON, now); - } - - @Override - public void updateFill(MetaObject metaObject) { - this.fillStrategy(metaObject, UPDATE_BY, getUserId()); - this.fillStrategy(metaObject, UPDATE_ON, LocalDateTime.now()); - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalExceptionHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalExceptionHandler.java deleted file mode 100644 index 7cee5f1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalExceptionHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.common.handler; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiResponse; -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.support.DefaultMessageSourceResolvable; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindException; -import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.servlet.NoHandlerFoundException; - -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; -import java.util.stream.Collectors; - -/** - * @description: 统一错误处理 - * @author: liuxinxin - * @date: 2023/01/03 11:39 - */ -@Slf4j -@ControllerAdvice -@ResponseStatus(HttpStatus.BAD_REQUEST) -public class GlobalExceptionHandler { - - @ResponseBody - @ExceptionHandler(value = NoHandlerFoundException.class) - public ApiResponse noHandlerFoundException(NoHandlerFoundException e) { - log.error("【全局异常拦截】NoHandlerFoundException: 请求方法 {}, 请求路径 {}", e.getRequestURL(), e.getHttpMethod()); - return ApiResponse.ofStatus(Status.REQUEST_NOT_FOUND); - } - - @ResponseBody - @ExceptionHandler(value = {MethodArgumentNotValidException.class, BindException.class}) - public ApiResponse bindException(BindException e) { - String msg = e.getAllErrors().stream() - .map(DefaultMessageSourceResolvable::getDefaultMessage) - .collect(Collectors.joining(",")); - return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); - } - - @ResponseBody - @ExceptionHandler(value = ConstraintViolationException.class) - public ApiResponse constraintViolationException(ConstraintViolationException e) { - String msg = e.getConstraintViolations().stream() - .map(ConstraintViolation::getMessage) - .collect(Collectors.joining(",")); - return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); - } - - @ResponseBody - @ExceptionHandler(value = Exception.class) - public ApiResponse handlerException(Exception e) { - log.error("【全局异常拦截】: 异常信息 {}: {} ", e.getClass().getSimpleName(), e); - return ApiResponse.of(Status.BAD_REQUEST.getCode(), e.getMessage(), null); - } - -} 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 deleted file mode 100644 index 9b0a1c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.common.handler; - -import com.ningdatech.basic.model.ApiResponse; -import org.springframework.core.MethodParameter; -import org.springframework.http.MediaType; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.server.ServerHttpRequest; -import org.springframework.http.server.ServerHttpResponse; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; - -/** - * @Author liuxinxin - * @Date 2021/7/21 11:26 - * @Version 1.0 - **/ -@RestControllerAdvice(basePackages = { - "com.ningdatech.pmapi.fiscal.controller", - "com.ningdatech.pmapi.organization.controller", - "com.ningdatech.pmapi.projectdeclared.controller", - "com.ningdatech.pmapi.projectlib.controller", - "com.ningdatech.pmapi.sys.controller", - "com.ningdatech.pmapi.todocenter.controller", - "com.ningdatech.pmapi.user.controller", - "com.ningdatech.pmapi.meeting.controller", - "com.ningdatech.pmapi.expert.controller", - "com.ningdatech.pmapi.sms.controller", - "com.ningdatech.pmapi.workbench.controller", - "com.ningdatech.pmapi.ding.controller", - "com.ningdatech.pmapi.filemanage.controller", - "com.ningdatech.pmapi.performance.controller", - "com.ningdatech.pmapi.irs.controller", - "com.ningdatech.pmapi.safety.controller", - "com.ningdatech.pmapi.portrait.controller", - "com.ningdatech.pmapi.irs.controller", - "com.ningdatech.pmapi.gov.controller", - "com.ningdatech.pmapi.dashboard.controller", - "com.ningdatech.pmapi.wps.controller", - "com.ningdatech.pmapi.gov.controller" -}) -public class GlobalResponseHandler implements ResponseBodyAdvice { - - private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; - - @Override - public boolean supports(MethodParameter methodParameter, Class> aClass) { - return filter(methodParameter); - } - - @Override - public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, - Class> aClass, ServerHttpRequest serverHttpRequest, - ServerHttpResponse serverHttpResponse) { - ApiResponse apiResponse = ApiResponse.ofSuccess(o); - // 处理字符串时,遇到了类型转换的问题,debug一步一步跟踪,原来是对于字符串的ContentType是“text-plain”, - // ConverterType是StringHttpMessageConverter这个类型转换, - // 由于将结果封装成了自定义的ApiResponse类型,所以有ApiResponse转换成String报错 - // 所以需要对String类型的返回值单独进行处理 -// if (o instanceof String) { -// return JSONUtil.toJsonStr(apiResponse); -// } - return ApiResponse.ofSuccess(o); -// return o; - } - - private Boolean filter(MethodParameter methodParameter) { - Class declaringClass = methodParameter.getDeclaringClass(); - // swagger中的所有返回不进行统一封装 - if (declaringClass.getName().contains(SWAGGER_CLASS_PREFIX)) { - return false; - } - if (methodParameter.hasMethodAnnotation(ExceptionHandler.class)) { - return false; - } - // 如果本身就是使用ApiResponse返回,则不需要进行格式化 - return !methodParameter.getParameterType().equals(ApiResponse.class); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java deleted file mode 100644 index 2519262..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.ningdatech.pmapi.common.helper; - - -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; - -import java.util.Collection; -import java.util.List; - -/** - *

- * RegionCacheHelper - - *

- * - * @author WendyYang - * @since 13:50 2023/3/1 - */ -public interface RegionCacheHelper { - - - /** - * 获取完整的区域树状结构 - * - * @return / - */ - List all(); - - /** - * 根据区域code 区域层级获取 区域类 - * - * @param code 区域编码 - * @param level 区域层级 - * @return {@link RegionDTO} - */ - RegionDTO getByCodeAndLevel(String code, Integer level); - - /** - * 获取区域名称 - * - * @param code 区域编码 - * @param level 区域层级 - * @return 名称 - */ - String getRegionName(String code, int level); - - /** - * 根据传入的地区code与level获取所有上层地区集合 - * 按照level升序排列 - * - * @param code 地区编码 - * @param level 地区层级 - * @return / - */ - List listParents(String code, int level); - - /** - * 根据传入的地区code与level获取所有子区域集合 - * - * @param code 地域编码 - * @param level 地域层级 - * @return 所有子区域(包含自己) - * @author WendyYang - **/ - List listChildren(String code, int level); - - /** - * 获取当前区域所有的子区域(包括自己) - * - * @param code 区域编码 - * @param level 级别 - * @return / - */ - Collection listChildRegionCodeList(String code, int level); - - /** - * 获取当前节点开始的区域树 - * - * @param regionCode 区域编码 - * @param regionLevel 区域层级 - * @return 区域树 - */ - RegionTreeVO getRegionTree(String regionCode, Integer regionLevel); - - /** - * 获取展示名称(浙江省/杭州市/滨江区) - * - * @param regionCode 区域编码 - * @param regionLevel 区域层级 - * @return java.lang.String - **/ - String getFullDisplayName(String regionCode, Integer regionLevel); - - /** - * 获取展示名称(杭州市/滨江区) - * - * @param regionCode 区域编码 - * @param regionLevel 区域层级 - * @return java.lang.String - **/ - String getDisplayName(String regionCode, Integer regionLevel); - - - /** - * 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用 - * - * @param code 区域编码 - * @param level 区域层级 - * @return \ - */ - String getUnionPath(String code, Integer level); - - /** - * 根据区域名称获取区域信息(参数格式:浙江省-杭州市-滨江区) - * - * @param regionName 地区名称 - * @return \ - **/ - RegionDTO getByRegionName(String regionName); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java deleted file mode 100644 index 4428076..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.common.helper; - -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/12/21 下午5:37 - * 区域限制帮助类 - */ - -public interface RegionLimitHelper { - /** - * 校验层级包含关系 - * - * @param regionContainsBOList / - * @param regionCode / - * @param regionLevel / - * @return / - */ - Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel); - - /** - * 查询操作 包含区域包含列表装配 - * - * @param queryRegionContainBo 查询区域范围列表 - * @param expertAdminContainsRegionList 专家管理员可管理的区域范围列表 - * @return / - */ - List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList); - - /** - * 根据 区域层级-区域编码 获取区域包含列表 - * - * @param regionLevel 区域层级 - * @param regionCode 区域编码 - * @return / - */ - RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); - - - - /** - * 根据专家管理员用户id 获取专家管理员管辖区域列表 - * - * @param expertAdminUserId 专家管理员用户id - * @return - */ - List getExpertAdminContainsRegion(Long expertAdminUserId); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java deleted file mode 100644 index 74864bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.common.helper; - -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; - -import java.util.Collection; -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:38 - * @Description: 用户信息管理工具类 helper - */ - -public interface UserInfoHelper { - - /** - * 根据用户id 获取 用户所属组织code organizationCode - * - * @param userId - * @return - */ - String getOrganizationCode(Long userId); - - UserFullInfoDTO getUserFullInfo(Long userId); - - UserFullInfoDTO getUserFullInfo(UserInfo userInfo); - - List getUserFullInfos(List userInfos); - - String getUserName(Long userId); - - /** - * 判断该用户是否是区管或者超管 - * - * @return - */ - boolean isSuperOrRegionAdmin(Long userId); - - UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); - - List getUserFullInfoByEmployeeCodes(Collection employeeCodes); - - /** - * 获取用户任职所在单位code - * - * @return - */ - String getUserEmpPosUnitCode(Long userId); - - String getMainOrgCode(String empPosUnitCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java deleted file mode 100644 index 4296134..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.common.helper.basic; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.model.RegionMapKey; -import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -/** - *

- * AbstractRegionCache - *

- * - * @author WendyYang - * @since 14:41 2023/3/1 - */ -@Slf4j -public abstract class AbstractRegionCacheHelper implements InitializingBean { - - private static final String PARENT_CODE_ROOT = "-1"; - - @Autowired - private IRegionService regionService; - - protected LoadingCache regionsCache; - - private void initRegionCache() { - List allRegions = regionService.all(); - if (allRegions.isEmpty()) { - log.warn("区域元数据未初始化"); - return; - } - allRegions.forEach(w -> { - RegionMapKey key = RegionMapKey.of(w.getRegionCode(), w.getRegionLevel()); - regionsCache.put(key, w); - }); - } - - protected RegionDTO get(RegionMapKey key) { - return regionsCache.get(key); - } - - protected List all() { - return Lists.newArrayList(regionsCache.asMap().values()); - } - - @Override - public void afterPropertiesSet() { - regionsCache = Caffeine.newBuilder() - .refreshAfterWrite(7, TimeUnit.DAYS) - .maximumSize(512) - .build(key -> { - Region region = regionService.getOne(key.getRegionCode(), key.getRegionLevel()); - if (Objects.isNull(region)) { - //查不到直接返回null - return null; - } - return RegionConverter.toRegionDTO(region); - }); - // 初始化所有区域数据到缓存 - initRegionCache(); - } - - public String getParentCodeRoot() { - return PARENT_CODE_ROOT; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java deleted file mode 100644 index 67dcad9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.common.helper.basic; - -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.RegionLimitHelper; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import lombok.AllArgsConstructor; - -import java.util.Objects; - -/** - *

- * AbstractRegionLimitHelper - *

- * - * @author WendyYang - * @since 14:35 2023/3/1 - */ -@AllArgsConstructor -public abstract class AbstractRegionLimitHelper implements RegionLimitHelper { - - protected final RegionCacheHelper regionCache; - protected final IExpertUserFullInfoService expertUserFullInfoService; - protected final IUserInfoService iUserInfoService; - protected final IRegionService regionService; - - - /** - * 根据 专家用户id 获取专家层级 - * - * @param expertUserId / - * @return / - */ - protected ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { - ExpertUserFullInfo userFullInfo = expertUserFullInfoService.getByUserId(expertUserId); - if (Objects.isNull(userFullInfo)) { - return new ExpertRegionInfo(); - } - ExpertRegionInfo regionInfo = new ExpertRegionInfo(); - regionInfo.setRegionCode(userFullInfo.getRegionCode()); - regionInfo.setRegionLevel(userFullInfo.getRegionLevel()); - return regionInfo; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java deleted file mode 100644 index aa62183..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.ningdatech.pmapi.common.helper.impl; - -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import org.apache.commons.collections4.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/8/1 下午2:27 - */ -@Component -public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { - - private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); - - public RegionLimitHelperImpl(RegionCacheHelper regionCache, IExpertUserFullInfoService expertUserFullInfoService - , IUserInfoService iUserInfoService, IRegionService regionService) { - super(regionCache, expertUserFullInfoService, iUserInfoService, regionService); - } - - public static Boolean contains(Integer adminRegionLevel, List adminAllContainsRegionCodes - , Integer expertRegionLevel, String expertRegionCode) { - for (String adminAllContainsRegionCode : adminAllContainsRegionCodes) { - if (adminAllContainsRegionCode.equals(expertRegionCode) && adminRegionLevel >= expertRegionLevel) { - return true; - } - } - return false; - } - - @Override - public Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel) { - for (RegionContainsBO regionContainsBO : regionContainsBOList) { - Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); - List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); - for (String containsRegionCode : containsRegionCodeList) { - if (containsRegionCode.equals(regionCode) && parentRegionTreeLevel <= regionLevel) { - return true; - } - } - } - return false; - } - - - @Override - public List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList) { - List resultBoList = new ArrayList<>(); - if (Objects.nonNull(queryRegionContainBo)) { - List containsRegionCodeList = queryRegionContainBo.getContainsRegionCodeList(); - // 查询取并级 - if (CollectionUtils.isNotEmpty(expertAdminContainsRegionList)) { - for (RegionContainsBO regionContainsBO : expertAdminContainsRegionList) { - List regionCodeList = regionContainsBO.getContainsRegionCodeList(); - regionCodeList.retainAll(containsRegionCodeList); - if (CollectionUtils.isNotEmpty(regionCodeList)) { - regionContainsBO.setContainsRegionCodeList(regionCodeList); - resultBoList.add(regionContainsBO); - } - } - } - return resultBoList; - } else { - return expertAdminContainsRegionList; - } - } - - @Override - public RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode) { - Collection regionCodes = regionCache.listChildRegionCodeList(regionCode, regionLevel); - RegionContainsBO regionContains = new RegionContainsBO(); - regionContains.setContainsRegionCodeList(new ArrayList<>(regionCodes)); - regionContains.setParentRegionTreeLevel(regionLevel); - return regionContains; - } - - - @Override - public List getExpertAdminContainsRegion(Long expertAdminUserId) { - if (Objects.isNull(expertAdminUserId)) { - logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); - return new ArrayList<>(); - } - - UserInfo userInfo = iUserInfoService.getById(expertAdminUserId); - - if (Objects.isNull(userInfo) || StringUtils.isBlank(userInfo.getRegionCode())) { - logger.error("getExpertAdminContainsRegion userInfo is null Or regionCode is null"); - return new ArrayList<>(); - } - - String regionCode = userInfo.getRegionCode(); - List regionList = regionService.list(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, regionCode) - .orderByDesc(Region::getRegionLevel)); - - Region region = regionList.get(0); - Collection regionCodes = regionCache - .listChildRegionCodeList(region.getRegionCode(), region.getRegionLevel()); - RegionContainsBO regionContainsBO = new RegionContainsBO(); - regionContainsBO.setContainsRegionCodeList(new ArrayList<>(regionCodes)); - regionContainsBO.setParentRegionTreeLevel(region.getRegionLevel()); - - ArrayList regionContainsBOS = CollectionUtil.toList(regionContainsBO); - - return regionContainsBOS; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java deleted file mode 100644 index bf2a57c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.ningdatech.pmapi.common.helper.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.text.StrPool; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.basic.AbstractRegionCacheHelper; -import com.ningdatech.pmapi.common.model.RegionMapKey; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; -import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/22 上午8:58 - * 构建地区码 地区树 - */ -@Slf4j -@Component -public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements RegionCacheHelper { - - @Override - public RegionDTO getByCodeAndLevel(String code, Integer level) { - if (StringUtils.isBlank(code) || Objects.isNull(level)) { - return null; - } - return super.get(RegionMapKey.of(code, level)); - } - - @Override - public String getRegionName(String code, int level) { - RegionDTO dto = getByCodeAndLevel(code, level); - if (Objects.nonNull(dto)) { - return dto.getRegionName(); - } - return StringUtils.EMPTY; - } - - @Override - public List all() { - return super.all(); - } - - @Override - public Collection listChildRegionCodeList(String regionCode, int regionLevel) { - RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); - if (Objects.isNull(currRegion)) { - return Collections.emptyList(); - } - if (currRegion.getParentCode().equals(regionCode)) { - return Collections.singletonList(regionCode); - } - List allRegions = all(); - return allRegions.stream().filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) - .map(RegionDTO::getRegionCode).collect(Collectors.toSet()); - } - - @Override - public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { - Map> regions; - Long parentId; - if (regionCode == null || regionCode.equals(RegionConst.RC_CHINA)) { - regions = CollUtils.group(all(), RegionDTO::getParentId); - parentId = RegionConst.PID_CHINA; - } else { - RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); - if (currRegion.getParentCode().equals(regionCode)) { - return RegionConverter.toRegionTreeVO(currRegion); - } - regions = all().stream() - .filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) - .collect(Collectors.groupingBy(RegionDTO::getParentId)); - parentId = currRegion.getParentId(); - } - regions.values().forEach(w -> w.sort(Comparator.comparing(x -> Long.parseLong(x.getRegionCode())))); - return RegionConverter.toRegionTree(parentId, regions, false).get(0); - } - - @Override - public String getFullDisplayName(String regionCode, Integer regionLevel) { - RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); - return getDisplayName(regionCurr, RegionConst.RL_PROVINCE); - } - - @Override - public String getDisplayName(String regionCode, Integer regionLevel) { - RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); - return getDisplayName(regionCurr, RegionConst.RL_CITY); - } - - //------------------------------------------------------------------------------------------------------------------ - - /** - * 获取指定层级的展示名称 - * - * @param region 当前区域 - * @param sLevel 开始层级 - * @return 展示名称 - */ - private String getDisplayName(RegionDTO region, int sLevel) { - if (Objects.isNull(region)) { - return StringUtils.EMPTY; - } - Integer level = region.getRegionLevel(); - if (RegionConst.RL_PROVINCE > sLevel || sLevel > level) { - throw BizException.wrap("区域层级无效"); - } - if (sLevel == level) { - return region.getRegionName(); - } - StringBuilder builder = new StringBuilder(); - List regionCodes = StrUtils.split(region.getRegionCodePath()); - for (int i = regionCodes.size() - 2; i > 0; i--) { - if (level <= sLevel) { - break; - } - RegionDTO tmp = getByCodeAndLevel(regionCodes.get(i), --level); - builder.insert(0, StrPool.SLASH); - builder.insert(0, tmp.getRegionName()); - } - builder.append(region.getRegionName()); - return builder.toString(); - } - - protected List getCopyListByLevel(int level) { - List regions = all().stream() - .filter(w -> w.getRegionLevel() <= level) - .collect(Collectors.toList()); - return RegionConverter.toRegionTreeDTOList(regions); - } - - /** - * 获取某一个地区开始的层级树 - * - * @param list 地区集合 - * @param code 地区编码 - * @param level 地区层级 - * @return / - */ - private RegionTreeDTO getTreeByRegionAndCode(List list, String code, int level) { - if (CollectionUtils.isEmpty(list)) { - list = getCopyListByLevel(3); - if (CollectionUtils.isEmpty(list)) { - return null; - } - } - Optional first = list.stream() - .filter(w -> w.getRegionCode().equals(code) && w.getLevel() == level) - .findFirst(); - if (first.isPresent()) { - return first.get(); - } - for (RegionTreeDTO dto : list) { - if (CollectionUtils.isEmpty(dto.getChildren())) { - continue; - } - RegionTreeDTO temp = getTreeByRegionAndCode(dto.getChildren(), code, level); - if (temp != null) { - return temp; - } - } - return null; - } - - @Override - public List listParents(String code, int level) { - List result = new ArrayList<>(); - RegionDTO dto = getByCodeAndLevel(code, level); - result.add(0, dto); - if (RegionConst.RC_CHINA.equals(dto.getParentCode())) { - return result; - } - result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1)); - return result; - } - - @Override - public List listChildren(String code, int level) { - RegionDTO curr = getByCodeAndLevel(code, level); - if (curr.getParentCode().equals(curr.getRegionCode())) { - return Collections.singletonList(curr); - } - return all().stream() - .filter(w -> StrUtils.split(w.getRegionCodePath()).contains(code)) - .collect(Collectors.toList()); - } - - - @Override - public String getUnionPath(String code, Integer level) { - if (StrUtils.isBlank(code) || Objects.isNull(level)) { - return StrUtils.EMPTY; - } - List unionPathStrList = new ArrayList<>(); - buildUnionPathStrList(code, level, unionPathStrList); - Collections.reverse(unionPathStrList); - if (CollUtil.isEmpty(unionPathStrList)) { - return StrUtils.EMPTY; - } - return String.join("@@", unionPathStrList); - } - - @Override - public RegionDTO getByRegionName(String regionName) { - if (StrUtils.isBlank(regionName)) { - return null; - } - String[] regionArray = regionName.split("-"); - int length = regionArray.length; - return all().stream() - .filter(w -> { - boolean lastEq = w.getRegionLevel().equals(length) - && w.getRegionName().equals(regionArray[length - 1]); - if (lastEq && length > 1) { - RegionDTO parent = getByCodeAndLevel(w.getParentCode(), w.getRegionLevel() - 1); - return parent.getRegionName().equals(regionArray[length - 2]); - } - return false; - }).findFirst().orElse(null); - } - - protected void buildUnionPathStrList(String code, Integer level, List unionPathStrList) { - if (level <= 0 || super.getParentCodeRoot().equals(code)) { - return; - } - RegionDTO regionDTO = getByCodeAndLevel(code, level); - unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel()); - if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) { - buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java deleted file mode 100644 index 5fc715a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.ningdatech.pmapi.common.helper.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sys.mapper.RoleMapper; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:40 - */ -@Component -@RequiredArgsConstructor -public class UserInfoHelperImpl implements UserInfoHelper { - - - private final IUserInfoService userInfoService; - private final IDingEmployeeInfoService iDingEmployeeInfoService; - private final IDingOrganizationService iDingOrganizationService; - private final IUserRoleService iUserRoleService; - private final RoleMapper roleMapper; - - @Override - public String getOrganizationCode(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - return userFullInfo.getOrganizationCode(); - } - - @Override - public UserFullInfoDTO getUserFullInfo(Long userId) { - UserInfo userInfo = userInfoService.getById(userId); - if (Objects.isNull(userInfo)) { - return null; - } - // 返回用户全量信息 - return getUserFullInfo(userInfo); - } - - @Override - public UserFullInfoDTO getUserFullInfo(UserInfo userInfo) { - UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); - // 获取浙政钉雇员信息 组织信息 - String employeeCode = userInfo.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)) { - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .eq(DingEmployeeInfo::getMainJob, "true")); - DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); - - - // 装配用户任职所在单位 - String empPosUnitCode = dingEmployeeInfo.getEmpPosUnitCode(); - if (StringUtils.isNotBlank(empPosUnitCode)) { - DingOrganization dingOrganization = iDingOrganizationService.getByOrgCode(empPosUnitCode); - if (Objects.nonNull(dingOrganization)) { - userFullInfo.setEmpPosUnitCode(empPosUnitCode); - userFullInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userFullInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - } - - // 装配用户所在orgCode - String organizationCode = dingEmployeeInfo.getOrganizationCode(); - List dingOrganizationList = iDingOrganizationService.list(Wrappers - .lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, organizationCode)); - if (CollectionUtil.isNotEmpty(dingOrganizationList)) { - DingOrganization dingOrganization = dingOrganizationList.get(0); - userFullInfo.setOrganizationCode(dingOrganization.getOrganizationCode()); - userFullInfo.setOrganizationName(dingOrganization.getOrganizationName()); - // 测试使用 - userFullInfo.setRegionLevel(3); - } - } - - List roleList = new ArrayList<>(); - // 获取用户角色列表信息 - List userRoleList = iUserRoleService - .list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userInfo.getId())); - if (CollectionUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream() - .map(UserRole::getRoleId).distinct() - .collect(Collectors.toList()); - roleList = roleMapper.selectBatchIds(roleIdList); - } - userFullInfo.setUserRoleList(roleList); - - // 装配用户任职所在单位 - - // 装配返回 - userFullInfo.setUserId(userInfo.getId()); - userFullInfo.setIdentifier(userInfo.getRealName()); - userFullInfo.setRealName(userInfo.getRealName()); - userFullInfo.setEmployeeCode(employeeCode); - userFullInfo.setUsername(userInfo.getRealName()); - userFullInfo.setMobile(userInfo.getMobile()); - userFullInfo.setAccountId(userInfo.getAccountId()); - - String available = userInfo.getAvailable(); - if (StringUtils.isNotBlank(available)) { - userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); - } - return userFullInfo; - } - - /** - * 批量查询 这里 会没有角色 - * - * @param userInfos \ - * @return \ - */ - @Override - public List getUserFullInfos(List userInfos) { - if (CollUtil.isEmpty(userInfos)) { - return Collections.emptyList(); - } - Map userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, e -> e)); - // 获取浙政钉雇员信息 组织信息 - List employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .in(DingEmployeeInfo::getEmployeeCode, employeeCodes) - .eq(DingEmployeeInfo::getMainJob, "true")); - - if (CollUtil.isEmpty(dingEmployeeInfoList)) { - return Collections.emptyList(); - } - - // 装配用户任职所在单位 - List empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); - List orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); - List allOrgCodes = Stream.concat(empPosUnitCodes.stream(), orgCodes.stream()).collect(Collectors.toList()); - if (CollUtil.isEmpty(allOrgCodes)) { - return Collections.emptyList(); - } - List dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); - if (CollUtil.isEmpty(dingOrganizations)) { - return Collections.emptyList(); - } - Map orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, d -> d)); - - return dingEmployeeInfoList.stream().map(e -> { - UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); - if (orgMap.containsKey(e.getEmpPosUnitCode())) { - DingOrganization organization = orgMap.get(e.getEmpPosUnitCode()); - userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode()); - userFullInfo.setEmpPosUnitName(organization.getOrganizationName()); - userFullInfo.setRegionCode(organization.getDivisionCode()); - } - if (orgMap.containsKey(e.getOrganizationCode())) { - DingOrganization organization = orgMap.get(e.getOrganizationCode()); - userFullInfo.setOrganizationCode(organization.getOrganizationCode()); - userFullInfo.setOrganizationName(organization.getOrganizationName()); - // 测试使用 - userFullInfo.setRegionLevel(3); - } - if (userMap.containsKey(e.getEmployeeCode())) { - UserInfo userInfo = userMap.get(e.getEmployeeCode()); - // 装配返回 - userFullInfo.setUserId(userInfo.getId()); - userFullInfo.setIdentifier(userInfo.getRealName()); - userFullInfo.setRealName(userInfo.getRealName()); - userFullInfo.setEmployeeCode(e.getEmployeeCode()); - userFullInfo.setUsername(userInfo.getRealName()); - userFullInfo.setMobile(userInfo.getMobile()); - userFullInfo.setAccountId(userInfo.getAccountId()); - String available = userInfo.getAvailable(); - if (StringUtils.isNotBlank(available)) { - userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); - } - } - return userFullInfo; - }).collect(Collectors.toList()); - } - - @Override - public String getUserName(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - return userFullInfo.getRealName(); - } - - @Override - public boolean isSuperOrRegionAdmin(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - if (CollUtil.isNotEmpty(userFullInfo.getUserRoleList())) { - for (Role role : userFullInfo.getUserRoleList()) { - if (RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) || - RoleEnum.REGION_MANAGER.name().equals(role.getCode())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; - } - - @Override - public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { - UserInfo userInfo = userInfoService.getUserInfoByEmployeeCode(employeeCode); - return getUserFullInfo(userInfo); - } - - @Override - public List getUserFullInfoByEmployeeCodes(Collection employeeCodes) { - List userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); - return getUserFullInfos(userInfos); - } - - @Override - public String getUserEmpPosUnitCode(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - return userFullInfo.getEmpPosUnitCode(); - } - - @Override - public String getMainOrgCode(String empPosUnitCode) { - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, empPosUnitCode) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(org)){ - return null; - } - return org.getParentCode(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/interceptor/LogInterceptor.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/interceptor/LogInterceptor.java deleted file mode 100644 index 084c92f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/interceptor/LogInterceptor.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.common.interceptor; - -import cn.hutool.core.lang.UUID; -import com.ningdatech.pmapi.common.util.MDCUtil; -import org.springframework.lang.NonNull; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - *

- * LogInterceptor - *

- * - * @author WendyYang - * @since 2023/10/26 - **/ -public class LogInterceptor implements HandlerInterceptor { - - @Override - public boolean preHandle(@NonNull HttpServletRequest request, - @NonNull HttpServletResponse response, - @NonNull Object handler) { - String traceId = UUID.randomUUID().toString(true); - response.addHeader(MDCUtil.TRACE_ID_HEADER, traceId); - MDCUtil.setTraceId(traceId); - return true; - } - - @Override - public void afterCompletion(@NonNull HttpServletRequest request, - @NonNull HttpServletResponse response, - @NonNull Object handler, Exception ex) { - MDCUtil.removeTraceId(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java deleted file mode 100644 index 7e97c54..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:34 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class CommonPage implements Serializable { - private static final long serialVersionUID = 1L; - private int currentPageNumber; - private Long itemsTotal; - private List items; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java deleted file mode 100644 index 945ca97..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:19 - */ -@Data -public class CommonPageReq { - private static final long serialVersionUID = 1L; - private int pageSize; - private int pageNumber; - - public int getOffset() { - return (this.getPageNumber() - 1) * this.getPageSize(); - } - - public int getLimit() { - return this.getPageSize(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ExpertRegionModifyDiffBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ExpertRegionModifyDiffBO.java deleted file mode 100644 index 13a7d0a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ExpertRegionModifyDiffBO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午4:34 - */ -@Data -public class ExpertRegionModifyDiffBO { - - private List addList; - - private List removeList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FileBasicInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FileBasicInfo.java deleted file mode 100644 index 5acb8da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FileBasicInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/25 下午1:55 - * 用于包装使用 - */ -@Data -@ApiModel("文件信息基类") -public class FileBasicInfo { - - @ApiModelProperty("文件id") - private Long fileId; - - @ApiModelProperty("文件url") - private String url; - - @ApiModelProperty("文件名") - private String fileName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FreemarkerBatchExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FreemarkerBatchExportDTO.java deleted file mode 100644 index 7221f81..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/FreemarkerBatchExportDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.Data; - -/** - *

- * FreemarkerBatchExportDTO - *

- * - * @author WendyYang - * @since 2023/8/1 - **/ -@Data -public class FreemarkerBatchExportDTO { - - private String fileName; - - private String template; - - private Object data; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java deleted file mode 100644 index 213b0f6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.util.Objects; - -/** - *

- * RegionMapKey - *

- * - * @author WendyYang - * @since 13:54 2023/3/1 - */ -@Data -@AllArgsConstructor -public class RegionMapKey { - - public static RegionMapKey of(String regionCode, int regionLevel) { - return new RegionMapKey(regionCode, regionLevel); - } - - /** - * 区域码 - */ - private String regionCode; - - /** - * 地区级别 - */ - private Integer regionLevel; - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RegionMapKey regionMapKey = (RegionMapKey) o; - return regionCode.equals(regionMapKey.getRegionCode()) - && regionLevel.equals(regionMapKey.getRegionLevel()); - } - - @Override - public int hashCode() { - return Objects.hash(regionCode, regionLevel); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ReqRegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ReqRegionDTO.java deleted file mode 100644 index e0693b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ReqRegionDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.Data; - -/** - *

- * ReqRegionDTO - *

- * - * @author WendyYang - * @since 2023/8/4 - **/ -@Data -public class ReqRegionDTO { - - private String regionCode; - - private Integer regionLevel; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ZwddTokenUser.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ZwddTokenUser.java deleted file mode 100644 index c3c99c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/ZwddTokenUser.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.common.model; - -import lombok.Data; - -@Data -public class ZwddTokenUser { - private Long accountId; - - private String employeeCode; - - private String employeeName; - - private String mobile; - - private Long tenantId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/CountGroupByDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/CountGroupByDTO.java deleted file mode 100644 index 9c4de54..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/CountGroupByDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import lombok.Data; - -/** - *

- * CountGroupByDto - *

- * - * @author WendyYang - * @since 15:44 2022/8/28 - */ -@Data -public class CountGroupByDTO { - - private Integer total; - - private T groupKey; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/DataDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/DataDTO.java deleted file mode 100644 index 8368d6c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/DataDTO.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.math.BigDecimal; - -/** - *

- * DataDTO - *

- * - * @author ZPF - * @since 16:40 2023/12/05 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class DataDTO { - - public static DataDTO of(String name,Integer num){ - DataDTO dataDTO = new DataDTO(); - dataDTO.setName(name); - dataDTO.setNum(num); - return dataDTO; - } - - public static DataDTO of(String name,String code,Integer num){ - DataDTO dataDTO = new DataDTO(); - dataDTO.setName(name); - dataDTO.setCode(code); - dataDTO.setNum(num); - return dataDTO; - } - - public static DataDTO of(String name,BigDecimal amount){ - DataDTO dataDTO = new DataDTO(); - dataDTO.setName(name); - dataDTO.setAmount(amount); - return dataDTO; - } - - public static DataDTO of(String name,String code,BigDecimal amount){ - DataDTO dataDTO = new DataDTO(); - dataDTO.setName(name); - dataDTO.setCode(code); - dataDTO.setAmount(amount); - return dataDTO; - } - - public static DataDTO ofRate(String name,BigDecimal rate){ - DataDTO dataDTO = new DataDTO(); - dataDTO.setName(name); - dataDTO.setRate(rate); - return dataDTO; - } - - @ApiModelProperty("编号") - private String code; - - @ApiModelProperty("名称") - private String name; - - @ApiModelProperty("数量") - private Integer num = 0; - - @ApiModelProperty("金额") - private BigDecimal amount = BigDecimal.ZERO; - - @ApiModelProperty("比例") - private BigDecimal rate = BigDecimal.ZERO; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java deleted file mode 100644 index 3991490..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 待办中心待我处理项目列表导出实体 - * - * @author CMM - * @since 2023/01/19 16:42 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor - -public class ExcelExportDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ExcelProperty("项目ID") - private Long id; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("行政区划编码") - private String areaCode; - - @ExcelProperty("行政区划名称") - private String area; - - @ExcelProperty("项目负责人") - private String responsibleMan; - - @ExcelProperty("项目负责人手机号") - private String responsibleManMobile; - - @ExcelProperty("项目联系人") - private String contactName; - - @ExcelProperty("项目联系人手机号") - private String contactPhone; - - @ExcelProperty("上级业务主管单位") - private String higherSuperOrg; - - @ExcelProperty("上级主管单位浙政钉ID") - private String higherSuperOrgCode; - - @ExcelProperty("本级主管部门") - private String superOrg; - - @ExcelProperty("本级主管部门浙政钉ID") - private String superOrgCode; - - @ExcelProperty("建设单位名称") - private String buildOrgName; - - @ExcelProperty("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ExcelProperty("建设单位统一信用代码") - private String buildOrgCode; - - @ExcelProperty("项目类型") - private Integer projectType; - - @ExcelProperty("是否首次新建") - private Integer isFirst; - - @ExcelProperty("关联应用") - private String relatedExistsApplication; - - @ExcelProperty("关联应用IRS编码") - private String relatedExistsApplicationCode; - - @ExcelProperty("申报金额(万元)") - private BigDecimal declareAmount; - - @ExcelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ExcelProperty("预算来源") - private String budgetSource; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("项目简介") - private String projectIntroduction; - - @ExcelProperty("立项依据") - private String buildBasis; - - @ExcelProperty("建设层级") - private String buildLevel; - - @ExcelProperty("发改编码") - private String developCode; - - @ExcelProperty("财政编码") - private String financialCode; - - @ExcelProperty("信息是否有效") - private Boolean informationValidity; - - @ExcelProperty("是否数字化改革项目") - private Integer isDigitalReform; - - @ExcelProperty("综合应用领域") - private String bizDomain; - - @ExcelProperty("是否上云") - private Integer isCloud; - - @ExcelProperty("云类型") - private String cloudType; - - @ExcelProperty("四大体系") - private Integer fourSystems; - - @ExcelProperty("是否临时增补") - private Integer isTemporaryAugment; - - @ExcelProperty("等保级别") - private Integer protectionLevel; - - @ExcelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ExcelProperty("业务编号") - private String businessNumber; - - @ExcelProperty("业务名称") - private String businessName; - - @ExcelProperty("单位名称") - private String orgName; - - @ExcelProperty("软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ExcelProperty("云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ExcelProperty("第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ExcelProperty("投入项") - private String safetyInputTitle; - - @ExcelProperty("内容描述") - private String safetyInputDescribe; - - @ExcelProperty("金额(万元)") - private BigDecimal safetyInputAmount; - - @ExcelProperty("年度支付金额(万元)") - private BigDecimal annualPlanAmount; - - @ExcelProperty("自有资金(万元)") - private BigDecimal annualPlanHaveAmount; - - @ExcelProperty("政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ExcelProperty("政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ExcelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ExcelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ExcelProperty("第一季度") - private String engineeringSpeedOne; - - @ExcelProperty("第二季度") - private String engineeringSpeedTwo; - - @ExcelProperty("第三季度") - private String engineeringSpeedThree; - - @ExcelProperty("第四季度") - private String engineeringSpeedFour; - - @ExcelProperty("初步方案") - private String preliminaryPlanFile; - - @ExcelProperty("附件-佐证材料") - private String supportingMaterialsFile; - - @ExcelProperty("备注") - private String projectRemarks; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportWriter.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportWriter.java deleted file mode 100644 index ac77f57..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportWriter.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Collection; -import java.util.List; - - -/** - * 文件模板导出对象 - * @author CMM - * @since 2023/02/11 11:26 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExcelExportWriter { - /** - * 文件名称 - */ - private String fileName; - - /** - * sheet 名称数组 - */ - private List sheets; - - /** - * 是否启用 头部Excel属性。 - * 如果使用,则会读取 class对象注解 ExcelProperty 属性值。 - * 不启用:则会根据heads 动态对列名称去便利 - */ - private Boolean headPropertyFlag; - - /** - * 头部属性class - */ - private Class headPropertyClass; - - /** - * 动态列名称 - * 描述: - * 第一个List 代表:sheet 列表集合 - * 第二个List 代表:表体行数据(集合) - * 第三个list 代表:表体列数据(集合) - */ - private List>> heads; - - - /** - * 数据对象 - * 1、对象写:根据对象固定字段写(分为三层) - * 第二个List 代表:表体行数据(集合) - * 第三个对象(class) 对象 - * List - * - * 2、无对象写(动态表体数据) 分为三层 - * 第一个List 代表:表体行数据(集合) - * 第二个list 代表:表体列数据(集合) - * List> - */ - private Collection datas; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/KeyValDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/KeyValDTO.java deleted file mode 100644 index c932655..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/KeyValDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

- * KeyValueDTO - *

- * - * @author WendyYang - * @since 16:40 2022/8/31 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class KeyValDTO { - - private K key; - - private V value; - - public static KeyValDTO of(K k, V v) { - return new KeyValDTO<>(k, v); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/MenuTreeEntity.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/MenuTreeEntity.java deleted file mode 100644 index 9c25903..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/MenuTreeEntity.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; - -/** - * 包括id、create_time、created_by、updated_by、update_time、label、parent_id、sort_value 字段的表继承的树形实体 - * - * @author PoffyZhang - * @since 2022/09/30 - */ -@Getter -@Setter -@Accessors(chain = true) -@ToString(callSuper = true) -public class MenuTreeEntity { - - @TableId(value = "id", type = IdType.AUTO) - protected Long id; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotEmpty(message = "名称不能为空") - @Size(max = 255, message = "名称长度不能超过255") - @TableField(value = "name", condition = LIKE) - protected String name; - - /** - * 菜单标题 - */ - @ApiModelProperty(value = "菜单标题") - @NotEmpty(message = "菜单标题不能为空") - @Size(max = 255, message = "菜单标题长度不能超过255") - @TableField(value = "title", condition = LIKE) - protected String title; - - /** - * 父菜单ID - */ - @ApiModelProperty(value = "父ID") - @TableField(value = "pid") - protected Long pid; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序号") - @TableField(value = "sort") - protected Integer sort; - - /** - * 顶层菜单 - */ - @ApiModelProperty(value = "顶层菜单") - @TableField(exist = false) - protected String topMenu; - - /** - * 路径 - */ - @ApiModelProperty(value = "路径") - @Size(max = 255, message = "路径长度不能超过255") - @TableField(value = "path", condition = LIKE) - protected String path; - - - @ApiModelProperty(value = "子节点", hidden = true) - @TableField(exist = false) - protected List children; - - - /** - * 层级 - */ - @ApiModelProperty(value = "层级") - @TableField(exist = false) - protected Integer level = 1; - - - /** - * 初始化子类 - */ - @JsonIgnore - public void initChildren() { - if (getChildren() == null) { - this.setChildren(new ArrayList<>()); - } - } - - @JsonIgnore - public void addChildren(E child) { - initChildren(); - children.add(child); - } - - public Integer getSize() { - if (CollUtil.isNotEmpty(getChildren())) { - return getChildren().size(); - } - return 0; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ViewRegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ViewRegionDTO.java deleted file mode 100644 index 9901790..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ViewRegionDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.common.model.entity; - -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.util.Collection; - -/** - *

- * ViewRegionDTO - *

- * - * @author WendyYang - * @since 2023/4/27 - **/ -@Data -@AllArgsConstructor -public class ViewRegionDTO { - - private Collection regions; - - private Integer regionLevel; - -} 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 deleted file mode 100644 index 1cf9af9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.StateContext; -import org.springframework.statemachine.action.Action; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SBJ_CODE) -public class ProjectDeclareAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java deleted file mode 100644 index e0f2ebf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import lombok.extern.slf4j.Slf4j; -import org.springframework.statemachine.StateContext; -import org.springframework.statemachine.action.Action; - -import java.util.List; - -import static com.ningdatech.pmapi.common.constant.StateMachineConst.APPLICATION_DECLARE; - -/** - * 项目申报状态机选择分支action类 - * - * @author CMM - * @since 2023/02/07 22:31 - */ -@Slf4j -public class ProjectDeclareChoiceAction implements Action { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @Override - public void execute(StateContext stateContext) { - log.info(String.valueOf(stateContext.getTarget().getId())); - ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId(); - switch (projectStatusEnum){ - case PENDING_PREQUALIFICATION_CHOICE: - preDeclareChoice(stateContext); - break; - case PREQUALIFICATION_WITHDRAW_CHOICE: - preWithDrawChoice(stateContext); - break; - case APPROVED_AFTER_CHOICE: - approvedAfterChoice(stateContext); - break; - default: - throw new IllegalStateException("Unexpected value: " + projectStatusEnum); - } - } - - private void approvedAfterChoice(StateContext stateContext) { - List projectApplications = stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("立项批复之后,项目的状态为:{}" + project.getStatus()); - // 判断 是否有初次创建的应用 - if (CollUtil.isEmpty(projectApplications)){ - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - final Boolean[] isFirstApp = {Boolean.FALSE}; - projectApplications.stream().forEach(app -> { - Integer isFirst = app.getIsFirst(); - if(isFirst.equals(CommonEnum.YES.getCode())){ - isFirstApp[0] = Boolean.TRUE; - } - }); - if(isFirstApp[0]){ - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()); - }else{ - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - } - - private void preDeclareChoice(StateContext stateContext) { - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); - }else { - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - } - - private void preWithDrawChoice(StateContext stateContext) { - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - }else { - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.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 deleted file mode 100644 index 868d2f8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 景宁畲族自治县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_JN_CODE) -public class ProjectDeclareJNAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index e5b4081..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 缙云县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_JY_CODE) -public class ProjectDeclareJYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index a72963f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 开发区 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_KFQ_CODE) -public class ProjectDeclareKFBAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index 7ac6a59..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 莲都区 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_LD_CODE) -public class ProjectDeclareLDAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index 4c6e792..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * ;龙泉市 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_LQ_CODE) -public class ProjectDeclareLQAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "TO_BE_APPROVED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index 6d127ac..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 青田县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_QT_CODE) -public class ProjectDeclareQTAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index 9906c7d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 庆元县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_QY_CODE) -public class ProjectDeclareQYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index b83c62a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 市本级 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SBJ_CODE) -public class ProjectDeclareSBJAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "TO_BE_FINALLY_INSPECTED") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index c5e6db5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 遂昌县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SC_CODE) -public class ProjectDeclareSCAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "APPROVED_AFTER_CHOICE") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); - } - - @OnTransition(source = "TO_BE_APP_REGISTER", target = "TO_BE_PURCHASED") - public void REGISTER_APP(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index e515925..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 松阳县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SY_CODE) -public class ProjectDeclareSYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.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 deleted file mode 100644 index 1498589..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.action; - -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 云和县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_YH_CODE) -public class ProjectDeclareYHAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @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()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java deleted file mode 100644 index 5e4fe1d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.persist.StateMachinePersister; - -/** - * 项目申报状态机 - * - * @author CMM - * @since 2023/02/07 15:56 - */ -public interface ProjectDeclareStateMachineBuilder { - StateMachine build() throws Exception; - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - StateMachine build(BeanFactory beanFactory) throws Exception; - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - StateMachinePersister getProjectPersister(); -} 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 deleted file mode 100644 index 80df271..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 景宁畲族自治县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineJNBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateMachineBuilder{ - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_JN_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineJNPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_JN_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index e6eca53..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 缙云县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineJYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_JY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineJYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_JY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index 670d0c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 开发区 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineKFQBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_KFQ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineKFQPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_KFQ_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index 669f3e4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 莲都区 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineLDBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_LD_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineLDPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_LD_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index f62873d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java +++ /dev/null @@ -1,286 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 龙泉市 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineLQBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_LQ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - - // 年度计划中开启方案申报,从年度计划中到立项批复 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineLQPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_LQ_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index 18ac62a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 青田县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineQTBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_QT_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineQTPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_QT_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index cca839d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 庆元县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineQYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_QY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineQYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_QY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index 0923d7c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 市本级 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSBJBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SBJ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSBJPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SBJ_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index af126d6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 遂昌县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSCBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateMachineBuilder{ - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SC_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .choice(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - .withChoice() - .source(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .first(ProjectStatusEnum.TO_BE_APP_REGISTER,projectDeclareGuardFactory.new ApprovedAfterChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.TO_BE_PURCHASED,new ProjectDeclareChoiceAction()).and() - //待所有应用都注册 并且 绑定了关系后 再进入下一状态 待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APP_REGISTER) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.REGISTER_APP).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSCPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SC_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index fc92307..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 松阳县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} 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 deleted file mode 100644 index e6dafa4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.builder; - -import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 云和县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineYHBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_YH_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .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) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineYHPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_YH_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/contants/RegionContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/contants/RegionContant.java deleted file mode 100644 index 43b7a5c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/contants/RegionContant.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.contants; - -/** - * @Classname RegionContant - * @Description - * @Date 2023/6/13 13:57 - * @Author PoffyZhang - */ -public class RegionContant { - //市本级 - public static final String LS_SBJ_CODE = "331100"; - //莲都区 - public static final String LS_LD_CODE = "331102"; - //青田县 - public static final String LS_QT_CODE = "331121"; - //缙云县 - public static final String LS_JY_CODE = "331122"; - //遂昌县 - public static final String LS_SC_CODE = "331123"; - //松阳县 - public static final String LS_SY_CODE = "331124"; - //云和县 - public static final String LS_YH_CODE = "331125"; - //庆元县 - public static final String LS_QY_CODE = "331126"; - //景宁畲族自治县 - public static final String LS_JN_CODE = "331127"; - //龙泉市 - public static final String LS_LQ_CODE = "331181"; - //开发区 - public static final String LS_KFQ_CODE = "331199"; - - public static final String MORE_CODE = "000"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java deleted file mode 100644 index 4c0f259..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.event; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.Objects; - -/** - * 项目状态改变事件 - * - * @author CMM - * @return - * @since 2023/02/07 9:22 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectStatusChangeEvent { - - /** - * 项目申报暂存(项目状态进入:待申报) - */ - PROJECT_APPLICATION_HOLD(null, null, null), - /** - * 项目申报提交(项目状态进入:单位内部审核中) - */ - PROJECT_APPLICATION_SUBMIT( ProjectStatusEnum.TO_BE_DECLARED.getCode(), null, null), - /** - * 单位内部审核驳回(项目状态进入:单位内部审核不通过) - */ - UNDER_INTERNAL_REJECT(null, ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode(), null), - /** - * 单位内部审核通过(项目状态进入:待预审) - */ - UNDER_INTERNAL_PASS(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode(), null, null), - /** - * 单位内部审核不通过重新提交(项目状态进入:单位内部审核中) - */ - UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),null,null), - - /** - * 预审申报(项目状态进入:待预审选择,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审中;否则项目状态变为:预审中) - */ - PRELIMINARY_REVIEW_DECLARE(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), null, null), - /** - * 省级部门联审不通过(项目状态变为:省级部门联审不通过) - */ - PROVINCIAL_DEPARTMENT_REVIEW_REJECT(null, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null), - /** - * 省级部门联审通过(项目状态变为:省级联审成功) - */ - PROVINCIAL_DEPARTMENT_REVIEW_PASS(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null, null), - - /** - * 去到预审(项目状态变为:预审中) - */ - PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode(), null, null), - /** - * 预审驳回(项目状态变为:预审不通过) - */ - PRELIMINARY_REVIEW_REJECT(null, ProjectStatusEnum.PRE_APPLYING.getCode(), null), - /** - * 预审不通过重新提交(项目状态变为:待预审选择) - */ - PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),null,null), - /** - * 预审通过(项目状态变为:部门联审中) - */ - PRELIMINARY_REVIEW_PASS(ProjectStatusEnum.PRE_APPLYING.getCode(), null, null), - /** - * 部门联审驳回(项目状态变为:部门联审不通过) - */ - DEPARTMENT_UNITED_REVIEW_REJECT(null, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), null), - /** - * 部门联审通过(项目状态变为:年度计划中) - */ - DEPARTMENT_UNITED_REVIEW_PASS(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), null, null), - /** - * 年度计划暂缓(项目状态变为:被暂缓) - */ - ANNUAL_PLAN_SUSPEND(null, ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode(), null), - /** - * 年度计划项目开启方案申报(项目状态变为:方案待申报) - */ - ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode(), null, null), - /** - * 申报方案(项目状态变为:方案评审中) - */ - DECLARE_PLAN( ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(), null, null), - /** - * 方案评审驳回(项目状态变为:方案评审不通过) - */ - PLAN_REVIEW_REJECT(null, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null), - /** - * 方案评审不通过重新提交(项目状态变为:方案评审中) - */ - PLAN_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(),null,null), - /** - * 方案评审通过(项目状态变为:待立项批复) - */ - PLAN_REVIEW_PASS(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null, null), - /** - * 立项批复(项目状态变为:已立项-待采购) - */ - PROJECT_APPROVAL(ProjectStatusEnum.TO_BE_APPROVED.getCode(), null, null), - - /** - * 注册应用 - */ - REGISTER_APP(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode(), null, null), - /** - * 采购备案(项目状态变为:待开工) - */ - PURCHASE_PUT_ON_RECORD(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), null, null), - - /** - * 开工 到建设中 - */ - START_TO_WORK(ProjectStatusEnum.OPERATION.getCode(), null,null), - /** - * 初验备案(项目状态变为:待终验) - */ - PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(), null, null), - /** - * 终验申请(项目状态变为:终验审核中) - */ - FINAL_ACCEPTANCE_APPLICATION(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(), null, null), - /** - * 终验审核不通过(项目状态变为:终验审核不通过) - */ - FINAL_ACCEPTANCE_REJECT(null, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode(), null), - /** - * 终验审核通过(项目状态变为:已归档) - */ - FINAL_ACCEPTANCE_PASS(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode(), null, null), - - // 下个节点还未提交审核意见时,流程发起人和前一个审核人可以点击撤回 - - /** - * 单位内部审核中时被撤回(项目状态进入:待申报) - */ - UNDER_INTERNAL_WITHDRAW(null, null, ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()), - /** - * 省级部门联审中时被撤回(项目状态进入:待预审) - */ - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(null, null, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()), - /** - * 预审中时被撤回(项目状态进入:待预审选择,,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审通过;否则项目状态变为:待预审) - */ - PRE_APPLYING_WITHDRAW(null, null, ProjectStatusEnum.PRE_APPLYING.getCode()), - /** - * 部门联审中时被撤回(项目状态进入:预审中) - */ - DEPARTMENT_JOINT_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()), - /** - * 方案评审中时被撤回(项目状态进入:方案待申报) - */ - SCHEME_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()), - /** - * 终验审核中时被撤回(项目状态进入:待终验) - */ - FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()), - - /** - * 重新提交 终验 - */ - FINAL_RE_ACCEPTANCE_APPLICATION(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), null, null); - - - private Integer passProjectStatusCode; - private Integer rejectProjectStatusCode; - private Integer withdrawProjectStatusCode; - - public static ProjectStatusChangeEvent getPassValueByCode(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { - if (code.equals(t.getPassProjectStatusCode())) { - return t; - } - } - return null; - } - - public static ProjectStatusChangeEvent getRejectValueByCode(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { - if (code.equals(t.getRejectProjectStatusCode())) { - return t; - } - } - return null; - } - - public static ProjectStatusChangeEvent getWithdrawValueByCode(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) { - if (code.equals(t.getWithdrawProjectStatusCode())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java deleted file mode 100644 index d4dd75b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.factory; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import org.springframework.statemachine.StateContext; -import org.springframework.statemachine.guard.Guard; - -import java.util.List; - -import static com.ningdatech.pmapi.common.constant.StateMachineConst.APPLICATION_DECLARE; - -/** - * 项目申报状态机guard集合类 - * - * @author CMM - * @since 2023/02/07 16:18 - */ - -public class ProjectDeclareGuardFactory { - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - public class PendingPreQualificationChoiceGuard implements Guard { - @Override - public boolean evaluate(StateContext context) { - Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ - return true; - } - return false; - } - } - - public class ApprovedAfterChoiceGuard implements Guard { - @Override - public boolean evaluate(StateContext context) { - List projectApplications = context.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); - final Boolean[] res = {Boolean.FALSE}; - // 判断 是否有初次创建的应用 - if (CollUtil.isEmpty(projectApplications)){ - return res[0]; - } - projectApplications.stream().forEach(app -> { - Integer isFirst = app.getIsFirst(); - if(isFirst.equals(CommonEnum.YES.getCode())){ - res[0] = Boolean.TRUE; - } - }); - return res[0]; - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/MachineBuilderFounder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/MachineBuilderFounder.java deleted file mode 100644 index 0416b1c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/MachineBuilderFounder.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.util; - -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.common.statemachine.builder.*; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.Map; - -/** - * 项目申报状态机 - * - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@Slf4j -public class MachineBuilderFounder { - - public final static Map machineBuilderMap = - Maps.newConcurrentMap(); - - @Autowired - private ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; - - @Autowired - private ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; - - @Autowired - private ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; - - @Autowired - private ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; - - @Autowired - private ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; - - @Autowired - private ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; - - @Autowired - private ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; - - @Autowired - private ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; - - @Autowired - private ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; - - @Autowired - private ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; - - @Autowired - private ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; - - @PostConstruct - public void MachineBuilderFounder(){ - machineBuilderMap.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); - machineBuilderMap.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); - machineBuilderMap.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); - machineBuilderMap.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); - machineBuilderMap.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); - machineBuilderMap.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); - machineBuilderMap.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); - machineBuilderMap.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); - machineBuilderMap.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); - machineBuilderMap.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); - machineBuilderMap.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java deleted file mode 100644 index 1760076..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.ningdatech.pmapi.common.statemachine.util; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.constant.StateMachineConst; -import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.wflow.exception.BusinessException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * 状态机工具类 - * - * @author CMM - * @since 2023/02/07 22:49 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class StateMachineUtils { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; - - private final INdProjectStatusChangeService projectStatusChangeService; - - private final IProjectApplicationService projectApplicationService; - - //通过审核 - public void pass(Project project) { - try{ - execute(project,getProjectStatusPassEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 通过失败 :{}",e.getMessage()); - throw new BusinessException("状态机 通过失败: " + e); - } - } - - //拒绝 - public void reject(Project project) { - try{ - execute(project,getProjectStatusRejectEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 拒绝失败 :{}",e.getMessage()); - throw new BusinessException("状态机 拒绝失败: " + e); - } - } - - //撤回 - public void withDraw(Project project) { - try{ - execute(project,getProjectStatusWithdrawEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 撤回失败 :{}",e.getMessage()); - throw new BusinessException("状态机 撤回失败: " + e); - } - } - - public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { - log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); - // 将状态变更记录保存到项目状态变更表中 - ProjectStatusChange projectStatusChange = new ProjectStatusChange(); - projectStatusChange.setBeforeStatus(project.getStatus()); - - ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.machineBuilderMap.get(project.getAreaCode()); - - VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); - //获取TO状态机 - StateMachine stateMachine = builder.build(); - Message message = MessageBuilder.withPayload(event) - .setHeader(PROJECT_DECLARE, project) - .setHeader(APPLICATION_DECLARE,projectApplicationService.getApplicationsByProject(project)) - .build(); - //初始化状态机 - StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); - projectDeclareStateMachinePersister.restore(stateMachine, project); - stateMachine.sendEvent(message); - projectStatusChange.setProjectId(project.getId()); - projectStatusChange.setAfterStatus(project.getStatus()); - projectStatusChange.setEvent(event.name()); - projectStatusChange.setCreateOn(LocalDateTime.now()); - projectStatusChange.setProjectCode(project.getProjectCode()); - // 插入项目状态变更表中 - projectStatusChangeService.save(projectStatusChange); - log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); - } - - /** - * 判断项目申报金额是否大于1000万元 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:13 - */ - public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { - int flag = project.getDeclareAmount().compareTo(targetAmount); - if (flag > 0 || flag == 0) { - return true; - } - return false; - } - - /** - * 判断申报项目是否为市级项目 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:05 - */ - public static boolean isCityProject(Project project) { - String areaCode = project.getAreaCode(); - if (areaCode.equals(RegionConst.RC_LS)) { - return true; - } - return false; - } - - public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的通过操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的驳回操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的撤回操作!"); - } - return event; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java deleted file mode 100644 index 9037deb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.file.entity.vo.result.FileResultVO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.util.NumberUtils; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.*; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static java.util.stream.Collectors.toList; - -/** - *

- * BizUtils - *

- * - * @author WendyYang - * @since 17:32 2023/1/29 - */ -public class BizUtils { - - private BizUtils() { - - } - - public static > void notEmpty(T objs, Consumer consumer) { - if (objs != null && !objs.isEmpty()) { - consumer.accept(objs); - } - } - - public static List splitToNum(String str, Class aClass) { - if (StrUtil.isEmpty(str)) { - return Collections.emptyList(); - } - return Arrays.stream(str.split(StrPool.COMMA)) - .map(w -> NumberUtils.parseNumber(w, aClass)) - .collect(Collectors.toList()); - } - - public static List splitToLong(String str) { - return splitToNum(str, Long.class); - } - - - public static void notNull(T obj, Consumer consumer) { - if (obj != null) { - consumer.accept(obj); - } - } - - public static void notBlank(String str, Consumer consumer) { - if (StrUtil.isNotBlank(str)) { - consumer.accept(str); - } - } - - public static boolean getJSONType(String str) { - boolean result = false; - if (StringUtils.isNotBlank(str)) { - str = str.trim(); - if (str.startsWith("{") && str.endsWith("}")) { - result = true; - } else if (str.startsWith("[") && str.endsWith("]")) { - result = true; - } - } - return result; - } - - public static String uuid32() { - return UUID.randomUUID().toString().replace("-", ""); - } - - /** - * 对象分组取第一条 - * - * @param objs 对象集合 - * @param group 分组函数 - * @param comparator 比较器 - * @return java.util.Collection - * @author WendyYang - **/ - public static Collection groupFirst(Collection objs, Function group, Comparator comparator) { - return groupFirstMap(objs, group, comparator).values(); - } - - /** - * 对象分组取第一条 - * - * @param objs 对象集合 - * @param group 分组函数 - * @param comparator 比较器 - * @return java.util.Collection - * @author WendyYang - **/ - public static Map groupFirstMap(Collection objs, Function group, Comparator comparator) { - return objs.stream().collect(Collectors.groupingBy(group, - Collectors.collectingAndThen(toList(), w -> { - w.sort(comparator); - return w.get(0); - }))); - } - - public static String inSqlJoin(List strings) { - return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); - } - - public static String getProjectTypeName(String projectType) { - if (Objects.nonNull(projectType)) { - return ProjectTypeNewEnum.getDesc(projectType); - } - return StringUtils.EMPTY; - } - - public static LocalDateTime convertDate(Date date) { - if (Objects.nonNull(date)) { - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - } - return null; - } - - public static String computeRise(Integer numa, Integer numb) { - if((Objects.isNull(numb)|| numb.equals(0)) && - (Objects.isNull(numa)|| numa.equals(0))){ - return "0"; - } - if(Objects.isNull(numa) || numa.equals(0)){ - return "-100"; - } - if(Objects.isNull(numb)|| numb.equals(0)){ - return "100"; - } - return BigDecimal.valueOf((numa - numb) * 100.0).divide(BigDecimal.valueOf(numb),2, RoundingMode.CEILING) - .stripTrailingZeros().toPlainString(); - } - - public static String buildFileJson(FileResultVO resultVo) { - JSONArray jsonArray = new JSONArray(); - jsonArray.add(resultVo); - return JSON.toJSONString(jsonArray); - } - - public static LocalDateTime convertLocalDateTime(String time) { - if(StringUtils.isBlank(time)){ - return null; - } - String[] timeSplit = time.split(StrPool.DASH); - String year = timeSplit[0]; - String month = "01"; - String dayOfMonth = "01"; - if(timeSplit.length > 1){ - month = timeSplit[1]; - } - if(timeSplit.length > 2){ - dayOfMonth = timeSplit[2]; - } - return LocalDateTime.of(Integer.parseInt(year), - Integer.parseInt(month), - Integer.parseInt(dayOfMonth) - ,0,0,0); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CallBack.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CallBack.java deleted file mode 100644 index c82d6c0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CallBack.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -/** - * @author qinxianyun - * @see {@link SpringContextHolder} - * 针对某些初始化方法,在SpringContextHolder 初始化前时,
- * 可提交一个 提交回调任务。
- * 在SpringContextHolder 初始化后,进行回调使用 - */ - -public interface CallBack { - /** - * 回调执行方法 - */ - void executor(); - - /** - * 本回调任务名称 - * @return / - */ - default String getCallBackName() { - return Thread.currentThread().getId() + ":" + this.getClass().getName(); - } -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java deleted file mode 100644 index 12a5268..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.ningdatech.basic.util.StrPool; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.stream.Collectors; - -/** - * @Classname CodeUtil - * @Description - * @Date 2023/6/20 16:06 - * @Author PoffyZhang - */ -@Slf4j -public class CodeUtil { - - public static Collection convertStrToList(String str) { - if(StringUtils.isBlank(str)){ - return Collections.emptyList(); - } - return Arrays.stream(str.split(StrPool.COMMA)).collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CommonInputStreamResource.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CommonInputStreamResource.java deleted file mode 100644 index 81e9cd3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CommonInputStreamResource.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.springframework.core.io.InputStreamResource; - -import java.io.InputStream; - -public class CommonInputStreamResource extends InputStreamResource { - /*** - * 文件長度 - */ - private int length; - /*** - * 文件名稱 - */ - private String fileName; - public CommonInputStreamResource(InputStream inputStream) { - super(inputStream); - } - public CommonInputStreamResource(InputStream inputStream, int length,String fileName) { - super(inputStream); - this.length = length; - this.fileName = fileName; - } - /** - * 覆写父类方法 - * 如果不重写这个方法,并且文件有一定大小,那么服务端会出现异常 - * {@code The multi-part request contained parameter data (excluding uploaded files) that exceeded} - * - * @return - */ - @Override - public String getFilename() { - return this.fileName; - } - /** - * 覆写父类 contentLength 方法 - * 因为 {@link org.springframework.core.io.AbstractResource#contentLength()}方法会重新读取一遍文件, - * 而上传文件时,restTemplate 会通过这个方法获取大小。然后当真正需要读取内容的时候,发现已经读完,会报如下错误。 - * - * java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times - * at org.springframework.core.io.InputStreamResource.getInputStream(InputStreamResource.java:96) - * - *

- * ref:com.amazonaws.services.s3.model.S3ObjectInputStream#available() - * - * @return - */ - @Override - public long contentLength() { - int estimate = length; - return estimate == 0 ? 1 : estimate; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java deleted file mode 100644 index 9ae2328..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.apache.commons.codec.binary.Hex; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * 加密工具 - * @author hank - */ -public class CryptUtils { - - /** - * 默认的算法 - */ - private static final String DE_KEY_MAC = "HmacMD5"; - - /** - * 默认的字符集 - */ - private static final Charset DE_CHARSET = StandardCharsets.UTF_8; - - - /** - * 使用默认的算法(HmacMD5) 得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key) throws Exception { - return encryptHMAC(inputStr, key, DE_KEY_MAC); - } - /** - * 使用指定的算法得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @param keyMac hmac算法 - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception { - return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac)); - } - - public static String MD5Encode(String origin) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET))); - } - - private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception { - - SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac); - Mac mac = Mac.getInstance(secretKey.getAlgorithm()); - mac.init(secretKey); - return mac.doFinal(data); - } - - /** - * 生成HMAC-MD5值 - * @param data 消息数据 - * @param key 密钥 - * @return HMAC-MD5值 - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - */ - public static byte[] hmacMd5(byte[] data, byte[] key) - throws NoSuchAlgorithmException, InvalidKeyException { - SecretKeySpec signingKey = new SecretKeySpec(key, "HmacMD5"); - Mac mac = Mac.getInstance("HmacMD5"); - mac.init(signingKey); - return mac.doFinal(data); - } - - public static void main(String[] args) throws Exception{ - System.out.println("HMACStr:\n" + encryptHMAC("a", "hank")); - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/DictUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/DictUtils.java deleted file mode 100644 index e11630d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/DictUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; - -import java.util.Comparator; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午2:14 - */ - -public class DictUtils { - - public static Boolean isValueEquals(List list1, List list2) { - if (CollUtil.isEmpty(list1) && CollUtil.isEmpty(list2)) { - return true; - } - boolean collectionStatusNotEquals = (CollUtil.isEmpty(list1) && CollUtil.isNotEmpty(list2)) - || (CollUtil.isEmpty(list2) && CollUtil.isNotEmpty(list1)); - if (collectionStatusNotEquals) { - return false; - } - if (list1.size() != list2.size()) { - return false; - } - list1.sort(Comparator.comparing(DictionaryFieldInfo::getDictionaryFieldName).thenComparing(DictionaryFieldInfo::getDictionaryCode)); - list2.sort(Comparator.comparing(DictionaryFieldInfo::getDictionaryFieldName).thenComparing(DictionaryFieldInfo::getDictionaryCode)); - - for (int i = 0; i < list1.size(); i++) { - if (!StrUtils.trimEquals(list1.get(i).getDictionaryFieldName(), list2.get(i).getDictionaryFieldName()) - || !StrUtils.trimEquals(list1.get(i).getDictionaryCode(), list2.get(i).getDictionaryCode())) { - return false; - } - } - return true; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java deleted file mode 100644 index e30d13b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.poi.excel.ExcelUtil; -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.write.metadata.WriteSheet; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.ApiResponse; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; -import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.wflow.workflow.bean.vo.ProcessInstanceVo; -import com.wflow.workflow.bean.vo.ProcessTaskVo; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.http.HttpStatus; - -import javax.servlet.http.HttpServletResponse; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.*; -import java.util.function.BiConsumer; - -/** - *

- * ExcelDownUtil - *

- * - * @author WendyYang - * @since 00:48 2022/11/5 - */ -@Slf4j -public class ExcelDownUtil { - - public static Map convertMap = Maps.newHashMap(); - - static { - convertMap.put("buildBasis","baseBasisEstablish"); - } - - public static String encodeName(String name) { - String fileName; - try { - fileName = URLEncoder.encode(name, "UTF-8"); - } catch (UnsupportedEncodingException e) { - log.error("文件名编码异常:", e); - fileName = UUID.randomUUID().toString().replace("-", ""); - } - return fileName; - } - - @SneakyThrows - private static void down(HttpServletResponse response, T param, BiConsumer consumer) { - response.setCharacterEncoding("utf-8"); - try { - consumer.accept(response, param); - } catch (Exception e) { - log.error("文件导出失败:", e); - response.reset(); - response.setContentType(StrPool.CONTENT_TYPE); - ApiResponse res = ApiResponse.of(HttpStatus.SC_BAD_REQUEST, "导出失败", null); - response.setStatus(HttpStatus.SC_BAD_REQUEST); - response.getWriter().println(JSON.toJSONString(res)); - } - } - - public static void downXls(HttpServletResponse response, T param, BiConsumer consumer) { - response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); - down(response, param, consumer); - } - - public static void downXlsx(HttpServletResponse response, T param, BiConsumer consumer) { - response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE); - down(response, param, consumer); - } - - public static void setFileName(String fileName, HttpServletResponse response) { - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); - } - - public static void excelExportFile(HttpServletResponse response, ExcelExportWriter excelExport) { - try { - if (Objects.isNull(excelExport)) { - throw new BizException("导出失败!"); - } - setExportResponseHeader(excelExport.getFileName(), response); - - ExcelWriter writer; - //是否启用头部属性、头部属性类不能为空 - if (Objects.nonNull(excelExport.getHeadPropertyFlag()) && excelExport.getHeadPropertyFlag() && Objects.nonNull(excelExport.getHeadPropertyClass())) { - writer = EasyExcel.write(response.getOutputStream(), excelExport.getHeadPropertyClass()).build(); - } else { - writer = EasyExcel.write(response.getOutputStream()).build(); - } - int sheetNum = 0; - if (CollectionUtils.isNotEmpty(excelExport.getSheets())) { - sheetNum = excelExport.getSheets().size(); - } else if (CollectionUtils.isNotEmpty(excelExport.getHeads())) { - sheetNum = excelExport.getHeads().size(); - } else if (CollectionUtils.isNotEmpty(excelExport.getDatas())) { - sheetNum = excelExport.getDatas().size(); - } - - if (sheetNum == 0) { - sheetNum = 1; - } - - for (int i = 0; i < sheetNum; i++) { - WriteSheet sheet = EasyExcel.writerSheet(i).automaticMergeHead(false).build(); - if (CollectionUtils.isNotEmpty(excelExport.getSheets())) { - sheet.setSheetName(excelExport.getSheets().get(i)); - } - if (CollectionUtils.isNotEmpty(excelExport.getHeads())) { - sheet.setHead(excelExport.getHeads().get(i)); - } - - if (CollectionUtils.isNotEmpty(excelExport.getDatas())) { - writer.write((Collection) ((List) excelExport.getDatas()).get(i), sheet); - } else { - writer.write((Collection) null, sheet); - } - } - // 最后 finish - writer.finish(); - writer.close(); - } catch (Exception e) { - log.error("export file error!", e); - throw new BizException("导出失败!"); - } - } - - public static void setExportResponseHeader(String fileName, HttpServletResponse response) throws UnsupportedEncodingException { - // 设置响应头和保存文件名 - response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); - } - - public static List> getTaskExportDatas(List columnList, List taskVoList, Map projectInfoMap) { - - // 表体行数据集合 - List> rowList = Lists.newArrayList(); - for (ExportOptionEnum column : columnList) { - List columnValues = Lists.newArrayList(); - columnValues.add(column.getDesc()); - taskVoList.forEach(taskVo -> { - Project project = projectInfoMap.get(taskVo.getInstanceId()); - String s = JSON.toJSONString(project); - JSONObject jsonObject = JSON.parseObject(s); - String columnValue; - if (column.name().equals(ExportOptionEnum.processStatusName.name())) { - columnValue = taskVo.getStatus(); - } else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())) { - columnValue = NdDateUtils.format(taskVo.getCreateTime(), "yyyy-MM-dd HH:mm"); - } else if (column.name().equals(ExportOptionEnum.processHandleTime.name())) { - columnValue = NdDateUtils.format(taskVo.getTaskEndTime(), "yyyy-MM-dd HH:mm"); - } else { - columnValue = String.valueOf(jsonObject.get(column.toString())); - } - columnValues.add(columnValue); - }); - rowList.add(columnValues); - } - return rowList; - } - - - public static List> getInstExportDatas(List columnList, List instanceVoList, Map projectInfoMap) { - - // 表体行数据集合 - List> rowList = Lists.newArrayList(); - for (ExportOptionEnum column : columnList) { - List columnValues = Lists.newArrayList(); - columnValues.add(column.getDesc()); - instanceVoList.forEach(instanceVo -> { - Project project = projectInfoMap.get(instanceVo.getInstanceId()); - String s = JSON.toJSONString(project); - JSONObject jsonObject = JSON.parseObject(s); - String columnValue; - if (column.name().equals(ExportOptionEnum.processStatusName.name())) { - columnValue = instanceVo.getStatus(); - } else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())) { - columnValue = NdDateUtils.format(instanceVo.getStartTime(), "yyyy-MM-dd HH:mm"); - } else { - columnValue = String.valueOf(jsonObject.get(column.toString())); - } - columnValues.add(columnValue); - }); - rowList.add(columnValues); - } - return rowList; - } - - - public static List> getProjectExportDatas(List columnList, List projects) { - - // 表体行数据集合 - List> rowList = Lists.newArrayList(); - for (ExportOptionEnum column : columnList) { - List columnValues = Lists.newArrayList(); - if(Objects.isNull(column)){ - continue; - } - String desc = column.getDesc(); - if (Objects.nonNull(desc)) { - columnValues.add(desc); - } - projects.forEach(project -> { - String s = JSON.toJSONString(project); - JSONObject jsonObject = JSON.parseObject(s); - String columnValue; - if (ExportOptionEnum.preliminaryPlanFile.equals(column) - || ExportOptionEnum.supportingMaterialsFile.equals(column)) { - String fileStr = jsonObject.getString(column.toString()); - if (Objects.isNull(fileStr) || CommonConst.NULL.equals(fileStr)) { - return; - } - List fileArray = JSON.parseArray(fileStr, JSONObject.class); - List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.FILE_NAME)); - columnValue = String.join(StrPool.COMMA, nameList); - } else { - //强转列 - if(convertMap.containsKey(column.toString())){ - columnValue = jsonObject.getString(convertMap.get(column.toString())); - }else{ - columnValue = jsonObject.getString(column.toString()); - } - } - if (Objects.isNull(columnValue) || CommonConst.NULL.equals(columnValue)) { - columnValue = ""; - } - columnValues.add(columnValue); - }); - rowList.add(columnValues); - } - return rowList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelExportStyle.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelExportStyle.java deleted file mode 100644 index 3d0f690..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelExportStyle.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.apache.poi.ss.usermodel.*; - -import com.alibaba.excel.write.metadata.style.WriteCellStyle; -import com.alibaba.excel.write.metadata.style.WriteFont; -import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; - -/** - *

- * ExcelExportStyle - *

- * - * @author WendyYang - * @since 01:39 2022/11/5 - */ -public class ExcelExportStyle { - - public static HorizontalCellStyleStrategy formalStyle() { - // 表头样式策略 - WriteCellStyle headStyle = new WriteCellStyle(); - // 是否换行 - headStyle.setWrapped(false); - // 水平对齐方式 - headStyle.setHorizontalAlignment(HorizontalAlignment.LEFT); - // 垂直对齐方式 - headStyle.setVerticalAlignment(VerticalAlignment.CENTER); - // 前景色 - headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - // 背景色 - headStyle.setFillBackgroundColor(IndexedColors.AUTOMATIC.getIndex()); - - // 设置为1时,单元格将被前景色填充 - headStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); - // 控制单元格是否应自动调整大小以适应文本过长时的大小 - headStyle.setShrinkToFit(false); - // 单元格边框类型 - headStyle.setBorderBottom(BorderStyle.NONE); - headStyle.setBorderLeft(BorderStyle.NONE); - headStyle.setBorderRight(BorderStyle.NONE); - headStyle.setBorderTop(BorderStyle.NONE); - // 单元格边框颜色 - headStyle.setLeftBorderColor(IndexedColors.BLACK.index); - headStyle.setRightBorderColor(IndexedColors.BLACK.index); - headStyle.setTopBorderColor(IndexedColors.BLACK.index); - headStyle.setBottomBorderColor(IndexedColors.BLACK.index); - // 字体策略 - WriteFont writeFont = new WriteFont(); - // 是否加粗/黑体 - writeFont.setBold(false); - // 字体颜色 - writeFont.setColor(Font.COLOR_NORMAL); - // 字体名称 - writeFont.setFontName("宋体"); - // 字体大小 - writeFont.setFontHeightInPoints((short) 11); - // 是否使用斜体 - writeFont.setItalic(false); - // 是否在文本中使用横线删除 - writeFont.setStrikeout(false); - // 设置要使用的文本下划线的类型 - writeFont.setUnderline(Font.U_NONE); - // 设置要使用的字符集 - writeFont.setCharset((int) Font.DEFAULT_CHARSET); - headStyle.setWriteFont(writeFont); - - // 内容样式策略策略 - WriteCellStyle contentStyle = new WriteCellStyle(); - contentStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); - contentStyle.setHorizontalAlignment(HorizontalAlignment.GENERAL); - contentStyle.setBorderBottom(BorderStyle.NONE); - contentStyle.setBorderLeft(BorderStyle.NONE); - contentStyle.setBorderRight(BorderStyle.NONE); - contentStyle.setBorderTop(BorderStyle.NONE); - contentStyle.setFillPatternType(FillPatternType.NO_FILL); - contentStyle.setWrapped(false); - return new HorizontalCellStyleStrategy(headStyle, contentStyle); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegionInfoUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegionInfoUtils.java deleted file mode 100644 index c36dfde..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegionInfoUtils.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.ningdatech.pmapi.common.model.ExpertRegionModifyDiffBO; -import com.ningdatech.pmapi.expert.model.RegionDtoMapKey; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/28 下午4:33 - */ - -public class ExpertRegionInfoUtils { - - public static ExpertRegionModifyDiffBO modifyDiff(List beforeList, List afterList) { - ExpertRegionModifyDiffBO expertRegionModifyDiffBO = new ExpertRegionModifyDiffBO(); - List addList = new ArrayList<>(); - List removeList = new ArrayList<>(); - if (CollectionUtils.isEmpty(beforeList) && CollectionUtils.isEmpty(afterList)) { - expertRegionModifyDiffBO.setAddList(addList); - expertRegionModifyDiffBO.setRemoveList(removeList); - return expertRegionModifyDiffBO; - } else if (CollectionUtils.isEmpty(beforeList)) { - expertRegionModifyDiffBO.setAddList(afterList); - expertRegionModifyDiffBO.setRemoveList(removeList); - return expertRegionModifyDiffBO; - } else if (CollectionUtils.isEmpty(afterList)) { - expertRegionModifyDiffBO.setAddList(addList); - expertRegionModifyDiffBO.setRemoveList(beforeList); - return expertRegionModifyDiffBO; - } - - List beforeRegionDtoMapKeyList = beforeList.stream().map(r -> { - RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); - regionDtoMapKey.setRegionLevel(r.getRegionLevel()); - regionDtoMapKey.setRegionCode(r.getRegionCode()); - return regionDtoMapKey; - }).collect(Collectors.toList()); - - List afterRegionDtoMapKeyList = afterList.stream().map(r -> { - RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); - regionDtoMapKey.setRegionLevel(r.getRegionLevel()); - regionDtoMapKey.setRegionCode(r.getRegionCode()); - return regionDtoMapKey; - }).collect(Collectors.toList()); - - for (RegionDtoMapKey key : beforeRegionDtoMapKeyList) { - if (!afterRegionDtoMapKeyList.contains(key)) { - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionCode(key.getRegionCode()); - expertRegionInfo.setRegionLevel(key.getRegionLevel()); - removeList.add(expertRegionInfo); - } - } - - for (RegionDtoMapKey key : afterRegionDtoMapKeyList) { - if (!beforeRegionDtoMapKeyList.contains(key)) { - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionCode(key.getRegionCode()); - expertRegionInfo.setRegionLevel(key.getRegionLevel()); - addList.add(expertRegionInfo); - } - } - - expertRegionModifyDiffBO.setAddList(addList); - expertRegionModifyDiffBO.setRemoveList(removeList); - return expertRegionModifyDiffBO; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegisterUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegisterUtil.java deleted file mode 100644 index 9bb3cbe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegisterUtil.java +++ /dev/null @@ -1,269 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.map.MapUtil; -import cn.hutool.json.JSONUtil; -import cn.hutool.poi.excel.ExcelReader; -import cn.hutool.poi.excel.ExcelUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.expert.controller.ExpertController; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest; -import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; - -import java.io.File; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - *

- * ExpertRegisterUtil - *

- * - * @author WendyYang - * @since 10:03 2023/11/21 - */ -public class ExpertRegisterUtil { - - private ExpertRegisterUtil() { - } - - private static final String SEPARATOR = ",|,|\\n"; - - public static RegionCacheHelper regionCacheHelper; - public static DictionaryCache dictionaryCache; - public static IDingOrganizationService organizationService; - public static TagCache tagCache; - public static ExpertController expertController; - - public static void registerExpertBatch(String path) { - ExcelReader reader = ExcelUtil.getReader(new File(path)); - List> experts = reader.readAll(); - experts.forEach(w -> { - ExpertRegistrationRequest request = new ExpertRegistrationRequest(); - ExpertBasicInfo basic = new ExpertBasicInfo(); - basic.setBank(MapUtil.getStr(w, "开户行")); - basic.setBankNo(MapUtil.getStr(w, "银行卡号")); - basic.setName(MapUtil.getStr(w, "*姓名")); - basic.setPhoneNo(MapUtil.getStr(w, "*手机")); - basic.setGender("男".equals(MapUtil.getStr(w, "性别")) ? "1" : "0"); - // 政治面貌 - basic.setPolitical(new ArrayList<>()); - String political = MapUtil.getStr(w, "政治面貌"); - List politicalDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.POLITICAL.getKey()); - if (!politicalDicts.isEmpty()) { - politicalDicts.stream() - .filter(dict -> dict.getName().equals(political)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - basic.getPolitical().add(dict); - }); - } - ExpertEduInfo eduInfo = new ExpertEduInfo(); - eduInfo.setSchool("暂无"); - eduInfo.setAcademicTitle("暂无"); - eduInfo.setGraduatedAt(LocalDateTime.now()); - eduInfo.setEdu(new ArrayList<>()); - eduInfo.setDegree(new ArrayList<>()); - // 学历 - String eduStr = MapUtil.getStr(w, "学历"); - List eduDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.EDU.getKey()); - if (!eduDicts.isEmpty()) { - eduDicts.stream() - .filter(dict -> dict.getName().equals(eduStr)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - eduInfo.getEdu().add(dict); - }); - } - // 学位 - String degreeStr = MapUtil.getStr(w, "学位"); - List degreeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.DEGREE.getKey()); - if (!degreeDicts.isEmpty()) { - degreeDicts.stream() - .filter(dict -> dict.getName().equals(degreeStr)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - eduInfo.getDegree().add(dict); - }); - } - request.setEduInfo(eduInfo); - // 专家层级 - String expertRegionStr = MapUtil.getStr(w, "*专家层级").replace("景宁县", "景宁畲族自治县"); - RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr); - if (expertRegion != null) { - basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class)); - } - // 履职意向 - String intentionRegions = MapUtil.getStr(w, "*履职意向").replace("景宁县", "景宁畲族自治县"); - basic.setExpertIntentionWorkRegions(new ArrayList<>()); - for (String intentionRegionStr : intentionRegions.split("")) { - RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr); - if (currRegion != null) { - basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class)); - } - } - request.setBasicInfo(basic); - // 职业信息 - ExpertJobInfo jobInfo = new ExpertJobInfo(); - jobInfo.setAddress("暂无"); - jobInfo.setExperience("暂无"); - jobInfo.setJobStatus(new ArrayList<>()); - jobInfo.setCompany(MapUtil.getStr(w, "*工作单位")); - List organizations = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationName, jobInfo.getCompany())); - if (organizations.size() == 1) { - jobInfo.setCompanyUniqCode(organizations.get(0).getOrganizationCode()); - } - jobInfo.setAdministrativeDuties(MapUtil.getStr(w, "行政职务")); - jobInfo.setAdministrativeRank(new ArrayList<>()); - String administrativeRankStr = MapUtil.getStr(w, "行政职级"); - List administrativeRankDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.ADMINISTRATIVE_RANK.getKey()); - if (!administrativeRankDicts.isEmpty()) { - administrativeRankDicts.stream() - .filter(dict -> dict.getName().equals(administrativeRankStr)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - jobInfo.getAdministrativeRank().add(dict); - }); - } - jobInfo.setCompanyAttribute(new ArrayList<>()); - String companyTypeStr = MapUtil.getStr(w, "*单位类型"); - List companyTypeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.COMPANY_ATTRIBUTE.getKey()); - if (!companyTypeDicts.isEmpty()) { - companyTypeDicts.stream() - .filter(dict -> dict.getName().equals(companyTypeStr)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - jobInfo.getCompanyAttribute().add(dict); - }); - } - request.setJobInfo(jobInfo); - ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); - professionalInfo.setAwards("暂无"); - professionalInfo.setIndustrySector(new ArrayList<>()); - professionalInfo.setOther(new ArrayList<>()); - Map tagMap = tagCache.getNameTagDtoMap(); - String otherTagStr = MapUtil.getStr(w, "其他标签"); - if (StrUtils.isNotBlank(otherTagStr)) { - for (String othTag : otherTagStr.split(SEPARATOR)) { - tagMap.entrySet().stream() - .filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.OTHER.getKey()) - && tag.getValue().getTagName().equals(othTag)) - .forEach(tag -> { - TagFieldInfo expertTag = new TagFieldInfo(); - expertTag.setTagCode(tag.getValue().getTagCode()); - expertTag.setTagFieldName(tag.getValue().getParentCode()); - expertTag.setTagName(tag.getValue().getTagName()); - professionalInfo.getOther().add(expertTag); - }); - } - } - - String avoidCompanyStr = MapUtil.getStr(w, "*回避单位"); - professionalInfo.setAvoidCompanyList(new ArrayList<>()); - List avoidOrges = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getOrganizationName, avoidCompanyStr.split(SEPARATOR))); - if (!avoidOrges.isEmpty()) { - avoidOrges.forEach(org -> { - ExpertAvoidCompanyInfo companyInfo = new ExpertAvoidCompanyInfo(); - companyInfo.setCompanyName(org.getOrganizationName()); - companyInfo.setCompanyUniqCode(org.getOrganizationCode()); - professionalInfo.getAvoidCompanyList().add(companyInfo); - }); - } - - professionalInfo.setGoodAt(new ArrayList<>()); - String goodAtStr = MapUtil.getStr(w, "*擅长方向"); - for (String othTag : goodAtStr.split(SEPARATOR)) { - tagMap.entrySet().stream() - .filter(tag -> tag.getValue().getTagName().equals(othTag)) - .forEach(tag -> { - TagFieldInfo expertTag = new TagFieldInfo(); - expertTag.setTagCode(tag.getValue().getTagCode()); - expertTag.setTagFieldName(ExpertTagEnum.GOOD_AT.getKey()); - expertTag.setTagName(tag.getValue().getTagName()); - professionalInfo.getGoodAt().add(expertTag); - }); - } - String industrySectorStr = MapUtil.getStr(w, "行业领域"); - for (String othTag : industrySectorStr.split(SEPARATOR)) { - tagMap.entrySet().stream() - .filter(tag -> tag.getValue().getTagName().equals(othTag)) - .forEach(tag -> { - TagFieldInfo expertTag = new TagFieldInfo(); - expertTag.setTagCode(tag.getValue().getTagCode()); - expertTag.setTagFieldName(ExpertTagEnum.INDUSTRY_SECTOR.getKey()); - expertTag.setTagName(tag.getValue().getTagName()); - professionalInfo.getIndustrySector().add(expertTag); - }); - } - professionalInfo.setTechnicalExpertise(new ArrayList<>()); - String techStr = MapUtil.getStr(w, "技术专长"); - for (String othTag : techStr.split(SEPARATOR)) { - tagMap.entrySet().stream() - .filter(tag -> tag.getValue().getTagName().equals(othTag)) - .forEach(tag -> { - TagFieldInfo expertTag = new TagFieldInfo(); - expertTag.setTagCode(tag.getValue().getTagCode()); - expertTag.setTagFieldName(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey()); - expertTag.setTagName(tag.getValue().getTagName()); - professionalInfo.getTechnicalExpertise().add(expertTag); - }); - } - professionalInfo.setTitleLevel(new ArrayList<>()); - String titleLevel = MapUtil.getStr(w, "*职称级别"); - List titleLevelDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.TITLE_LEVEL.getKey()); - if (!titleLevelDicts.isEmpty()) { - titleLevelDicts.stream() - .filter(dict -> dict.getName().equals(titleLevel)) - .findFirst().ifPresent(dictionary -> { - DictionaryFieldInfo dict = new DictionaryFieldInfo(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - professionalInfo.getTitleLevel().add(dict); - }); - } - professionalInfo.setTechnicalTitles(MapUtil.getStr(w, "技术职称")); - request.setProfessionalInfo(professionalInfo); - ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); - recommendInfo.setRecommendedWay(new ArrayList<>()); - recommendInfo.setRecommendationProofFile(new ArrayList<>()); - request.setRecommendInfo(recommendInfo); - try { - expertController.expertBasicInfoSubmit(request); - } catch (Exception e) { - System.out.println(JSONUtil.toJsonStr(request)); - } - }); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/FreemarkerWordUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/FreemarkerWordUtil.java deleted file mode 100644 index cc5b787..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/FreemarkerWordUtil.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.core.io.IoUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.model.FreemarkerBatchExportDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ExpertFeeExportDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ExpertInfoDTO; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import lombok.extern.slf4j.Slf4j; -import org.apache.http.entity.ContentType; -import org.springframework.core.io.ByteArrayResource; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.math.BigDecimal; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - *

- * FreemarkerWordUtil - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Slf4j -public class FreemarkerWordUtil { - - private static void setDownFileName(HttpServletResponse response, String fileName) { - String fileNameEncoded; - try { - fileNameEncoded = URLEncoder.encode(fileName, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("文件名编码异常"); - } - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileNameEncoded); - } - - private static final Configuration CONFIGURATION = new Configuration(Configuration.VERSION_2_3_31); - - static { - CONFIGURATION.setDefaultEncoding("UTF-8"); - CONFIGURATION.setClassForTemplateLoading(FreemarkerWordUtil.class, "/template"); - } - - /** - * 生成word文件 - * - * @param dataMap word中需要展示的动态数据,用map集合来保存 - * @param templateName word模板名称,例如:test.ftl - * @param filePath 文件生成的目标路径,例如:D:/wordFile/ - * @param fileName 生成的文件名称,例如:test.doc - */ - public static void create(Object dataMap, String templateName, String filePath, String fileName) { - try { - Template template = CONFIGURATION.getTemplate(templateName); - //输出文件 - File outFile = new File(filePath + File.separator + fileName); - //如果输出目标文件夹不存在,则创建 - if (!outFile.getParentFile().exists()) { - boolean ignore = outFile.getParentFile().mkdirs(); - } - //将模板和数据模型合并生成文件 - Writer out = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outFile.toPath()), StandardCharsets.UTF_8)); - //生成文件 - template.process(dataMap, out); - IoUtil.flush(out); - IoUtil.close(out); - } catch (Exception e) { - log.error("根据模版生成Word文件失败:", e); - throw BizException.wrap("根据模版生成Word文件失败"); - } - } - - public static void export(String fileName, Object data, HttpServletResponse response, String templateName) throws TemplateException, IOException { - Template template = CONFIGURATION.getTemplate(templateName); - response.setCharacterEncoding(StandardCharsets.UTF_8.displayName()); - response.setContentType(ContentType.APPLICATION_JSON.getMimeType()); - setDownFileName(response, fileName); - try (StringWriter out = new StringWriter(); - Writer writer = new BufferedWriter(out, 4096)) { - template.process(data, writer); - try (InputStream is = new ByteArrayResource(out.toString().getBytes(StandardCharsets.UTF_8)).getInputStream(); - ServletOutputStream outputStream = response.getOutputStream()) { - // 缓冲区 - byte[] buffer = new byte[1024]; - int bytesToRead; - // 通过循环将读入的Word文件的内容输出到浏览器中 - while ((bytesToRead = is.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesToRead); - } - } - } - - - } - - public static void exportBatch(HttpServletResponse response, List fbeList, String fileName) throws IOException, TemplateException { - response.setCharacterEncoding(StandardCharsets.UTF_8.displayName()); - response.setContentType("application/zip"); - setDownFileName(response, fileName); - try (ServletOutputStream os = response.getOutputStream(); - ZipOutputStream zos = new ZipOutputStream(os)) { - for (FreemarkerBatchExportDTO param : fbeList) { - Template template = CONFIGURATION.getTemplate(param.getTemplate()); - StringWriter out = new StringWriter(); - try (Writer writer = new BufferedWriter(out, 4096)) { - template.process(param.getData(), writer); - } - ZipEntry zipEntry = new ZipEntry(param.getFileName()); - zos.putNextEntry(zipEntry); - zos.write(out.toString().getBytes(StandardCharsets.UTF_8)); - zos.closeEntry(); - } - } finally { - response.flushBuffer(); - } - } - - public static void main(String[] args) { - ExpertFeeExportDTO dto = new ExpertFeeExportDTO(); - dto.setMeetingAddress("杭州市滨江区海创还能到我当时防守打法十大发放"); - dto.setMeetingTime("2023-01-01 12:20"); - dto.setProjectName("阿萨法舒服舒服舒服舒服送达方"); - dto.setExperts(new ArrayList<>()); - for (int i = 0; i < 10; i++) { - ExpertInfoDTO expert = new ExpertInfoDTO(); - expert.setNo(i); - expert.setBank("中国建设银行"); - expert.setMobile("17819392616"); - expert.setBankNo("6111111172121324354"); - expert.setCompany("宁达科技有限公司"); - expert.setFee(BigDecimal.valueOf(500)); - expert.setName("张三丰"); - expert.setSex("男"); - expert.setIdcard("1212121211212121"); - dto.getExperts().add(expert); - } - create(dto, "meeting/专家费.ftl", "/Users/wendy/Desktop/", "专家费.doc"); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/GzipUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/GzipUtils.java deleted file mode 100644 index 5eed3e7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/GzipUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -/** - *

- * 压缩为Gzip - *

- * - * @author WendyYang - */ -public class GzipUtils { - /** - * 使用gzip进行压缩 - */ - public static String compress(String primStr) { - if (primStr == null || primStr.length() == 0) { - return primStr; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - GZIPOutputStream gzip = null; - try { - gzip = new GZIPOutputStream(out); - gzip.write(primStr.getBytes()); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - if (gzip != null) { - try { - gzip.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - return new sun.misc.BASE64Encoder().encode(out.toByteArray()); - } - - /** - * 使用gzip进行解压缩 - */ - public static String uncompress(String compressedStr) { - if (compressedStr == null) { - return null; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ByteArrayInputStream in = null; - GZIPInputStream ginzip = null; - byte[] compressed = null; - String decompressed = null; - try { - compressed = new sun.misc.BASE64Decoder().decodeBuffer(compressedStr); - in = new ByteArrayInputStream(compressed); - ginzip = new GZIPInputStream(in); - - byte[] buffer = new byte[1024]; - int offset = -1; - while ((offset = ginzip.read(buffer)) != -1) { - out.write(buffer, 0, offset); - } - decompressed = out.toString(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (ginzip != null) { - try { - ginzip.close(); - } catch (IOException e) { - } - } - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } - try { - out.close(); - } catch (IOException e) { - } - } - return decompressed; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java deleted file mode 100644 index bd56ce9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.apache.commons.math3.util.Pair; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import javax.xml.bind.DatatypeConverter; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLEncoder; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -public class HmacAuthUtil { - /** - * 构造http请求 header - * - * @param url 请求url,全路径格式,比如:https://bcdsg.zj.gov.cn/api/p/v1/user.get - * @param requestMethod 请求方法,大写格式,如:GET, POST - * @param accessKey 应用的 AK - * @param secretKey 应用的 SK - * @return - */ - public static Map generateHeader(String url, String requestMethod, String accessKey, String secretKey) { - Map header = new HashMap<>(); - try { - DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); - dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); - String date = dateFormat.format(new Date()); - URI uri = URI.create(url); - String canonicalQueryString = getCanonicalQueryString(uri.getQuery()); - String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + accessKey + "\n" + date + "\n"; - Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(new SecretKeySpec(secretKey.getBytes(), "HmacSHA256")); - byte[] hash = mac.doFinal(message.getBytes()); - // to lowercase hexits - DatatypeConverter.printHexBinary(hash); - // to base64 - String sign = DatatypeConverter.printBase64Binary(hash); - header.put("X-BG-HMAC-SIGNATURE", sign); - header.put("X-BG-HMAC-ALGORITHM", "hmac-sha256"); - header.put("X-BG-HMAC-ACCESS-KEY", accessKey); - header.put("X-BG-DATE-TIME", date); - System.out.println(date); - } catch (Exception e) { - throw new RuntimeException("generate jc brain header error", e); - } - return header; - } - - private static String getCanonicalQueryString(String query) { - if (query == null || query.trim().length() == 0) { - return ""; - } - List> queryParamList = new ArrayList<>(); - String[] params = query.split("&"); - for (String param : params) { - String[] keyValue = param.split("="); - Pair pair = new Pair(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); - queryParamList.add(pair); - } - List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); - List> encodeParamList = new ArrayList<>(); - sortedParamList.stream().forEach(param -> { - try { - String key = URLEncoder.encode(param.getKey(), "utf-8"); - String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8"); - encodeParamList.add(new Pair<>(key, value)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("encoding error"); - } - }); - StringBuilder queryParamString = new StringBuilder(64); - for (Pair encodeParam : encodeParamList) { - queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); - queryParamString.append("&"); - } - return queryParamString.substring(0, queryParamString.length() - 1); - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java deleted file mode 100644 index 2470fd3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.apache.http.HttpEntity; -import org.apache.http.NameValuePair; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.conn.ssl.DefaultHostnameVerifier; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.TrustStrategy; -import org.apache.http.conn.util.PublicSuffixMatcher; -import org.apache.http.conn.util.PublicSuffixMatcherLoader; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.ssl.SSLContexts; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; - -import javax.net.ssl.SSLContext; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -public class HttpUtil { - private Logger logger = LoggerFactory.getLogger(getClass()); - private RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(15000) - .setConnectTimeout(15000) - .setConnectionRequestTimeout(15000) - .build(); - private static HttpUtil instance = null; - private HttpUtil(){} - - public static HttpUtil getInstance(){ - if (instance == null) { - instance = new HttpUtil(); - } - return instance; - } - - /** - * 发送 post 请求 - * @param httpUrl 地址 - */ - public String sendHttpPost(String httpUrl) { - HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost - return sendHttpPost(httpPost); - } - - /** - * 发送 post 请求 - * @param httpUrl 地址 - * @param params 参数(格式:key1=value1&key2=value2) - */ - public String sendHttpPost(String httpUrl, String params) { - HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost - try { - //设置参数 - StringEntity stringEntity = new StringEntity(params, "UTF-8"); - stringEntity.setContentType("application/x-www-form-urlencoded"); - httpPost.setEntity(stringEntity); - } catch (Exception e) { - logger.error(e.getMessage(),e); - } - return sendHttpPost(httpPost); - } - - /** - * 发送 post 请求 - * @param httpUrl 地址 - * @param maps 参数 - */ - public String sendHttpPost(String httpUrl, Map maps) { - HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost - // 创建参数队列 - List nameValuePairs = new ArrayList(); - for (String key : maps.keySet()) { - nameValuePairs.add(new BasicNameValuePair(key, maps.get(key))); - } - try { - httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); - } catch (Exception e) { - logger.error(e.getMessage(),e); - } - return sendHttpPost(httpPost); - } - - /** - * 发送 Post请求 - * @param httpPost - *@return - */ - private String sendHttpPost(HttpPost httpPost) { - CloseableHttpClient httpClient = null; - CloseableHttpResponse response = null; - HttpEntity entity = null; - String responseContent = null; - try { - // 创建默认的 httpClient 实例. - httpClient = HttpClients.createDefault(); - httpPost.setConfig(requestConfig); - // 执行请求 - response = httpClient.execute(httpPost); - entity = response.getEntity(); - responseContent = EntityUtils.toString(entity, "UTF-8"); - } catch (Exception e) { - logger.error(e.getMessage(),e); - } finally { - try { - // 关闭连接,释放资源 - if (response != null) { - response.close(); - } - if (httpClient != null) { - httpClient.close(); - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - } - } - return responseContent; - } - - /** - * 发送 get 请求 - * @param httpUrl - */ - public String sendHttpGet(String httpUrl) { - HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 - return sendHttpGet(httpGet); - } - - /** - * 发送 get请求 Https - * @param httpUrl - */ - public String sendHttpsGet(String httpUrl) { - HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 - return sendHttpsGet(httpGet); - } - - /** - * 发送 Get请求 - * @param httpGet - *@return - */ - private String sendHttpGet(HttpGet httpGet) { - CloseableHttpClient httpClient = null; - CloseableHttpResponse response = null; - HttpEntity entity = null; - String responseContent = null; - try { - // 创建默认的 httpClient 实例. - httpClient = HttpClients.createDefault(); - httpGet.setConfig(requestConfig); - // 执行请求 - response = httpClient.execute(httpGet); - entity = response.getEntity(); - responseContent = EntityUtils.toString(entity, "UTF-8"); - } catch (Exception e) { - logger.error(e.getMessage(),e); - } finally { - try { - // 关闭连接,释放资源 - if (response != null) { - response.close(); - } - if (httpClient != null) { - httpClient.close(); - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - } - } - return responseContent; - } - - /** - * 发送 Get请求 Https - *@return - */ - private String sendHttpsGet(HttpGet httpGet) { - CloseableHttpClient httpClient = null; - CloseableHttpResponse response = null; - HttpEntity entity = null; - String responseContent = null; - try { - // 创建默认的 httpClient 实例. - PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new - URL(httpGet.getURI().toString())); - DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher); - httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build(); - httpGet.setConfig(requestConfig); - // 执行请求 - response = httpClient.execute(httpGet); - entity = response.getEntity(); - responseContent = EntityUtils.toString(entity, "UTF-8"); - } catch (Exception e) { - logger.error(e.getMessage(),e); - } finally { - try { - // 关闭连接,释放资源 - if (response != null) { - response.close(); - } - if (httpClient != null) { - httpClient.close(); - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - } - } - return responseContent; - } - - /** - * 通过该工厂类创建的RestTemplate发送请求时,可忽略https证书认证 - * @return 工厂 - */ - public static HttpComponentsClientHttpRequestFactory generateHttpRequestFactory(){ - try{ - TrustStrategy acceptingTrustStrategy = ((x509Certificates, authType) -> true); - SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); - SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); - - HttpClientBuilder httpClientBuilder = HttpClients.custom(); - httpClientBuilder.setSSLSocketFactory(connectionSocketFactory); - CloseableHttpClient httpClient = httpClientBuilder.build(); - HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); - factory.setHttpClient(httpClient); - return factory; - }catch (Exception e){ - e.printStackTrace(); - } - return null; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/JwtTokenUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/JwtTokenUtil.java deleted file mode 100644 index 61f52b7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/JwtTokenUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.auth0.jwt.JWT; -import com.auth0.jwt.JWTVerifier; -import com.auth0.jwt.algorithms.Algorithm; -import com.ningdatech.pmapi.common.model.ZwddTokenUser; -import org.apache.commons.lang3.StringUtils; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * @author liuxinxin - * @date 2023/5/4 下午2:34 - */ - -public class JwtTokenUtil { - - private static final String SECRET_KEY = "dbe1cc89019c4c7abd5085bf47a25fb0"; - - private static final String CLAIM_KEY = "content"; - - private static final Integer DEFAULT_EXPIRE_TIME = Integer.valueOf(86400); - - public static String createToken(ZwddTokenUser dingTokenUser) { - return createToken(dingTokenUser, DEFAULT_EXPIRE_TIME); - } - - public static String createToken(ZwddTokenUser dingTokenUser, Integer expireTime) { - if (dingTokenUser == null) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - if (StringUtils.isEmpty(dingTokenUser.getEmployeeCode())) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - return createToken(JSON.toJSONString(dingTokenUser), expireTime); - } - - private static String createToken(String content, Integer expireTime) { - if (StringUtils.isEmpty(content)) { - throw new IllegalArgumentException(""); - } - Map header = new HashMap<>(4); - header.put("alg", "HS256"); - header.put("typ", "JWT"); - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - return JWT.create() - .withHeader(header) - .withClaim("content", content) - .withIssuedAt(new Date()) - .withExpiresAt(new Date(System.currentTimeMillis() + (expireTime.intValue() * 1000))) - .sign(algorithm); - } - - public static boolean verifyToken(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - verifier.verify(token); - return true; - } - - private static String parseJwtString(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - return verifier.verify(token).getClaim("content").asString(); - } - - public static ZwddTokenUser parseJwt(String token) { - String dingUserJson = parseJwtString(token); - if (StringUtils.isEmpty(dingUserJson)) { - return null; - } - ZwddTokenUser dingTokenUser = (ZwddTokenUser) JSONObject.parseObject(dingUserJson, ZwddTokenUser.class); - return dingTokenUser; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/MDCUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/MDCUtil.java deleted file mode 100644 index 00bed26..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/MDCUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.slf4j.MDC; - -/** - *

- * MDCUtil - *

- * - * @author WendyYang - * @since 2023/10/26 - **/ -public class MDCUtil { - - public static final String TRACE_ID = "traceId"; - public static final String TRACE_ID_HEADER = "Trace-Id"; - - public static void setTraceId(String traceId) { - MDC.put(TRACE_ID, traceId); - } - - public static void removeTraceId() { - MDC.remove(TRACE_ID); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java deleted file mode 100644 index cc09421..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; - -public class Md5Utils { - private static final Logger LOGGER = LoggerFactory.getLogger(Md5Utils.class); - - public static byte[] md5(String s) { - MessageDigest algorithm; - try { - algorithm = MessageDigest.getInstance("MD5"); - algorithm.reset(); - algorithm.update(s.getBytes(StandardCharsets.UTF_8)); - return algorithm.digest(); - } catch (Exception e) { - LOGGER.error("MD5 Error...", e); - } - return null; - } - - private static String toHex(byte[] hash) { - if (hash == null) { - return null; - } - StringBuilder buf = new StringBuilder(hash.length * 2); - int i; - for (i = 0; i < hash.length; i++) { - if ((hash[i] & 0xff) < 0x10) { - buf.append("0"); - } - buf.append(Long.toString(hash[i] & 0xff, 16)); - } - return buf.toString(); - } - - public static String hash(String s) { - try { - String hex = toHex(md5(s)); - if (hex == null) { - return s; - } - return new String(hex.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); - } catch (Exception e) { - LOGGER.error("not supported charset:", e); - return s; - } - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java deleted file mode 100644 index 2764282..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.extern.slf4j.Slf4j; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname RefreshKeyUtil - * @Description - * @Date 2023/6/27 10:03 - * @Author PoffyZhang - */ -@Slf4j -public class RefreshKeyUtil { - public static String getRequestSecret(String appKey, String appSecret,Long requestTime) { - // 刷新秘钥 - HttpUtil httpUtil = HttpUtil.getInstance(); - log.info("请求密钥" + appSecret); - String sign = Md5Utils.hash (appKey + appSecret + requestTime); - String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm"; - log.info(refreshUrl); - Map map = new HashMap<>(); - map.put("appKey",appKey); - map.put("sign",sign); - map.put("requestTime",requestTime + ""); - String result = httpUtil.sendHttpPost(refreshUrl,map); - log.info(result); - JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); - if(Objects.nonNull(dataJson)){ - return dataJson.getString("requestSecret"); - } - return result; - } - - public static String refreshSecret(String appKey, String refreshSecret,Long requestTime) { - // 刷新秘钥 - HttpUtil httpUtil = HttpUtil.getInstance(); - log.info("刷新密钥" + refreshSecret); - String refreshSign = Md5Utils.hash (appKey + refreshSecret + requestTime); - String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm"; - log.info(refreshUrl); - Map map = new HashMap<>(); - map.put("appKey",appKey); - map.put("sign",refreshSign); - map.put("requestTime",requestTime + ""); - String result = httpUtil.sendHttpPost(refreshUrl,map); - log.info(result); - JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); - if(Objects.nonNull(dataJson)){ - return dataJson.getString("requestSecret"); - } - return result; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RegionUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RegionUtils.java deleted file mode 100644 index abaacb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RegionUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.Comparator; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午2:27 - */ - -public class RegionUtils { - - public static Boolean isValueEquals(ExpertRegionInfo regionInfo1, ExpertRegionInfo regionInfo2) { - if (null == regionInfo1.getRegionCode() && null == regionInfo1.getRegionLevel()) { - return false; - } - return regionInfo1.getRegionCode().equals(regionInfo2.getRegionCode()) - && regionInfo1.getRegionLevel().equals(regionInfo2.getRegionLevel()); - } - - public static Boolean isValueEquals(List list1, List list2) { - if (CollectionUtils.isEmpty(list1) && CollectionUtils.isEmpty(list2)) { - return true; - } - boolean collectionStatusNotEquals = (CollectionUtils.isEmpty(list1) && CollectionUtils.isNotEmpty(list2)) - || (CollectionUtils.isEmpty(list2) && CollectionUtils.isNotEmpty(list1)); - if (collectionStatusNotEquals) { - return false; - } - if (list1.size() != list2.size()) { - return false; - } - list1.sort(Comparator.comparing(ExpertRegionInfo::getRegionCode).thenComparing(ExpertRegionInfo::getRegionLevel)); - list2.sort(Comparator.comparing(ExpertRegionInfo::getRegionCode).thenComparing(ExpertRegionInfo::getRegionLevel)); - - for (int i = 0; i < list1.size(); i++) { - if (!StrUtils.trimEquals(list1.get(i).getRegionCode(), list2.get(i).getRegionCode()) - || !list1.get(i).getRegionLevel().equals(list2.get(i).getRegionLevel())) { - return false; - } - } - return true; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java deleted file mode 100644 index a213c7b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.zwdd.client.ZwddClient; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.concurrent.*; - -/** - * 异步发送工作通知工具类 - * - * @author CMM - * @since 2023/02/23 13:50 - */ -@Slf4j -@RequiredArgsConstructor -@Component -public class SendWorkNoticeUtil { - - private final ZwddClient zwddClient; - - /** - * 初始化线程池 - */ - public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, - 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); - - public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ - - // 将发送工作通知交给异步任务Future - String msg = workNoticeInfo.getMsg(); - CompletableFuture future = CompletableFuture.supplyAsync(() -> { - // 调用浙政钉的接口发送工作通知 - long startTime = System.currentTimeMillis(); - GenericResult result = - zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); - String resultMsg = result.getMsg(); - if ("success".equals(resultMsg)) { - log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); - long endTime = System.currentTimeMillis(); - log.info("方法执行完成返回,耗时:" + (endTime - startTime)); - }else { - return "发送工作通知失败!"; - } - return "发送工作通知成功!"; - }, threadPool); - String s; - try { - s = future.get(); - } catch (Exception e) { - throw new BizException("获取异步线程处理结果失败!"); - } - threadPool.shutdown(); - while (!threadPool.isTerminated()) { - log.info(s); - return Boolean.FALSE; - } - log.info(s); - return Boolean.TRUE; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SpringContextHolder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SpringContextHolder.java deleted file mode 100644 index ebd0e3b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SpringContextHolder.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import java.util.ArrayList; -import java.util.List; - - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.core.env.Environment; -import org.springframework.lang.NonNull; - -import lombok.extern.slf4j.Slf4j; - -/** - * @author qinxianyun - */ -@Slf4j -public class SpringContextHolder implements ApplicationContextAware, DisposableBean { - - private static ApplicationContext applicationContext = null; - private static final List CALL_BACKS = new ArrayList<>(); - private static boolean addCallback = true; - - /** - * 针对 某些初始化方法,在SpringContextHolder 未初始化时 提交回调方法。 - * 在SpringContextHolder 初始化后,进行回调使用 - * - * @param callBack 回调函数 - */ - public synchronized static void addCallBacks(CallBack callBack) { - if (addCallback) { - SpringContextHolder.CALL_BACKS.add(callBack); - } else { - log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName()); - callBack.executor(); - } - } - - /** - * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. - */ - @SuppressWarnings("unchecked") - public static T getBean(String name) { - assertContextInjected(); - return (T) applicationContext.getBean(name); - } - - /** - * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. - */ - public static T getBean(Class requiredType) { - assertContextInjected(); - return applicationContext.getBean(requiredType); - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @param defaultValue 默认值 - * @param requiredType 返回类型 - * @return / - */ - public static T getProperties(String property, T defaultValue, Class requiredType) { - T result = defaultValue; - try { - result = getBean(Environment.class).getProperty(property, requiredType); - } catch (Exception ignored) { - } - return result; - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @return / - */ - public static String getProperties(String property) { - return getProperties(property, null, String.class); - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @param requiredType 返回类型 - * @return / - */ - public static T getProperties(String property, Class requiredType) { - return getProperties(property, null, requiredType); - } - - /** - * 检查ApplicationContext不为空. - */ - private static void assertContextInjected() { - if (applicationContext == null) { - throw new IllegalStateException("applicationContext属性未注入, 请在applicationContext" + - ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); - } - } - - /** - * 清除SpringContextHolder中的ApplicationContext为Null. - */ - private static void clearHolder() { - log.debug("清除SpringContextHolder中的ApplicationContext:" - + applicationContext); - applicationContext = null; - } - - @Override - public void destroy() { - SpringContextHolder.clearHolder(); - } - - @Override - public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException { - if (SpringContextHolder.applicationContext != null) { - log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); - } - SpringContextHolder.applicationContext = applicationContext; - if (addCallback) { - for (CallBack callBack : SpringContextHolder.CALL_BACKS) { - callBack.executor(); - } - CALL_BACKS.clear(); - } - SpringContextHolder.addCallback = false; - } - - /** - * 获取当前启用的配置文件 - *
    - *
  • 生产环境:prod
  • - *
  • 开发环境:dev
  • - *
- * - * @return java.lang.String - * @author WendyYang - **/ - public static String getActiveProfile() { - String[] strings = applicationContext.getEnvironment().getActiveProfiles(); - return strings[0]; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/StrUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/StrUtils.java deleted file mode 100644 index 86982a4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/StrUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import cn.hutool.core.text.StrPool; -import cn.hutool.core.util.StrUtil; - -import java.util.Collections; -import java.util.List; - -/** - *

- * StrUtils - *

- * - * @author WendyYang - * @since 21:23 2023/2/23 - */ -public class StrUtils extends StrUtil { - - private StrUtils() { - } - - public static List split(String str) { - if (isBlank(str)) { - return Collections.emptyList(); - } - return split(str, StrPool.COMMA); - } - - public static boolean trimEquals(String str1, String str2) { - if (isNotBlank(str1)) { - str1 = str1.trim(); - } - if (isNotBlank(str2)) { - str2 = str2.trim(); - } - return equals(str1, str2); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TagUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TagUtils.java deleted file mode 100644 index 1a00c92..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TagUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.common.util; - -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.Comparator; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午2:14 - */ -public class TagUtils { - - private TagUtils() { - } - - public static Boolean isValueEquals(List list1, List list2) { - if (CollectionUtils.isEmpty(list1) && CollectionUtils.isEmpty(list2)) { - return true; - } - - boolean collectionStatusNotEquals = (CollectionUtils.isEmpty(list1) && CollectionUtils.isNotEmpty(list2)) - || (CollectionUtils.isEmpty(list2) && CollectionUtils.isNotEmpty(list1)); - if (collectionStatusNotEquals) { - return false; - } - if (list1.size() != list2.size()) { - return false; - } - list1.sort(Comparator.comparing(TagFieldInfo::getTagFieldName).thenComparing(TagFieldInfo::getTagCode)); - list2.sort(Comparator.comparing(TagFieldInfo::getTagFieldName).thenComparing(TagFieldInfo::getTagCode)); - - for (int i = 0; i < list1.size(); i++) { - if (!StrUtils.trimEquals(list1.get(i).getTagFieldName(), list2.get(i).getTagFieldName()) - || !StrUtils.trimEquals(list1.get(i).getTagCode(), list2.get(i).getTagCode())) { - return false; - } - } - return true; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java deleted file mode 100644 index 7df8bf0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.ningdatech.pmapi.common.util; - - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; -import com.google.common.collect.Maps; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; - -import java.io.Serializable; -import java.util.*; -import java.util.stream.Collectors; - -/** - * list列表 转换成tree列表 - * - * @author PoffyZhang - */ -public final class TreeUtil { - private TreeUtil() { - } - - private static Map nodeMap = Maps.newConcurrentMap(); - - /** - * 判断id是否为根节点 - * - * @param id - * @return - */ - public static boolean isRoot(Long id) { - return id == null || StrPool.DEF_PARENT_ID.equals(id); - } - - - public static String getTreePath(String parentTreePath, Long parentId) { - return StrPool.COMMA + parentId + parentTreePath; - } - - /** - * 构建Tree结构 - * - * @param treeList 待转换的集合 - * @return 树结构 - */ - public static > List buildTree(List treeList) { - if (CollUtil.isEmpty(treeList)) { - return treeList; - } - //记录自己是自己的父节点的id集合 - List selfIdEqSelfParent = new ArrayList<>(); - - // 遍历两次 - foreachNodes(treeList, selfIdEqSelfParent); - foreachNodesWithTopMenu(treeList); - - // 找出根节点集合 - List trees = new ArrayList<>(); - - List allIds = treeList.stream().map(node -> node.getId()).collect(Collectors.toList()); - for (E baseNode : treeList) { - if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { - baseNode.setPid(null); - baseNode.setTopMenu(baseNode.getName()); - trees.add(baseNode); - } - } - return trees; - } - - private static > - void foreachNodes(List treeList, List selfIdEqSelfParent) { - nodeMap = Maps.newConcurrentMap(); - for (E parent : treeList) { - Serializable id = parent.getId(); - nodeMap.put(parent.getId(), parent); - for (E children : treeList) { - if (parent != children) { - //parent != children 这个来判断自己的孩子不允许是自己,因为有时候,根节点的parent会被设置成为自己 - if (id.equals(children.getPid())) { - parent.initChildren(); - if (0L == parent.getPid()) { - children.setTopMenu(parent.getName()); - children.setLevel(2); - } else { - children.setTopMenu(parent.getTopMenu()); - children.setLevel(parent.getLevel() + 1); - } - parent.getChildren().add(children); - } - } else if (id.equals(parent.getPid())) { - selfIdEqSelfParent.add(id); - } - } - } - } - - private static > void foreachNodesWithTopMenu(List treeList) { - for (E parent : treeList) { - Serializable id = parent.getId(); - for (E children : treeList) { - if (parent != children) { - if (id.equals(children.getPid())) { - if (0L == parent.getPid()) { - children.setTopMenu(parent.getName()); - children.setLevel(2); - } else { - children.setTopMenu(parent.getTopMenu()); - children.setLevel(parent.getLevel() + 1); - } - } - } - } - } - } - - public static List buildUserTree(List treeList) { - if (CollUtil.isEmpty(treeList)) { - return Collections.emptyList(); - } - Map> menuGroup = CollUtils.group(treeList, MenuTreeEntity::getPid); - Map menuMap = CollUtils.listToMap(treeList, MenuTreeEntity::getId); - return buildUserMenuTree(menuGroup, menuMap, StrPool.DEF_PARENT_ID, null); - } - - private static List buildUserMenuTree(Map> menuGroup, - Map menuMap, - Long parentId, - ListIterator parentIter) { - MenuRoleVO parentMenu = menuMap.get(parentId); - List currMenus = menuGroup.get(parentId); - if (currMenus == null) { - return Collections.emptyList(); - } - List menus; - if (!parentId.equals(StrPool.DEF_PARENT_ID)) { - Map> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType); - for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) { - vo.setTopMenu(parentMenu.getTopMenu()); - parentIter.add(vo); - } - menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList()); - } else { - menus = new ArrayList<>(currMenus); - } - menus.sort(Comparator.comparing(w -> ObjectUtil.defaultIfNull(w.getSort(), 99))); - ListIterator currIter = menus.listIterator(); - while (currIter.hasNext()) { - MenuRoleVO curr = currIter.next(); - if (curr.getPid().equals(StrPool.DEF_PARENT_ID)) { - curr.setPid(null); - curr.setTopMenu(curr.getName()); - } else { - curr.setTopMenu(parentMenu.getTopMenu()); - } - curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter)); - } - return menus; - } - -} 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 deleted file mode 100644 index 17c455e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index cdcb0ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java +++ /dev/null @@ -1,65 +0,0 @@ -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/constant/DashboardConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java deleted file mode 100644 index 7a32a3c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.dashboard.constant; - -import java.math.BigDecimal; - -/** - * @author liuxinxin - * @date 2023/8/2 下午2:46 - */ - -public class DashboardConstant { - - public static class Protrait{ - public static final String NONE = "暂无"; - public static final String PLAN = "计划"; - public static final String DECLARED = "申报"; - public static final String APPROVE = "审批"; - public static final String CONSTRUCTION = "建设"; - public static final String ACCEPT = "验收"; - - public static final String OPERATION = "运维"; - public static final String PERFORMANCE = "绩效"; - public static final String LOG_OFF = "注销"; - - public static final String PROJECT_SIGNS = "项目体征"; - public static final String FEILD_SAFETYMONEY = "safetyInputAmount"; - - public static final String ZREO_PERCEN = "0"; - } - - - public static class CockpitStats{ - //总数 - public static final String TOTAL = "TOTAL"; - public static final int NONE_YEAR = 0; - } - - public static class Expert { - public static final String ACCOUNT_STATUS_OK = "available"; - - public static final String DISTRIBUTION_SHENG = "省维度"; - - public static final String DISTRIBUTION_SHI = "市维度"; - - public static final String NETWORK_CODE = "1030000"; - public static final String XINCHUANG_CODE = "2040000"; - public static final String FANGAN_CODE = "2030000"; - public static final String JISHU_CODE = "2010000"; - public static final String DANGZHENG_CODE = "1020000"; - public static final String RUANYING_CODE = "2020000"; - public static final String CAIWU_CODE = "5600000"; - - public static final String XINCHUANG_OTTHER_CODE = "5500000"; - - public static final String XINXIHUA_CODE = "5400000"; - public static final String EXPERT_TYPE = "expert_type"; - - public static final String EXPERT_TYPE_INNER = "300000"; - - public static final String EXPERT_TYPE_OUT = "300001"; - - public static final String EXPERT_LEVEL_ZHENGGAO = "900000"; - - public static final String EXPERT_LEVEL_FUGAO = "900001"; - - public static final String EXPERT_LEVEL_MID = "900002"; - - public static final String EXPERT_LEVEL_CHUJI = "900003"; - - public static final String EXPERT_LEVEL_NULL = "900004"; - - public static final BigDecimal REVIEW_AOUMT_EXPERT = BigDecimal.valueOf(0.05); - } -} 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 deleted file mode 100644 index 1e376b7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ningdatech.pmapi.dashboard.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.dashboard.manage.CockpitStatsManage; -import com.ningdatech.pmapi.dashboard.manage.DashboardExpertManage; -import com.ningdatech.pmapi.dashboard.manage.DashboardProjectManage; -import com.ningdatech.pmapi.dashboard.model.dto.CockpitStatsSaveDTO; -import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; -import com.ningdatech.pmapi.dashboard.model.vo.*; -import com.ningdatech.pmapi.scheduler.task.CockpitStatsStatisticsTask; -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.*; -import javax.validation.Valid; -import java.net.UnknownHostException; -import java.util.List; - -/** - * @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; - - private final CockpitStatsManage cockpitStatsManage; - - private final CockpitStatsStatisticsTask cockpitStatsStatisticsTask; - - @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); - } - - @GetMapping("/project-portrait/{projectCode}") - @ApiOperation("驾驶舱-项目画像接口") - public DashboardProjectProtraitVO getProjectPortrait(@PathVariable String projectCode) { - return dashboardProjectManage.getProjectPortrait(projectCode); - } - - @GetMapping("cockpit-stats") - @ApiOperation("驾驶舱-统计数据接口") - public CockpitStatsVO getData(@RequestParam(required = false) String regionCode, - @RequestParam(required = false) Integer year) { - return cockpitStatsManage.getData(regionCode,year); - } - - @GetMapping("cockpit-stats-start") - @ApiOperation("驾驶舱-统计数据接口 强制运行任务") - public String statsStart() throws UnknownHostException { - cockpitStatsStatisticsTask.doTask(); - return "运行成功"; - } - - @PostMapping("cockpit-stats-save") - @ApiOperation("驾驶舱-统计数据接口 假数据保存") - public String statsSave(@RequestBody List saves) { - cockpitStatsManage.save(saves); - return "保存成功"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/StatisticsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/StatisticsController.java deleted file mode 100644 index f25556e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/StatisticsController.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.dashboard.controller; - -import com.ningdatech.pmapi.dashboard.manage.*; -import com.ningdatech.pmapi.dashboard.model.vo.*; -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.*; - -/** - * @author ZPF - * @date 2023/11/25 上午10:36 - */ -@RestController -@RequestMapping("/api/v1/statistics") -@Validated -@RequiredArgsConstructor -@Api(value = "StatisticsController", tags = "统计") -public class StatisticsController { - - private final FundStatisticsManage fundStatisticsManage; - - private final ExpertStatisticsManage expertStatisticsManage; - - private final MeetingStatisticsManage meetingStatisticsManage; - - private final ProjectCostStatisticsManage costStatisticsManage; - - private final EarlyWarningStatisticsManage earlyWarningStatisticsManage; - - private final PerformanceStatisticsManage performanceStatisticsManage; - - @GetMapping("/fund") - @ApiOperation("项目资金统计") - public FundStatisticsVO fund(@RequestParam(required = false) Integer year) { - return fundStatisticsManage.statistics(year); - } - - @GetMapping("/expert") - @ApiOperation("专家统计") - public ExpertStatisticsVO expert(@RequestParam(required = false) Integer year) { - return expertStatisticsManage.statistics(year); - } - - @GetMapping("/meeting") - @ApiOperation("评审会议统计") - public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) { - return meetingStatisticsManage.statistics(year); - } - - @GetMapping("/project-cost") - @ApiOperation("项目成本统计") - public CostStatisticsVO projectCost() { - return costStatisticsManage.statistics(); - } - - @GetMapping("/early-warning") - @ApiOperation("预警统计") - public EarlyWarningStatisticsVO earlyWarning(@RequestParam(required = false) Integer year) { - return earlyWarningStatisticsManage.statistics(year); - } - - @GetMapping("/performance") - @ApiOperation("绩效统计") - public PerformanceStatisticsVO performance(@RequestParam(required = false) Integer year) { - return performanceStatisticsManage.statistics(year); - } - - @GetMapping("/project") - @ApiOperation("项目统计") - public EarlyWarningStatisticsVO project(@RequestParam(required = false) Integer year) { - return earlyWarningStatisticsManage.statistics(year); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/enums/CockpitAppcationTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/enums/CockpitAppcationTypeEnum.java deleted file mode 100644 index a06f080..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/enums/CockpitAppcationTypeEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.dashboard.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.Objects; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum CockpitAppcationTypeEnum { - /** - * 驾驶舱 应用类型 - */ - OPTIMAL(1,"最佳应用"), - MAJOR(2,"重大应用"); - - private Integer code; - private String desc; - - public static CockpitAppcationTypeEnum match(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (CockpitAppcationTypeEnum t : CockpitAppcationTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ApplicationHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ApplicationHandler.java deleted file mode 100644 index 39c36ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ApplicationHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ningdatech.pmapi.dashboard.handle; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectOutputVO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname ApplicationHandler - * @Description - * @Date 2023/10/9 14:11 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ApplicationHandler { - private final IProjectApplicationService applicationService; - - private final IProjectService projectService; - /** - * 生成项目产出 - * @param projectCode - * @return - */ - public Map generateOutput(String projectCode) { - Map res = Maps.newHashMap(); - //1.初始化 项目体征 - res.put(DashboardConstant.Protrait.PROJECT_SIGNS, - generateOutputEntity(DashboardConstant.Protrait.PROJECT_SIGNS)); - //2.查询应用 - Project project = projectService.getProjectByCode(projectCode); - if(Objects.nonNull(project)){ - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectVersion, project.getVersion()) - .eq(ProjectApplication::getProjectCode, projectCode)); - for(ProjectApplication app : apps){ - String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication(); - res.put(appName,generateOutputEntity(appName)); - } - } - return res; - } - - public List generateIrsApp(String projectCode) { - List res = Lists.newArrayList(); - //.查询应用 - Project project = projectService.getProjectByCode(projectCode); - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectVersion, project.getVersion()) - .eq(ProjectApplication::getProjectCode, projectCode)); - for(ProjectApplication app : apps){ - String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication(); - res.add(generateOutputEntity(appName)); - } - return res; - } - - private ProtraitProjectOutputVO generateOutputEntity(String name){ - return ProtraitProjectOutputVO.builder() - .name(DashboardConstant.Protrait.PROJECT_SIGNS) - .generateData(new ProtraitProjectOutputVO.GenerateData()) - .componentUsage(new ProtraitProjectOutputVO.ComponentUsage()) - .cloudResourceUsage(new ProtraitProjectOutputVO.CloudResourceUsage()) - .dataUsage(new ProtraitProjectOutputVO.DataUsage()) - .operationReport(new ProtraitProjectOutputVO.OperationReport()) - .build(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java deleted file mode 100644 index 6511cff..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.ningdatech.pmapi.dashboard.handle; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.enums.CockpitAppcationTypeEnum; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; -import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname CockpitStatsHandler - * @Description - * @Date 2023/10/9 14:11 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class CockpitStatsHandler { - - private final RegionCacheHelper regionCacheHelper; - - private final ICockpitStatsService cockpitStatsService; - - private static final List years = Lists.newArrayList(2021,2022,2023,2024,2025); - - public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats, String regionCode, Integer year - , List appDatas) { - CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); - - if(Objects.isNull(cockpitStats)){ - return res; - } - //监测数据 - res.setMonitorData(convertMonitor(cockpitStats,regionCode)); - //专家数据 - res.setExpertData(convertExpertData(cockpitStats)); - //顶部数据 - res.setTopData(convertTopData(cockpitStats)); - //地图数据 - res.setMapProjectData(convertMapProjectsData(cockpitStats,year)); - //项目项目数据 - res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); - //项目效益 优秀项目 - res.setExcellentData(convertExcellentData(cockpitStats)); - //核减信息 - res.setReduceData(convertReduceData(cockpitStats)); - //产出信息 - res.setProduceData(convertProduceData(cockpitStats)); - //绩效 - res.setPerformanceData(convertPerformanceData(cockpitStats)); - //最佳/重大应用 - res.setAppDatas(convertCockpitApps(appDatas)); - //数据质量分数 - res.setQualityDatas(convertQualityDatas(year)); - return res; - } - - private List convertQualityDatas(Integer year) { - List datas = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) - .eq(Objects.nonNull(year), CockpitStats::getYear, year) - .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) - .ne(CockpitStats::getRegionCode,DashboardConstant.CockpitStats.TOTAL) - .orderByAsc(CockpitStats::getRegionCode)); - - if(CollUtil.isEmpty(datas)){ - return Collections.emptyList(); - } - - return datas.stream().map(d -> { - CockpitStatsVO.QualityData data = new CockpitStatsVO.QualityData(); - data.setRegionCode(d.getRegionCode()); - data.setRegionName(d.getRegionName()); - data.setQuality(d.getDataQuality()); - return data; - }).collect(Collectors.toList()); - } - - private Map> convertCockpitApps(List appDatas) { - Map> res = Maps.newHashMap(); - res.put(CockpitAppcationTypeEnum.OPTIMAL.getDesc(), CollUtil.isEmpty(appDatas) ? Collections.emptyList() : - appDatas.stream().filter(a -> Objects.nonNull(a) && Objects.nonNull(a.getType()) && - CockpitAppcationTypeEnum.OPTIMAL.getCode().equals(a.getType())).collect(Collectors.toList())); - res.put(CockpitAppcationTypeEnum.MAJOR.getDesc(), CollUtil.isEmpty(appDatas) ? Collections.emptyList() : - appDatas.stream().filter(a -> Objects.nonNull(a) && Objects.nonNull(a.getType()) && - CockpitAppcationTypeEnum.MAJOR.getCode().equals(a.getType())).collect(Collectors.toList())); - return res; - } - - private CockpitStatsVO.PerformanceData convertPerformanceData(CockpitStats cockpitStats) { - CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.PerformanceData.class); - data.setPerformanceTops(convertTops(cockpitStats)); - return data; - } - - private List convertTops(CockpitStats cockpitStats) { - List tops = Lists.newArrayList(); - tops.add(new CockpitStatsVO.PerformanceTop("一星",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); - tops.add(new CockpitStatsVO.PerformanceTop("二星",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); - tops.add(new CockpitStatsVO.PerformanceTop("三星",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); - tops.add(new CockpitStatsVO.PerformanceTop("四星",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); - tops.add(new CockpitStatsVO.PerformanceTop("五星",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); - return tops; - } - - private CockpitStatsVO.ProduceData convertProduceData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ProduceData.class); - } - - private CockpitStatsVO.ReduceData convertReduceData(CockpitStats cockpitStats) { - CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ReduceData.class); - data.setAmountComparisonCharts(convertAmountComparisonChart(cockpitStats)); - return data; - } - - private List convertAmountComparisonChart(CockpitStats cockpitStats) { - List res = Lists.newArrayList(); - res.add(new CockpitStatsVO.AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(),cockpitStats.getApprovalAmountApprove(),cockpitStats.getDifferenceApprove())); - res.add(new CockpitStatsVO.AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(),cockpitStats.getApprovalAmountApproval(),cockpitStats.getDifferenceApproval())); - res.add(new CockpitStatsVO.AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(),cockpitStats.getApprovalAmountContract(),cockpitStats.getDifferenceContract())); - return res; - } - - private CockpitStatsVO.ExcellentData convertExcellentData(CockpitStats cockpitStats) { - CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ExcellentData.class); - data.setExcellentProjects(Lists.newArrayList()); - return data; - } - - private CockpitStatsVO.StatusProjectsData convertStatusProjectsData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.StatusProjectsData.class); - } - - private List convertMapProjectsData(CockpitStats cockpitStats,Integer year) { - List mapProjectsDatas = Lists.newArrayList(); - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); - - List cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) - .eq(Objects.nonNull(year), CockpitStats::getYear, year) - .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR)); - Map totalMap = cockpitStatsAll.stream().filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) - .collect(Collectors.toMap(c -> c.getRegionCode(), c -> c.getProjectsTotal())); - - for(RegionDTO region : regions){ - CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); - mapProjectsData.setRegionCode(region.getRegionCode()); - mapProjectsData.setRegionName(region.getRegionName()); - if(totalMap.containsKey(mapProjectsData.getRegionCode())){ - mapProjectsData.setProjectsNum(totalMap.get(mapProjectsData.getRegionCode())); - }else{ - mapProjectsData.setProjectsNum(0); - } - mapProjectsDatas.add(mapProjectsData); - } - return mapProjectsDatas; - } - - private CockpitStatsVO.TopData convertTopData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.TopData.class); - } - - private CockpitStatsVO.Expert convertExpertData(CockpitStats cockpitStats) { - CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Expert.class); - expert.setExpertRegionData(buidExpertRegionData(cockpitStats)); - return expert; - } - - private List buidExpertRegionData(CockpitStats cockpitStats) { - List regionData = Lists.newArrayList(); - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); - - List cs = cockpitStatsService.list(); - Map csMap = cs.stream().collect(Collectors.toMap(c -> c.getRegionCode() + c.getYear(), CockpitStats::getExpertTotalNum)); - for(RegionDTO region : regions){ - CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); - expertRegion.setRegionCode(region.getRegionCode()); - expertRegion.setRegionName(region.getRegionName()); - if(csMap.containsKey(region.getRegionCode() + 0)){ - expertRegion.setExpertNum(csMap.get(region.getRegionCode() + 0)); - }else{ - expertRegion.setExpertNum(0); - } - regionData.add(expertRegion); - } - return regionData; - } - - private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats,String regionCode) { - CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Monitor.class); - monitor.setPasswordGradeCharts(buidPasswordGradeCharts(cockpitStats)); - monitor.setSecrecyGradeCharts(buidSecrecyGradeCharts(cockpitStats)); - monitor.setMonitorSafetyInputRate(computeSafetyRate(regionCode)); - return monitor; - } - - /** - * 安全投入 比 图 - * @param regionCode - * @return - */ - private List computeSafetyRate(String regionCode) { - List cocks = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) - .eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) - .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) - .in(CockpitStats::getYear, years) - .orderByAsc(CockpitStats::getYear)); - return cocks.stream().map(c -> { - CockpitStatsVO.SafetyInput safetyInput = new CockpitStatsVO.SafetyInput(); - safetyInput.setYear(c.getYear()); - safetyInput.setRate(Objects.nonNull(c.getMonitorDeclaredAmount()) && c.getMonitorDeclaredAmount().compareTo(BigDecimal.ZERO) > 0 ? - c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(),2, RoundingMode.CEILING): BigDecimal.ZERO); - return safetyInput; - }).collect(Collectors.toList()); - } - - private List buidSecrecyGradeCharts(CockpitStats cockpitStats) { - List chars = Lists.newArrayList(); - chars.add(new CockpitStatsVO.SecrecyGradeChart(1,cockpitStats.getMonitorSecrecyGrade1Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(2,cockpitStats.getMonitorSecrecyGrade2Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(3,cockpitStats.getMonitorSecrecyGrade3Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(4,cockpitStats.getMonitorSecrecyGrade4Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(5,cockpitStats.getMonitorSecrecyGrade5Num())); - return chars; - } - - private List buidPasswordGradeCharts(CockpitStats cockpitStats) { - List chars = Lists.newArrayList(); - chars.add(new CockpitStatsVO.PasswordGradeChart(1,cockpitStats.getMonitorPasswordGrade1Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(2,cockpitStats.getMonitorPasswordGrade2Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(3,cockpitStats.getMonitorPasswordGrade3Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(4,cockpitStats.getMonitorPasswordGrade4Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(5,cockpitStats.getMonitorPasswordGrade5Num())); - return chars; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ProjectStatusHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ProjectStatusHandler.java deleted file mode 100644 index dc87eba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/ProjectStatusHandler.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.ningdatech.pmapi.dashboard.handle; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.github.xiaoymin.knife4j.core.util.CommonUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectStatusSituationVO; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.flowable.engine.HistoryService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.springframework.stereotype.Component; - -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectStatusHandler - * @Description - * @Date 2023/10/9 14:11 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectStatusHandler { - - private final IProjectService projectService; - private final IProjectInstService projectInstService; - - private final INdProjectStatusChangeService statusChangeService; - - private final HistoryService historyService; - - private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; - - /** - * 不同的项目状态 去求不同的审批完成时间 审批类型的 - * @param project - * @return - */ - public ProtraitProjectStatusSituationVO generateApproveStatus(Project project,String statusName,Integer instType) { - ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); - if(Objects.isNull(project)){ - return vo; - } - vo.setStatusName(statusName); - //查询 单位内部审核完成的时间 - String projectCode = project.getProjectCode(); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - List ids = projects.stream().map(Project::getId).collect(Collectors.toList()); - //查询 项目与实例关联表 - ProjectInst unitInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, ids) - .eq(ProjectInst::getInstType, instType) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(unitInst)){ - return vo; - } - //查询 这个实例 的完成时间 - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() - .finished() - .processInstanceId(unitInst.getInstCode()) - .singleResult(); - if(Objects.isNull(instance)){ - return vo; - } - Date endTime = instance.getEndTime(); - vo.setStatusTime(BizUtils.convertDate(endTime)); - return vo; - } - - /** - * 不同的项目状态 去求不同的审批完成时间 非审批类型的 - * @param project - * @return - */ - public ProtraitProjectStatusSituationVO generateStatus(Project project,String statusName, - Integer beforeStatusCode,Integer afterStatusCode) { - ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); - if(Objects.isNull(project)){ - return vo; - } - vo.setStatusName(statusName); - //查询 单位内部审核完成的时间 - String projectCode = project.getProjectCode(); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - List ids = projects.stream().map(Project::getId).collect(Collectors.toList()); - //查询 状态机流转的时间点 - ProjectStatusChange statusChange = statusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getBeforeStatus, beforeStatusCode) - .eq(ProjectStatusChange::getProjectCode, projectCode) - .eq(ProjectStatusChange::getAfterStatus, afterStatusCode) - .last(BizConst.LIMIT_1)); - - if(Objects.isNull(statusChange)){ - return vo; - } - vo.setStatusTime(statusChange.getCreateOn()); - return vo; - } - - /** - * 绩效 - * @param project - * @return - */ - public ProtraitProjectStatusSituationVO generatePerformanceStatus(Project project) { - ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); - vo.setStatusName(DashboardConstant.Protrait.PERFORMANCE); - if(Objects.isNull(project)){ - return vo; - } - //查询 绩效完成 核查时间 - String projectCode = project.getProjectCode(); - PerformanceAppraisalProject performance = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getProjectCode,projectCode) - .isNotNull(PerformanceAppraisalProject::getVerifyTotalScore) - .isNotNull(PerformanceAppraisalProject::getVerifyScoreTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(performance)){ - vo.setStatusTime(performance.getVerifyScoreTime()); - } - return vo; - } -} 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 deleted file mode 100644 index 6a80476..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java +++ /dev/null @@ -1,123 +0,0 @@ -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 static AnalysisChart buildAnalysisChartString(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 deleted file mode 100644 index 9cdcf62..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.dashboard.helper; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.dashboard.constant.AnalysisBasicConstant; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; -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.Objects; -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/CockpitStatsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/CockpitStatsManage.java deleted file mode 100644 index ddf00aa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/CockpitStatsManage.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.handle.CockpitStatsHandler; -import com.ningdatech.pmapi.dashboard.model.dto.CockpitApplicationDTO; -import com.ningdatech.pmapi.dashboard.model.dto.CockpitStatsSaveDTO; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; -import com.ningdatech.pmapi.dashboard.service.ICockpitApplicationService; -import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname CockpitStatsManage - * @Description - * @Date 2023/10/11 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class CockpitStatsManage { - - private final ICockpitStatsService cockpitStatsService; - - private final CockpitStatsHandler convertCockpitStats; - - private final ICockpitApplicationService cockpitApplicationService; - - /** - * 驾驶舱 统计数据 - * @param regionCode - * @param year - * @return - */ - public CockpitStatsVO getData(String regionCode, Integer year) { - CockpitStats cockpitStats = cockpitStatsService.getOne(Wrappers.lambdaQuery(CockpitStats.class) - .eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) - .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) - .eq(Objects.nonNull(year), CockpitStats::getYear, year) - .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) - .last(BizConst.LIMIT_1)); - - if(Objects.isNull(cockpitStats)){ - return new CockpitStatsVO(); - } - - List aps = cockpitApplicationService - .list(Wrappers.lambdaQuery(CockpitApplication.class) - .orderByAsc(CockpitApplication::getCreateOn)); - - return convertCockpitStats.convertCockpitStats(cockpitStats,regionCode,year,aps); - } - - public void save(List saves) { - for(CockpitStatsSaveDTO save : saves){ - List cockpitStatsList = cockpitStatsService.list(Wrappers.lambdaUpdate(CockpitStats.class) - .eq(Objects.nonNull(save.getRegionCode()), CockpitStats::getRegionCode, save.getRegionCode()) - .eq(Objects.nonNull(save.getYear()), CockpitStats::getYear, save.getYear())); - if(CollUtil.isNotEmpty(cockpitStatsList)){ - for(CockpitStats cockpitStats : cockpitStatsList){ - BeanUtil.copyProperties(save,cockpitStats, CopyOptions.create().ignoreNullValue()); - cockpitStatsService.updateById(cockpitStats); - } - } - - if(Objects.nonNull(save.getCockpitApplications())){ - cockpitApplicationService.remove(Wrappers.lambdaQuery(CockpitApplication.class)); - - List cockpitApplications = save.getCockpitApplications(); - if(CollUtil.isNotEmpty(cockpitApplications)){ - List applications = cockpitApplications.stream() - .map(a -> BeanUtil.copyProperties(a,CockpitApplication.class)) - .collect(Collectors.toList()); - cockpitApplicationService.saveBatch(applications); - } - } - } - } -} 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 deleted file mode 100644 index d53a236..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java +++ /dev/null @@ -1,168 +0,0 @@ -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 deleted file mode 100644 index d651575..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java +++ /dev/null @@ -1,566 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler; -import com.ningdatech.pmapi.dashboard.handle.ProjectStatusHandler; -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.*; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -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 com.ningdatech.pmapi.sys.model.req.NoticeListReq; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; -import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/8/2 上午10:39 - */ - -@Component -@RequiredArgsConstructor -public class DashboardProjectManage { - - private final IProjectService iProjectService; - - private final IGovBizProjectBaseinfoService baseinfoService; - - private final IGovBizProjectApplyService applyService; - - - private final IGovOperationProjectBaseinfoService operationBaseService; - private final INdProjectDelayApplyService iProjectDelayApplyService; - private final DashboardHelper dashboardHelper; - private final IPurchaseService iPurchaseService; - - private final ProjectStatusHandler statusHandler; - - private final IProjectTagService projectTagService; - - private final ApplicationHandler applicationHandler; - - 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.buildAnalysisChartString(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; - } - - /** - * 驾驶舱-项目画像 - * @param projectCode - * @return - */ - public DashboardProjectProtraitVO getProjectPortrait(String projectCode) { - DashboardProjectProtraitVO res = new DashboardProjectProtraitVO(); - //1.先查询项目 - Project project = iProjectService.getProjectByCode(projectCode); - - GovBizProjectBaseinfo baseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - - GovOperationProjectBaseinfo operationBase = operationBaseService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - - if(Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)){ - return res; - } - - //2.转换项目信息 - if(Objects.nonNull(project)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); - projectInfo.setOverdueSituation("即将超期"); - projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); - projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null); - //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(project)); - res.setProjectInfo(projectInfo); - }else if(Objects.nonNull(baseInfo)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); - projectInfo.setOverdueSituation("即将超期"); - projectInfo.setSafetyInputRate("0"); - if(Objects.nonNull(apply)){ - try{ - projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - }catch (Exception e){ - } - projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); - projectInfo.setBuildCycle(apply.getBaseProjDuration()); - projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); - } - projectInfo.setProjectCode(projectCode); - projectInfo.setProjectName(baseInfo.getBaseProjName()); - projectInfo.setBuildOrgName(baseInfo.getBaseBuildDeprt()); - projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); - //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); - projectInfo.setStatus(baseInfo.getBaseProjSetProg()); - res.setProjectInfo(projectInfo); - }else if(Objects.nonNull(operationBase)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); - projectInfo.setOverdueSituation("即将超期"); - projectInfo.setSafetyInputRate("0"); - if(Objects.nonNull(apply)){ - try{ - projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - }catch (Exception e){ - } - projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); - projectInfo.setBuildCycle(apply.getBaseProjDuration()); - projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); - } - projectInfo.setProjectCode(projectCode); - projectInfo.setProjectName(operationBase.getBaseProjName()); - projectInfo.setBuildOrgName(operationBase.getBaseBuildDeprt()); - projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); - //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(operationBase)); - projectInfo.setStatus(operationBase.getBaseProjSetProg()); - res.setProjectInfo(projectInfo); - } - - - //4.查询项目特征 - res.setProjectFeatures(projectTagService.getProjectTas(projectCode)); - - //5.查询项目产出 - res.setProjectOutput(applicationHandler.generateOutput(projectCode)); - - return res; - } - - /** - * 计算安全投入 - * @param project - * @return - */ - public static String convertSafetyInputRate(Project project) { - String safetyInputDescribe = project.getSafetyInputDescribe(); - if(org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)){ - try{ - JSONArray array = JSON.parseArray(safetyInputDescribe); - final Double[] total = {0.0}; - array.forEach(j -> { - JSONObject json = JSON.parseObject(JSON.toJSONString(j)); - Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); - if(Objects.nonNull(safetyInputAmount)){ - total[0] += safetyInputAmount; - } - }); - Double totalAmount = total[0]; - //申报金额 - BigDecimal declareAmount = project.getDeclareAmount(); - if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ - return DashboardConstant.Protrait.ZREO_PERCEN; - } - BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) - .divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) - .stripTrailingZeros(); - return rate.toPlainString(); - }catch (Exception e){} - } - return DashboardConstant.Protrait.ZREO_PERCEN; - } - - /** - * 生成项目 状态流转信息 - * @param project - * @return - */ - private List generateProjectStatus(Project project) { - final List res = Lists.newArrayList(); - //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO()); - //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO()); - //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO()); - //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO()); - //5.验收(终验) - res.add(new ProtraitProjectStatusSituationVO()); - //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); - //7.绩效 - res.add(new ProtraitProjectStatusSituationVO()); - //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); - - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - res.set(0,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(1,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(2,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(3,statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, - ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(4,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(6, statusHandler.generatePerformanceStatus(project)); - }, ForkJoinPool.commonPool()) - ).join(); - return res; - } - - private List generateProjectStatus(GovBizProjectBaseinfo baseinfo) { - final List res = Lists.newArrayList(); - //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); - //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); - //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); - //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); - //5.验收(终验) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, - Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); - //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); - //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); - //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); - return res; - } - - private List generateProjectStatus(GovOperationProjectBaseinfo baseinfo) { - final List res = Lists.newArrayList(); - //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); - //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); - //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); - //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); - //5.验收(终验) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, - Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); - //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); - //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); - //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/EarlyWarningStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/EarlyWarningStatisticsManage.java deleted file mode 100644 index 582c83e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/EarlyWarningStatisticsManage.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import com.ningdatech.pmapi.dashboard.model.vo.EarlyWarningStatisticsVO; -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.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; -import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; -import com.ningdatech.pmapi.sys.utils.EarlyWarningUtil; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.wflow.enums.WarningNoticeTypeEnum; -import com.wflow.enums.WarningRuleTypeEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.task.api.Task; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @Classname EarlyWarningStatisticsManage - * @Description - * @Date 2023/12/05 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class EarlyWarningStatisticsManage { - - private final IEarlyWarningRecordsService earlyWarningRecordsService; - - private final HistoryService historyService; - - private final IProjectInstService projectInstService; - - private final IProjectService projectService; - - private final TaskService taskService; - - private static final List threeYears = Lists.newArrayList(LocalDateTime.now().getYear() - 2, - LocalDateTime.now().getYear() - 1,LocalDateTime.now().getYear()); - - public EarlyWarningStatisticsVO statistics(Integer year) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - //项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE)); - - EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class); - EarlyWarningUtil.buildPermissonWrapper(wrapper,user); - List records = earlyWarningRecordsService.list(wrapper); - //累积总告警数 - res.setAccumulatedAlarmsTotal(records.size()); - res.setAccumulatedAlarmsFlow(records.stream().filter(a -> { - if (Objects.nonNull(a.getRuleType()) && - a.getRuleType().equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size()); - res.setAccumulatedAlarmsFilling(records.stream().filter(a -> { - if (Objects.nonNull(a.getRuleType()) && - a.getRuleType().equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size()); - - //近三年 - List threeYearsAlarms = Lists.newArrayList(); - for(Integer thisYear : threeYears){ - DataDTO yearData = new DataDTO(); - yearData.setName(thisYear.toString()); - yearData.setNum(records.stream().filter(r -> { - if(Objects.nonNull(r.getWarningTime()) && - thisYear.equals(r.getWarningTime().getYear())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size()); - threeYearsAlarms.add(yearData); - } - res.setThreeYearsAlarms(threeYearsAlarms); - - //当前各流程报警数 - List alarmsFlowsNow = Lists.newArrayList(); - for(ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()){ - String processName = stageEnum.getDesc(); - Integer processType = stageEnum.getCode(); - alarmsFlowsNow.add(DataDTO.of(processName,computeFlowWarningNow(processType,records))); - } - res.setAlarmsFlowsNow(alarmsFlowsNow); - - //当前各填报报警数 - List alarmsFillingNow = Lists.newArrayList(); - for(WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()){ - String processName = fillingEnum.getDesc(); - Integer projectStutas = fillingEnum.getProjectStutas(); - alarmsFillingNow.add(DataDTO.of(processName,computeFillingNow(projectStutas,records,projects))); - } - res.setAlarmsFillingNow(alarmsFillingNow); - - //实施预警 - List alarmsConstruction = Lists.newArrayList(); - for(WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()){ - String name = noticeTypeEnum.getDesc(); - Integer noticeType = noticeTypeEnum.getCode(); - alarmsConstruction.add(DataDTO.of(name,computeConstruction(noticeType,records,projects))); - } - res.setConstructionAlarms(alarmsConstruction); - - //安全监测 - List safetyMonitoring = Lists.newArrayList(); - //--1 安全设计 - safetyMonitoring.add(DataDTO.of("安全设计",0)); - //--2 安全投入低于5% - safetyMonitoring.add(DataDTO.of("安全投入低于5%",computeSafeLessFive(projects))); - //--3 非信创 - safetyMonitoring.add(DataDTO.of("非信创",computeNotXinChuang(projects))); - //--4 等保未做 - safetyMonitoring.add(DataDTO.of("等保未做",0)); - //--5 密评未做 - safetyMonitoring.add(DataDTO.of("密评未做",0)); - res.setSafetyMonitoring(safetyMonitoring); - return res; - } - - //计算非信创 - private Integer computeNotXinChuang(List projects) { - return projects.stream().filter(p -> StringUtils.isNotBlank(p.getCloudType()) && - !p.getCloudType().contains("2")) - .collect(Collectors.toList()).size(); - } - - //计算安全投入低于5% - private Integer computeSafeLessFive(List projects) { - return projects.stream().filter(p -> { - //计算出 安全投入 - BigDecimal rate = new BigDecimal(DashboardProjectManage.convertSafetyInputRate(p)); - if (rate.compareTo(new BigDecimal(5)) < 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - - private Integer computeConstruction(Integer noticeType, List records, - List projects) { - //终验告警 - List constructionRecords = records.stream().filter(r -> { - if (Objects.nonNull(r.getRuleType()) && - WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) && - WarningOperationTypeEnum.ZHONGYAN.getCode().equals(r.getBiz())) - .collect(Collectors.toList()); - if(CollUtil.isEmpty(constructionRecords)){ - return 0; - } - Map> recordsMap = constructionRecords.stream().collect(Collectors.groupingBy( - WflowEarlyWarningRecords::getProjectCode)); - - //待终验的项目 - List tobeFinalProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - - return tobeFinalProjects.stream().filter(p -> { - if(recordsMap.containsKey(p.getProjectCode())){ - List warningRecords = recordsMap.get(p.getProjectCode()); - //如果是临期的 不能包含有超期的 - if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())){ - for(WflowEarlyWarningRecords warningRecord : warningRecords){ - if(Objects.isNull(warningRecord.getNoticeType()) || warningRecord.getNoticeType() - .equals(WarningNoticeTypeEnum.OVER.getCode())){ - return Boolean.FALSE; - } - } - } - //这个状态有告警 并且 这个项目也是这个类型 - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - - private Integer computeFillingNow(Integer projectStutas, List records, - List projects) { - List fillingRecords = records.stream().filter(r -> { - if (Objects.nonNull(r.getRuleType()) && - WarningRuleTypeEnum.DECLARED_WARNING.getCode().equals(r.getRuleType())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); - if(CollUtil.isEmpty(fillingRecords)){ - return 0; - } - Map> warningMap = fillingRecords.stream() - .collect(Collectors.groupingBy(WflowEarlyWarningRecords::getProjectCode)); - - List thisStatusProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(projectStutas)){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - - return thisStatusProjects.stream().filter(p -> { - if(warningMap.containsKey(p.getProjectCode())){ - //这个状态有告警 并且 这个项目也是这个类型 - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - - //计算某个流程当前正在告警的数量 - private Integer computeFlowWarningNow(Integer processType,List records) { - List processRecords = records.stream().filter(r -> { - if (Objects.nonNull(r.getRuleType()) && - WarningRuleTypeEnum.PROCESS_WARNING.getCode().equals(r.getRuleType())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); - if(CollUtil.isEmpty(processRecords)){ - return 0; - } - Map> warningMap = processRecords.stream() - .collect(Collectors.groupingBy(WflowEarlyWarningRecords::getNodeId)); - - //1.先查出 所育 这个类型的 流程 - List proInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstType, processType)); - if(CollUtil.isEmpty(proInsts)){ - return 0; - } - //2.再筛选一下 选出 正在审核 未完成的 - Set instCodes = proInsts.stream().map(ProjectInst::getInstCode) - .collect(Collectors.toSet()); - List processes = historyService.createHistoricProcessInstanceQuery() - .processInstanceIds(instCodes) - .unfinished() - .orderByProcessInstanceStartTime() - .asc() - .list(); - if(CollUtil.isEmpty(processes)){ - return 0; - } - //查出所有正在执行的工作流任务 - List tasks = taskService.createTaskQuery() - .list(); - if(CollUtil.isEmpty(tasks)){ - return 0; - } - Map> taskMap = tasks.stream() - .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - return processes.stream().filter(p -> { - if(taskMap.containsKey(p.getId())){ - List tasksThis = taskMap.get(p.getId()); - for(Task taskThis : tasksThis){ - //说明 当前有告警 - if(warningMap.containsKey(taskThis.getTaskDefinitionKey())){ - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ExpertStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ExpertStatisticsManage.java deleted file mode 100644 index 61f32ae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ExpertStatisticsManage.java +++ /dev/null @@ -1,341 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.model.vo.ExpertStatisticsVO; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; -import com.ningdatech.pmapi.meta.service.IMetaTagService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; - -/** - * @Classname ExpertStatisticsManage - * @Description - * @Date 2023/12/04 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ExpertStatisticsManage { - - private final RegionCacheHelper regionCacheHelper; - - private final IExpertUserFullInfoService userFullInfoService; - - private final IExpertIntentionWorkRegionService expertIntentionWorkRegionService; - - private final IExpertTagService expertTagService; - - private final IMetaTagService metaTagService; - - private final IExpertDictionaryService expertDictionaryService; - - private final IMetaDictionaryService metaDictionaryService; - - private Integer[] years = new Integer[]{LocalDateTime.now().getYear()-2, - LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear(), - LocalDateTime.now().getYear()+1,LocalDateTime.now().getYear()+2}; - - private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, - LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; - - private String[] SHENGWEIDU = new String[]{DashboardConstant.Expert.NETWORK_CODE, - DashboardConstant.Expert.DANGZHENG_CODE,DashboardConstant.Expert.FANGAN_CODE, - DashboardConstant.Expert.JISHU_CODE,DashboardConstant.Expert.XINCHUANG_CODE, - DashboardConstant.Expert.RUANYING_CODE}; - - private String[] SHIWEIDU = new String[]{DashboardConstant.Expert.CAIWU_CODE, - DashboardConstant.Expert.XINXIHUA_CODE,DashboardConstant.Expert.XINCHUANG_OTTHER_CODE}; - - private String[] TYPES = new String[]{DashboardConstant.Expert.EXPERT_TYPE_INNER, - DashboardConstant.Expert.EXPERT_TYPE_OUT}; - - private String[] LEVELS = new String[]{DashboardConstant.Expert.EXPERT_LEVEL_ZHENGGAO, - DashboardConstant.Expert.EXPERT_LEVEL_FUGAO,DashboardConstant.Expert.EXPERT_LEVEL_MID, - DashboardConstant.Expert.EXPERT_LEVEL_CHUJI,DashboardConstant.Expert.EXPERT_LEVEL_NULL}; - - /** - * 专家统计 - * @param year - * @return - */ - public ExpertStatisticsVO statistics(Integer year) { - List experts = userFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .eq(ExpertUserFullInfo::getExpertAccountStatus, DashboardConstant.Expert.ACCOUNT_STATUS_OK) - .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); - List intentionWorkRegions = expertIntentionWorkRegionService.list(); - - List expertTags = expertTagService.list(); - - List tags = metaTagService.queryAll(); - - List dictionaries = metaDictionaryService.queryAll(); - Set code = Sets.newHashSet(); - Map dictionMap = dictionaries.stream().filter(d -> code.add(d.getDictionaryCode())) - .collect(Collectors.toMap(DictionaryDTO::getDictionaryCode, DictionaryDTO::getName)); - - List expertDictionaries = expertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getExpertInfoField, DashboardConstant.Expert.EXPERT_TYPE)); - - ExpertStatisticsVO res = new ExpertStatisticsVO(); - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - //选择的年份去计算的数据 - yearCompleteExpert(res,year,experts,intentionWorkRegions,expertTags, - tags,expertDictionaries,dictionMap); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //近三年 - threeYearsCompleteExpert(res,experts); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //近一年 - lastYearsCompleteExpert(res,experts); - }, ForkJoinPool.commonPool()) - ).join(); - - return res; - } - - /** - * 近一年 - * @param res - */ - private void lastYearsCompleteExpert(ExpertStatisticsVO res,List experts) { - List lastYear = experts.stream().filter(expert -> { - if (expert.getCreateOn().compareTo(LocalDateTime.now().plusYears(-1)) >= 0 && - expert.getCreateOn().compareTo(LocalDateTime.now()) <= 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - res.setThisYearAdded(lastYear.size()); - } - - /** - * 近三年 - * @param res - */ - private void threeYearsCompleteExpert(ExpertStatisticsVO res,List experts) { - List threeYearsAdds = Lists.newArrayList(); - for (Integer year : threeYears){ - threeYearsAdds.add(DataDTO.of(year.toString(),year.toString(), - experts.stream().filter(e -> { - if (Objects.nonNull(e.getCreateOn()) && year.equals(e.getCreateOn().getYear())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size())); - } - res.setThreeYearsAdded(threeYearsAdds); - } - - /** - * 选择年份或者全部 - * @param res - * @param year - */ - private void yearCompleteExpert(ExpertStatisticsVO res, Integer year, - List experts,List intentionWorkRegions, - List expertTags,List tags,List expertDictionaries, - Map dictionMap) { - res.setTotal(experts.size()); - - Set userSet = Sets.newHashSet(); - Map expertMap = experts.stream().filter(e -> userSet.add(e.getUserId())) - .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); - - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) - .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) - .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); - - //是否要筛选年 - experts = experts.stream().filter(e -> { - if (Objects.nonNull(e.getCreateOn()) && - (Objects.isNull(year) || year.equals(e.getCreateOn().getYear()))) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - - //计算区域专家 - computeRegionExperts(res, intentionWorkRegions, expertMap, regions); - - //计算专家特长 - computeRegionDistribution(res,experts,expertTags,tags); - - //计算专家类型 - computeTypes(res,experts,expertDictionaries,dictionMap); - - //计算专家等级 - computeLevels(res,experts,expertDictionaries,dictionMap); - } - - /** - * 计算 专家等级 - * @param res - * @param experts - */ - private void computeLevels(ExpertStatisticsVO res, List experts, - List expertDictionaries,Map dictionMap) { - List levels = Lists.newArrayList(); - - Set userSets = Sets.newHashSet(); - Map expertUserFullInfoMap = experts.stream() - .filter(u -> userSets.add(u.getUserId())) - .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); - - Map> dictionaryMap = expertDictionaries.stream() - .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); - for(String levelCode : LEVELS){ - int num = 0; - if(dictionaryMap.containsKey(levelCode)){ - List dictionaries = dictionaryMap.get(levelCode); - num = dictionaries.stream().filter(d -> { - if (expertUserFullInfoMap.containsKey(d.getUserId())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - levels.add(DataDTO.of(dictionMap.get(levelCode),levelCode,num)); - } - - res.setLevels(levels); - } - - /** - * 计算 专家类型 - * @param res - * @param experts - */ - private void computeTypes(ExpertStatisticsVO res, List experts, - List expertDictionaries,Map dictionMap) { - List types = Lists.newArrayList(); - - Set userSets = Sets.newHashSet(); - Map expertUserFullInfoMap = experts.stream() - .filter(u -> userSets.add(u.getUserId())) - .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); - - Map> dictionaryMap = expertDictionaries.stream() - .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); - for(String typeCode : TYPES){ - int num = 0; - if(dictionaryMap.containsKey(typeCode)){ - List dictionaries = dictionaryMap.get(typeCode); - num = dictionaries.stream().filter(d -> { - if(expertUserFullInfoMap.containsKey(d.getUserId())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - types.add(DataDTO.of(dictionMap.get(typeCode),typeCode,num)); - } - - res.setTypes(types); - } - - //计算专家特长 - private void computeRegionDistribution(ExpertStatisticsVO res, List experts, - List expertTags, List tags) { - Set userSets = Sets.newHashSet(); - Map expertUserFullInfoMap = experts.stream() - .filter(u -> userSets.add(u.getUserId())) - .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); - - Map> typeDistribution = Maps.newHashMap(); - - Map> tagsMap = - expertTags.stream().filter(e -> Objects.nonNull(e.getTagCode())) - .collect(Collectors.groupingBy(ExpertTag::getTagCode)); - - Set tagSets = Sets.newHashSet(); - Map tagNameMap = tags.stream().filter(t -> tagSets.add(t.getTagCode())) - .collect(Collectors.toMap(TagDTO::getTagCode, TagDTO::getTagName)); - - //1.省维度 - List shengWeidu = Lists.newArrayList(); - for(String code : SHENGWEIDU){ - shengWeidu.add(getExpertData(expertUserFullInfoMap, - tagsMap, tagNameMap, code)); - } - - //2.市维度 - List shiWeidu = Lists.newArrayList(); - for(String code : SHIWEIDU){ - shiWeidu.add(getExpertData(expertUserFullInfoMap, - tagsMap, tagNameMap, code)); - } - - typeDistribution.put(DashboardConstant.Expert.DISTRIBUTION_SHENG,shengWeidu); - typeDistribution.put(DashboardConstant.Expert.DISTRIBUTION_SHI,shiWeidu); - res.setTypeDistribution(typeDistribution); - } - - /** - * 包装 - * @param expertUserFullInfoMap - * @param tagsMap - * @param tagNameMap - * @param code - * @return - */ - private static DataDTO getExpertData(Map expertUserFullInfoMap, Map> tagsMap, Map tagNameMap, String code) { - int num = 0; - if(tagsMap.containsKey(code)){ - List ets = tagsMap.get(code); - num = ets.stream().filter(e -> { - if(expertUserFullInfoMap.containsKey(e.getUserId())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - } - return DataDTO.of(tagNameMap.get(code),code,num); - } - - //计算区域专家 - private static void computeRegionExperts(ExpertStatisticsVO res, List intentionWorkRegions, Map expertMap, List regions) { - List regionExpert = Lists.newArrayList(); - for(RegionDTO region : regions){ - regionExpert.add(DataDTO.of(region.getRegionName(),region.getRegionCode(), - intentionWorkRegions.stream().filter(w -> { - if(Objects.nonNull(w) && Objects.nonNull(w.getRegionCode()) && - w.getRegionCode().equals(region.getRegionCode()) && - expertMap.containsKey(w.getUserId())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size())); - } - res.setRegionExpert(regionExpert); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/FundStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/FundStatisticsManage.java deleted file mode 100644 index 4cc37eb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/FundStatisticsManage.java +++ /dev/null @@ -1,471 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.dashboard.model.vo.FundStatisticsVO; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectProcure; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApproveService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectProcureService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @Classname FundStatisticsManage - * @Description - * @Date 2023/11/24 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class FundStatisticsManage { - private final IProjectService projectService; - - private final IGovBizProjectBaseinfoService baseinfoService; - - private final IGovBizProjectApplyService applyService; - - private final IGovBizProjectApproveService approveService; - - private final IGovBizProjectProcureService procureService; - - private Integer[] years = new Integer[]{2021,2022,2023,2024,2025}; - - private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, - LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; - - /** - * 项目统计 - * @param year - * @return - */ - public FundStatisticsVO statistics(Integer year) { - FundStatisticsVO res = new FundStatisticsVO(); - - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - //选择的年份去计算的数据 - yearCompleteAmount(res,year); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //近三年 - threeYearsCompleteAmount(res); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //所有年 用于算累积 - allYearsCompleteAmount(res); - }, ForkJoinPool.commonPool()) - ).join(); - - return res; - } - - /** - * 计算 所有年的 - * @param res - */ - private void allYearsCompleteAmount(FundStatisticsVO res) { - //1.申报项目 和 归集项目 - //申报项目 - List allProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .in(Project::getProjectYear, years)); - - //项目归集 - List allApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjSetYear, years)); - - List allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - - List allBaseInfos = Lists.newArrayList(); - List allApplies = Lists.newArrayList(); - List allApproves = Lists.newArrayList(); - List allProcures = Lists.newArrayList(); - - if(CollUtil.isNotEmpty(allProjIds)){ - allBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,allProjIds)); - if(CollUtil.isNotEmpty(allBaseInfos)){ - List allBaseProjIds = allBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - allApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,allBaseProjIds)); - allApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,allBaseProjIds)); - allProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,allBaseProjIds)); - } - } - - //2.4 累积 核减 - res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects,allApplies, - allApproves,allProcures)); - } - - /** - * 计算核减资金的方法 - * @param projects - * @param applies - * @param approves - * @param procures - * @return - */ - private BigDecimal completeDeductionAmount(List projects, - List applies, List approves, - List procures) { - //首先完成年度计划 并且未注销的项目 - List normalProjects = projects.stream().filter(p -> { - if (Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.BE_SUSPENDED.getCode()) > 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(normalProjects,applies,approves); - //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(normalProjects,approves,planHejian.getApproval()); - //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(normalProjects,procures,approvalHejian.getApproval()); - - return planHejian.getDiff().add(approvalHejian.getDiff()).add(contractHejian.getDiff()); - } - - //计算 计划阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computePlanHeJian(List projects, List applies, - List approves) { - FundStatisticsVO.HeJianAmount heJianAmount = new FundStatisticsVO.HeJianAmount(); - - //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) - final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? - p.getDeclareAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); - final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; - applies.stream().map(g -> { - BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; - return totalAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); - BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); - heJianAmount.setApprove(declaredAmountApproveTotal); - - //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) - final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); - final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; - return expertTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); - BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); - heJianAmount.setApproval(approvalAmountApproveTotal); - //申报的差额 - BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); - heJianAmount.setDiff(subtractApprove); - return heJianAmount; - } - - //计算 批复阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List projects,List approves, - BigDecimal approvalAmountApproveTotal){ - FundStatisticsVO.HeJianAmount approvalHejian = new FundStatisticsVO.HeJianAmount(); - approvalHejian.setApprove(approvalAmountApproveTotal); - //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) - final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; - return proposeTotalInvest; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); - final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; - return reviewTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); - BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); - approvalHejian.setApproval(approvalAmountApprovalTotal); - //批复的差额 - BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); - approvalHejian.setDiff(subtractApproval); - return approvalHejian; - } - - //计算 合同阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeContractHeJian(List projects,List procures, - BigDecimal approvalAmountApprovalTotal){ - FundStatisticsVO.HeJianAmount contractHejian = new FundStatisticsVO.HeJianAmount(); - contractHejian.setApprove(approvalAmountApprovalTotal); - //合同的批复金额(申报项目:成交金额 项目归集:成交金额) - final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; - return transactionAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); - final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; - procures.stream().map(p -> { - BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? - p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; - return purchaseAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); - BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); - contractHejian.setApproval(approvalAmountContractTotal); - //合同的差额 - BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); - contractHejian.setDiff(subtractContract); - return contractHejian; - } - - /** - * 近三年 - * @param res - */ - private void threeYearsCompleteAmount(FundStatisticsVO res) { - //申报项目 - List threeYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .in(Project::getProjectYear, threeYears)); - //项目归集 - List threeYearsApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjSetYear, threeYears)); - List threeYearsProjIds = threeYearsApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List threeYearsBaseInfos = Lists.newArrayList(); - List threeYearsApplies = Lists.newArrayList(); - List threeYearsApproves = Lists.newArrayList(); - List threeYearsProcures = Lists.newArrayList(); - - if(CollUtil.isNotEmpty(threeYearsProjIds)){ - threeYearsBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); - if(CollUtil.isNotEmpty(threeYearsBaseInfos)){ - List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - threeYearsApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); - threeYearsApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); - threeYearsProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); - } - } - - //2.4 近三年 核减 - res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects,threeYearsApplies, - threeYearsApproves,threeYearsProcures)); - - //安全起见 再排序下 - Arrays.sort(threeYears); - - List threeYearsDeduction = Lists.newArrayList(); - for(Integer year : threeYears){ - FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData(); - //申报项目 - List thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getProjectYear, year)); - //项目归集 - List thisYearApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjSetYear, year)); - List thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List thisYearBaseInfos = Lists.newArrayList(); - List thisYearApplies = Lists.newArrayList(); - List thisYearApproves = Lists.newArrayList(); - List thisYearProcures = Lists.newArrayList(); - - if(CollUtil.isNotEmpty(thisYearProjIds)){ - thisYearBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); - if(CollUtil.isNotEmpty(thisYearBaseInfos)){ - List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - thisYearApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); - thisYearApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); - thisYearProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); - } - } - amountData.setName(year.toString()); - amountData.setAmount(completeDeductionAmount(thisYearsProjects,thisYearApplies, - thisYearApproves,thisYearProcures)); - threeYearsDeduction.add(amountData); - } - res.setThreeYearsDeduction(threeYearsDeduction); - } - - /** - * 选择年份去计算 - * @param res - */ - private void yearCompleteAmount(FundStatisticsVO res, Integer year) { - //申报项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Objects.nonNull(year), Project::getProjectYear, year) - .in(Objects.isNull(year), Project::getProjectYear, years)); - //项目归集 - List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(Objects.nonNull(year), GovBizProjectApply::getBaseProjSetYear, year) - .in(Objects.isNull(year), GovBizProjectApply::getBaseProjSetYear, years)); - List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List baseInfos = Lists.newArrayList(); - List applies = Lists.newArrayList(); - List approves = Lists.newArrayList(); - List procures = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearProjIds)){ - baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); - if(CollUtil.isNotEmpty(baseInfos)){ - List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,baseProjIds)); - approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,baseProjIds)); - procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,baseProjIds)); - } - } - //2 - //2.1 总申请金额 - final BigDecimal[] declaredTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmount[0] = b); - final BigDecimal[] declaredTotalAmountGov = {BigDecimal.ZERO}; - applies.stream() - .map(a -> Objects.nonNull(a.getBaseProjTotalAmount()) ? a.getBaseProjTotalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmountGov[0] = b); - res.setDeclaredTotalAmount(declaredTotalAmount[0].add(declaredTotalAmountGov[0])); - //2.2 总批复金额 - final BigDecimal[] approvalTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmount[0] = b); - final BigDecimal[] approvalTotalAmountGov = {BigDecimal.ZERO}; - approves.stream() - .map(a -> Objects.nonNull(a.getBaseExpertTotalMoney()) ? a.getBaseExpertTotalMoney() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmountGov[0] = b); - res.setApprovalTotalAmount(approvalTotalAmount[0].add(approvalTotalAmountGov[0])); - //2.3 总合同金额 - final BigDecimal[] contractTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getContractAmount()) ? p.getContractAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmount[0] = b); - final BigDecimal[] contractTotalAmountGov = {BigDecimal.ZERO}; - procures.stream() - .map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmountGov[0] = b); - res.setApprovalTotalAmount(contractTotalAmount[0].add(contractTotalAmountGov[0])); - - //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(projects,applies,approves); - //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(projects,approves,planHejian.getApproval()); - //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(projects,procures,approvalHejian.getApproval()); - res.setPlanDeduction(planHejian); - res.setApprovalDeduction(approvalHejian); - res.setContractDeduction(contractHejian); - - //部门TOP10 - res.setDepartmentTop10(computeTop10(projects,baseInfos,applies,approves,procures)); - } - - /** - * 计算 部门TOP10 - * @param projects - * @param applies - * @param approves - * @param procures - * @return - */ - private List computeTop10(List projects,List baseInfos, - List applies, List approves, - List procures) { - //申报项目颗粒度 - Map> groupProjectMap = projects.stream() - .filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode())) - .collect(Collectors.groupingBy(Project::getBuildOrgCode)); - List projectAmounts = Lists.newArrayList(); - for(Map.Entry> entry : groupProjectMap.entrySet()){ - FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData(); - List ps = entry.getValue(); - if(CollUtil.isNotEmpty(ps)){ - orgAmount.setName(ps.get(0).getBuildOrgName()); - } - orgAmount.setAmount(completeDeductionAmount(entry.getValue(), - Collections.emptyList(), Collections.emptyList(), - Collections.emptyList())); - projectAmounts.add(orgAmount); - } - - //项目归集颗粒度 - Map> groupGovMap = baseInfos.stream() - .filter(b -> StringUtils.isNotBlank(b.getBaseBuildDeprtDing())) - .collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing)); - List govAmounts = Lists.newArrayList(); - for(Map.Entry> entry : groupGovMap.entrySet()){ - FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData(); - List bs = entry.getValue(); - List baseProjIds = Lists.newArrayList(); - if(CollUtil.isNotEmpty(bs)){ - govAmount.setName(bs.get(0).getBaseBuildDeprt()); - baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - } - - List finalBaseProjIds = baseProjIds; - List appliesThis = applies.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - List approvesThis = approves.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - List procuresThis = procures.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - govAmount.setAmount(completeDeductionAmount(Collections.emptyList(), - appliesThis, approvesThis,procuresThis)); - govAmounts.add(govAmount); - } - - //求出TOP10 - return Stream.concat(projectAmounts.stream(), govAmounts.stream()) - .collect(Collectors.toMap(FundStatisticsVO.AmountData::getName, Function.identity(), - (v1, v2) -> { - v1.setAmount(v1.getAmount().add(v2.getAmount())); - return v1; - })).values().stream() - .sorted(Comparator.comparing(FundStatisticsVO.AmountData::getAmount).reversed()) - .limit(10).collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/MeetingStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/MeetingStatisticsManage.java deleted file mode 100644 index 730c7c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/MeetingStatisticsManage.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import com.ningdatech.pmapi.dashboard.model.vo.MeetingStatisticsVO; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.expert.constant.ReviewResultEnum; -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.ningdatech.pmapi.expert.model.enumeration.ReviewTemplateTypeEnum; -import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.Comparator; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname MeetingStatisticsManage - * @Description - * @Date 2023/12/05 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class MeetingStatisticsManage { - - private final IMeetingService meetingService; - - private final IExpertReviewService expertReviewService; - - private final RegionCacheHelper regionCacheHelper; - - private final IDingOrganizationService dingOrganizationService; - - private final IProjectService projectService; - - public MeetingStatisticsVO statistics(Integer year) { - MeetingStatisticsVO res = new MeetingStatisticsVO(); - List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); - //查出 年份的 会议数据 - meetings = meetings.stream().filter(m -> { - if(Objects.nonNull(m.getStartTime()) && - (Objects.isNull(year) || year.equals(m.getStartTime().getYear()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - List meetingIds = meetings.stream().map(Meeting::getId) - .collect(Collectors.toList()); - - //会议总数 - res.setMeetingTotal(meetings.size()); - - //评审数 - List expertReviews = Lists.newArrayList(); - Integer reviewsTotal = 0; - if(CollUtil.isNotEmpty(meetingIds)){ - expertReviews = expertReviewService.list(Wrappers.lambdaQuery(ExpertReview.class) - .eq(ExpertReview::getIsFinal, Boolean.TRUE) - .in(ExpertReview::getMeetingId,meetingIds)); - reviewsTotal = expertReviews.size(); - } - //通过的评审 - List passExpertReviews = expertReviews.stream() - .filter(r -> Objects.nonNull(r.getReviewResult()) && - r.getReviewResult().equals(ReviewResultEnum.PASSED.getCode())) - .collect(Collectors.toList()); - //不通过的评审 - List notpassExpertReviews = expertReviews.stream() - .filter(r -> Objects.nonNull(r.getReviewResult()) && - r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) - .collect(Collectors.toList()); - res.setPassReview(passExpertReviews.size()); - res.setNotPassRate(reviewsTotal.compareTo(0) == 0 ? BigDecimal.ZERO : - BigDecimal.valueOf(notpassExpertReviews.size()).multiply(BigDecimal.valueOf(100) - .divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); - - //各区域 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) - .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) - .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); - List regionMeetngs = Lists.newArrayList(); - for(RegionDTO region : regions){ - regionMeetngs.add(DataDTO.of(region.getRegionName(),region.getRegionCode(),meetings.stream().filter(m -> { - if(StringUtils.isNotBlank(m.getRegionCode()) && - m.getRegionCode().equals(region.getRegionCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size())); - } - res.setRegionMeetings(regionMeetngs); - - //预审 验收 会议 - List meetingTypes = Lists.newArrayList(); - meetingTypes.add(DataDTO.of("预审会议",ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(), - meetings.stream().filter(m -> { - if(StringUtils.isNotBlank(m.getType()) && - m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() - .toString())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size())); - Long yanshouCount = meetings.stream().filter(m -> { - if (StringUtils.isNotBlank(m.getType()) && - m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode() - .toString())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).count(); - meetingTypes.add(DataDTO.of("验收会议",ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), - yanshouCount.intValue())); - res.setMeetingTypes(meetingTypes); - - //各区县评审 不通过率 - List regionNotpassReview = Lists.newArrayList(); - for(RegionDTO region : regions){ - DataDTO data = new DataDTO(); - data.setCode(region.getRegionCode()); - data.setName(region.getRegionName()); - //先求出 此区域会议 - List regionMeetingIds = meetings.stream().filter(m -> { - if (StringUtils.isNotBlank(m.getRegionCode()) && - m.getRegionCode().equals(region.getRegionCode())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).map(Meeting::getId).collect(Collectors.toList()); - - List regionReviews = expertReviews.stream().filter(r -> { - if (Objects.nonNull(r.getMeetingId()) && - regionMeetingIds.contains(r.getMeetingId())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - long regionNotpass = regionReviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) && - r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) - .count(); - - data.setRate(CollUtil.isEmpty(regionReviews) ? BigDecimal.ZERO : - BigDecimal.valueOf(regionNotpass).multiply(BigDecimal.valueOf(100)) - .divide(BigDecimal.valueOf(regionReviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); - - regionNotpassReview.add(data); - } - res.setNotPassRegionMeetings(regionNotpassReview); - - //各部门 不通过项目TOP10 - List organizations = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE, - DingOrganizationContant.GOV_TEMPORARY))); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE)); - - //TOP10 - List finalExpertReviews = expertReviews; - List notpassTop10 = organizations.stream() - .map(o -> { - DataDTO data = new DataDTO(); - data.setCode(o.getOrganizationCode()); - data.setName(o.getOrganizationName()); - List orgProjects = projects.stream().filter(p -> Objects.nonNull(p.getBuildOrgCode()) && - p.getBuildOrgCode().equals(o.getOrganizationCode())) - .collect(Collectors.toList()); - List projectCodes = orgProjects.stream().map(Project::getProjectCode) - .collect(Collectors.toList()); - if(CollUtil.isEmpty(projectCodes)){ - data.setRate(BigDecimal.ZERO); - return data; - } - List reviews = finalExpertReviews.stream().filter(r -> Objects.nonNull(r.getProjectCode()) && - projectCodes.contains(r.getProjectCode())).collect(Collectors.toList()); - long orgNotpass = reviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) && - r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode())) - .count(); - data.setRate(CollUtil.isEmpty(reviews) ? BigDecimal.ZERO : - BigDecimal.valueOf(orgNotpass).multiply(BigDecimal.valueOf(100)) - .divide(BigDecimal.valueOf(reviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); - return data; - }) - .sorted(Comparator.comparing(DataDTO::getRate).reversed()) - .limit(10).collect(Collectors.toList()); - res.setNotPassTop10(notpassTop10); - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/PerformanceStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/PerformanceStatisticsManage.java deleted file mode 100644 index f194c7d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/PerformanceStatisticsManage.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.dashboard.model.vo.PerformanceStatisticsVO; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname PerformanceStatisticsManage - * @Description - * @Date 2023/12/05 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class PerformanceStatisticsManage { - - private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; - - List thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1 - ,LocalDateTime.now().getYear()); - - public PerformanceStatisticsVO statistics(Integer year) { - PerformanceStatisticsVO res = new PerformanceStatisticsVO(); - - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java deleted file mode 100644 index 3950c5a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.ningdatech.pmapi.dashboard.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.model.vo.CostStatisticsVO; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectCostStatisticsManage - * @Description - * @Date 2023/12/05 17:44 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectCostStatisticsManage { - - private final IMeetingExpertService meetingExpertService; - - private final IMeetingService meetingService; - - List thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1 - ,LocalDateTime.now().getYear()); - - public CostStatisticsVO statistics() { - CostStatisticsVO res = new CostStatisticsVO(); - List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); - List meetingIds = meetings.stream().map(Meeting::getId) - .collect(Collectors.toList()); - //算出所有的 同意的专家 - List meetingExperts = meetingExpertService.listAgreedExperts(meetingIds); - - //评审费 每人500 (0.05万) - BigDecimal reviewAoumtExpert = DashboardConstant.Expert.REVIEW_AOUMT_EXPERT; - - //计算累积 - res.setReviewAmount(reviewAoumtExpert.multiply(BigDecimal.valueOf(meetingExperts.size()))); - res.setPricingAmount(BigDecimal.ZERO); - - //近两年 - List twoYearsReviews = Lists.newArrayList(); - List twoYearsPricing = Lists.newArrayList(); - List twoYearsAvg = Lists.newArrayList(); - - DataDTO reviewAvg = new DataDTO(); - reviewAvg.setName("评审费"); - DataDTO pricingAvg = new DataDTO(); - pricingAvg.setName("核价费"); - BigDecimal reviewTwoYearTotal = BigDecimal.ZERO; - BigDecimal pricingTwoYearTotal = BigDecimal.ZERO; - for(Integer thisYear : thisTwoYears){ - //查出 年份的 会议数据 - List yearMeetings = meetings.stream().filter(m -> { - if(Objects.nonNull(m.getStartTime()) && - ( thisYear.equals(m.getStartTime().getYear()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - List yearMeetingIds = yearMeetings.stream().map(Meeting::getId) - .collect(Collectors.toList()); - //算出所有的 同意的专家 - List yearMeetingExperts = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearMeetingIds)){ - yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); - } - twoYearsReviews.add(DataDTO.of(thisYear.toString(),reviewAoumtExpert.multiply(BigDecimal - .valueOf(yearMeetingExperts.size())))); - twoYearsPricing.add(DataDTO.of(thisYear.toString(),BigDecimal.ZERO)); - - reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal - .valueOf(yearMeetingExperts.size()))); - } - reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2),BigDecimal.ROUND_CEILING, - RoundingMode.HALF_UP)); - twoYearsAvg.add(reviewAvg); - twoYearsAvg.add(pricingAvg); - res.setTwoYearsReviews(twoYearsReviews); - res.setTwoYearsPricing(twoYearsPricing); - res.setTwoYearsAvg(twoYearsAvg); - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitApplicationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitApplicationMapper.java deleted file mode 100644 index b61f2b2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitApplicationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dashboard.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface CockpitApplicationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.java deleted file mode 100644 index b468436..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.dashboard.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.po.SecrecyPasswordGradePO; -import org.apache.ibatis.annotations.Param; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface CockpitStatsMapper extends BaseMapper { - - SecrecyPasswordGradePO getSecrecyPasswordGrade(@Param("regionCode") String regionCode, - @Param("year") Integer year); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.xml deleted file mode 100644 index a3e935d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/mapper/CockpitStatsMapper.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - 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 deleted file mode 100644 index 7091913..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisChart.java +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 448e15d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisData.java +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index ea92abe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/CompanyProjectCntBO.java +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index b334aaf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/ProjectATIISBO.java +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index beca0f2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index b3e354a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/StarExpertBO.java +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index a3a327b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/YearTrendBO.java +++ /dev/null @@ -1,45 +0,0 @@ -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/dto/CockpitApplicationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/dto/CockpitApplicationDTO.java deleted file mode 100644 index 0afc7cc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/dto/CockpitApplicationDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -@Data -@ApiModel(value = "驾驶舱统计应用对象", description = "") -public class CockpitApplicationDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("介绍") - private String introduce; - - @ApiModelProperty("年份") - private LocalDateTime createOn; - - @ApiModelProperty("建设单位") - private String buildOrgName; - - @ApiModelProperty("金额") - private BigDecimal amount; - - @ApiModelProperty("标签") - private String tags; - - @ApiModelProperty("类型 1最佳应用 2重大应用") - private Integer type; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/dto/CockpitStatsSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/dto/CockpitStatsSaveDTO.java deleted file mode 100644 index 9bf5fbd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/dto/CockpitStatsSaveDTO.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -@Data -@ApiModel(value = "CockpitStatsSaveDTO", description = "") -public class CockpitStatsSaveDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("区域名") - private String regionName; - - @ApiModelProperty("年份") - private Integer year; - - @ApiModelProperty("年份") - private LocalDateTime createOn; - - @ApiModelProperty("项目监控-超期建设项目数") - private Integer monitorOverdueConstructionProjectsNum; - - @ApiModelProperty("项目监控-超期建设项目-增长比例") - private String monitorOverdueConstructionProjectsRise; - - @ApiModelProperty("项目监控-环节滞后项目数") - private Integer monitorLaggingProjectsNum; - - @ApiModelProperty("项目监控-环节滞后项目-增长比例") - private String monitorLaggingProjectsRise; - - @ApiModelProperty("项目监控-预审驳回项目数") - private Integer monitorRejectedPreReviewProjectsNum; - - @ApiModelProperty("项目监控-预审驳回项目-增长比例") - private String monitorRejectedPreReviewProjectsRise; - - @ApiModelProperty("项目监控-评审驳回项目数") - private Integer monitorRejectedApproveProjectsNum; - - @ApiModelProperty("项目监控-评审驳回项目-增长比例") - private String monitorRejectedApproveProjectsRise; - @ApiModelProperty("项目监控-验收条件未达标") - private Integer monitorAcceptConditionsNotStandardsNum; - - @ApiModelProperty("项目监控-验收条件未达标-增长比例") - private String monitorAcceptConditionsNotStandardsRise; - - @ApiModelProperty("项目监控-安全投入金额(用于算安全投入占比)") - private BigDecimal monitorSafetyInputAmount; - - @ApiModelProperty("项目监控-总申报金额(用于算安全投入占比)") - private BigDecimal monitorDeclaredAmount; - - @ApiModelProperty("项目监控-等保1级数量") - private Integer monitorSecrecyGrade1Num; - - @ApiModelProperty("项目监控-等保2级数量") - private Integer monitorSecrecyGrade2Num; - - @ApiModelProperty("项目监控-等保3级数量") - private Integer monitorSecrecyGrade3Num; - - @ApiModelProperty("项目监控-等保4级数量") - private Integer monitorSecrecyGrade4Num; - - @ApiModelProperty("项目监控-等保5级数量") - private Integer monitorSecrecyGrade5Num; - - @ApiModelProperty("项目监控-密评1级数量") - private Integer monitorPasswordGrade1Num; - - @ApiModelProperty("项目监控-密评2级数量") - private Integer monitorPasswordGrade2Num; - - @ApiModelProperty("项目监控-密评3级数量") - private Integer monitorPasswordGrade3Num; - - @ApiModelProperty("项目监控-密评4级数量") - private Integer monitorPasswordGrade4Num; - - @ApiModelProperty("项目监控-密评5级数量") - private Integer monitorPasswordGrade5Num; - - @ApiModelProperty("专家-总人数") - private Integer expertTotalNum; - - @ApiModelProperty("专家-方案合理性") - private Integer expertPlanRationalityNum; - - @ApiModelProperty("专家-计数可行性评估") - private Integer expertTechnicalFeasibilityAssessmentNum; - - @ApiModelProperty("专家-信创") - private Integer expertXinchuangNum; - - @ApiModelProperty("专家-软硬件核价") - private Integer expertSoftHardPricingNum; - - @ApiModelProperty("专家-党政信息") - private Integer expertPartyGovInfoNum; - - @ApiModelProperty("专家-网络安全") - private Integer expertNetworkSecurityNum; - - @ApiModelProperty("专家-信息化专家") - private Integer expertPromotionInfoTechnologyNum; - - @ApiModelProperty("专家-财务专家") - private Integer expertFinancialNum; - - @ApiModelProperty("顶部-计划项目数") - private Integer topPlanProjectsNum; - - @ApiModelProperty("顶部-批复项目数") - private Integer topApprovalProjectsNum ; - - @ApiModelProperty("顶部-批复金额") - private BigDecimal topApprovalProjectsAmount; - - @ApiModelProperty("顶部-平均建设周期") - private Integer topAverageConstructionPeriod; - - @ApiModelProperty("顶部-在建项目数") - private Integer topOngoingProjectsNum; - - @ApiModelProperty("项目总数") - private Integer projectsTotal; - - @ApiModelProperty("项目总数-计划状态") - private Integer projectsTotalPlan; - - @ApiModelProperty("项目总数-申报状态") - private Integer projectsTotalApply; - - @ApiModelProperty("项目总数-审批状态") - private Integer projectsTotalApprove; - - @ApiModelProperty("项目总数-建设状态") - private Integer projectsTotalConstruction; - - @ApiModelProperty("项目总数-验收状态") - private Integer projectsTotalAccept; - - @ApiModelProperty("项目总数-运维状态") - private Integer projectsTotalOperation; - - @ApiModelProperty("项目总数-绩效状态") - private Integer projectsTotalPerformance; - - @ApiModelProperty("项目总数-注销状态") - private Integer projectsTotalLogOff; - - @ApiModelProperty("优秀项目-最佳应用") - private Integer excellentBestAppNum; - - @ApiModelProperty("优秀项目-重大应用") - private Integer excellentMajorAppNum; - - @ApiModelProperty("优秀项目-跨域共享数") - private Integer excellentCrossDomainSharingNum; - - @ApiModelProperty("优秀项目-跨域共享数") - private Integer excellentCrossLevelSharingNum; - - @ApiModelProperty("核减资金") - private BigDecimal reduceFundsTotal; - - @ApiModelProperty("驳回节约资金") - private BigDecimal rejectSavingsFunds; - - @ApiModelProperty("申报金额-申报状态") - private BigDecimal declaredAmountApprove; - @ApiModelProperty("批复金额-申报状态") - private BigDecimal approvalAmountApprove; - @ApiModelProperty("差额-申报状态") - private BigDecimal differenceApprove; - - @ApiModelProperty("申报金额-批复状态") - private BigDecimal declaredAmountApproval; - @ApiModelProperty("批复金额-批复状态") - private BigDecimal approvalAmountApproval; - @ApiModelProperty("差额-批复状态") - private BigDecimal differenceApproval; - - @ApiModelProperty("申报金额-合同状态") - private BigDecimal declaredAmountContract; - @ApiModelProperty("批复金额-合同状态") - private BigDecimal approvalAmountContract; - @ApiModelProperty("差额-合同状态") - private BigDecimal differenceContract; - - @ApiModelProperty("产出-应用数量") - private Integer produceAppNum; - @ApiModelProperty("产出-数据产品") - private Integer produceDataNum; - @ApiModelProperty("产出-组件数") - private Integer produceComponentNum; - @ApiModelProperty("产出-大脑要素") - private Integer produceBrainElementsNum; - @ApiModelProperty("产出-大脑要素 模型数") - private Integer produceBrainModelNum; - - @ApiModelProperty("绩效-项目总数量") - private Integer performanceTotal; - - @ApiModelProperty("绩效-未评价数量") - private Integer performanceTobeReviewTotal; - - @ApiModelProperty("绩效-已评价数量") - private Integer performanceReviewedTotal; - - @ApiModelProperty("绩效-top1分数") - private BigDecimal performanceTop1Score; - - @ApiModelProperty("绩效-top1名称") - private String performanceTop1Name; - - @ApiModelProperty("绩效-top2分数") - private BigDecimal performanceTop2Score; - - @ApiModelProperty("绩效-top2名称") - private String performanceTop2Name; - - @ApiModelProperty("绩效-top3分数") - private BigDecimal performanceTop3Score; - - @ApiModelProperty("绩效-top3名称") - private String performanceTop3Name; - - @ApiModelProperty("绩效-top4分数") - private BigDecimal performanceTop4Score; - - @ApiModelProperty("绩效-top4名称") - private String performanceTop4Name; - - @ApiModelProperty("绩效-top5分数") - private BigDecimal performanceTop5Score; - - @ApiModelProperty("绩效-top5名称") - private String performanceTop5Name; - - @ApiModelProperty("数据质量") - private BigDecimal dataQuality; - - @ApiModelProperty("数据质量") - private List cockpitApplications; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitApplication.java deleted file mode 100644 index 730c026..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitApplication.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.dashboard.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.math.BigDecimal; -import java.time.LocalDateTime; - -@Data -@TableName("nd_project_cockpit_applition") -@ApiModel(value = "驾驶舱统计应用对象", description = "") -public class CockpitApplication implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("介绍") - private String introduce; - - @ApiModelProperty("年份") - private LocalDateTime createOn; - - @ApiModelProperty("建设单位") - private String buildOrgName; - - @ApiModelProperty("金额") - private BigDecimal amount; - - @ApiModelProperty("标签") - private String tags; - - @ApiModelProperty("类型 1最佳应用 2重大应用") - private Integer type; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java deleted file mode 100644 index 432cbee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java +++ /dev/null @@ -1,268 +0,0 @@ -package com.ningdatech.pmapi.dashboard.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.math.BigDecimal; -import java.time.LocalDateTime; - -@Data -@TableName("nd_cockpit_stats") -@ApiModel(value = "驾驶舱统计数据对象", description = "") -public class CockpitStats implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("区域名") - private String regionName; - - @ApiModelProperty("年份") - private Integer year; - - @ApiModelProperty("年份") - private LocalDateTime createOn; - - @ApiModelProperty("项目监控-超期建设项目数") - private Integer monitorOverdueConstructionProjectsNum; - - @ApiModelProperty("项目监控-超期建设项目-增长比例") - private String monitorOverdueConstructionProjectsRise = "0"; - - @ApiModelProperty("项目监控-环节滞后项目数") - private Integer monitorLaggingProjectsNum; - - @ApiModelProperty("项目监控-环节滞后项目-增长比例") - private String monitorLaggingProjectsRise = "0"; - - @ApiModelProperty("项目监控-预审驳回项目数") - private Integer monitorRejectedPreReviewProjectsNum; - - @ApiModelProperty("项目监控-预审驳回项目-增长比例") - private String monitorRejectedPreReviewProjectsRise = "0"; - - @ApiModelProperty("项目监控-评审驳回项目数") - private Integer monitorRejectedApproveProjectsNum; - - @ApiModelProperty("项目监控-评审驳回项目-增长比例") - private String monitorRejectedApproveProjectsRise = "0"; - @ApiModelProperty("项目监控-验收条件未达标") - private Integer monitorAcceptConditionsNotStandardsNum; - - @ApiModelProperty("项目监控-验收条件未达标-增长比例") - private String monitorAcceptConditionsNotStandardsRise = "0"; - - @ApiModelProperty("项目监控-安全投入金额(用于算安全投入占比)") - private BigDecimal monitorSafetyInputAmount; - - @ApiModelProperty("项目监控-总申报金额(用于算安全投入占比)") - private BigDecimal monitorDeclaredAmount; - - @ApiModelProperty("项目监控-等保1级数量") - private Integer monitorSecrecyGrade1Num = 0; - - @ApiModelProperty("项目监控-等保2级数量") - private Integer monitorSecrecyGrade2Num = 0; - - @ApiModelProperty("项目监控-等保3级数量") - private Integer monitorSecrecyGrade3Num = 0; - - @ApiModelProperty("项目监控-等保4级数量") - private Integer monitorSecrecyGrade4Num = 0; - - @ApiModelProperty("项目监控-等保5级数量") - private Integer monitorSecrecyGrade5Num = 0; - - @ApiModelProperty("项目监控-密评1级数量") - private Integer monitorPasswordGrade1Num = 0; - - @ApiModelProperty("项目监控-密评2级数量") - private Integer monitorPasswordGrade2Num = 0; - - @ApiModelProperty("项目监控-密评3级数量") - private Integer monitorPasswordGrade3Num = 0; - - @ApiModelProperty("项目监控-密评4级数量") - private Integer monitorPasswordGrade4Num = 0; - - @ApiModelProperty("项目监控-密评5级数量") - private Integer monitorPasswordGrade5Num = 0; - - @ApiModelProperty("专家-总人数") - private Integer expertTotalNum = 0; - - @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") - private Integer specialExpertNum = 0; - - @ApiModelProperty("专家-方案合理性-擅长") - private Integer expertPlanRationalityNum = 0; - - @ApiModelProperty("专家-计数可行性评估-擅长") - private Integer expertTechnicalFeasibilityAssessmentNum = 0; - - @ApiModelProperty("专家-信创-擅长") - private Integer expertXinchuangNum = 0; - - @ApiModelProperty("专家-软硬件核价-擅长") - private Integer expertSoftHardPricingNum = 0; - - @ApiModelProperty("专家-党政信息-擅长") - private Integer expertPartyGovInfoNum = 0; - - @ApiModelProperty("专家-网络安全-擅长") - private Integer expertNetworkSecurityNum = 0; - - @ApiModelProperty("专家-信息化专家") - private Integer expertPromotionInfoTechnologyNum = 0; - - @ApiModelProperty("专家-信创专家") - private Integer expertXinchuangOtherNum = 0; - - @ApiModelProperty("专家-财务专家") - private Integer expertFinancialNum = 0; - - @ApiModelProperty("顶部-计划项目数") - private Integer topPlanProjectsNum = 0; - - @ApiModelProperty("顶部-批复项目数") - private Integer topApprovalProjectsNum = 0; - - @ApiModelProperty("顶部-批复金额") - private BigDecimal topApprovalProjectsAmount; - - @ApiModelProperty("顶部-平均建设周期") - private Integer topAverageConstructionPeriod; - - @ApiModelProperty("顶部-在建项目数") - private Integer topOngoingProjectsNum; - - @ApiModelProperty("项目总数") - private Integer projectsTotal; - - @ApiModelProperty("项目总数-计划状态") - private Integer projectsTotalPlan; - - @ApiModelProperty("项目总数-申报状态") - private Integer projectsTotalApply; - - @ApiModelProperty("项目总数-审批状态") - private Integer projectsTotalApprove; - - @ApiModelProperty("项目总数-建设状态") - private Integer projectsTotalConstruction; - - @ApiModelProperty("项目总数-验收状态") - private Integer projectsTotalAccept; - - @ApiModelProperty("项目总数-运维状态") - private Integer projectsTotalOperation; - - @ApiModelProperty("项目总数-绩效状态") - private Integer projectsTotalPerformance; - - @ApiModelProperty("项目总数-注销状态") - private Integer projectsTotalLogOff; - - @ApiModelProperty("优秀项目-最佳应用") - private Integer excellentBestAppNum; - - @ApiModelProperty("优秀项目-重大应用") - private Integer excellentMajorAppNum; - - @ApiModelProperty("优秀项目-跨域共享数") - private Integer excellentCrossDomainSharingNum; - - @ApiModelProperty("优秀项目-提级共享数") - private Integer excellentCrossLevelSharingNum; - - @ApiModelProperty("核减资金") - private BigDecimal reduceFundsTotal; - - @ApiModelProperty("驳回节约资金") - private BigDecimal rejectSavingsFunds; - - @ApiModelProperty("申报金额-申报状态") - private BigDecimal declaredAmountApprove; - @ApiModelProperty("批复金额-申报状态") - private BigDecimal approvalAmountApprove; - @ApiModelProperty("差额-申报状态") - private BigDecimal differenceApprove; - - @ApiModelProperty("申报金额-批复状态") - private BigDecimal declaredAmountApproval; - @ApiModelProperty("批复金额-批复状态") - private BigDecimal approvalAmountApproval; - @ApiModelProperty("差额-批复状态") - private BigDecimal differenceApproval; - - @ApiModelProperty("申报金额-合同状态") - private BigDecimal declaredAmountContract; - @ApiModelProperty("批复金额-合同状态") - private BigDecimal approvalAmountContract; - @ApiModelProperty("差额-合同状态") - private BigDecimal differenceContract; - - @ApiModelProperty("产出-应用数量") - private Integer produceAppNum = 0; - @ApiModelProperty("产出-数据产品") - private Integer produceDataNum = 0; - @ApiModelProperty("产出-组件数") - private Integer produceComponentNum = 0; - @ApiModelProperty("产出-大脑要素") - private Integer produceBrainElementsNum = 0; - @ApiModelProperty("产出-大脑要素 模型数") - private Integer produceBrainModelNum = 0; - - @ApiModelProperty("绩效-项目总数量") - private Integer performanceTotal = 0; - - @ApiModelProperty("绩效-未评价数量") - private Integer performanceTobeReviewTotal = 0; - - @ApiModelProperty("绩效-已评价数量") - private Integer performanceReviewedTotal = 0; - - @ApiModelProperty("绩效-top1分数") - private BigDecimal performanceTop1Score = BigDecimal.ZERO; - - @ApiModelProperty("绩效-top1名称") - private String performanceTop1Name; - - @ApiModelProperty("绩效-top2分数") - private BigDecimal performanceTop2Score = BigDecimal.ZERO; - - @ApiModelProperty("绩效-top2名称") - private String performanceTop2Name; - - @ApiModelProperty("绩效-top3分数") - private BigDecimal performanceTop3Score = BigDecimal.ZERO; - - @ApiModelProperty("绩效-top3名称") - private String performanceTop3Name; - - @ApiModelProperty("绩效-top4分数") - private BigDecimal performanceTop4Score = BigDecimal.ZERO; - - @ApiModelProperty("绩效-top4名称") - private String performanceTop4Name; - - @ApiModelProperty("绩效-top5分数") - private BigDecimal performanceTop5Score = BigDecimal.ZERO; - - @ApiModelProperty("绩效-top5名称") - private String performanceTop5Name; - - @ApiModelProperty("数据质量") - private BigDecimal dataQuality = BigDecimal.ZERO; - -} \ No newline at end of file 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 deleted file mode 100644 index 6f0dae6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/QueryYearPO.java +++ /dev/null @@ -1,21 +0,0 @@ -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/po/SecrecyPasswordGradePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/SecrecyPasswordGradePO.java deleted file mode 100644 index 48a048a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/SecrecyPasswordGradePO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; - -@Data -@ApiModel(value = "等保密评PO", description = "") -public class SecrecyPasswordGradePO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目监控-等保1级数量") - private Integer monitorSecrecyGrade1Num = 0; - - @ApiModelProperty("项目监控-等保2级数量") - private Integer monitorSecrecyGrade2Num = 0; - - @ApiModelProperty("项目监控-等保3级数量") - private Integer monitorSecrecyGrade3Num = 0; - - @ApiModelProperty("项目监控-等保4级数量") - private Integer monitorSecrecyGrade4Num = 0; - - @ApiModelProperty("项目监控-等保5级数量") - private Integer monitorSecrecyGrade5Num = 0; - - @ApiModelProperty("项目监控-密评1级数量") - private Integer monitorPasswordGrade1Num = 0; - - @ApiModelProperty("项目监控-密评2级数量") - private Integer monitorPasswordGrade2Num; - - @ApiModelProperty("项目监控-密评3级数量") - private Integer monitorPasswordGrade3Num; - - @ApiModelProperty("项目监控-密评4级数量") - private Integer monitorPasswordGrade4Num; - - @ApiModelProperty("项目监控-密评5级数量") - private Integer monitorPasswordGrade5Num; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java deleted file mode 100644 index 4713fbe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java +++ /dev/null @@ -1,378 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; -import com.ningdatech.pmapi.portrait.model.entity.Tag; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -@Data -@ApiModel(value = "驾驶舱统计数据对象VO", description = "") -public class CockpitStatsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("区域名") - private String regionName; - - @ApiModelProperty("年份") - private Integer year; - - @ApiModelProperty("年份") - private LocalDateTime createOn; - - @ApiModelProperty("项目监测数据") - private Monitor monitorData; - - @ApiModelProperty("项目专家数据") - private Expert expertData; - - @ApiModelProperty("顶部数据") - private TopData topData; - - @ApiModelProperty("地图-项目数") - private List mapProjectData; - - @ApiModelProperty("状态-项目数") - private StatusProjectsData statusProjectsData; - - @ApiModelProperty("优秀项目数据") - private ExcellentData excellentData; - - @ApiModelProperty("核减数据") - private ReduceData reduceData; - - @ApiModelProperty("产出数据") - private ProduceData produceData; - - @ApiModelProperty("绩效数据") - private PerformanceData performanceData; - - @ApiModelProperty("最佳应用or重大应用") - private Map> appDatas; - - @ApiModelProperty("数据质量区域信息") - private List qualityDatas; - - @Data - public static class Monitor { - @ApiModelProperty("项目监控-超期建设项目数") - private Integer monitorOverdueConstructionProjectsNum; - - @ApiModelProperty("项目监控-超期建设项目-增长比例") - private String monitorOverdueConstructionProjectsRise; - - @ApiModelProperty("项目监控-环节滞后项目数") - private Integer monitorLaggingProjectsNum; - - @ApiModelProperty("项目监控-环节滞后项目-增长比例") - private String monitorLaggingProjectsRise; - - @ApiModelProperty("项目监控-预审驳回项目数") - private Integer monitorRejectedPreReviewProjectsNum; - - @ApiModelProperty("项目监控-预审驳回项目-增长比例") - private String monitorRejectedPreReviewProjectsRise; - - @ApiModelProperty("项目监控-评审驳回项目数") - private Integer monitorRejectedApproveProjectsNum; - - @ApiModelProperty("项目监控-评审驳回项目-增长比例") - private String monitorRejectedApproveProjectsRise; - - @ApiModelProperty("项目监控-验收条件未达标") - private Integer monitorAcceptConditionsNotStandardsNum; - - @ApiModelProperty("项目监控-验收条件未达标-增长比例") - private String monitorAcceptConditionsNotStandardsRise; - - @ApiModelProperty("项目监控-安全投入占比 图") - private List monitorSafetyInputRate; - - @ApiModelProperty("项目监控-等保等级图") - private List secrecyGradeCharts; - - @ApiModelProperty("项目监控-密保等级图") - private List passwordGradeCharts; - } - - @Data - public static class SecrecyGradeChart { - public SecrecyGradeChart (Integer level,Integer num){ - this.level = level; - this.num = num; - } - - @ApiModelProperty("等保等级") - private Integer level; - - @ApiModelProperty("等保数量") - private Integer num; - } - - @Data - public static class PasswordGradeChart { - public PasswordGradeChart (Integer level,Integer num){ - this.level = level; - this.num = num; - } - - @ApiModelProperty("密保等级") - private Integer level; - - @ApiModelProperty("密保数量") - private Integer num; - } - - @Data - public static class SafetyInput { - private Integer year; - private BigDecimal rate; - private Integer amount; - } - - @Data - public static class Expert { - @ApiModelProperty("专家-各区域专家数") - private List expertRegionData; - - @ApiModelProperty("专家-总人数") - private Integer expertTotalNum; - - @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") - private Integer specialExpertNum; - - @ApiModelProperty("专家-方案合理性 数量") - private Integer expertPlanRationalityNum; - - @ApiModelProperty("专家-计数可行性评估 数量") - private Integer expertTechnicalFeasibilityAssessmentNum; - - @ApiModelProperty("专家-信创 数量") - private Integer expertXinchuangNum; - - @ApiModelProperty("专家-软硬件核价 数量") - private Integer expertSoftHardPricingNum; - - @ApiModelProperty("专家-党政信息 数量") - private Integer expertPartyGovInfoNum; - - @ApiModelProperty("专家-网络安全 数量") - private Integer expertNetworkSecurityNum; - - @ApiModelProperty("专家-信息化专家 数量") - private Integer expertPromotionInfoTechnologyNum; - - @ApiModelProperty("专家-财务专家 数量") - private Integer expertFinancialNum; - - @ApiModelProperty("专家-信创专家 数量") - private Integer expertXinchuangOtherNum; - } - - @Data - public static class ExpertRegion { - @ApiModelProperty("区域CODE") - private String regionCode; - - @ApiModelProperty("区域名字") - private String regionName; - - @ApiModelProperty("专家数量") - private Integer expertNum; - } - - @Data - public static class TopData { - @ApiModelProperty("顶部-计划项目数") - private Integer topPlanProjectsNum; - - @ApiModelProperty("顶部-批复项目数") - private Integer topApprovalProjectsNum; - - @ApiModelProperty("顶部-批复金额") - private BigDecimal topApprovalProjectsAmount; - - @ApiModelProperty("顶部-平均建设周期") - private Integer topAverageConstructionPeriod; - - @ApiModelProperty("顶部-在建项目数") - private Integer topOngoingProjectsNum; - } - - @Data - public static class MapProjectsData { - @ApiModelProperty("区域CODE") - private String regionCode; - - @ApiModelProperty("区域名字") - private String regionName; - - @ApiModelProperty("项目数量") - private Integer projectsNum; - } - - @Data - public static class QualityData { - @ApiModelProperty("区域CODE") - private String regionCode; - - @ApiModelProperty("区域名字") - private String regionName; - - @ApiModelProperty("质量分数") - private BigDecimal quality = BigDecimal.ZERO; - } - - @Data - public static class StatusProjectsData { - @ApiModelProperty("项目总数-计划状态") - private Integer projectsTotalPlan; - - @ApiModelProperty("项目总数-申报状态") - private Integer projectsTotalApply; - - @ApiModelProperty("项目总数-审批状态") - private Integer projectsTotalApprove; - - @ApiModelProperty("项目总数-建设状态") - private Integer projectsTotalConstruction; - - @ApiModelProperty("项目总数-验收状态") - private Integer projectsTotalAccept; - - @ApiModelProperty("项目总数-运维状态") - private Integer projectsTotalOperation; - - @ApiModelProperty("项目总数-绩效状态") - private Integer projectsTotalPerformance; - - @ApiModelProperty("项目总数-注销状态") - private Integer projectsTotalLogOff; - } - - @Data - public static class ExcellentData { - @ApiModelProperty("优秀项目-最佳应用") - private Integer excellentBestAppNum; - - @ApiModelProperty("优秀项目-重大应用") - private Integer excellentMajorAppNum; - - @ApiModelProperty("优秀项目-跨域共享数") - private Integer excellentCrossDomainSharingNum; - - @ApiModelProperty("优秀项目-跨域共享数") - private Integer excellentCrossLevelSharingNum; - - @ApiModelProperty("优秀项目-列表") - private List excellentProjects; - } - - @Data - public static class ExcellentProjects { - @ApiModelProperty("项目CODE") - private String projectCode; - - @ApiModelProperty("项目名") - private String projectName; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("标签") - private List tags; - } - - @Data - public static class ReduceData { - @ApiModelProperty("核减资金") - private BigDecimal reduceFundsTotal; - - @ApiModelProperty("驳回节约资金") - private BigDecimal rejectSavingsFunds; - - @ApiModelProperty("资金对比图") - private List amountComparisonCharts; - } - - @Data - public static class AmountComparisonChart { - public AmountComparisonChart (String statusName,BigDecimal declaredAmount,BigDecimal approvalAmount,BigDecimal differenceAmount){ - this.statusName = statusName; - this.declaredAmount = declaredAmount; - this.approvalAmount = approvalAmount; - this.differenceAmount = differenceAmount; - } - - @ApiModelProperty("状态名") - private String statusName; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("批复金额") - private BigDecimal approvalAmount; - - @ApiModelProperty("差额") - private BigDecimal differenceAmount; - } - - @Data - public static class ProduceData { - @ApiModelProperty("产出-应用数量") - private Integer produceAppNum; - @ApiModelProperty("产出-数据产品") - private Integer produceDataNum; - @ApiModelProperty("产出-组件数") - private Integer produceComponentNum; - @ApiModelProperty("产出-大脑要素") - private Integer produceBrainElementsNum; - @ApiModelProperty("产出-大脑要素") - private Integer produceBrainModelNum; - } - - @Data - public static class PerformanceData { - @ApiModelProperty("绩效-项目总数量") - private Integer performanceTotal; - - @ApiModelProperty("绩效-未评价数量") - private Integer performanceTobeReviewTotal; - - @ApiModelProperty("绩效-已评价数量") - private Integer performanceReviewedTotal; - - @ApiModelProperty("绩效-top数据") - private List performanceTops; - } - - @Data - public static class PerformanceTop { - public PerformanceTop (String topName,BigDecimal score,String appName){ - this.topName = topName; - this.score = score; - this.appName = appName; - } - - @ApiModelProperty("绩效-top") - private String topName; - - @ApiModelProperty("分数") - private BigDecimal score; - - @ApiModelProperty("应用名称") - private String appName; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CostStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CostStatisticsVO.java deleted file mode 100644 index 297da48..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CostStatisticsVO.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@ApiModel(value = "项目成本统计", description = "") -public class CostStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("累积专家评审费用") - private BigDecimal reviewAmount = BigDecimal.ZERO; - - @ApiModelProperty("累积专家核价费用") - private BigDecimal pricingAmount = BigDecimal.ZERO; - - @ApiModelProperty("市本级近两年人工核价费") - private List twoYearsPricing; - - @ApiModelProperty("市本级近两年人工评审费") - private List twoYearsReviews; - - @ApiModelProperty("市本级近两年平均专家评审/核价费") - private List twoYearsAvg; -} \ No newline at end of file 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 deleted file mode 100644 index 7405847..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardInvestmentSummaryVO.java +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index 9f7b312..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java +++ /dev/null @@ -1,30 +0,0 @@ -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/DashboardProjectProtraitVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectProtraitVO.java deleted file mode 100644 index 4bba2ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectProtraitVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.portrait.model.entity.Tag; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; -import java.util.Map; - -/** - * @author ZPF - * @date 2023/10/9 下午3:07 - */ - -@Data -@ApiModel("驾驶舱项目画像VO") -public class DashboardProjectProtraitVO { - - @ApiModelProperty("项目信息") - private ProtraitProjectInfoVO projectInfo; - - @ApiModelProperty("项目特征(就是标签)") - private List projectFeatures; - - @ApiModelProperty("项目产出") - private Map projectOutput; - -} - 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 deleted file mode 100644 index 166dd82..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java +++ /dev/null @@ -1,58 +0,0 @@ -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/EarlyWarningStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/EarlyWarningStatisticsVO.java deleted file mode 100644 index 91b4de8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/EarlyWarningStatisticsVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@ApiModel(value = "预警统计", description = "") -public class EarlyWarningStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("累积报警数") - private Integer accumulatedAlarmsTotal = 0; - - @ApiModelProperty("流程累积报警数") - private Integer accumulatedAlarmsFlow = 0; - - @ApiModelProperty("填报累积报警数") - private Integer accumulatedAlarmsFilling = 0; - - @ApiModelProperty("近三年累积报警数") - private List threeYearsAlarms; - - @ApiModelProperty("当前各流程报警情况") - private List alarmsFlowsNow; - - @ApiModelProperty("当前各填报报警情况") - private List alarmsFillingNow; - - @ApiModelProperty("建设周期预警监测") - private List constructionAlarms; - - @ApiModelProperty("安全监测") - private List safetyMonitoring; -} \ No newline at end of file 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 deleted file mode 100644 index bf56914..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertDashboardSummaryVO.java +++ /dev/null @@ -1,31 +0,0 @@ -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/dashboard/model/vo/ExpertStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertStatisticsVO.java deleted file mode 100644 index bf139a0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertStatisticsVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -@Data -@ApiModel(value = "专家统计", description = "") -public class ExpertStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("入驻专家总数") - private Integer total = 0; - - @ApiModelProperty("近一年新增专家数") - private Integer thisYearAdded = 0; - - @ApiModelProperty("活跃专家数") - private Integer active = 0; - - @ApiModelProperty("各区县专家数") - private List regionExpert; - - @ApiModelProperty("近三年专家数") - private List threeYearsAdded; - - @ApiModelProperty("专家类型分布") - private Map> typeDistribution; - - @ApiModelProperty("专家类型") - private List types; - - @ApiModelProperty("专家等级") - private List levels; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/FundStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/FundStatisticsVO.java deleted file mode 100644 index f454b35..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/FundStatisticsVO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@ApiModel(value = "项目资金统计", description = "") -public class FundStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("累积核减总资金") - private BigDecimal accumulatedDeductionTotalAmount; - - @ApiModelProperty("近三年核减总资金") - private BigDecimal threeYearsDeductionTotalAmount; - - @ApiModelProperty("申请总金额") - private BigDecimal declaredTotalAmount; - - @ApiModelProperty("批复总金额") - private BigDecimal approvalTotalAmount; - - @ApiModelProperty("合同总金额") - private BigDecimal contractTotalAmount; - - @ApiModelProperty("近三年核减数据") - private List threeYearsDeduction; - - @ApiModelProperty("计划阶段核减情况") - private HeJianAmount planDeduction; - - @ApiModelProperty("批复阶段阶段核减情况") - private HeJianAmount approvalDeduction; - - @ApiModelProperty("合同阶段阶段核减情况") - private HeJianAmount contractDeduction; - - @ApiModelProperty("各部门核减TOP10") - private List departmentTop10; - - - @Data - public static class AmountData{ - @ApiModelProperty("金额") - private BigDecimal amount; - - @ApiModelProperty("名称") - private String name; - } - - @Data - public static class HeJianAmount{ - @ApiModelProperty("申请金额") - private BigDecimal approve; - - @ApiModelProperty("批复金额") - private BigDecimal approval; - - @ApiModelProperty("差额") - private BigDecimal diff; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/MeetingStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/MeetingStatisticsVO.java deleted file mode 100644 index f9b196f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/MeetingStatisticsVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@ApiModel(value = "评审会议统计", description = "") -public class MeetingStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("评审召开总数") - private Integer meetingTotal = 0; - - @ApiModelProperty("评审通过数") - private Integer passReview = 0; - - @ApiModelProperty("评审不通过率") - private BigDecimal notPassRate = BigDecimal.ZERO; - - @ApiModelProperty("各区县召开总数") - private List regionMeetings; - - @ApiModelProperty("预审/验收 会议情况") - private List meetingTypes; - - @ApiModelProperty("各区县不通过率") - private List notPassRegionMeetings; - - @ApiModelProperty("各部门不通过top10") - private List notPassTop10; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/PerformanceStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/PerformanceStatisticsVO.java deleted file mode 100644 index 95c08fe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/PerformanceStatisticsVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.model.entity.DataDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@ApiModel(value = "绩效统计", description = "") -public class PerformanceStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("当前已完成项目总数") - private Integer finishedTotalNow = 0; - - @ApiModelProperty("当前已完成自评总数") - private Integer finishedSelfNow = 0; - - @ApiModelProperty("当前已完成复评总数") - private Integer finishedReAppraisalNow = 0; - - @ApiModelProperty("当前需整改项目总数") - private Integer rectifyTotalNow = 0; - - @ApiModelProperty("是否评价") - private List regionMeetings; - - @ApiModelProperty("预审/验收 会议情况") - private List meetingTypes; - - @ApiModelProperty("各区县不通过率") - private List notPassRegionMeetings; - - @ApiModelProperty("各部门不通过top10") - private List notPassTop10; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java deleted file mode 100644 index d9e0c20..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.common.compare.Compare; -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.math.BigDecimal; -import java.util.List; - -/** - * @author ZPF - * @date 2023/10/9 下午3:07 - */ - -@Data -@ApiModel("驾驶舱项目画像里的项目信息VO") -public class ProtraitProjectInfoVO { - - @ApiModelProperty("项目名字") - private String projectName; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("建设单位code") - private String buildOrgCode; - - @ApiModelProperty("建设单位名") - private String buildOrgName; - - @ApiModelProperty("批复金额") - private BigDecimal approvalAmount; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("项目安全投入占比") - private String safetyInputRate; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("超期情况") - private String overdueSituation; - - @ApiModelProperty("状态") - private String status; - - @ApiModelProperty("项目状态情况") - private List statusSituation; - - @ApiModelProperty("系统定位") - private String systemPosition; -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectOutputVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectOutputVO.java deleted file mode 100644 index 8e5cd8d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectOutputVO.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; - -/** - * @author ZPF - * @date 2023/10/9 下午3:07 - */ - -@Data -@Builder -@ApiModel("驾驶舱项目画像里的项目产出VO") -public class ProtraitProjectOutputVO { - - public ProtraitProjectOutputVO(){ - - } - - public ProtraitProjectOutputVO(String name,CloudResourceUsage cloudResourceUsage,DataUsage dataUsage, - ComponentUsage componentUsage,GenerateData generateData,OperationReport operationReport){ - this.name = name; - this.cloudResourceUsage = cloudResourceUsage; - this.dataUsage = dataUsage; - this.componentUsage = componentUsage; - this.generateData = generateData; - this.operationReport = operationReport; - } - - @ApiModelProperty("名称") - private String name; - - @ApiModelProperty("云资源使用情况") - private CloudResourceUsage cloudResourceUsage = new CloudResourceUsage(); - - @ApiModelProperty("数据使用情况") - private DataUsage dataUsage = new DataUsage(); - - @ApiModelProperty("组件使用情况") - private ComponentUsage componentUsage = new ComponentUsage(); - - @ApiModelProperty("产生数据") - private GenerateData generateData = new GenerateData(); - - @ApiModelProperty("试运行报告") - private OperationReport operationReport = new OperationReport(); - - @Data - public static class CloudResourceUsage{ - @ApiModelProperty("云资源实例使用数") - private String instancesNum = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("云资源实例利用率") - private String utilizationRate = DashboardConstant.Protrait.NONE; - } - - @Data - public static class DataUsage{ - @ApiModelProperty("数据共享申请量") - private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("数据共享使用量") - private String sharedUsage = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("数据共享接口调用量") - private String sharedInterfaceCallVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("协同接口使用量") - private String collaborativeInterfaceCallVolume= DashboardConstant.Protrait.NONE; - } - - @Data - public static class ComponentUsage{ - @ApiModelProperty("组件申请量") - private String applicationVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("组件使用量") - private String useVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("组件调用量") - private String callVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("统一组件调用量") - private String unifyCallolVolume = DashboardConstant.Protrait.NONE; - } - - @Data - public static class GenerateData{ - @ApiModelProperty("产生数据量") - private String volume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("产生数据共享申请量") - private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("产生数据共享使用量") - private String sharedUseVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("产生数据审批通过率") - private String approvalPassRate = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("数据接口被调用量") - private String dataInterfaceCallsVolume = DashboardConstant.Protrait.NONE; - - @ApiModelProperty("协同接口使用量") - private String collaborativeInterfaceCallVolume = DashboardConstant.Protrait.NONE; - } - - @Data - public static class OperationReport{ - @ApiModelProperty("试运行报告通过率") - private String passRate = DashboardConstant.Protrait.NONE; - } -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectStatusSituationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectStatusSituationVO.java deleted file mode 100644 index d2fadd3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectStatusSituationVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.dashboard.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import java.time.LocalDateTime; - -/** - * @author ZPF - * @date 2023/10/9 下午3:07 - */ - -@Data -@Builder -@ApiModel("驾驶舱项目画像里的项目状态信息VO") -public class ProtraitProjectStatusSituationVO { - - public ProtraitProjectStatusSituationVO(){ - - } - - public ProtraitProjectStatusSituationVO(String statusName,LocalDateTime statusTime){ - this.statusName = statusName; - this.statusTime = statusTime; - } - - @ApiModelProperty("状态名") - private String statusName; - - @ApiModelProperty("状态时间节点") - private LocalDateTime statusTime; -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitApplicationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitApplicationService.java deleted file mode 100644 index 3e384f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitApplicationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dashboard.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface ICockpitApplicationService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitStatsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitStatsService.java deleted file mode 100644 index bd75fd8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/ICockpitStatsService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.dashboard.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.po.SecrecyPasswordGradePO; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface ICockpitStatsService extends IService { - - SecrecyPasswordGradePO getSecrecyPasswordGrade(String regionCode,Integer year); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitApplicationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitApplicationServiceImpl.java deleted file mode 100644 index 0a145e2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitApplicationServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.dashboard.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.dashboard.mapper.CockpitApplicationMapper; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; -import com.ningdatech.pmapi.dashboard.service.ICockpitApplicationService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -@RequiredArgsConstructor -public class CockpitApplicationServiceImpl extends ServiceImpl - implements ICockpitApplicationService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitStatsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitStatsServiceImpl.java deleted file mode 100644 index af59d07..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/service/impl/CockpitStatsServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.dashboard.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.dashboard.mapper.CockpitStatsMapper; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.po.SecrecyPasswordGradePO; -import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -@RequiredArgsConstructor -public class CockpitStatsServiceImpl extends ServiceImpl - implements ICockpitStatsService { - - private final CockpitStatsMapper cockpitStatsMapper; - - @Override - public SecrecyPasswordGradePO getSecrecyPasswordGrade(String regionCode, Integer year) { - return cockpitStatsMapper.getSecrecyPasswordGrade(regionCode,year); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/DataScopeColumnConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/DataScopeColumnConst.java deleted file mode 100644 index edb745d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/DataScopeColumnConst.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.datascope.contants; - -/** - *

- * DataScopeColumnConst - *

- * - * @author WendyYang - * @since 16:24 2022/11/3 - */ -public interface DataScopeColumnConst { - - String REGION_ID = "region_id"; - - String REGION_CODE = "region_code"; - - String ORG_CODE = "org_code"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/LambdaDataScopeTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/LambdaDataScopeTypeEnum.java deleted file mode 100644 index 526e8a4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/contants/LambdaDataScopeTypeEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.datascope.contants; - -import io.swagger.annotations.ApiModel; - -/** - * @Classname DataScopeTypeEnum - * @Description - * @Date 2022/11/18 11:15 - * @Created by PoffyZhang - */ -@ApiModel(value = "DataScopeTypeEnum", description = "数据范围类型-枚举") -public enum LambdaDataScopeTypeEnum { - /** - * 地区 - */ - REGION, - - /** - * 公司 - */ - ORG, - - /** - * 员工 - */ - EMPLOYEE, - - /** - * 都没有 - */ - NONE; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeDTO.java deleted file mode 100644 index 2c16506..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.datascope.model; - -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import lombok.Data; - -import java.util.List; - -/** - *

- * DataScopeDto - *

- * - * @author WendyYang - * @since 13:42 2022/11/4 - */ -@Data -public class DataScopeDTO { - - private RoleEnum role; - - private List regionIds; - - private List regionCodes; - - private String orgCode; - - private String employeeCode; - - private Long userId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeEntity.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeEntity.java deleted file mode 100644 index d7a6c0f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/model/DataScopeEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.datascope.model; - -import lombok.Data; - -/** - * @Classname DataScopEntity - * @Description - * @Date 2022/11/11 16:25 - * @Created by PoffyZhang - */ -@Data -public class DataScopeEntity { - - protected Long id; - - protected Long regionId; - - protected String regionCode; - - protected Long orgCode; - - protected Long userId; - - protected String employeeCode; - - protected String dataScopeSql; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java deleted file mode 100644 index 2728bab..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider; - -import com.ningdatech.basic.util.SpringUtils; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import lombok.RequiredArgsConstructor; - -import java.io.Serializable; -import java.util.Map; -import java.util.Optional; - -/** - *

- * 数据权限获取 - *

- * - * @author WendyYang - * @since 2022/1/9 23:28 - */ -@RequiredArgsConstructor -public class DataScopeContext implements Serializable { - - private static final String WARN_MSG = "请先创建数据权限[%s]的实现类,使其实现 DataScopeProvider"; - - private static final Map DSP_MAP; - - static { - DSP_MAP = SpringUtils.getBeansOfType(DataScopeProvider.class); - } - - public static Optional getDataScope(String roleCode) { - DataScopeProvider dataScopeProvider = DSP_MAP.get(roleCode); - if (dataScopeProvider == null) { - throw new IllegalArgumentException(String.format(WARN_MSG, roleCode)); - } - return dataScopeProvider.findDataFieldProperty(); - } - - public static Optional getDataScopeHasUserId(String roleCode,Long userId) { - DataScopeProvider dataScopeProvider = DSP_MAP.get(roleCode); - if (dataScopeProvider == null) { - throw new IllegalArgumentException(String.format(WARN_MSG, roleCode)); - } - return dataScopeProvider.findDataFieldProperty(userId); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeProvider.java deleted file mode 100644 index 24b76bc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider; - - -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; - -import java.util.Optional; - -/** - *

- * 数据权限获取接口 - *

- * - * @author zpf - * @since 2023/3/27 23:28 - */ -public interface DataScopeProvider { - - /** - * 获取登录人的数据权限 - * - * @return 数据权限 - **/ - Optional findDataFieldProperty(); - - Optional findDataFieldProperty(Long userId); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java deleted file mode 100644 index 11364be..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.Optional; - -/** - *

- * 数据权限 数据看板角色 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("DASHBOARD") -public class DashboardUserDataScopeProviderImpl implements DataScopeProvider { - - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); - ds.setRole(RoleEnum.DASHBOARD); - return Optional.ofNullable(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); - ds.setRole(RoleEnum.DASHBOARD); - return Optional.ofNullable(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java deleted file mode 100644 index 591e72b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -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.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * ExpertAdminDataScopeProviderImpl - *

- * - * @author WendyYang - * @since 10:39 2023/12/11 - */ -@Component("EXPERT_ADMIN") -@RequiredArgsConstructor -public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { - - private final RegionCacheHelper regionCacheHelper; - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - DataScopeDTO ds = new DataScopeDTO(); - if (Objects.isNull(user.getRegionLevel())) { - ds.setRegionIds(Collections.emptyList()); - ds.setRegionCodes(Collections.emptyList()); - } else { - List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); - ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); - ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); - } - ds.setRole(RoleEnum.EXPERT_ADMIN); - ds.setUserId(user.getUserId()); - ds.setEmployeeCode(user.getEmployeeCode()); - ds.setOrgCode(user.getOrganizationCode()); - return Optional.of(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - if (Objects.isNull(user.getRegionLevel())) { - ds.setRegionIds(Collections.emptyList()); - ds.setRegionCodes(Collections.emptyList()); - } else { - List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); - ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); - ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); - } - ds.setRole(RoleEnum.EXPERT_ADMIN); - ds.setUserId(user.getUserId()); - ds.setEmployeeCode(user.getEmployeeCode()); - ds.setOrgCode(user.getOrganizationCode()); - return Optional.of(ds); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java deleted file mode 100644 index 01ca934..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.Collection; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - *

- * 专家 数据看板角色 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("EXPERT") -public class ExpertDataScopeProviderImpl implements DataScopeProvider { - - private final RegionCacheHelper regionCacheHelper; - - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, - RegionConst.RL_CITY); - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.EXPERT); - return Optional.ofNullable(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, - RegionConst.RL_CITY); - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.EXPERT); - return Optional.ofNullable(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/HigherUserDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/HigherUserDataScopeProviderImpl.java deleted file mode 100644 index 9e3ab5b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/HigherUserDataScopeProviderImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Optional; - -/** - *

- * 数据权限 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("HIGH_MEMBER") -public class HigherUserDataScopeProviderImpl implements DataScopeProvider { - - private final RegionCacheHelper regionCacheHelper; - private final UserInfoHelper userInfoHelper; - - //和区域管理员一样 - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.REGION_MANAGER); - return Optional.of(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.REGION_MANAGER); - return Optional.of(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java deleted file mode 100644 index 2df78ce..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import java.util.Optional; - -/** - *

- * 数据权限 普通用户 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("NORMAL_MEMBER") -public class OrdinaryUserDataScopeProviderImpl implements DataScopeProvider { - - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); - ds.setRole(RoleEnum.NORMAL_MEMBER); - return Optional.ofNullable(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); - ds.setRole(RoleEnum.NORMAL_MEMBER); - return Optional.ofNullable(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java deleted file mode 100644 index d4eeb4e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import java.util.Optional; - -/** - *

- * 数据权限 单位管理员 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("COMPANY_MANAGER") -public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { - - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - DataScopeDTO ds = new DataScopeDTO(); - ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.COMPANY_MANAGER); - return Optional.of(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.COMPANY_MANAGER); - return Optional.of(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java deleted file mode 100644 index 81820b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Optional; - -/** - *

- * 数据权限 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("REGION_MANAGER") -public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { - - private final RegionCacheHelper regionCacheHelper; - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.REGION_MANAGER); - return Optional.of(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.REGION_MANAGER); - return Optional.of(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java deleted file mode 100644 index 4b21bf6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Optional; - -/** - *

- * 数据权限 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("SUPER_ADMIN") -public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { - - private final RegionCacheHelper regionCacheHelper; - - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, - RegionConst.RL_CITY); - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.of(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, - RegionConst.RL_CITY); - - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); - ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.of(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/VisitoyDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/VisitoyDataScopeProviderImpl.java deleted file mode 100644 index 79e280c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/VisitoyDataScopeProviderImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.datascope.provider.impl; - -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import java.util.Optional; - -/** - *

- * 数据权限 访客 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("VISITOR") -public class VisitoyDataScopeProviderImpl implements DataScopeProvider { - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.ofNullable(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.ofNullable(ds); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/utils/DataScopeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/utils/DataScopeUtil.java deleted file mode 100644 index 7beb4ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/utils/DataScopeUtil.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.datascope.utils; - -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.provider.DataScopeContext; -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 java.util.Objects; -import java.util.Optional; - -/** - * @Classname DataScopeUtil - * @Description - * @Date 2023/3/28 16:00 - * @Author PoffyZhang - */ -public class DataScopeUtil { - - public static Optional getCurrentUserDataScope(UserFullInfoDTO user) { - if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { - return Optional.empty(); - } - return DataScopeContext.getDataScope(user.getRoleCode().name()); - } - - public static Optional getCurrentUserDataScopeHasUserId(UserFullInfoDTO user) { - if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { - return Optional.empty(); - } - return DataScopeContext.getDataScopeHasUserId(user.getRoleCode().name(),user.getUserId()); - } - - public static Optional getCurrentUserDataScope() { - UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); - if (Objects.isNull(loginUser) || Objects.isNull(loginUser.getRoleCode())) { - return Optional.empty(); - } - return DataScopeContext.getDataScope(loginUser.getRoleCode().name()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java deleted file mode 100644 index e8ffb0d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.ding.constants; - -/** - * @Classname DingOrganizationContant - * @Description - * @Date 2023/7/10 17:58 - * @Author PoffyZhang - */ -public interface DingOrganizationContant { - - String UNIT_TYPE = "GOV_UNIT"; - String GOV_TEMPORARY = "GOV_TEMPORARY"; - String HOLLOW = "GOV_HOLLOW_DIVISION_NODE"; -} 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 deleted file mode 100644 index 2d92494..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ /dev/null @@ -1,305 +0,0 @@ -package com.ningdatech.pmapi.ding.controller; - -import com.alibaba.fastjson.JSON; -import com.ningdatech.irs.service.IRefreshTokenService; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; -import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; -import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; -import com.ningdatech.pmapi.irs.manage.AppIrsManage; -import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; -import com.ningdatech.pmapi.organization.manage.ProcDefManage; -import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.util.Assert; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.client.RestTemplate; -import javax.annotation.Resource; -import javax.validation.Valid; -import java.io.*; -import java.security.NoSuchAlgorithmException; -import java.util.Objects; - -/** - *

- * PullDingInfoController - *

- * - * @author WendyYang - * @since 2023/6/2 - **/ -@RestController -@RequestMapping("/api/v1/zwdd/pull") -@RequiredArgsConstructor -@Slf4j -public class DingInfoPullController { - - private final EmployeeBatchGetTask employeeBatchGetTask; - private final GovBusinessStripsTask businessStripsTask; - private final OrganizationBatchGetTask organizationBatchGetTask; - - private final ProcDefManage procDefManage; - - private final IrsManage irsManage; - - @Resource - private IRefreshTokenService refreshTokenService; - - @Value("${irs.interface-refresh.request-token-url}") - private String govRequestTokenUrl; - @Value("${irs.interface-refresh.refresh-token-url}") - private String govRefreshTokenUrl; - - private final AppIrsManage appIrsManage; - - private final IProjectService projectService; - - @GetMapping("/employee") - public void employeeBatchGet() { - employeeBatchGetTask.batchGetEmployeeTask(); - } - - @GetMapping("/businessStrips") - public void businessStripsBatchGet() { - businessStripsTask.batchGetGovBusinessStripsTask(); - } - - @GetMapping("/organization") - public void organizationBatchGet() { - organizationBatchGetTask.batchGetOrganizationTask(); - } - - @GetMapping("/organization/{orgCode}") - public void organizationGetSubs(@PathVariable String orgCode) { - organizationBatchGetTask.organizationGetSubs(orgCode); - } - - @GetMapping("/organization-sub/{orgCode}") - public void organizationSubGetOrgs(@PathVariable String orgCode) { - organizationBatchGetTask.organizationSubGetOrgs(orgCode); - } - - @GetMapping("/employeeByRegionCode/{regionCode}") - public void employeeBatchGetByRegionCode(@PathVariable String regionCode) { - employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode); - } - - @GetMapping("/employeeByOrdCode/{orgCode}") - public void employeeBatchGetByOrdCode(@PathVariable String orgCode) { - employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); - } - - @GetMapping("/getEmployeeByCode/{empCode}") - public void getEmployeeByCode(@PathVariable String empCode) { - employeeBatchGetTask.getEmployeeByCode(empCode); - } - - @GetMapping("/getBatchEmployeeByCode/{orgCode}") - public void getBatchEmployeeByCode(@PathVariable String orgCode) { - employeeBatchGetTask.getBatchEmployeeByCode(orgCode); - } - - @GetMapping("/getToken") - public String getToken() { - return employeeBatchGetTask.getToken(); - } - - @GetMapping("/getAuthToken") - public String getAuthToken() { - return employeeBatchGetTask.getAuthToken(); - } - - @ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化") - @GetMapping("/init") - public String init() { - return procDefManage.init(); - } - - @ApiOperation(value = "系统流程配置初始化按区域", notes = "系统流程配置初始化按区域") - @GetMapping("/init/{areaCode}") - public String initByArea(@PathVariable String areaCode) { - return procDefManage.initByArea(areaCode); - } - - @ApiOperation(value = "项目详情推送", notes = "项目详情推送") - @GetMapping("/push-project") - public String pushProject() throws Exception { - File f = new File("/temp/遂昌归集项目信息(需补).xlsx"); -// File f = new File("C:\\Users\\PoffyZhang\\Desktop\\遂昌归集项目信息(需补).xlsx"); - Workbook wb = readExcel(new FileInputStream(f),f.getName()); - Assert.notNull(wb,"文件流为空"); - Row row; - Integer sucessNum = 0; - if(wb != null){ - //获取第一个sheet - Sheet sheet = wb.getSheetAt(0); - //获取最大行数 - int rownum = sheet.getPhysicalNumberOfRows(); - //获取第一行 - row = sheet.getRow(0); - //获取最大列数 - for (int i = 1; i forEntity = restTemplate.getForEntity(url, String.class); - - log.info(JSON.toJSONString(forEntity)); - - return forEntity.getBody(); - } - - @ApiOperation(value = "项目详情推送", notes = "项目详情推送") - @GetMapping("/push-project-detail") - public String pushProjectDetail() throws NoSuchAlgorithmException { - Project project = projectService.getById(189L); - ProjectDTO projectDto = new ProjectDTO(); - - projectDto.setProjectCode(project.getProjectCode()); - projectDto.setProjectName(project.getProjectName()); - projectDto.setArea(project.getArea()); - projectDto.setAreaCode(project.getAreaCode()); - projectDto.setBaseProjType("1"); - projectDto.setBaseConstructionType("03"); - projectDto.setBaseProjConsClass("C"); - projectDto.setBaseLowestLevel("C"); - projectDto.setProjectYear(project.getProjectYear()); - projectDto.setBaseProjBasis("1"); - projectDto.setBuildBasis("01"); - projectDto.setBaseProjSetProg("05"); - projectDto.setResponsibleMan(project.getResponsibleMan()); - projectDto.setResponsibleManMobile(project.getResponsibleManMobile()); - projectDto.setContactName(project.getContactName()); - projectDto.setContactPhone(project.getContactPhone()); - projectDto.setBuildOrgName(project.getBuildOrgName()); - projectDto.setBuildOrgCode(project.getBuildOrgCode()); - projectDto.setSuperOrg(project.getSuperOrg()); - projectDto.setSuperOrgCode(project.getSuperOrgCode()); - projectDto.setHigherSuperOrg(project.getHigherSuperOrg()); - projectDto.setHigherSuperOrgCode(project.getHigherSuperOrgCode()); - - log.info("projectDto :{}",JSON.toJSONString(projectDto)); - - if(StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))){ - return "推送成功"; - } - return "推送失败"; - } - - @ApiOperation(value = "同步企业信息 条线", notes = "同步企业信息 条线") - @GetMapping("/synchronouOrgBiz") - public String synchronouOrgBiz() { - return procDefManage.synchronouOrgBiz(); - } - - @ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于") - @PostMapping("/forward") - public String forward(@Valid @RequestBody ForwardDTO dto) { - return irsManage.forward(dto); - } - - public static Workbook readExcel(InputStream is, String extString){ - Workbook wb = null; - - extString = extString.substring(extString.lastIndexOf(".")); - try { - if(".xls".equals(extString)){ - return wb = new HSSFWorkbook(is); - }else if(".xlsx".equals(extString)){ - return wb = new XSSFWorkbook(is); - }else { - return wb = null; - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return wb; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/model/DingOrgInfoTreeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/model/DingOrgInfoTreeDTO.java deleted file mode 100644 index 7040ce1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/model/DingOrgInfoTreeDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.ding.model; - -import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/24 上午11:06 - * 钉钉组织结构树状结构 - */ -@Data -public class DingOrgInfoTreeDTO { - - /** - * 钉钉code码 - */ - private String code; - - /** - * 组织信息 - */ - private DingOrgInfoDTO dingOrgInfoDTO; - /** - * 子节点code - */ - private List childCodes; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java deleted file mode 100644 index 592cd8c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ /dev/null @@ -1,491 +0,0 @@ -package com.ningdatech.pmapi.ding.task; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddAuthClient; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.Page; -import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; -import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; -import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; -import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; -import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/10 上午9:52 - */ - -@Component -@Slf4j -public class EmployeeBatchGetTask { - - private final static Integer PAGE_SIZE = 20; - - private final static Integer GROUP_SIZE = 100; - - private final static Integer MAX_SIZE = 10000; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private ZwddAuthClient zwddAuthClient; - - @Autowired - private IDingOrganizationService iDingOrganizationService; - - @Autowired - private IDingEmployeeInfoService iDingEmployeeInfoService; - - @Autowired - private ZwddIntegrationProperties zwddIntegrationProperties; - - @Autowired - private IUserInfoService iUserInfoService; - - @Transactional(rollbackFor = Exception.class) -// @Scheduled(cron = "0 0 1 * * ?") - public void batchGetEmployeeTask() { - // 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型) - List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); - log.info("所有待更新员工的单位数:{}",dingOrganizationList.size()); - if (CollUtil.isNotEmpty(dingOrganizationList)) { - //记录任务 单位数 - Integer index = 0; - for (DingOrganization dingOrganization : dingOrganizationList) { - log.info("当前单位:{},下标数,{}",dingOrganization.getOrganizationName(),index); - index++; - List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = dingOrganization.getOrganizationCode(); - PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); - query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); - query.setReturnTotalSize(true); - query.setTenantId(zwddIntegrationProperties.getTenantId()); - int pageNo = 1; - query.setPageNo(pageNo); - query.setPageSize(PAGE_SIZE); - - // 查询组织下 用户信息 - GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - Page data = firstPageGenericResult.getData(); - if (Objects.isNull(data)){ - log.info("响应为空:{}",organizationCode); - continue; - } - if (CollUtil.isNotEmpty(data.getData())) { - allOrganizationEmployeePositionList.addAll(data.getData()); - } - Long totalSize = data.getTotalSize(); - - log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); - - log.info("totalSize :{},{}", totalSize,dingOrganization.getOrganizationName()); - if (totalSize > PAGE_SIZE) { - if (totalSize > MAX_SIZE) { - //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); - } - - int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; - int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; - for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { - query.setPageNo(pageNo); - GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); -// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); - if(pageGenericResult.isSuccess()){ - allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); - }else{ - log.error(pageGenericResult.getMsg()); - } - } - } - - // 批量查询 成员的accountId - List dingEmployeeInfoSaveRecordList = new ArrayList<>(); - if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); - } else { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); - for (List segment : split) { - assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); - } - } - // 批量保存用户信息 - saveBatch(dingEmployeeInfoSaveRecordList); - } - } - } - - - private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { - List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); - GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); - List employeeAccountIdDTOList = listGenericResult.getData(); - if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { - Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) - .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); - - List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); - - dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { - r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); - return r; - }).collect(Collectors.toList()); - dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); - } - } - - private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { - List saveRecordList = new ArrayList<>(); - for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { - List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); - if (CollUtil.isNotEmpty(govEmployeePositions)) { - List segmentSaveRecordList = new ArrayList<>(); - for (GovEmployeePosition govEmployeePosition : govEmployeePositions) { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); - dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); - dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); - dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); - dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); - dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); - dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); - dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); - dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); - dingEmployeeInfo.setCreateOn(LocalDateTime.now()); - dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); - dingEmployeeInfo.setCreateBy(-1L); - dingEmployeeInfo.setUpdateBy(-1L); - segmentSaveRecordList.add(dingEmployeeInfo); - } - saveRecordList.addAll(segmentSaveRecordList); - } else { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - saveRecordList.add(dingEmployeeInfo); - } - } - return saveRecordList; - } - - private void saveBatch(List dingEmployeeInfoSaveRecordList) { - dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() - .filter(r -> "true".equals(r.getMainJob()) - && "A".equals(r.getEmpStatus()) - && StringUtils.isNotBlank(r.getEmpPosUnitCode()) - && StringUtils.isNotBlank(r.getEmployeeCode()) - ).collect(Collectors.toList()); - - Set uniqueKeySet = new HashSet(); - - List saveList = new ArrayList<>(); - - for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { - if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { - saveList.add(dingEmployeeInfo); - } - } - - List organizations = iDingOrganizationService.list(); - Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); - - for (DingEmployeeInfo dingEmployeeInfo : saveList) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - - DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(employeeInfo)) { - iDingEmployeeInfoService.save(dingEmployeeInfo); - } else { - dingEmployeeInfo.setId(employeeInfo.getId()); - iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); - } - generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); - } - } - - public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode)); - if (Objects.isNull(userInfo)) { - userInfo = UserInfo.builder() - .accountId(dingEmployeeInfo.getAccountId()) - .username(dingEmployeeInfo.getEmployeeName()) - .realName(dingEmployeeInfo.getEmployeeName()) - .employeeCode(dingEmployeeInfo.getEmployeeCode()) - .available(UserAvailableEnum.DISABLE.name()) - .createBy(-1L) - .updateBy(-1L) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) - .avatar(dingEmployeeInfo.getAvatar()) - .build(); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.save(userInfo); - }else{ - userInfo.setAvatar(dingEmployeeInfo.getAvatar()); - userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.updateById(userInfo); - } - } - - /** - * 按区域 来更新员工 - * @param regionCode - */ - public void batchGetEmployeeTaskByRegionCode(String regionCode) { - List units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) - .eq(DingOrganization::getDivisionCode, regionCode)); - - - log.info("所有地区 {} 待更新员工的单位数:{}",regionCode,units.size()); - if (CollUtil.isNotEmpty(units)) { - //记录任务 单位数 - Integer index = 0; - for (DingOrganization dingOrganization : units) { - log.info("当前单位:{},下标数,{}",dingOrganization.getOrganizationName(),index); - index++; - List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = dingOrganization.getOrganizationCode(); - PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); - query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); - query.setReturnTotalSize(true); - query.setTenantId(zwddIntegrationProperties.getTenantId()); - int pageNo = 1; - query.setPageNo(pageNo); - query.setPageSize(PAGE_SIZE); - - // 查询组织下 用户信息 - GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - Page data = firstPageGenericResult.getData(); - if (Objects.isNull(data)){ - log.info("响应为空:{}",organizationCode); - continue; - } - if (CollUtil.isNotEmpty(data.getData())) { - allOrganizationEmployeePositionList.addAll(data.getData()); - } - Long totalSize = data.getTotalSize(); - - log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); - - log.info("totalSize :{},{}", totalSize,dingOrganization.getOrganizationName()); - if (totalSize > PAGE_SIZE) { - if (totalSize > MAX_SIZE) { - //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); - } - - int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; - int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; - for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { - query.setPageNo(pageNo); - GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); -// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); - if(pageGenericResult.isSuccess()){ - allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); - }else{ - log.error(pageGenericResult.getMsg()); - } - } - } - - // 批量查询 成员的accountId - List dingEmployeeInfoSaveRecordList = new ArrayList<>(); - if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); - } else { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); - for (List segment : split) { - assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); - } - } - // 批量保存用户信息 - saveBatch(dingEmployeeInfoSaveRecordList); - } - log.info("员工同步完成"); - } - } - - public void batchGetEmployeeTaskByOrdCode(String orgCode) { - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, orgCode) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); - log.info("所属单位 {} 要更新员工信息了",org.getOrganizationName()); - - List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = orgCode; - PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); - query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); - query.setReturnTotalSize(true); - query.setTenantId(zwddIntegrationProperties.getTenantId()); - int pageNo = 1; - query.setPageNo(pageNo); - query.setPageSize(PAGE_SIZE); - - // 查询组织下 用户信息 - GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - Page data = firstPageGenericResult.getData(); - if (Objects.isNull(data)){ - log.info("响应为空:{}",organizationCode); - return; - } - if (CollUtil.isNotEmpty(data.getData())) { - allOrganizationEmployeePositionList.addAll(data.getData()); - } - Long totalSize = data.getTotalSize(); - - log.info("dingOrganization :{}", JSON.toJSONString(org)); - - log.info("totalSize :{},{}", totalSize,org.getOrganizationName()); - if (totalSize > PAGE_SIZE) { - if (totalSize > MAX_SIZE) { - //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); - } - - int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; - int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; - for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { - query.setPageNo(pageNo); - GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); -// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); - if(pageGenericResult.isSuccess()){ - allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); - }else{ - log.error(pageGenericResult.getMsg()); - } - } - } - - // 批量查询 成员的accountId - List dingEmployeeInfoSaveRecordList = new ArrayList<>(); - if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); - } else { - log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); - List> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); - for (List segment : split) { - assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); - } - } - // 批量保存用户信息 - saveBatch(dingEmployeeInfoSaveRecordList); - - log.info("员工同步完成"); - - } - - /** - * 更新员工信息 主要是头像 - * @param empCode - */ - public void getEmployeeByCode(String empCode) { - GenericResult result = zwddClient.getEmployeeByCode(empCode); - log.error("请求员工信息 result:{}",JSON.toJSONString(result)); - if(!result.isSuccess()){ - log.error("请求员工信息失败 :{},mesg:{}",empCode,result.getMsg()); - return; - } - EmployeeInfoDTO data = result.getData(); - - if(Objects.isNull(data)){ - log.error("请求员工信息失败 返回为空"); - return; - } - - DingEmployeeInfo emp = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, empCode) - .last(BizConst.LIMIT_1)); - - if(Objects.nonNull(emp)){ - emp.setAvatar(data.getGovEmpAvatar()); - iDingEmployeeInfoService.updateById(emp); - } - - UserInfo user = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, empCode) - .last(BizConst.LIMIT_1)); - - if(Objects.nonNull(user)){ - user.setAvatar(data.getGovEmpAvatar()); - iUserInfoService.updateById(user); - } - } - - /** - * 更新一整个单位的 - * @param orgCode - */ - public void getBatchEmployeeByCode(String orgCode) { - - List employees = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode)); - - for(DingEmployeeInfo employee : employees){ - getEmployeeByCode(employee.getEmployeeCode()); - } - } - - /** - * 获取token - */ - public String getToken() { - GenericResult accessToken = zwddClient.getAccessToken(); - return accessToken.getData(); - } - - public String getAuthToken() { - GenericResult accessToken = zwddAuthClient.getAccessToken(); - return accessToken.getData(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java deleted file mode 100644 index 955166c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ningdatech.pmapi.ding.task; - -import cn.hutool.core.collection.CollectionUtil; -import com.alibaba.fastjson.JSON; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; -import com.ningdatech.pmapi.organization.service.IGovBusinessStripService; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.Page; -import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; -import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/3/8 下午2:55 - */ - -@Component -@Slf4j -public class GovBusinessStripsTask { - - private final static Integer PAGE_SIZE = 20; - - private final static Integer GROUP_SIZE = 100; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private IGovBusinessStripService iGovBusinessStripService; - - @Transactional(rollbackFor = Exception.class) -// @Scheduled(cron = "0 0 1 * * ?") - public void batchGetGovBusinessStripsTask() { - PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); - pageSubGovBusinessStripsQuery.setPageNo(1); - pageSubGovBusinessStripsQuery.setPageSize(100); - GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); - - log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); - - if(!pageGenericResult.isSuccess()){ - return; - } - - Page data = pageGenericResult.getData(); - List govBusinessStripsDTOList = data.getData(); - - List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { - GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); - govBusinessStrip.setBusinessStripCode(r.getCode()); - govBusinessStrip.setBusinessStripName(r.getName()); - return govBusinessStrip; - }).collect(Collectors.toList()); - - saveBatch(govBusinessStripList); - - for (SubGovBusinessStripsDTO subGovBusinessStripsDTO : govBusinessStripsDTOList) { - saveSub(subGovBusinessStripsDTO); - } - - } - - - public void saveSub(SubGovBusinessStripsDTO parentGovBusinessStripsDTO) { - String parentCode = parentGovBusinessStripsDTO.getCode(); - String parentName = parentGovBusinessStripsDTO.getName(); - - PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); - pageSubGovBusinessStripsQuery.setPageNo(1); - pageSubGovBusinessStripsQuery.setPageSize(100); - pageSubGovBusinessStripsQuery.setBusinessStripCode(parentCode); - GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); - Page data = pageGenericResult.getData(); - List govBusinessStripsDTOList = data.getData(); - - if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) { - List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { - GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); - govBusinessStrip.setBusinessStripCode(r.getCode()); - govBusinessStrip.setBusinessStripName(r.getName()); - govBusinessStrip.setParentCode(parentCode); - govBusinessStrip.setParentName(parentName); - return govBusinessStrip; - }).collect(Collectors.toList()); - saveBatch(govBusinessStripList); - } - } - - - public void saveBatch(List govBusinessStripList) { - if (CollectionUtil.isNotEmpty(govBusinessStripList)) { - iGovBusinessStripService.saveBatch(govBusinessStripList); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java deleted file mode 100644 index ce564b2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java +++ /dev/null @@ -1,257 +0,0 @@ - -package com.ningdatech.pmapi.ding.task; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; -import com.ningdatech.zwdd.model.dto.DingScopesV2DTO; -import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/7 上午10:15 - */ - -@Slf4j -@Component -public class OrganizationBatchGetTask { - - @Autowired - private ZwddClient zwddClient; - - private static final Integer GROUP_SIZE = 100; - - @Autowired - private IDingOrganizationService iDingOrganizationService; - - @Autowired - private EmployeeBatchGetTask employeeBatchGetTask; - - /** - * 获取浙政钉组织架构 - */ - @Transactional(rollbackFor = Exception.class) -// @Scheduled(cron = "0 0 1 * * ?") - public void batchGetOrganizationTask() { -// List allList = iDingOrganizationService.list(); -// List currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); - // 全量删除 - iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); - // 获取顶级组织code - GenericResult scopesV2Result = zwddClient.getScopesV2(); - DingScopesV2DTO scopesV2 = scopesV2Result.getData(); - - if (Objects.nonNull(scopesV2)) { - // 顶级组织code - List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); - log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); - // 获取顶级节点信息 - GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); - log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); - List dingOrgInfoDtos = listGenericResult.getData(); - for (String orgCode : deptVisibleScopes) { -// if (currentAllOrganizationCodeList.contains(orgCode)) { -// log.info("已存在组织架构---{}", orgCode); -// continue; -// } - List treeDTOList = new ArrayList<>(); - - DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); - //设置节点详情 - if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { - for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { - if (orgInfo.getOrganizationCode().equals(orgCode)) { - childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); - } - } - } - childDingOrgInfoTreeDTO.setCode(orgCode); - childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); - getDingOrgChild(childDingOrgInfoTreeDTO); - treeDTOList.add(childDingOrgInfoTreeDTO); - if (CollectionUtils.isNotEmpty(treeDTOList)) { - List saveRecordList = new ArrayList<>(); - buildSaveRecordList(treeDTOList, saveRecordList); - // 批量保存 - if (saveRecordList.size() <= GROUP_SIZE) { - iDingOrganizationService.saveBatch(saveRecordList); - } else { - List> split = Lists.partition(saveRecordList, GROUP_SIZE); - for (List segment : split) { - iDingOrganizationService.saveBatch(segment); - } - } - } - log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); - } - } - } - - /** - * 更新 其 子单位 - * @param orgCode - */ - public void organizationGetSubs(String orgCode) { - log.info("----拉取浙政钉组织子单位开始---,顶级code:" + orgCode); - DingOrganization topOrg = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, orgCode) - .last(BizConst.LIMIT_1)); - // 顶级组织code - GenericResult subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode); - log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult)); - PageSubOrganizationCodeDTO data = subOrganizationResult.getData(); - List subOrganizationCodeList = data.getSubOrganizationCodeList(); - - if(Objects.isNull(subOrganizationCodeList)){ - log.info("subOrganizationCodeList为null"); - return; - } - - employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); - - for(String subOrganizationCode : subOrganizationCodeList){ - GenericResult organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode); - DingOrgInfoDTO dingOrgInfo = organizationByCode.getData(); - DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(old)){ - log.info("该单位已经存在 :{}",old.getOrganizationName()); - organizationGetSubs(dingOrgInfo.getOrganizationCode()); -// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(dingOrgInfo.getOrganizationCode()); - continue; - } - - DingOrganization organization = new DingOrganization(); - organization.setOrganizationCode(dingOrgInfo.getOrganizationCode()); - organization.setOrganizationName(dingOrgInfo.getOrganizationName()); - //和顶级单位一个区域 - organization.setDivisionCode(topOrg.getDivisionCode()); - organization.setParentCode(dingOrgInfo.getParentCode()); - organization.setTypeName(dingOrgInfo.getTypeName()); - organization.setAddress(dingOrgInfo.getAddress()); - organization.setBusinessStripCodes(dingOrgInfo.getBusinessStripCodes()); - organization.setDisplayOrder(dingOrgInfo.getDisplayOrder()); - organization.setGmtCreate(LocalDateTime.now()); - organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode()); - organization.setParentName(dingOrgInfo.getParentName()); - if(iDingOrganizationService.save(organization)){ - organizationGetSubs(organization.getOrganizationCode()); -// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode()); - } - } - - log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode); - } - - /** - * 查看下 当前的子单位信息 - * @param orgCode - */ - public void organizationSubGetOrgs(String orgCode) { - // 顶级组织code - GenericResult subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode); - log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult)); - PageSubOrganizationCodeDTO data = subOrganizationResult.getData(); - List subOrganizationCodeList = data.getSubOrganizationCodeList(); - - if(Objects.isNull(subOrganizationCodeList)){ - log.info("subOrganizationCodeList为null"); - return; - } - - for(String subOrganizationCode : subOrganizationCodeList){ - GenericResult organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode); - DingOrgInfoDTO dingOrgInfo = organizationByCode.getData(); - log.info("dingOrgInfo :{}",JSON.toJSONString(dingOrgInfo)); - } - } - - private void buildSaveRecordList(List treeDTOList, List saveRecordList) { - if (CollectionUtils.isEmpty(treeDTOList)) { - return; - } - for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { - DingOrganization saveRecord = new DingOrganization(); - DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); - List childCodes = dingOrgInfoTreeDTO.getChildCodes(); - saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); -// saveRecord.setEnabled("1"); - saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); - saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); - saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); - saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); -// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); - saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); - saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode()); - saveRecordList.add(saveRecord); - if (CollectionUtils.isNotEmpty(childCodes)) { - buildSaveRecordList(childCodes, saveRecordList); - } - } - } - - private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { - String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); - DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); - boolean leaf = orgInfoDTO.getLeaf(); - if (!leaf) { - int currentPage = 1; - int pageSize = 100; - GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); - PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); - - if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { - List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); - Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); - - while (totalSize > (long) currentPage * pageSize) { - GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient - .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); - PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); - if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { - subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); - } - } - - if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { - GenericResult> listGenericResult = zwddClient - .listOrganizationsByCodes(subOrganizationCodeList); - List dingOrgInfoDtos = listGenericResult.getData(); - List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { - DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); - dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); - dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); - dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); - getDingOrgChild(dingOrgInfoTreeDTO); - return dingOrgInfoTreeDTO; - }).collect(Collectors.toList()); - parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); - } - } - } - } -} - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java deleted file mode 100644 index f0c9bfa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/25 下午4:30 - */ - -public class DictionaryAssembler { - - public static List toDictFieldInfoList(List expertDictList) { - if (CollUtil.isEmpty(expertDictList)) { - return new ArrayList<>(); - } - return expertDictList.stream().map(r -> { - DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); - dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); - return dictionaryFieldInfo; - }).collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java deleted file mode 100644 index b7e6a73..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - -import cn.hutool.core.collection.CollectionUtil; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.constant.QueryExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; -import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.impl.TagsCacheImpl; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/8/5 下午4:32 - */ -@Component -@RequiredArgsConstructor -public class ExpertAdminExpertManageAssembler { - - private final DictionaryCache dictionaryCache; - private final TagsCacheImpl tagCache; - private final RegionCacheHelper regionCache; - - public List toExpertAdminExpertManageListVOList( - List expertManageListDTOList) { - if (CollectionUtil.isEmpty(expertManageListDTOList)) { - return new ArrayList<>(); - } - return expertManageListDTOList.stream().map(r -> { - ExpertAdminExpertManageListVO expertAdminExpertManageListVO = new ExpertAdminExpertManageListVO(); - expertAdminExpertManageListVO.setUserId(r.getUserId()); - expertAdminExpertManageListVO.setExpertName(r.getExpertName()); - expertAdminExpertManageListVO.setPhoneNo(r.getPhoneNo()); - expertAdminExpertManageListVO.setIsDingUser(r.getIsDingUser()); - expertAdminExpertManageListVO.setCompany(r.getCompany()); - expertAdminExpertManageListVO.setLegalEntityCode(r.getLegalEntityCode()); - - if (StringUtils.isNotBlank(r.getExpertAccountStatus())) { - ExpertAccountStatusEnum statusEnum = ExpertAccountStatusEnum.of(r.getExpertAccountStatus()); - switch (statusEnum) { - case FREEZE: - expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.FREEZING.getKey()); - break; - case AVAILABLE: - expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.NORMAL.getKey()); - break; - default: - break; - } - } - ExpertRegionInfo expertRegionInfo = r.getExpertRegionInfo(); - if (Objects.nonNull(expertRegionInfo)) { - Integer regionLevel = expertRegionInfo.getRegionLevel(); - String regionCode = expertRegionInfo.getRegionCode(); - RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); - if (Objects.nonNull(regionDTO)) { - expertRegionInfo.setRegionCode(regionDTO.getRegionCode()); - expertRegionInfo.setRegionLevel(regionDTO.getRegionLevel()); - expertRegionInfo.setRegionName(regionDTO.getRegionName()); - expertAdminExpertManageListVO.setExpertRegionInfo(expertRegionInfo); - } - } - List expertType = r.getExpertType(); - if (CollectionUtils.isNotEmpty(expertType)) { - expertType = assembleDictionaryName(expertType); - expertAdminExpertManageListVO.setExpertType(expertType); - } - List companyAttribute = r.getCompanyAttribute(); - if (CollectionUtils.isNotEmpty(companyAttribute)) { - companyAttribute = assembleDictionaryName(companyAttribute); - expertAdminExpertManageListVO.setCompanyAttribute(companyAttribute); - } - List titleLevel = r.getTitleLevel(); - if (CollectionUtils.isNotEmpty(titleLevel)) { - titleLevel = assembleDictionaryName(titleLevel); - expertAdminExpertManageListVO.setTitleLevel(titleLevel); - } - - List expertSource = r.getExpertSource(); - if (CollectionUtils.isNotEmpty(expertSource)) { - expertSource = assembleTagName(expertSource); - expertAdminExpertManageListVO.setExpertSource(expertSource); - } - expertAdminExpertManageListVO.setCreateTime(r.getCreateTime()); - return expertAdminExpertManageListVO; - }).collect(Collectors.toList()); - - } - - public List assembleDictionaryName(List collect) { - if (CollectionUtil.isEmpty(collect)){ - return new ArrayList<>(); - } - return collect.stream().peek(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - if (Objects.nonNull(dictionaryDTO)) { - r.setDictionaryName(dictionaryDTO.getName()); - } - }).collect(Collectors.toList()); - } - - - public List assembleTagName(List collect) { - if (CollectionUtil.isEmpty(collect)){ - return new ArrayList<>(); - } - return collect.stream().peek(r -> { - TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); - if (Objects.nonNull(tagDTO)) { - r.setTagName(tagDTO.getTagName()); - } - }).collect(Collectors.toList()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java deleted file mode 100644 index b535aff..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java +++ /dev/null @@ -1,266 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; -import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; -import com.ningdatech.pmapi.expert.model.cmd.ExpertInfoModifyCmd; -import com.ningdatech.pmapi.expert.model.dto.*; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/22 下午5:19 - */ - -public class ExpertInfoCmdAssembler { - - public static ExpertFullInfoSaveCmd buildExpertFullInfoSaveCmd(Long userId - , ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo - , ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo) { - - ExpertFullInfoSaveCmd expertFullInfoSaveCmd = new ExpertFullInfoSaveCmd(); - ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO( - expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null, null); - List expertDictionaryList = - buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); - List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, null); - // 专家履职意向(区域编码) - List expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); - List expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); - - expertFullInfoSaveCmd.setUserId(userId); - expertFullInfoSaveCmd.setExpertUserInfoDTO(expertUserInfoDTO); - expertFullInfoSaveCmd.setExpertDictionaryList(expertDictionaryList); - expertFullInfoSaveCmd.setExpertTagList(expertTagList); - expertFullInfoSaveCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); - expertFullInfoSaveCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); - - return expertFullInfoSaveCmd; - } - - - private static List buildExpertAvoidCompanyList(ExpertProfessionalInfo professionalInfo) { - List expertAvoidCompanyList = new ArrayList<>(); - List avoidCompanyList = professionalInfo.getAvoidCompanyList(); - if (CollectionUtils.isNotEmpty(avoidCompanyList)) { - expertAvoidCompanyList = avoidCompanyList.stream().map(r -> { - ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); - expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); - expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); - return expertAvoidCompanyDTO; - }).collect(Collectors.toList()); - } - return expertAvoidCompanyList; - } - - private static List buildExpertRegionList(ExpertBasicInfo basicInfo) { - List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); - if (CollectionUtils.isEmpty(expertIntentionWorkRegions)) { - return new ArrayList<>(); - } - return expertIntentionWorkRegions.stream().map(r -> { - ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); - expertRegionDTO.setRegionCode(r.getRegionCode()); - expertRegionDTO.setRegionLevel(r.getRegionLevel()); - return expertRegionDTO; - }).collect(Collectors.toList()); - } - - private static List buildExpertTagList(ExpertProfessionalInfo professionalInfo - , ExpertBasicInfo basicInfo, ExpertOtherInfo otherInfo) { - List goodAt = professionalInfo.getGoodAt(); - List technicalExpertise = professionalInfo.getTechnicalExpertise(); - List industrySector = professionalInfo.getIndustrySector(); - List expertSource = basicInfo.getExpertSource(); - List other; - if (Objects.nonNull(otherInfo)) { - other = otherInfo.getOther(); - } else { - other = professionalInfo.getOther(); - } - if (other == null) { - other = Collections.emptyList(); - } - List tagFieldInfoList = new ArrayList<>(); - assemblerTagExpertInfoFieldName(tagFieldInfoList, goodAt, ExpertTagEnum.GOOD_AT); - assemblerTagExpertInfoFieldName(tagFieldInfoList, technicalExpertise, ExpertTagEnum.TECHNICAL_EXPERTISE); - assemblerTagExpertInfoFieldName(tagFieldInfoList, industrySector, ExpertTagEnum.INDUSTRY_SECTOR); - assemblerTagExpertInfoFieldName(tagFieldInfoList, expertSource, ExpertTagEnum.EXPERT_SOURCE); - assemblerTagExpertInfoFieldName(tagFieldInfoList, other, ExpertTagEnum.OTHER); - - return tagFieldInfoList.stream().map(r -> { - ExpertTagDTO expertTagDTO = new ExpertTagDTO(); - expertTagDTO.setTagCode(r.getTagCode()); - expertTagDTO.setExpertInfoField(r.getTagFieldName()); - return expertTagDTO; - }).collect(Collectors.toList()); - } - - private static void assemblerTagExpertInfoFieldName(List allTagList - , List targetTagList, ExpertTagEnum expertTagEnum) { - if (CollUtil.isNotEmpty(targetTagList)) { - targetTagList.forEach(r -> r.setTagFieldName(expertTagEnum.getKey())); - allTagList.addAll(targetTagList); - } - } - - private static List buildExpertDictionaryList(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo - , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo) { - List political = basicInfo.getPolitical(); - List expertType = basicInfo.getExpertType(); - List edu = eduInfo.getEdu(); - List degree = eduInfo.getDegree(); - List jobStatus = jobInfo.getJobStatus(); - List companyAttribute = jobInfo.getCompanyAttribute(); - List administrativeRank = jobInfo.getAdministrativeRank(); - List titleLevel = professionalInfo.getTitleLevel(); - - List recommendedWay = new ArrayList<>(); - if (Objects.nonNull(recommendInfo)) { - recommendedWay = recommendInfo.getRecommendedWay(); - } - List dictionaryFieldInfoList = new ArrayList<>(); - assemblerDictionaryFieldName(dictionaryFieldInfoList, political, DictExpertInfoTypeEnum.POLITICAL); - assemblerDictionaryFieldName(dictionaryFieldInfoList, expertType, DictExpertInfoTypeEnum.EXPERT_TYPE); - assemblerDictionaryFieldName(dictionaryFieldInfoList, edu, DictExpertInfoTypeEnum.EDU); - assemblerDictionaryFieldName(dictionaryFieldInfoList, degree, DictExpertInfoTypeEnum.DEGREE); - assemblerDictionaryFieldName(dictionaryFieldInfoList, jobStatus, DictExpertInfoTypeEnum.JOB_STATUS); - assemblerDictionaryFieldName(dictionaryFieldInfoList, companyAttribute, DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE); - assemblerDictionaryFieldName(dictionaryFieldInfoList, administrativeRank, DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK); - assemblerDictionaryFieldName(dictionaryFieldInfoList, titleLevel, DictExpertInfoTypeEnum.TITLE_LEVEL); - assemblerDictionaryFieldName(dictionaryFieldInfoList, recommendedWay, DictExpertInfoTypeEnum.RECOMMENDED_WAY); - - return dictionaryFieldInfoList.stream().map(r -> { - ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); - expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); - expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); - return expertDictionaryDTO; - }).collect(Collectors.toList()); - } - - private static void assemblerDictionaryFieldName( - List allDictionaryFieldInfoList, List originalDictionaryFieldInfoList - , DictExpertInfoTypeEnum dictExpertInfoTypeEnum) { - if (CollectionUtils.isNotEmpty(originalDictionaryFieldInfoList)) { - originalDictionaryFieldInfoList = originalDictionaryFieldInfoList.stream().map(r -> { - r.setDictionaryFieldName(dictExpertInfoTypeEnum.getKey()); - return r; - }).collect(Collectors.toList()); - allDictionaryFieldInfoList.addAll(originalDictionaryFieldInfoList); - } - } - - private static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo - , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo, ExpertOtherInfo otherInfo) { - ExpertUserFullInfoDTO expertFullInfo = new ExpertUserFullInfoDTO(); - - expertFullInfo.setIsDingUser(basicInfo.getIsDingUser()); - expertFullInfo.setPhoneNo(basicInfo.getPhoneNo()); - expertFullInfo.setGender(basicInfo.getGender()); - expertFullInfo.setName(basicInfo.getName()); - if (Objects.nonNull(basicInfo.getAvatarFile())) { - expertFullInfo.setAvatarFileId(basicInfo.getAvatarFile().getFileId()); - } - expertFullInfo.setIdCard(basicInfo.getIdCard()); - expertFullInfo.setOfficePhone(basicInfo.getOfficePhone()); - expertFullInfo.setBirth(basicInfo.getBirth()); - expertFullInfo.setBankNo(basicInfo.getBankNo()); - expertFullInfo.setBank(basicInfo.getBank()); - expertFullInfo.setEmail(basicInfo.getEmail()); - expertFullInfo.setHometown(basicInfo.getHometown()); - expertFullInfo.setNationality(basicInfo.getNationality()); - if (Objects.nonNull(otherInfo)) { - expertFullInfo.setRemark(otherInfo.getRemark()); - } - expertFullInfo.setSchool(eduInfo.getSchool()); - expertFullInfo.setGraduatedAt(eduInfo.getGraduatedAt()); - expertFullInfo.setAcademicTitle(eduInfo.getAcademicTitle()); - - if (CollectionUtils.isNotEmpty(eduInfo.getGraduationCertificateFile())) { - expertFullInfo.setGraduationCertificateFileIdList(eduInfo.getGraduationCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); - } - if (CollectionUtils.isNotEmpty(eduInfo.getDegreeCertificateFile())) { - - expertFullInfo.setDegreeCertificateFileIdList(eduInfo.getDegreeCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); - } - - expertFullInfo.setRetiredAt(jobInfo.getRetiredAt()); - expertFullInfo.setCompany(jobInfo.getCompany()); - expertFullInfo.setCompanyUniqCode(jobInfo.getCompanyUniqCode()); - expertFullInfo.setLegalEntityCode(jobInfo.getLegalEntityCode()); - expertFullInfo.setAdministrativeDuties(jobInfo.getAdministrativeDuties()); - expertFullInfo.setStartWorkAt(jobInfo.getStartWorkAt()); - expertFullInfo.setAddress(jobInfo.getAddress()); - expertFullInfo.setExperience(jobInfo.getExperience()); - - expertFullInfo.setTechnicalTitles(professionalInfo.getTechnicalTitles()); - if (CollectionUtils.isNotEmpty(professionalInfo.getTitleCertificateFile())) { - expertFullInfo.setTitleCertificateFileIdList(CollUtils.fieldList(professionalInfo.getTitleCertificateFile(), FileBasicInfo::getFileId)); - } - expertFullInfo.setAwards(professionalInfo.getAwards()); - expertFullInfo.setRecognitionReward(professionalInfo.getRecognitionReward()); - - if (Objects.nonNull(basicInfo.getExpertRegionInfo())) { - expertFullInfo.setRegionCode(basicInfo.getExpertRegionInfo().getRegionCode()); - expertFullInfo.setRegionLevel(basicInfo.getExpertRegionInfo().getRegionLevel()); - } - // 推荐证明材料单独装配 - if (Objects.nonNull(recommendInfo)) { - List recommendationProofFile = recommendInfo.getRecommendationProofFile(); - if (CollectionUtils.isNotEmpty(recommendationProofFile)) { - expertFullInfo.setRecommendationProofFileIdList(CollUtils.fieldList(recommendationProofFile, FileBasicInfo::getFileId)); - - } - } - return expertFullInfo; - } - - public static ExpertInfoModifyCmd buildExpertInfoModifyCmd(Long userId - , ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo - , ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo - , ExpertRecommendInfo recommendInfo - , ExpertOtherInfo otherInfo - , ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO - , ModifyApplyExtraInfo modifyApplyExtraInfo) { - ExpertInfoModifyCmd expertInfoModifyCmd = new ExpertInfoModifyCmd(); - ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo, otherInfo); - - List expertDictionaryList = buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo); - List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, otherInfo); - // 专家履职意向(区域编码) - List expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); - List expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); - - if (Objects.nonNull(modifyApplyExtraInfo)) { - ModifyApplyExtraInfoDTO modifyApplyExtraInfoDTO = new ModifyApplyExtraInfoDTO(); - modifyApplyExtraInfoDTO.setEvidenceList(modifyApplyExtraInfo.getEvidenceList()); - modifyApplyExtraInfoDTO.setFactSheet(modifyApplyExtraInfo.getFactSheet()); - expertInfoModifyCmd.setModifyApplyExtraInfo(modifyApplyExtraInfoDTO); - } - - expertInfoModifyCmd.setUserId(userId); - expertInfoModifyCmd.setExpertUserInfoDTO(expertUserInfoDTO); - expertInfoModifyCmd.setExpertDictionaryList(expertDictionaryList); - expertInfoModifyCmd.setExpertTagList(expertTagList); - expertInfoModifyCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); - expertInfoModifyCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); - expertInfoModifyCmd.setExpertInfoSensitiveFieldCheckBO(expertInfoSensitiveFieldCheckBO); - expertInfoModifyCmd.setBusinessStrips(expertJobInfo.getBusinessStrips()); - return expertInfoModifyCmd; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java deleted file mode 100644 index 5541f7a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java +++ /dev/null @@ -1,462 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import com.ningdatech.pmapi.expert.entity.*; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.dto.*; -import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/27 上午10:46 - */ -@Component -@RequiredArgsConstructor -public class ExpertUserInfoAssembler { - - private final TagCache tagCache; - private final DictionaryCache dictionaryCache; - private final RegionCacheHelper regionCacheHelper; - - public ExpertFullInfoVO buildExpertFullInfo(List attachFiles, ExpertFullInfoAllDTO expertFullInfoAll) { - ExpertUserFullInfoDTO expertUserInfo = expertFullInfoAll.getExpertUserInfoDTO(); - // 字典字典段map - Map> dictMap = buildDictInfoMap(expertFullInfoAll.getExpertDictionaryList()); - // 专家文件资料map - Map fileMap = buildFileBasicInfoMap(attachFiles); - // 专家标签字段map - Map> tagMap = buildTagFieldInfoMap(expertFullInfoAll.getExpertTagList()); - // 专家履职意向地 - List intentionWorkRegions = expertFullInfoAll.getExpertIntentionWorkRegionInfo(); - // 专家回避单位列表 - List avoidCompanies = expertFullInfoAll.getExpertAvoidCompanyList(); - // 基本信息 - ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfo, dictMap, tagMap, intentionWorkRegions, fileMap); - // 学历信息 - ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfo, dictMap, fileMap); - // 职业信息 - ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfo, dictMap); - jobInfo.setBusinessStrips(expertFullInfoAll.getBusinessStrips()); - // 专业信息 - ExpertProfessionalInfo profession = buildExpertProfessionalInfo(expertUserInfo, dictMap, tagMap, fileMap, avoidCompanies); - // 推荐信息 - ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); - recommendInfo.setRecommendedWay(dictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey())); - recommendInfo.setRecommendationProofFile(getFileBasicInfoList(fileMap, expertUserInfo.getRecommendationProofFileIdList())); - // 其他信息 - ExpertOtherInfo otherInfo = new ExpertOtherInfo(); - otherInfo.setOther(tagMap.get(ExpertTagEnum.OTHER.getKey())); - otherInfo.setRemark(expertUserInfo.getRemark()); - - // 专家申请履职意向展示列表 - List applyIntentionWorkRegions = expertFullInfoAll.getExpertApplyIntentionWorkRegionInfo().stream().map(r -> { - ExpertRegionInfo intentionWorkRegion = new ExpertRegionInfo(); - intentionWorkRegion.setRegionLevel(r.getRegionLevel()); - intentionWorkRegion.setRegionCode(r.getRegionCode()); - intentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel())); - return intentionWorkRegion; - }).collect(Collectors.toList()); - - if (CollUtil.isEmpty(basicInfo.getExpertIntentionWorkRegions())) { - basicInfo.setExpertIntentionWorkRegions(applyIntentionWorkRegions); - } - ExpertFullInfoVO resExpertFullInfo = new ExpertFullInfoVO(); - resExpertFullInfo.setUserId(expertUserInfo.getUserId()); - resExpertFullInfo.setBasicInfo(basicInfo); - resExpertFullInfo.setEduInfo(eduInfo); - resExpertFullInfo.setJobInfo(jobInfo); - resExpertFullInfo.setProfessionalInfo(profession); - resExpertFullInfo.setRecommendInfo(recommendInfo); - resExpertFullInfo.setExpertOtherInfo(otherInfo); - resExpertFullInfo.setExpertApplyIntentionWorkRegions(applyIntentionWorkRegions); - return resExpertFullInfo; - } - - public static Map buildFileBasicInfoMap(List attachFiles) { - return attachFiles.stream().map(r -> { - FileBasicInfo fileBasicInfo = new FileBasicInfo(); - fileBasicInfo.setFileId(r.getFileId()); - fileBasicInfo.setFileName(r.getOriginalFileName()); - return fileBasicInfo; - }).collect(Collectors.toMap(FileBasicInfo::getFileId, Function.identity())); - } - - public Map> buildTagFieldInfoMap(List expertTagList) { - return expertTagList.stream().map(r -> { - TagFieldInfo tagFieldInfo = new TagFieldInfo(); - tagFieldInfo.setTagCode(r.getTagCode()); - tagFieldInfo.setTagFieldName(r.getExpertInfoField()); - TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); - if (Objects.nonNull(tagDTO)) { - tagFieldInfo.setTagName(tagDTO.getTagName()); - } - return tagFieldInfo; - }).collect(Collectors.groupingBy(TagFieldInfo::getTagFieldName)); - } - - public Map> buildDictInfoMap(List expertDictList) { - return expertDictList.stream().map(r -> { - DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); - dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } - return dictionaryFieldInfo; - }).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName)); - } - - public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO, - Map> dictInfoMap, - Map> tagFieldInfoMap, - Map fileInfoMap, - List expertAvoidCompanyList) { - ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); - professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); - professionalInfo.setTitleLevel(dictInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())); - professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList())); - professionalInfo.setGoodAt(tagFieldInfoMap.get(ExpertTagEnum.GOOD_AT.getKey())); - professionalInfo.setTechnicalExpertise(tagFieldInfoMap.get(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey())); - professionalInfo.setAwards(expertUserInfoDTO.getAwards()); - professionalInfo.setIndustrySector(tagFieldInfoMap.get(ExpertTagEnum.INDUSTRY_SECTOR.getKey())); - professionalInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); - professionalInfo.setAvoidCompanyList(expertAvoidCompanyList.stream().map(r -> { - ExpertAvoidCompanyInfo avoidCompanyInfo = new ExpertAvoidCompanyInfo(); - avoidCompanyInfo.setCompanyName(r.getCompanyName()); - avoidCompanyInfo.setCompanyUniqCode(r.getCompanyUniqCode()); - return avoidCompanyInfo; - }).collect(Collectors.toList())); - return professionalInfo; - } - - public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO, - Map> dictInfoMap) { - ExpertJobInfo jobInfo = new ExpertJobInfo(); - jobInfo.setJobStatus(dictInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey())); - jobInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); - jobInfo.setCompany(expertUserInfoDTO.getCompany()); - jobInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); - jobInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); - jobInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); - jobInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); - jobInfo.setAdministrativeRank(dictInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey())); - jobInfo.setCompanyAttribute(dictInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey())); - jobInfo.setAddress(expertUserInfoDTO.getAddress()); - jobInfo.setExperience(expertUserInfoDTO.getExperience()); - return jobInfo; - } - - public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertFullInfo, - Map> dictInfoMap, - Map fileInfoMap) { - // 学历信息 - ExpertEduInfo eduInfo = new ExpertEduInfo(); - eduInfo.setSchool(expertFullInfo.getSchool()); - eduInfo.setGraduatedAt(expertFullInfo.getGraduatedAt()); - eduInfo.setAcademicTitle(expertFullInfo.getAcademicTitle()); - eduInfo.setEdu(dictInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey())); - eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getGraduationCertificateFileIdList())); - eduInfo.setDegree(dictInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey())); - eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getDegreeCertificateFileIdList())); - return eduInfo; - } - - private static List getFileBasicInfoList(Map fileBasicInfoMap, List fileIdList) { - if (CollUtil.isEmpty(fileIdList)) { - return new ArrayList<>(); - } - List fileBasicInfoList = new ArrayList<>(); - for (Long fileId : fileIdList) { - FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId); - if (Objects.nonNull(fileBasicInfo)) { - fileBasicInfoList.add(fileBasicInfo); - } - } - return fileBasicInfoList; - } - - public static FileBasicInfo getFileBasicInfo(Map fileBasicInfoMap, Long fileId) { - if (Objects.isNull(fileId)) { - return null; - } - return fileBasicInfoMap.get(fileId); - } - - public ExpertBasicInfo buildExpertBasicInfo(ExpertUserFullInfoDTO expertUserInfoDTO - , Map> dictionaryFieldInfoMap - , Map> tagFieldInfoMap - , List expertIntentionWorkRegionInfo - , Map fileBasicInfoMap) { - //专家层级 - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); - expertRegionInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); - - // 基本信息 - ExpertBasicInfo basicInfo = new ExpertBasicInfo(); - basicInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser()); - basicInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); - basicInfo.setName(expertUserInfoDTO.getName()); - basicInfo.setAvatarFile(getFileBasicInfo(fileBasicInfoMap, expertUserInfoDTO.getAvatarFileId())); - basicInfo.setGender(expertUserInfoDTO.getGender()); - basicInfo.setPolitical(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey())); - basicInfo.setIdCard(expertUserInfoDTO.getIdCard()); - basicInfo.setOfficePhone(expertUserInfoDTO.getPhoneNo()); - basicInfo.setBirth(expertUserInfoDTO.getBirth()); - basicInfo.setBank(expertUserInfoDTO.getBank()); - basicInfo.setBankNo(expertUserInfoDTO.getBankNo()); - basicInfo.setEmail(expertUserInfoDTO.getEmail()); - basicInfo.setHometown(expertUserInfoDTO.getHometown()); - basicInfo.setNationality(expertUserInfoDTO.getNationality()); - basicInfo.setExpertSource(tagFieldInfoMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey())); - expertRegionInfo.setRegionName(regionCacheHelper.getUnionPath(expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel())); - basicInfo.setExpertRegionInfo(expertRegionInfo); - - basicInfo.setExpertIntentionWorkRegions(expertIntentionWorkRegionInfo.stream().map(r -> { - ExpertRegionInfo expertIntentionWorkRegion = new ExpertRegionInfo(); - expertIntentionWorkRegion.setRegionCode(r.getRegionCode()); - expertIntentionWorkRegion.setRegionLevel(r.getRegionLevel()); - expertIntentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel())); - return expertIntentionWorkRegion; - }).collect(Collectors.toList())); - basicInfo.setExpertType(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); - return basicInfo; - } - - public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo, - List expertTagList, - List expertDictionaryList, - List intentionWorkRegionList, - List expertMetaApplyList, - List expertAvoidCompanyList, - List businessStrips) { - ExpertUserFullInfoDTO expertFullInfoDto = buildExpertUserFullInfoDTO(expertUserFullInfo); - List expertDicts = buildExpertDictionaryDTOList(expertDictionaryList); - List expertTags = buildExpertTagDTOList(expertTagList); - List intentionWorkRegions = buildExpertIntentionWorkRegionInfo(intentionWorkRegionList); - - // 专家申请履职意向展示列表 - List applyIntentionWorkRegions = buildExpertApplyIntentionWorkRegionInfo(intentionWorkRegionList, expertMetaApplyList); - List expertAvoidCompanyDTOList = buildExpertAvoidCompanyDTOList(expertAvoidCompanyList); - ExpertFullInfoAllDTO expertFullInfoAll = new ExpertFullInfoAllDTO(); - expertFullInfoAll.setUserId(expertUserFullInfo.getUserId()); - expertFullInfoAll.setExpertUserInfoDTO(expertFullInfoDto); - expertFullInfoAll.setExpertDictionaryList(expertDicts); - expertFullInfoAll.setExpertTagList(expertTags); - expertFullInfoAll.setExpertIntentionWorkRegionInfo(intentionWorkRegions); - expertFullInfoAll.setExpertApplyIntentionWorkRegionInfo(applyIntentionWorkRegions); - expertFullInfoAll.setExpertAvoidCompanyList(expertAvoidCompanyDTOList); - expertFullInfoAll.setBusinessStrips(BeanUtil.copyToList(businessStrips, GovBusinessStripVO.class)); - return expertFullInfoAll; - } - - private static List buildExpertApplyIntentionWorkRegionInfo(List expertIntentionWorkRegionList, - List expertMetaApplyList) { - Set set = new HashSet<>(); - for (ExpertIntentionWorkRegion expertIntentionWorkRegion : expertIntentionWorkRegionList) { - RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); - regionDtoMapKey.setRegionCode(expertIntentionWorkRegion.getRegionCode()); - regionDtoMapKey.setRegionLevel(expertIntentionWorkRegion.getRegionLevel()); - set.add(regionDtoMapKey); - } - - for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { - String regionCode = expertMetaApply.getRegionCode(); - Integer regionLevel = expertMetaApply.getRegionLevel(); - if (Objects.nonNull(regionLevel) && StringUtils.isNotBlank(regionCode)) { - String applyType = expertMetaApply.getApplyType(); - RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); - regionDtoMapKey.setRegionCode(regionCode); - regionDtoMapKey.setRegionLevel(regionLevel); - ExpertApplyTypeEnum typeEnum = ExpertApplyTypeEnum.of(applyType); - switch (typeEnum) { - case EXPERT_INTENTION_LEAVE: { - set.remove(regionDtoMapKey); - } - break; - case EXPERT_INTENTION_JOIN: { - set.add(regionDtoMapKey); - } - break; - default: - break; - } - } - } - return set.stream().map(r -> { - ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); - expertRegionDTO.setRegionCode(r.getRegionCode()); - expertRegionDTO.setRegionLevel(r.getRegionLevel()); - return expertRegionDTO; - }).collect(Collectors.toList()); - } - - private static List buildExpertAvoidCompanyDTOList(List expertAvoidCompanyList) { - return expertAvoidCompanyList.stream().map(r -> { - ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); - expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); - expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); - return expertAvoidCompanyDTO; - }).collect(Collectors.toList()); - } - - private static List buildExpertIntentionWorkRegionInfo(List expertIntentionWorkRegionList) { - return expertIntentionWorkRegionList.stream().map(r -> { - ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); - expertRegionDTO.setRegionLevel(r.getRegionLevel()); - expertRegionDTO.setRegionCode(r.getRegionCode()); - return expertRegionDTO; - }).collect(Collectors.toList()); - } - - private static List buildExpertTagDTOList(List expertTagList) { - return expertTagList.stream().map(r -> { - ExpertTagDTO expertTagDTO = new ExpertTagDTO(); - expertTagDTO.setExpertInfoField(r.getExpertInfoField()); - expertTagDTO.setTagCode(r.getTagCode()); - return expertTagDTO; - }).collect(Collectors.toList()); - } - - private static List buildExpertDictionaryDTOList(List expertDictionaryList) { - return expertDictionaryList.stream().map(r -> { - ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); - expertDictionaryDTO.setExpertInfoField(r.getExpertInfoField()); - expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); - return expertDictionaryDTO; - }).collect(Collectors.toList()); - } - - public static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertUserFullInfo expertUserFullInfo) { - ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO(); - expertUserFullInfoDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); - expertUserFullInfoDTO.setPhoneNo(expertUserFullInfo.getPhoneNo()); - expertUserFullInfoDTO.setGender(expertUserFullInfo.getGender()); - expertUserFullInfoDTO.setName(expertUserFullInfo.getExpertName()); - expertUserFullInfoDTO.setAvatarFileId(expertUserFullInfo.getAvatarFileId()); - expertUserFullInfoDTO.setIdCard(expertUserFullInfo.getIdCard()); - expertUserFullInfoDTO.setOfficePhone(expertUserFullInfo.getOfficePhone()); - expertUserFullInfoDTO.setBirth(expertUserFullInfo.getBirth()); - expertUserFullInfoDTO.setBankNo(expertUserFullInfo.getBankNo()); - expertUserFullInfoDTO.setBank(expertUserFullInfo.getBank()); - expertUserFullInfoDTO.setEmail(expertUserFullInfo.getEmail()); - expertUserFullInfoDTO.setHometown(expertUserFullInfo.getHometown()); - expertUserFullInfoDTO.setNationality(expertUserFullInfo.getNationality()); - - expertUserFullInfoDTO.setSchool(expertUserFullInfo.getSchool()); - expertUserFullInfoDTO.setGraduatedAt(expertUserFullInfo.getGraduatedAt()); - expertUserFullInfoDTO.setAcademicTitle(expertUserFullInfo.getAcademicTitle()); - if (StringUtils.isNotBlank(expertUserFullInfo.getGraduationCertificateFileIdList())) { - expertUserFullInfoDTO.setGraduationCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getGraduationCertificateFileIdList(), Long.class)); - } - if (StringUtils.isNotBlank(expertUserFullInfo.getDegreeCertificateFileIdList())) { - expertUserFullInfoDTO.setDegreeCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getDegreeCertificateFileIdList(), Long.class)); - } - expertUserFullInfoDTO.setRetiredAt(expertUserFullInfo.getRetiredAt()); - expertUserFullInfoDTO.setCompany(expertUserFullInfo.getCompany()); - expertUserFullInfoDTO.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode()); - expertUserFullInfoDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); - expertUserFullInfoDTO.setAdministrativeDuties(expertUserFullInfo.getAdministrativeDuties()); - expertUserFullInfoDTO.setStartWorkAt(expertUserFullInfo.getStartWorkAt()); - expertUserFullInfoDTO.setAddress(expertUserFullInfo.getAddress()); - expertUserFullInfoDTO.setExperience(expertUserFullInfo.getExperience()); - - expertUserFullInfoDTO.setTechnicalTitles(expertUserFullInfo.getTechnicalTitles()); - if (StringUtils.isNotBlank(expertUserFullInfo.getTitleCertificateFileIdList())) { - expertUserFullInfoDTO.setTitleCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getTitleCertificateFileIdList(), Long.class)); - } - expertUserFullInfoDTO.setAwards(expertUserFullInfo.getAwards()); - expertUserFullInfoDTO.setRecognitionReward(expertUserFullInfo.getRecognitionReward()); - - expertUserFullInfoDTO.setRegionCode(expertUserFullInfo.getRegionCode()); - expertUserFullInfoDTO.setRegionLevel(expertUserFullInfo.getRegionLevel()); - - if (StringUtils.isNotBlank(expertUserFullInfo.getRecommendationProofFileIdList())) { - expertUserFullInfoDTO.setRecommendationProofFileIdList(JSONObject.parseArray(expertUserFullInfo.getRecommendationProofFileIdList(), Long.class)); - } - expertUserFullInfoDTO.setRemark(expertUserFullInfo.getRemark()); - - return expertUserFullInfoDTO; - } - - public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo, - Map> expertDictMap, - Map> expertTagMap) { - Long userId = expertUserFullInfo.getUserId(); - ExpertAdminExpertManageListDTO adminManageExpertListItem = new ExpertAdminExpertManageListDTO(); - adminManageExpertListItem.setUserId(expertUserFullInfo.getUserId()); - adminManageExpertListItem.setExpertName(expertUserFullInfo.getExpertName()); - adminManageExpertListItem.setPhoneNo(expertUserFullInfo.getPhoneNo()); - adminManageExpertListItem.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); - adminManageExpertListItem.setCompany(expertUserFullInfo.getCompany()); - adminManageExpertListItem.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); - adminManageExpertListItem.setExpertAccountStatus(expertUserFullInfo.getExpertAccountStatus()); - - // 装配字典数据 - List userExpertDictList = expertDictMap.getOrDefault(userId, Collections.emptyList()); - Map> fieldExpertDictMap = userExpertDictList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField)); - adminManageExpertListItem.setExpertType( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()))); - adminManageExpertListItem.setCompanyAttribute( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()))); - adminManageExpertListItem.setTitleLevel( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()))); - // 装配标签数据 - List expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); - Map> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField)); - adminManageExpertListItem.setExpertSource(TagAssembler.toTagFieldInfoList(fieldExpertTagMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey()))); - - if (StrUtil.isNotBlank(expertUserFullInfo.getRegionCode()) && Objects.nonNull(expertUserFullInfo.getRegionLevel())) { - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); - expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); - adminManageExpertListItem.setExpertRegionInfo(expertRegionInfo); - } - - // 以下数据为专家excel导出使用 - adminManageExpertListItem.setGender(expertUserFullInfo.getGender()); - adminManageExpertListItem.setBirth(expertUserFullInfo.getBirth()); - adminManageExpertListItem.setHometown(expertUserFullInfo.getHometown()); - adminManageExpertListItem.setNationality(expertUserFullInfo.getNationality()); - adminManageExpertListItem.setPolitical( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()))); - adminManageExpertListItem.setIdCard(expertUserFullInfo.getIdCard()); - adminManageExpertListItem.setBankNo(expertUserFullInfo.getBankNo()); - adminManageExpertListItem.setEdu( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EDU.getKey()))); - adminManageExpertListItem.setRecommendedWay( - DictionaryAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()))); - - adminManageExpertListItem.setCreateTime(expertUserFullInfo.getCreateOn()); - return adminManageExpertListItem; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java deleted file mode 100644 index e7f67ce..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/10 下午5:36 - */ - -public class RegionWrapperAssembler { - - public static void expertUserFullInfoRegionContainsWrapperAssembler(LambdaQueryWrapper wrapperQuery, List containsRegionList) { - for (RegionContainsBO regionContainsBO : containsRegionList) { - List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); - Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); - if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { - wrapperQuery.and(wrapper -> wrapper.in(ExpertUserFullInfo::getRegionCode, containsRegionCodeList) - .ge(ExpertUserFullInfo::getRegionLevel, parentRegionTreeLevel)); - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java deleted file mode 100644 index 4a4c029..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.expert.assembler; - -import cn.hutool.core.collection.CollectionUtil; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/25 下午4:30 - */ - -public class TagAssembler { - - public static List toTagFieldInfoList(List expertTagList) { - if (CollectionUtil.isEmpty(expertTagList)) { - return new ArrayList<>(); - } - return expertTagList.stream().map(r -> { - TagFieldInfo dictionaryFieldInfo = new TagFieldInfo(); - dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField()); - dictionaryFieldInfo.setTagCode(r.getTagCode()); - return dictionaryFieldInfo; - }).collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java deleted file mode 100644 index b0fccbb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/7/22 下午4:21 - */ -@AllArgsConstructor -@Getter -public enum ExpertAccountStatusEnum { - - /** - * 可用 - */ - AVAILABLE("available"), - - /** - * 冻结中 - */ - FREEZE("freeze"), - - /** - * 已出库 - */ - DELIVERY("delivery"), - - /** - * 申请中 - */ - APPLYING("applying"); - - private final String key; - - public static ExpertAccountStatusEnum of(String key) { - for (ExpertAccountStatusEnum statusEnum : ExpertAccountStatusEnum.values()) { - if (statusEnum.key.equals(key)) { - return statusEnum; - } - } - throw new IllegalArgumentException(String.format("Illegal ExpertAccountStatusEnum = %s", key)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyStatusEnum.java deleted file mode 100644 index f56b30a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyStatusEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -/** - * @author liuxinxin - * @date 2022/7/26 下午1:38 - */ -@AllArgsConstructor -@Getter -public enum ExpertApplyStatusEnum { - - // 待审核 - PENDING_REVIEW("pending_review"), - // 审核通过 - PASSED("passed"), - // 审核不通过 - REFUSED("refused"), - // 已撤销 - REVOKED("revoked"); - private final String key; - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) { - if (statusEnum.key.equals(key)) { - return true; - } - } - return false; - } - - public static ExpertApplyStatusEnum of(String key) { - for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) { - if (statusEnum.key.equals(key)) { - return statusEnum; - } - } - throw new IllegalArgumentException(String.format("Illegal ExpertApplyStatusEnum = %s", key)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeEnum.java deleted file mode 100644 index 19b173a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeEnum.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -/** - * @author liuxinxin - * @date 2022/7/26 下午1:40 - * 专家审核申请类型 - */ -@AllArgsConstructor -@Getter -public enum ExpertApplyTypeEnum { - - // 专家入库 - EXPERT_STORAGE("expert_storage"), - // 专家出库 - EXPERT_DELIVERY("expert_delivery"), - // 专家履职意向加入 - EXPERT_INTENTION_JOIN("expert_intention_join"), - // 专家履职意向退出 - EXPERT_INTENTION_LEAVE("expert_intention_leave"), - // 长期请假申请 - LONG_TERM_LEAVE("long_term_leave"), - // 专家信息修改申请 - EXPERT_INFO_MODIFY("expert_info_modify"); - - private final String key; - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) { - if (typeEnum.key.equals(key)) { - return true; - } - } - return false; - } - - public static ExpertApplyTypeEnum of(String key) { - for (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) { - if (typeEnum.key.equals(key)) { - return typeEnum; - } - } - throw new IllegalArgumentException(String.format("IllegalExpertApplyTypeEnum = %s", key)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java deleted file mode 100644 index 11701dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -/** - * @author liuxinxin - * @date 2022/7/26 下午1:40 - * 专家 申请类型用于前端筛选时入参展示 - */ -@AllArgsConstructor -@Getter -public enum ExpertApplyTypeQueryEnum { - - // 专家入库 - EXPERT_STORAGE("expert_storage"), - // 专家出库 - EXPERT_DELIVERY("expert_delivery"), - // 专家履职意变更 - EXPERT_INTENTION_CHANGE("expert_intention_change"), - // 长期请假申请 - LONG_TERM_LEAVE("long_term_leave"), - // 专家信息修改申请 - EXPERT_INFO_MODIFY("expert_info_modify"); - - private final String key; - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { - if (typeEnum.key.equals(key)) { - return true; - } - } - return false; - } - - public static ExpertApplyTypeQueryEnum of(String key) { - for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { - if (typeEnum.key.equals(key)) { - return typeEnum; - } - } - throw new IllegalArgumentException(String.format("ExpertApplyTypeQueryEnum = %s", key)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertSensitiveFieldTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertSensitiveFieldTypeEnum.java deleted file mode 100644 index 5a3880d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertSensitiveFieldTypeEnum.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/7/28 上午11:19 - */ -@AllArgsConstructor -@Getter -public enum ExpertSensitiveFieldTypeEnum { - - /** - * 专家敏感信息修改 - */ - expert_sensitive_info_field, - - /** - * 专家层级修改 - */ - expert_region_field, - - /** - * 专家履职意向修改 - */ - expert_intention_field; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java deleted file mode 100644 index 588b311..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - - -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/27 下午3:34 - * 专家修改信息需要审核的字段 - */ -@AllArgsConstructor -@Getter -public enum ExpertUserInfoSensitiveFieldEnum { - - // 手机号码 - phone_no("phone_no", "手机号码", String.class, UnitType.single), - // 电子邮箱 - email("email", "电子邮箱", String.class, UnitType.single), - // 专家层级 - expert_region("expert_region", "专家层级", ExpertRegionInfo.class, UnitType.single), - // 履职意向 - expert_intention_work_region("expert_intention_work_region", "履职意向", ExpertRegionInfo.class, UnitType.list), - // 工作单位(单位code和单位法人编号是关联的) - company("company", "工作单位", String.class, UnitType.single), - company_uniq_code("company_uniq_code", "工作单位编码", String.class, UnitType.single), - legal_entity_code("legal_entity_code", "单位法人编号", String.class, UnitType.single), - // 行政职级 - administrative_rank("administrative_rank", "行政职级", DictionaryFieldInfo.class, UnitType.list), - // 职称级别 - title_level("title_level", "职称级别", DictionaryFieldInfo.class, UnitType.list), - // 擅长方向 - good_at("good_at", "擅长方向", TagFieldInfo.class, UnitType.list), - // 技术专长 - technical_expertise("technical_expertise", "技术专长", TagFieldInfo.class, UnitType.list), - // 行业领域 - industry_sector("industry_sector", "行业领域", TagFieldInfo.class, UnitType.list), - // 其他标签 - other("other", "其他标签", TagFieldInfo.class, UnitType.list); - - private final String key; - private final String value; - private final Class aClass; - private final UnitType type; - - public static List getSensitiveDictionaryList() { - return Arrays.asList(administrative_rank.name(), title_level.name()); - } - - @AllArgsConstructor - public enum UnitType { - /** - * 单个 - */ - single, - - /** - * list - */ - list; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java deleted file mode 100644 index 0d176b8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/7/26 上午9:26 - */ -@AllArgsConstructor -@Getter -public enum ExpertUserInfoStepEnum { - - /** - * 待提交信息 - */ - INFORMATION_TO_BE_SUBMITTED("information_to_be_submitted"), - - /** - * 已提交基本信息 - */ - BASIC_INFORMATION_SUBMITTED("basic_information_submitted"), - - /** - * 已提交证明材料 - */ - EVIDENCE_HAS_BEEN_SUBMITTED("evidence_has_been_submitted"); - - private final String key; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java deleted file mode 100644 index 63f6111..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:14 - */ -@AllArgsConstructor -@Getter -public enum QueryExpertAccountStatusEnum { - - - /** - * 冻结中 - */ - FREEZING("freezing"), - - /** - * 正常 - */ - NORMAL("normal"); - - private final String key; - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { - if (statusEnum.key.equals(key)) { - return true; - } - } - return false; - } - - - public static QueryExpertAccountStatusEnum of(String key) { - for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { - if (statusEnum.key.equals(key)) { - return statusEnum; - } - } - throw new IllegalArgumentException(String.format("Illegal QueryExpertAccountStatusEnum = %s", key)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java deleted file mode 100644 index b62f072..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.expert.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * ReviewResultEnum - *

- * - * @author WendyYang - * @since 14:17 2023/3/20 - */ -@Getter -@AllArgsConstructor -public enum ReviewResultEnum { - - PASSED(1, "通过"), - TO_BE_REVIEWED(2, "需复核"), - REFUSED(3, "不通过"); - - private final int code; - private final String value; - - public static ReviewResultEnum getByCode(int code) { - return Arrays.stream(values()) - .filter(w -> w.getCode() == code) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的审核结果编码")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java deleted file mode 100644 index 0c43225..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.expert.manage.ExpertAdminManage; -import com.ningdatech.pmapi.expert.manage.ExpertManage; -import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; -import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; -import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest; -import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; -import com.ningdatech.pmapi.expert.model.req.GetZzdInfoRequest; -import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; -import com.ningdatech.pmapi.expert.model.vo.ExpertBasicInfoModifyResultVO; -import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; -import com.ningdatech.pmapi.expert.model.vo.ZzdInfoByMobileVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.io.IOException; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@RestController -@Api(tags = "专家管理相关接口") -@RequestMapping(value = {"/api/v1/expert", "/expert"}) -@RequiredArgsConstructor -public class ExpertController { - - private final ExpertManage expertManage; - private final ExpertAdminManage expertAdminManage; - - /** - * 生成专家报名临时地址 - * - * @return 生成专家报名临时地址 - */ - @GetMapping("/getRegistrationUrl") - public String getRegistrationUrl() { - return expertManage.getRegistrationUrl(); - } - - @ApiIgnore - @GetMapping("/ephemeral/{uniqueId}/registration") - public void getRegistrationUrl(@PathVariable String uniqueId, HttpServletResponse response) throws IOException { - expertManage.redirectToRegistrationUrl(uniqueId, response); - } - - - @PostMapping("/registration") - @ApiOperation("社会专家报名") - @WebLog("社会专家报名") - public void expertRegistration(@Valid @RequestBody ExpertRegistrationRequest request) { - expertManage.expertRegistration(request); - } - - @PostMapping("/basic-info-submit") - @ApiOperation("专家管理员新增专家)") - @WebLog("专家管理员新增专家") - public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) { - expertManage.expertBasicInfoSubmit(request); - } - - @PostMapping("/basic-info-submit-notvalid") - @ApiOperation("专家管理员新增专家 参数不校检") - @WebLog("专家管理员新增专家 参数不校检") - public void expertBasicInfoSubmitNotValid(@RequestBody ExpertUserBasicInfoSubmitRequest request) { - expertManage.expertBasicInfoSubmit(request); - } - - @GetMapping("/detail") - @ApiOperation("专家获取专家详细信息") - public ExpertFullInfoVO getExpertFullInfoDetail() { - return expertManage.getExpertFullInfoDetail(null); - } - - - @GetMapping("/admin/detail") - @ApiOperation("专家管理员获取专家详细信息") - public ExpertFullInfoVO getExpertFullInfoDetail(@RequestParam(value = "expertUserId") @NotNull Long expertUserId) { - return expertManage.getExpertFullInfoDetail(expertUserId); - } - - @PostMapping("/expert-library/list") - @ApiOperation("专家库列表查询接口") - public PageVo getExpertLibraryList(@RequestBody @Valid ExpertAdminExpertManageQuery query) { - return expertAdminManage.getExpertLibraryList(query); - } - - @PostMapping("/basic-info-modify") - @ApiOperation("专家信息编辑") - @WebLog("专家信息编辑") - public ExpertBasicInfoModifyResultVO expertBasicInfoModify(@Valid @RequestBody AdminExpertBasicInfoModifyRequest request) { - return expertAdminManage.adminModifyExpertBasicInfo(request); - } - - @PostMapping("/get-zzd-info") - @ApiOperation("获取浙政钉用户信息") - @WebLog("获取浙政钉用户信息") - public ZzdInfoByMobileVO getZzdInfo(@Valid @RequestBody GetZzdInfoRequest request) { - return expertAdminManage.getZzdInfo(request); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java deleted file mode 100644 index d25807d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.expert.manage.ExpertMetaApplyManage; -import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery; -import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; -import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; -import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; -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.*; - -import javax.validation.Valid; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-01 - */ -@RestController -@RequestMapping("/api/v1/apply/meta/") -@Validated -@RequiredArgsConstructor -@Api(value = "ExpertMetaApplyController", tags = "专家申请管理相关接口") -public class ExpertMetaApplyController { - - private final ExpertMetaApplyManage expertMetaApplyManage; - - @PostMapping("/list") - @ApiOperation(value = "审核列表筛选") - public PageVo metaApplyListQuery(@RequestBody @Valid MetaApplyListQuery metaApplyListQuery) { - return expertMetaApplyManage.metaApplyListQuery(metaApplyListQuery); - } - - @PostMapping("/result") - @ApiOperation(value = "审核结果处理") - public void metaApplyResult(@RequestBody @Valid MetaApplyResultRequest applyResultRequest) { - expertMetaApplyManage.metaApplyResult(applyResultRequest); - } - - @PostMapping("/revoke/{applyId}") - @ApiOperation(value = "申请撤销") - @WebLog("申请撤销") - public void metaApplyRevoke(@PathVariable Long applyId) { - expertMetaApplyManage.metaApplyRevoke(applyId); - } - - @ApiOperation("申请审核详情") - @GetMapping("/detail/{applyId}") - public MetaApplyResultVo applyAuditDetail(@PathVariable Long applyId) { - return expertMetaApplyManage.metaApplyResult(applyId); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertReviewController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertReviewController.java deleted file mode 100644 index a841a8a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertReviewController.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.expert.manage.ExpertReviewManage; -import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; -import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; -import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@RestController -@AllArgsConstructor -@Api(tags = "专家评审") -@RequestMapping("/api/v1/expertReview") -public class ExpertReviewController { - - private final ExpertReviewManage expertReviewManage; - - @PostMapping("/save") - @ApiOperation("填写评审意见") - @WebLog("填写评审意见") - public void expertReview(@RequestBody @Valid ExpertReviewDetailReq req) { - expertReviewManage.expertReview(req); - } - - @GetMapping("/detail/{meetingId}/{projectId}/{userId}") - @ApiOperation("获取专家评审详情") - @WebLog("获取专家评审详情") - @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "专家ID"), - @ApiImplicitParam(name = "projectId", value = "项目ID") - }) - public ExpertReviewDetailVO getExpertReviewDetail(@PathVariable Long userId, - @PathVariable Long projectId, - @PathVariable Long meetingId) { - return expertReviewManage.getExpertReviewDetail(userId, projectId, meetingId); - } - - @GetMapping("/listForGroupLeader/{projectId}/{meetingId}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectId", value = "项目ID"), - @ApiImplicitParam(name = "meetingId", value = "会议ID") - }) - @ApiOperation("查看组员评审意见") - @WebLog("查看组员评审意见") - public List listForGroupLeader(@PathVariable Long meetingId, - @PathVariable Long projectId) { - return expertReviewManage.listReviews(projectId, meetingId, true); - } - - @GetMapping("/list/{projectId}/{meetingId}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectId", value = "项目ID"), - @ApiImplicitParam(name = "meetingId", value = "会议ID") - }) - @ApiOperation("查看项目某次会议的所有评审意见") - @WebLog("查看项目某次会议的所有评审意见") - public List list(@PathVariable Long meetingId, - @PathVariable Long projectId) { - return expertReviewManage.listReviews(projectId, meetingId, false); - } - - @GetMapping("/detail/{projectCode}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectCode", value = "项目编号"), - }) - @ApiOperation("查看项目的所有评审意见") - @WebLog("查看项目的所有评审意见") - public ProjectReviewDetailVO projectExpertReviewDetail(@PathVariable String projectCode) { - return expertReviewManage.projectExpertReviewDetail(projectCode); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java deleted file mode 100644 index 8df2d60..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertSensitiveInfoModifyDetailRecordController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@Controller -@RequestMapping("/pmapi.expert/expert-sensitive-info-modify-detail-record") -public class ExpertSensitiveInfoModifyDetailRecordController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java deleted file mode 100644 index 244ea81..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.expert.manage.ReviewTemplateSettingsManage; -import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; -import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 评审模版配置表 前端控制器 - *

- * - * @author WendyYang - * @since 2023-02-14 - */ -@RestController -@AllArgsConstructor -@Api(tags = "评审模版配置") -@RequestMapping("/api/v1/reviewTemplateSettings") -public class ReviewTemplateSettingsController { - - private final ReviewTemplateSettingsManage reviewTemplateSettingsManage; - - @GetMapping("/template/{templateType}/{regionCode}") - @ApiOperation("根据模版类型获取模版") - public ReviewTemplateVO getReviewTemplateByType(@PathVariable Integer templateType, @PathVariable String regionCode) { - return reviewTemplateSettingsManage.getReviewTemplateSettings(templateType, regionCode); - } - - @PostMapping("/modify") - @ApiOperation("修改或保存模版配置") - @WebLog("修改或保存模版配置") - public void modifyReviewTemplateSettings(@RequestBody @Valid ReviewTemplateReq req) { - reviewTemplateSettingsManage.saveOrUpdate(req); - } - - @GetMapping("/template") - @ApiOperation("根据模版ID获取评审模版") - @ApiImplicitParam(name = "templateId", defaultValue = "模版ID") - public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) { - return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); - } - - @GetMapping("/templates") - @ApiOperation("(批量)根据模版ID获取评审模版") - @ApiImplicitParam(name = "templateIds", defaultValue = "模版ID集合") - public List getTemplateById(@RequestParam List templateIds) { - return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java deleted file mode 100644 index 1e29c60..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.expert.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-23 - */ -@TableName("expert_avoid_company") -@ApiModel(value = "ExpertAvoidCompany对象", description = "") -@Data -public class ExpertAvoidCompany implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String companyName; - - private String companyUniqCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java deleted file mode 100644 index ff5d292..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-04-17 - */ -@Data -@TableName("expert_gov_business_strip") -@ApiModel(value = "ExpertGovBusinessStrip对象") -public class ExpertGovBusinessStrip implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private String businessStripCode; - - private String businessStripName; - - private Long expertUserId; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java deleted file mode 100644 index a001dca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.expert.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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@TableName("expert_intention_work_region") -@Data -@ApiModel(value = "ExpertIntentionWorkRegion对象", description = "") -public class ExpertIntentionWorkRegion implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String regionCode; - - private Integer regionLevel; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java deleted file mode 100644 index 9e83a57..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.expert.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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-03-01 - */ -@Data -@TableName("expert_meta_apply") -@ApiModel(value = "ExpertMetaApply对象") -public class ExpertMetaApply implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long createBy; - - private Long updateBy; - - private String applyType; - - private Long userId; - - private Long approverUserId; - - private String applyStatus; - - private LocalDateTime reviewTime; - - private String auditOpinion; - - private String regionCode; - - private String approver; - - private Integer regionLevel; - - private Long applicantId; - - private String extraMaterial; - - private String displayEnable; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java deleted file mode 100644 index f76b499..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertSensitiveInfoModifyDetailRecord.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@Data -@TableName("expert_sensitive_info_modify_detail_record") -@ApiModel(value = "ExpertSensitiveInfoModifyDetailRecord对象", description = "") -public class ExpertSensitiveInfoModifyDetailRecord implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String originalJson; - - private String modifyJson; - - private Long metaApplyId; - - private String extraMaterial; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java deleted file mode 100644 index e69361e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.ningdatech.pmapi.expert.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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("nd_expert_user_full_info") -@ApiModel(value = "NdExpertUserFullInfo对象", description = "") -public class ExpertUserFullInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String expertAccountStatus; - - private String isDingUser; - - private String userInfoStep; - - private String phoneNo; - - private String gender; - - private String expertName; - - private Long avatarFileId; - - private String idCard; - - private String officePhone; - - private String bankNo; - - private String bank; - - private String email; - - private String school; - - private LocalDateTime graduatedAt; - - private String academicTitle; - - private String graduationCertificateFileIdList; - - private String degreeCertificateFileIdList; - - private LocalDateTime retiredAt; - - private String company; - - private String companyUniqCode; - - private String legalEntityCode; - - private String administrativeDuties; - - private LocalDateTime startWorkAt; - - private String address; - - private String experience; - - private String technicalTitles; - - private String titleCertificateFileIdList; - - private String awards; - - private String recognitionReward; - - private String recommendationProofFileIdList; - - private String regionCode; - - private Integer regionLevel; - - private String recommendedWay; - - private String remark; - - private String hometown; - - private String nationality; - - private LocalDateTime birth; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java deleted file mode 100644 index fe63c30..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.expert.helper; - -import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertUserFullInfoDTO; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/7/28 上午10:18 - */ -@Component -public class ExpertInfoCommonHelper { - - /** - * 获取专家的所有文件id - * 头像,学位证书,毕业证书,推荐证明材料,职称证明 - * - * @param expertUserFullInfoAll - * @return - */ - public List getExpertFileIdList(ExpertFullInfoAllDTO expertUserFullInfoAll) { - ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); - List fileIdList = new ArrayList<>(); - if (Objects.nonNull(expertUserInfoDTO.getAvatarFileId())) { - fileIdList.add(expertUserInfoDTO.getAvatarFileId()); - } - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { - fileIdList.addAll(expertUserInfoDTO.getDegreeCertificateFileIdList()); - } - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { - fileIdList.addAll(expertUserInfoDTO.getGraduationCertificateFileIdList()); - } - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { - fileIdList.addAll(expertUserInfoDTO.getRecommendationProofFileIdList()); - } - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { - fileIdList.addAll(expertUserInfoDTO.getTitleCertificateFileIdList()); - } - return fileIdList; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java deleted file mode 100644 index 0acba3d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.ningdatech.pmapi.expert.helper; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; -import com.ningdatech.pmapi.expert.constant.ExpertSensitiveFieldTypeEnum; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum; -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; -import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertUserFullInfoDTO; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/7/28 上午10:09 - */ -@Component -@RequiredArgsConstructor -public class ExpertInfoSensitiveFieldModifyCheckHelper { - - private final ExpertInfoService expertInfoService; - private final ExpertInfoCommonHelper expertInfoCommonHelper; - private final FileService fileService; - private final ExpertUserInfoAssembler expertUserInfoAssembler; - private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService; - - - public ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldModifyCheck(ExpertBasicInfo applyBasicInfo - , ExpertEduInfo applyEduInfo, ExpertJobInfo applyJobInfo, ExpertProfessionalInfo applyProfessionalInfo, Long expertUserId) { - - ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); - if (Objects.isNull(expertUserFullInfoAll)) { - throw new BizException("当前账号尚未有专家相关信息,无法更新"); - } - List attachFiles = fileService.getByIds(expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll)); - - ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); - // 字典字典段map - Map> dictionaryFieldInfoMap = - expertUserInfoAssembler.buildDictInfoMap(expertUserFullInfoAll.getExpertDictionaryList()); - // 专家文件资料map - Map fileBasicInfoMap = ExpertUserInfoAssembler.buildFileBasicInfoMap(attachFiles); - // 专家标签字段map - Map> tagFieldInfoMap = expertUserInfoAssembler.buildTagFieldInfoMap(expertUserFullInfoAll.getExpertTagList()); - ExpertBasicInfo originalBasicInfo = expertUserInfoAssembler - .buildExpertBasicInfo(expertUserInfoDTO, dictionaryFieldInfoMap - , tagFieldInfoMap, expertUserFullInfoAll.getExpertIntentionWorkRegionInfo(), fileBasicInfoMap); - - ExpertJobInfo originalJobInfo = ExpertUserInfoAssembler.buildExpertJobInfo(expertUserInfoDTO, dictionaryFieldInfoMap); - ExpertProfessionalInfo originalProfessionalInfo = ExpertUserInfoAssembler.buildExpertProfessionalInfo(expertUserInfoDTO - , dictionaryFieldInfoMap, tagFieldInfoMap, fileBasicInfoMap, expertUserFullInfoAll.getExpertAvoidCompanyList()); - - - // 敏感字段 手机号/电子邮箱/专家层级/履职意向/工作单位/单位法人编号/行政职级/职称级别/擅长方向/技术专长/行业领域/其他标签 - // 敏感信息字段修改 - List sensitiveModifySegmentList = new ArrayList<>(); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.phone_no - , originalBasicInfo.getPhoneNo(), applyBasicInfo.getPhoneNo())); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.email - , originalBasicInfo.getEmail(), applyBasicInfo.getEmail())); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company - , originalJobInfo.getCompany(), applyJobInfo.getCompany())); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company_uniq_code - , originalJobInfo.getCompanyUniqCode(), applyJobInfo.getCompanyUniqCode())); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.legal_entity_code - , originalJobInfo.getLegalEntityCode(), applyJobInfo.getLegalEntityCode())); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.administrative_rank - , originalJobInfo.getAdministrativeRank() - , assemblerDictionaryFieldInfoList(applyJobInfo.getAdministrativeRank(), ExpertUserInfoSensitiveFieldEnum.administrative_rank.getKey()))); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.title_level - , originalProfessionalInfo.getTitleLevel() - , assemblerDictionaryFieldInfoList(applyProfessionalInfo.getTitleLevel(), ExpertUserInfoSensitiveFieldEnum.title_level.getKey()))); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.good_at - , originalProfessionalInfo.getGoodAt() - , assemblerTagFieldInfoList(applyProfessionalInfo.getGoodAt(), ExpertUserInfoSensitiveFieldEnum.good_at.getKey()))); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.technical_expertise - , originalProfessionalInfo.getTechnicalExpertise() - , assemblerTagFieldInfoList(applyProfessionalInfo.getTechnicalExpertise(), ExpertUserInfoSensitiveFieldEnum.technical_expertise.getKey()))); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.industry_sector - , originalProfessionalInfo.getIndustrySector() - , assemblerTagFieldInfoList(applyProfessionalInfo.getIndustrySector(), ExpertUserInfoSensitiveFieldEnum.industry_sector.getKey()))); - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.other - , originalProfessionalInfo.getOther() - , assemblerTagFieldInfoList(applyProfessionalInfo.getOther(), ExpertUserInfoSensitiveFieldEnum.other.getKey()))); - // 专家层级修改 - sensitiveModifySegmentList - .add(new SensitiveModifySegment(ExpertSensitiveFieldTypeEnum.expert_region_field, ExpertUserInfoSensitiveFieldEnum.expert_region - , originalBasicInfo.getExpertRegionInfo(), applyBasicInfo.getExpertRegionInfo())); - // 履职意向修改 - sensitiveModifySegmentList - .add(new SensitiveModifySegment( - ExpertSensitiveFieldTypeEnum.expert_intention_field, ExpertUserInfoSensitiveFieldEnum.expert_intention_work_region - , originalBasicInfo.getExpertIntentionWorkRegions(), applyBasicInfo.getExpertIntentionWorkRegions())); - - return new ExpertInfoSensitiveFieldCheckBO(sensitiveModifySegmentList); - } - - public ExpertInfoSensitiveFieldCheckBO intentionWorkRegionsModifyCheck(Long expertUserId, List applyExpertIntentionWorkRegions) { - List sensitiveModifySegmentList = new ArrayList<>(); - - LambdaQueryWrapper expertIntentionWorkRegionEq = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) - .eq(ExpertIntentionWorkRegion::getUserId, expertUserId); - List expertIntentionWorkRegions = iExpertIntentionWorkRegionService.list(expertIntentionWorkRegionEq); - - List currentExpertIntentionWorkRegions = new ArrayList<>(); - if (CollUtil.isNotEmpty(expertIntentionWorkRegions)) { - expertIntentionWorkRegions.forEach(r -> { - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionLevel(r.getRegionLevel()); - expertRegionInfo.setRegionCode(r.getRegionCode()); - currentExpertIntentionWorkRegions.add(expertRegionInfo); - }); - } - // 履职意向修改 - sensitiveModifySegmentList - .add(new SensitiveModifySegment( - ExpertSensitiveFieldTypeEnum.expert_intention_field, ExpertUserInfoSensitiveFieldEnum.expert_intention_work_region - , currentExpertIntentionWorkRegions, applyExpertIntentionWorkRegions)); - - return new ExpertInfoSensitiveFieldCheckBO(sensitiveModifySegmentList); - } - - - private List assemblerDictionaryFieldInfoList(List dictionaryFieldInfoList, String fieldName) { - if (CollUtil.isNotEmpty(dictionaryFieldInfoList)) { - dictionaryFieldInfoList.forEach(r -> r.setDictionaryFieldName(fieldName)); - } - return dictionaryFieldInfoList; - } - - private List assemblerTagFieldInfoList(List tagFieldInfoList, String fieldName) { - if (CollUtil.isNotEmpty(tagFieldInfoList)) { - tagFieldInfoList.forEach(r -> r.setTagFieldName(fieldName)); - } - return tagFieldInfoList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java deleted file mode 100644 index 160dcd6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.ningdatech.pmapi.expert.helper; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/2/23 上午9:18 - */ - -@Component -public class ExpertManageHelper { - -// @Autowired -// private RegionCache regionCache; - - @Autowired - private TagCache tagCache; - - @Autowired - private DictionaryCache dictionaryCache; - - - /** - * 校验区域code - * - * @param expertRegionInfo - */ - public void expertRegionInfoCheck(ExpertRegionInfo expertRegionInfo) { -// // todo 必须为叶子节点编码 -// String regionCode = expertRegionInfo.getRegionCode(); -// Integer regionLevel = expertRegionInfo.getRegionLevel(); -// RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); -// if (Objects.isNull(regionDTO)) { -// throw new BadRequestException("illegal regionInfo"); -// } - } - - - /** - * 校验标签code是否合法 - * - * @param expertProfessionalInfo - * @param expertBasicInfo - */ - public void tagFieldCheck(ExpertProfessionalInfo expertProfessionalInfo, ExpertBasicInfo expertBasicInfo) { - List goodAt = expertProfessionalInfo.getGoodAt(); - List technicalExpertise = expertProfessionalInfo.getTechnicalExpertise(); - List industrySector = expertProfessionalInfo.getIndustrySector(); - List expertSource = expertBasicInfo.getExpertSource(); - - List tagFieldInfoList = new ArrayList<>(); - tagFieldInfoList.addAll(goodAt); - tagFieldInfoList.addAll(technicalExpertise); - tagFieldInfoList.addAll(industrySector); - if (CollUtil.isNotEmpty(expertSource)) { - tagFieldInfoList.addAll(expertSource); - } - for (TagFieldInfo tagFieldInfo : tagFieldInfoList) { - String tagCode = tagFieldInfo.getTagCode(); - TagDTO tagCodeDTO = tagCache.getByTagCode(tagCode); - if (Objects.isNull(tagCodeDTO)) { - throw new BizException("illegal tagCode: tagField=" + tagFieldInfo.getTagFieldName() + ",tagCode=" + tagCode); - } - } - } - - - /** - * 校验字典code是否合法 - * - * @param expertBasicInfo - * @param expertEduInfo - * @param expertJobInfo - */ - public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo - , ExpertJobInfo expertJobInfo) { - List political = expertBasicInfo.getPolitical(); - List edu = expertEduInfo.getEdu(); - List degree = expertEduInfo.getDegree(); - List jobStatus = expertJobInfo.getJobStatus(); - List companyAttribute = expertJobInfo.getCompanyAttribute(); - List administrativeRank = expertJobInfo.getAdministrativeRank(); - - List dictionaryFieldInfoList = new ArrayList<>(); - dictionaryFieldInfoList.addAll(political); - dictionaryFieldInfoList.addAll(edu); - dictionaryFieldInfoList.addAll(degree); - dictionaryFieldInfoList.addAll(jobStatus); - dictionaryFieldInfoList.addAll(companyAttribute); - dictionaryFieldInfoList.addAll(administrativeRank); - - for (DictionaryFieldInfo dictionaryFieldInfo : dictionaryFieldInfoList) { - String dictionaryFieldName = dictionaryFieldInfo.getDictionaryFieldName(); - String dictionaryCode = dictionaryFieldInfo.getDictionaryCode(); - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(dictionaryCode); - if (Objects.isNull(dictionaryDTO)) { - throw new BizException("illegal dictionaryCode: dictionaryFieldName=" + dictionaryFieldName + ",dictionaryCode=" + dictionaryCode); - } - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/PermissionCheckHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/PermissionCheckHelper.java deleted file mode 100644 index 41c0642..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/PermissionCheckHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.expert.helper; - -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.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - * @author liuxinxin - * @date 2022/8/18 上午10:02 - * 校验是否一个账号对一个专家有操作的权限 - */ -@Component -@RequiredArgsConstructor -public class PermissionCheckHelper { - - public boolean isSuperAdmin() { - UserInfoDetails details = LoginUserUtil.loginUserDetail(); - return details.getUserRoleList().stream().anyMatch(w -> w.getCode().equals(RoleEnum.SUPER_ADMIN.name())); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java deleted file mode 100644 index cc9c078..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.ningdatech.pmapi.expert.manage; - -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; -import com.ningdatech.pmapi.common.helper.RegionLimitHelper; -import com.ningdatech.pmapi.common.model.CommonPage; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.expert.assembler.ExpertAdminExpertManageAssembler; -import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import com.ningdatech.pmapi.expert.constant.QueryExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.helper.ExpertInfoSensitiveFieldModifyCheckHelper; -import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; -import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; -import com.ningdatech.pmapi.expert.model.cmd.ExpertInfoModifyCmd; -import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; -import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; -import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; -import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; -import com.ningdatech.pmapi.expert.model.req.GetZzdInfoRequest; -import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; -import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; -import com.ningdatech.pmapi.expert.model.vo.ExpertBasicInfoModifyResultVO; -import com.ningdatech.pmapi.expert.model.vo.ZzdInfoByMobileVO; -import com.ningdatech.pmapi.expert.service.ExpertAdminManageService; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; -import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; -import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; -import com.ningdatech.zwdd.model.dto.EmployeePositionsDTO; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.*; - -/** - * @author liuxinxin - * @date 2023/3/1 下午2:12 - */ - -@Component -@RequiredArgsConstructor -public class ExpertAdminManage { - - private final PermissionCheckHelper permissionCheckHelper; - private final RegionLimitHelper regionLimitHelper; - private final IExpertMetaApplyService iExpertMetaApplyService; - private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; - private final ExpertInfoService expertInfoService; - private final ExpertMetaApplyManage expertMetaApplyManage; - private final ExpertAdminManageService expertAdminManageService; - private final ExpertAdminExpertManageAssembler expertAdminExpertManageAssembler; - private final ZwddClient zwddClient; - - /** - * 专家管理员使用 专家库列表查询 - * - * @param query - * @return - */ - public PageVo getExpertLibraryList(ExpertAdminExpertManageQuery query) { - Long userId = LoginUserUtil.getUserId(); - ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); - if (queryCmd.isHasNonData()) { - return PageVo.empty(); - } - CommonPage pageResult = expertAdminManageService.getExpertLibraryList(queryCmd); - - PageVo pageVo = new PageVo<>(); - pageVo.setTotal(pageResult.getItemsTotal()); - pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); - return pageVo; - } - - - private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(ExpertAdminExpertManageQuery query, Long userId) { - ExpertAdminExpertManageQueryCmd queryCmd = new ExpertAdminExpertManageQueryCmd(); - queryCmd.setPageNumber(query.getPageNumber()); - queryCmd.setPageSize(query.getPageSize()); - if (StrUtils.isNotBlank(query.getExpertName())) { - queryCmd.setExpertName(query.getExpertName()); - } - if (StrUtils.isNotBlank(query.getCompany())) { - queryCmd.setCompany(query.getCompany()); - } - List expertDictQueryList = new ArrayList<>(); - if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { - ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); - expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); - expertDictQueryList.add(expertDictQuery); - } - if (StringUtils.isNotBlank(query.getCompanyAttributeDictionaryCode())) { - ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()); - expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getCompanyAttributeDictionaryCode())); - expertDictQueryList.add(expertDictQuery); - } - if (StringUtils.isNotBlank(query.getExpertTypeDictionaryCode())) { - ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()); - expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getExpertTypeDictionaryCode())); - expertDictQueryList.add(expertDictQuery); - } - List expertTagQueryList = new ArrayList<>(); - if (StringUtils.isNotBlank(query.getExpertSourceTagCode())) { - ExpertTagQuery expertTagQuery = new ExpertTagQuery(); - expertTagQuery.setExpertInfoField(ExpertTagEnum.EXPERT_SOURCE.getKey()); - expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getExpertSourceTagCode())); - expertTagQueryList.add(expertTagQuery); - } - if (StringUtils.isNotBlank(query.getGoodAtTagCode())) { - ExpertTagQuery expertTagQuery = new ExpertTagQuery(); - expertTagQuery.setExpertInfoField(ExpertTagEnum.GOOD_AT.getKey()); - expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getGoodAtTagCode())); - expertTagQueryList.add(expertTagQuery); - } - if (StringUtils.isNotBlank(query.getExpertAccountStatus())) { - QueryExpertAccountStatusEnum queryExpertAccountStatus = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); - switch (queryExpertAccountStatus) { - case NORMAL: - queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE)); - break; - case FREEZING: - queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.FREEZE)); - break; - default: - break; - } - } else { - queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE, ExpertAccountStatusEnum.FREEZE)); - } - - List expertAdminContainsRegionList; - // 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 - boolean isSuperAdmin; - if (!(isSuperAdmin = permissionCheckHelper.isSuperAdmin())) { - expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); - } else { - expertAdminContainsRegionList = Collections.emptyList(); - } - - List containsRegion = null; - if (Objects.nonNull(query.getExpertRegionInfo())) { - RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() - , query.getExpertRegionInfo().getRegionCode()); - if (isSuperAdmin) { - containsRegion = Collections.singletonList(containsRegionBo); - } else { - containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); - if (containsRegion.isEmpty()) { - queryCmd.setHasNonData(true); - return queryCmd; - } - } - } - - List intentionRegions = null; - if (query.getIntentionRegionInfo() != null) { - ExpertRegionInfo intentionRegionInfo = query.getIntentionRegionInfo(); - RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(intentionRegionInfo.getRegionLevel() - , intentionRegionInfo.getRegionCode()); - if (isSuperAdmin) { - intentionRegions = Collections.singletonList(containsRegionBo); - } else { - intentionRegions = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); - if (intentionRegions.isEmpty()) { - queryCmd.setHasNonData(true); - return queryCmd; - } - } - } - if (containsRegion == null && intentionRegions == null) { - containsRegion = expertAdminContainsRegionList; - } - queryCmd.setExpertDictionaryQueryList(expertDictQueryList); - queryCmd.setExpertTagQueryList(expertTagQueryList); - queryCmd.setIsDingUser(query.getIsDingUser()); - queryCmd.setRegionContainsList(containsRegion); - queryCmd.setIntentionRegionList(intentionRegions); - queryCmd.setPageSize(query.getPageSize()); - queryCmd.setPageNumber(query.getPageNumber()); - return queryCmd; - } - - - /** - * 专家管理员修改专家的个人信息接口(包含专家层级变更) - * - * @param request - * @return - */ - public ExpertBasicInfoModifyResultVO adminModifyExpertBasicInfo(AdminExpertBasicInfoModifyRequest request) { - Long adminUserId = LoginUserUtil.getUserId(); - Long expertUserId = request.getExpertUserId(); - // 手机号不能更改 - request.getBasicInfo().setPhoneNo(null); - - // 校验当前是否有信息变更审核 如有,无法变更信息 - LambdaQueryWrapper infoModifyEq = Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, expertUserId) - .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) - .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()); - ExpertMetaApply infoModifyApply = iExpertMetaApplyService.getOne(infoModifyEq); - if (Objects.nonNull(infoModifyApply)) { - throw new BizException("该账号还有信息修审核审核未审批,请撤销或审批后处理"); - } - // 校验当前是否有层级变更审核,如有需要审核通过或撤销审核后重新提交 - LambdaQueryWrapper expertStorageEq = Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, expertUserId) - .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) - .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()); - ExpertMetaApply expertStorageApply = iExpertMetaApplyService.getOne(expertStorageEq); - if (Objects.nonNull(expertStorageApply)) { - throw new BizException("当前账号还有入库审核未审批,请撤销或审批后处理"); - } - - ExpertBasicInfo basicInfo = request.getBasicInfo(); - ExpertEduInfo eduInfo = request.getEduInfo(); - ExpertJobInfo jobInfo = request.getJobInfo(); - ExpertProfessionalInfo professionalInfo = request.getProfessionalInfo(); - ExpertRecommendInfo recommendInfo = request.getRecommendInfo(); - ExpertOtherInfo otherInfo = request.getExpertOtherInfo(); - - ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = - expertInfoSensitiveFieldModifyCheckHelper.expertInfoSensitiveFieldModifyCheck(basicInfo, eduInfo, jobInfo, professionalInfo, expertUserId); - ExpertInfoModifyCmd expertInfoModifyCmd = ExpertInfoCmdAssembler - .buildExpertInfoModifyCmd(expertUserId, basicInfo, eduInfo, jobInfo, professionalInfo, recommendInfo, otherInfo, expertInfoSensitiveFieldCheckBO, null); - List applyIdList = expertInfoService.adminModifyExpertInfo(expertInfoModifyCmd, adminUserId); - - // 批量通过专家管理员审核 - for (Long applyId : applyIdList) { - MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); - applyResult.setApplyId(applyId); - applyResult.setAuditOpinion("同意"); - applyResult.setApplyResult(true); - expertMetaApplyManage.metaApplyResult(applyResult); - } - return new ExpertBasicInfoModifyResultVO(false); - } - - - public ZzdInfoByMobileVO getZzdInfo(GetZzdInfoRequest request) { - ZzdInfoByMobileVO zzdInfoByMobileVO = new ZzdInfoByMobileVO(); - String phoneNo = request.getPhoneNo(); - zzdInfoByMobileVO.setPhoneNo(phoneNo); - - GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile(phoneNo); - DingInfoByMobileDTO dingInfo = dingInfoByMobile.getData(); - if (Objects.nonNull(dingInfo) && StringUtils.isNotBlank(dingInfo.getEmployeeCode())) { - zzdInfoByMobileVO.setIsDingUser(true); - String employeeCode = dingInfo.getEmployeeCode(); - GenericResult> listGenericResult = zwddClient.listEmployeePositionsByEmployeeCode(employeeCode); - List employeePositionsDTOS = listGenericResult.getData(); - if (CollectionUtils.isNotEmpty(employeePositionsDTOS)) { - EmployeePositionsDTO employeePositionsDTO = employeePositionsDTOS.get(0); - String organizationCode = employeePositionsDTO.getOrganizationCode(); - GenericResult dingOrgInfoDTOGenericResult = zwddClient.getOrganizationByCode(organizationCode); - DingOrgInfoDTO organizationByCode = dingOrgInfoDTOGenericResult.getData(); - String organizationName = organizationByCode.getOrganizationName(); - zzdInfoByMobileVO.setCompanyName(organizationName); - } - GenericResult infoDTOGenericResult = zwddClient.getEmployeeByCode(employeeCode); - EmployeeInfoDTO employeeInfoDTO = infoDTOGenericResult.getData(); - if (Objects.nonNull(employeeInfoDTO)) { - String employeeName = employeeInfoDTO.getEmployeeName(); - zzdInfoByMobileVO.setName(employeeName); - } - } else { - zzdInfoByMobileVO.setIsDingUser(false); - } - return zzdInfoByMobileVO; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java deleted file mode 100644 index 4875a0e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.ningdatech.pmapi.expert.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; -import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.helper.ExpertInfoCommonHelper; -import com.ningdatech.pmapi.expert.helper.ExpertManageHelper; -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; -import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; -import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; -import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest; -import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; -import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meeting.entity.config.WebProperties; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; -import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import com.ningdatech.pmapi.sys.service.IRoleService; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/23 上午8:55 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ExpertManage { - - private final ExpertManageHelper expertManageHelper; - private final IExpertUserFullInfoService expertUserFullInfoService; - private final ExpertInfoService expertInfoService; - private final ExpertInfoCommonHelper expertInfoCommonHelper; - private final FileService fileService; - private final ExpertUserInfoAssembler expertUserInfoAssembler; - private final IUserInfoService userInfoService; - private final ExpertMetaApplyManage expertMetaApplyManage; - private final IUserRoleService userRoleService; - private final IRoleService roleService; - private final VerifyCodeCheckHelper verifyCodeCheckHelper; - private final CachePlusOps cachePlusOps; - private final ZwddClient zwddClient; - - @Value("${expert-registration.verify-code.check:true}") - private Boolean expertRegistrationVerifyCodeCheck; - - private static final Duration REGISTER_EXPIRED_DURATION = Duration.ofDays(3); - private static final Duration REGISTER_GEN_DURATION = Duration.ofMinutes(30); - - private static final String RK_REGISTER_UNIQUE_ID = "expert_registration_id:"; - private static final String RK_REGISTER_UNIQUE_ID_LAST = RK_REGISTER_UNIQUE_ID + "last"; - - public synchronized String getRegistrationUrl() { - CacheKey lastKey = new CacheKey(RK_REGISTER_UNIQUE_ID_LAST, REGISTER_GEN_DURATION); - String lastUniqueId = cachePlusOps.get(lastKey); - if (StrUtil.isBlank(lastUniqueId)) { - lastUniqueId = BizUtils.uuid32(); - CacheKey key = new CacheKey(); - key.setKey(RK_REGISTER_UNIQUE_ID + lastUniqueId); - key.setExpire(REGISTER_EXPIRED_DURATION); - cachePlusOps.set(lastKey, lastUniqueId); - String gmtUserTime = LoginUserUtil.getUserId() + "#" + System.currentTimeMillis(); - cachePlusOps.set(key, gmtUserTime); - } - return WebProperties.webUrl + "/pm/expert/ephemeral/" + lastUniqueId + "/registration"; - } - - public void redirectToRegistrationUrl(String uniqueId, HttpServletResponse response) throws IOException { - CacheKey cacheKey = new CacheKey(RK_REGISTER_UNIQUE_ID + uniqueId); - response.setContentType(MediaType.TEXT_PLAIN_VALUE); - response.setCharacterEncoding(StandardCharsets.UTF_8.name()); - try { - if (cachePlusOps.exists(cacheKey)) { - response.sendRedirect(WebProperties.webUrl + WebProperties.expertRegistrationUrl); - } else { - response.getWriter().write("专家报名链接已失效"); - } - } catch (Exception e) { - log.error("专家报名链接重定向异常:", e); - response.getWriter().write("专家报名链接访问异常"); - } - } - - - /** - * 专家管理员新增专家 - * - * @param req / - */ - @Transactional(rollbackFor = Exception.class) - public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest req) { - Long operatorId = LoginUserUtil.getUserId(); - // 用户id - Long userId = assemblerAndGenerateExpert(req, operatorId); - // 批量通过专家入库审核/专家履职意向审核 - expertMetaApplyManage.autoPassExpertApply(userId); - - // 增加用户专家角色 - Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); - UserRole expertRole = userRoleService.getOne(userId, role.getId()); - if (Objects.isNull(expertRole)) { - expertRole = new UserRole(); - expertRole.setUserId(userId); - expertRole.setRoleId(role.getId()); - userRoleService.save(expertRole); - } - } - - - @Transactional(rollbackFor = Exception.class) - public Long expertRecommendProofSubmit - (List recommendedWay, List recommendProofFile, Long expertUserId) { - // 用户id - ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(expertUserId); - // 判断专家状态,是否可以进行证明材料提交 - if (Objects.isNull(expertUserFullInfo) - || !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) - || ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())) { - throw new BizException("当前状态无法提交证明材料"); - } - - // 证明材料提交 - ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd = new ExpertRecommendProofSaveCmd(); - if (CollectionUtils.isNotEmpty(recommendProofFile)) { - expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); - } - List recommendedWayDictionaryDTOList = new ArrayList<>(); - if (CollUtil.isNotEmpty(recommendedWay)) { - recommendedWay.forEach(r -> { - ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); - expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); - expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); - recommendedWayDictionaryDTOList.add(expertDictionaryDTO); - }); - } - expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); - expertRecommendProofSaveCmd.setUserId(expertUserId); - return expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd); - } - - public ExpertFullInfoVO getExpertFullInfoDetail(Long expertUserId) { - Long currentUserId = LoginUserUtil.getUserId(); - if (Objects.isNull(expertUserId)) { - expertUserId = currentUserId; - } - ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); - if (Objects.isNull(expertUserFullInfoAll)) { - return null; - } - List fileIdList = expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll); - List attachFiles = fileService.getByIds(fileIdList); - return expertUserInfoAssembler.buildExpertFullInfo(attachFiles, expertUserFullInfoAll); - } - - @Transactional(rollbackFor = Exception.class) - public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { - String phoneNo = basicInfo.getPhoneNo(); - UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); - if (Objects.isNull(userInfo)) { - GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile(basicInfo.getPhoneNo()); - if (dingInfoByMobile.isSuccess()) { - DingInfoByMobileDTO data = dingInfoByMobile.getData(); - String accountId = data.getAccountId(); - userInfo = userInfoService.getUserInfoByAccountId(Long.parseLong(accountId)); - } - if (userInfo == null) { - userInfo = UserInfo.builder() - .username(basicInfo.getName()) - .realName(basicInfo.getName()) - .available(UserAvailableEnum.DISABLE.name()) - .mobile(phoneNo) - .createBy(operatorId) - .updateBy(operatorId) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .build(); - userInfoService.save(userInfo); - } else if (!StrUtil.equals(userInfo.getRealName(), basicInfo.getName())) { - log.warn("相似账户为:{} ==> {}", basicInfo.getPhoneNo(), userInfo); - throw BizException.wrap("已存在同手机号,但不同名的账号"); - } else if (StrUtil.isBlank(userInfo.getMobile())) { - userInfo.setMobile(basicInfo.getPhoneNo()); - userInfoService.updateById(userInfo); - } - } - ExpertUserFullInfo one = expertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); - if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { - throw new BizException("该手机号已被专家注册,请确认后再填写"); - } - return userInfo.getId(); - } - - /** - * 社会专家报名 需要校验手机号 - * - * @param request - */ - @Transactional(rollbackFor = Exception.class) - public void expertRegistration(ExpertRegistrationRequest request) { - String verificationCode = request.getVerificationCode(); - String phoneNo = request.getBasicInfo().getPhoneNo(); - //校验 专家验证码 - if (expertRegistrationVerifyCodeCheck) { - verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); - } - assemblerAndGenerateExpert(request, null); - } - - - @Transactional(rollbackFor = Exception.class) - public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req, Long operatorId) { - if (Objects.isNull(operatorId)) { - operatorId = -1L; - } - ExpertBasicInfo basicInfo = req.getBasicInfo(); - Long userId = generateOrGetUserId(basicInfo, operatorId); - - // 校验区域编码合法性 校验履职意向编码合法性 - ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); - expertManageHelper.expertRegionInfoCheck(expertRegionInfo); - List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); - for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { - expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); - } - ExpertEduInfo eduInfo = req.getEduInfo(); - ExpertJobInfo jobInfo = req.getJobInfo(); - ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo(); - // 校验标签字段 - expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); - // 校验字典字段 - expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); - // 判断专家提交状态,判断是否可以进行此操作 - ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(userId); - - boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) - || (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) - && !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); - if (submitBasicInfoStatusEnable) { - // 新建 保存 - ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler - .buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); - expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); - } - - ExpertRecommendInfo recommendInfo = req.getRecommendInfo(); - // 推荐证明材料 - List recommendedWay = recommendInfo.getRecommendedWay(); - // 推荐方式 - List recommendProofFile = recommendInfo.getRecommendationProofFile(); - expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId); - return userId; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java deleted file mode 100644 index 9d9f11a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ /dev/null @@ -1,573 +0,0 @@ -package com.ningdatech.pmapi.expert.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -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.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.RegionLimitHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.expert.model.cmd.*; -import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO; -import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; -import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; -import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest.StorageApplyResultExtraInfo; -import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; -import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; -import com.ningdatech.pmapi.expert.service.ExpertAdminManageService; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.ExpertUserInfoHelper; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/3/1 上午10:38 - */ - -@Component -@RequiredArgsConstructor -public class ExpertMetaApplyManage { - - private final IExpertMetaApplyService iMetaApplyService; - private final IExpertDictionaryService expertDictionaryService; - private final RegionCacheHelper regionCacheHelper; - private final IExpertUserFullInfoService userFullInfoService; - private final DictionaryCache dictionaryCache; - private final ExpertInfoService expertInfoService; - private final UserInfoHelper userInfoHelper; - private final RegionLimitHelper regionLimitHelper; - private final ExpertUserInfoHelper expertUserInfoHelper; - private final ExpertAdminManageService expertAdminManageService; - private final IExpertDictionaryService iExpertDictionaryService; - - public PageVo metaApplyListQuery(MetaApplyListQuery req) { - // 筛选符合专家类型的用户id - List filterExpertTypeUserIdList = null; - DictionaryFieldInfo expertType = req.getExpertType(); - if (Objects.nonNull(expertType) && StringUtils.isNotBlank(expertType.getDictionaryCode())) { - List expertTypeDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getDictionaryCode, expertType.getDictionaryCode())); - filterExpertTypeUserIdList = expertTypeDictionaryList.stream().map(ExpertDictionary::getUserId).distinct().collect(Collectors.toList()); - } - - // 查找符合专家条件的用户id - ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req); - List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); - - // 取交集 - List finalFilterExpertUserIdList = new ArrayList<>(); - if (Objects.nonNull(filterExpertTypeUserIdList)) { - for (Long userId : filterExpertUserIdList) { - if (filterExpertTypeUserIdList.contains(userId)) { - finalFilterExpertUserIdList.add(userId); - } - } - } else { - finalFilterExpertUserIdList = filterExpertUserIdList; - } - - if (CollUtil.isEmpty(finalFilterExpertUserIdList)) { - return PageVo.empty(); - } - - LambdaQueryWrapper expertMetaApplyListQuery = - buildMetaApplyListQueryWrapper(req, finalFilterExpertUserIdList); - Page pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); - PageVo result = new PageVo<>(); - result.setTotal(pageResult.getTotal()); - BizUtils.notEmpty(pageResult.getRecords(), records -> { - List expertIds = CollUtils.fieldList(records, ExpertMetaApply::getUserId); - // 根据用户id 获取专家基本信息 - List expertList = userFullInfoService.listByUserIds(expertIds); - Map expertMap = CollUtils.listToMap(expertList, ExpertUserFullInfo::getUserId); - List titleLevelDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.TITLE_LEVEL); - Map> titleLevelDictMap = CollUtils.group(titleLevelDictList, ExpertDictionary::getUserId); - - List expertTypeDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.EXPERT_TYPE); - Map> expertTypeDictMap = CollUtils.group(expertTypeDictList, ExpertDictionary::getUserId); - result.setRecords(buildExpertApplyMetaVOList(records, expertMap, titleLevelDictMap, expertTypeDictMap)); - }); - return result; - } - - @Transactional(rollbackFor = Exception.class) - public void metaApplyResult(MetaApplyResultRequest req) { - Long applyId = req.getApplyId(); - ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); - Long userId = LoginUserUtil.getUserId(); - // 校验专家管理员区域权限,是否可以审核当前专家申请 - // permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId()); - String applyStatus = expertMetaApply.getApplyStatus(); - if (!ExpertApplyStatusEnum.PENDING_REVIEW.getKey().equals(applyStatus)) { - throw BizException.wrap("apply is already processed"); - } - ExpertApplyTypeEnum applyType = ExpertApplyTypeEnum.of(expertMetaApply.getApplyType()); - boolean applyResult = req.getApplyResult(); - - switch (applyType) { - // 专家入库 - case EXPERT_STORAGE: { - ExpertStorageDealCmd expertStorageDealCmd = buildExpertStorageDealCmd(req, expertMetaApply.getUserId(), expertMetaApply); - expertInfoService.expertStorageDeal(expertStorageDealCmd); - // 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核 - if (applyResult) { - Long expertUserId = expertMetaApply.getUserId(); - List joinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, expertUserId) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) - .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) - .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name())); - BizUtils.notEmpty(joinApplyList, list -> list.forEach(r -> { - MetaApplyResultRequest resultRequest = new MetaApplyResultRequest(); - resultRequest.setApplyId(r.getId()); - resultRequest.setApplyResult(true); - resultRequest.setAuditOpinion("同意"); - metaApplyResult(resultRequest); - })); - } - } - break; - // 专家出库 - case EXPERT_DELIVERY: - // ExpertDeliveryDealCmd expertDeliveryDealCmd = buildExpertDeliveryDealCmd(req, expertMetaApply.getUserId()); - // expertInfoService.expertDeliveryDeal(expertDeliveryDealCmd); - break; - // 长期请假 - case LONG_TERM_LEAVE: - // leaveManage.leaveAuditCallback(req.getApplyResult(), applyId); - break; - // 专家信息审核 - case EXPERT_INFO_MODIFY: - ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId); - expertInfoService.expertInfoModifyDeal(applyDealCmd); - break; - // 专家履职意向加入/离开 - case EXPERT_INTENTION_JOIN: - case EXPERT_INTENTION_LEAVE: - ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply); - expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd); - break; - default: - break; - } - - String auditOpinion = req.getAuditOpinion(); - // 发送审核结果短信 - // sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId); - // 更新申请结果 - expertMetaApply.setApproverUserId(userId); - String adminUserName = userInfoHelper.getUserName(userId); - expertMetaApply.setApprover(adminUserName); - expertMetaApply.setAuditOpinion(auditOpinion); - expertMetaApply.setApplyStatus(applyResult ? ExpertApplyStatusEnum.PASSED.getKey() : ExpertApplyStatusEnum.REFUSED.getKey()); - expertMetaApply.setReviewTime(LocalDateTime.now()); - expertMetaApply.setUpdateOn(LocalDateTime.now()); - iMetaApplyService.saveOrUpdate(expertMetaApply); - } - - public MetaApplyResultVo metaApplyResult(Long applyId) { - ExpertMetaApply metaApply = iMetaApplyService.getById(applyId); - if (Objects.isNull(metaApply)) { - throw BizException.wrap("当前审核不存在"); - } - MetaApplyResultVo metaApplyResultVo = MetaApplyResultVo.builder() - .applyTime(metaApply.getCreateOn()) - .auditor(metaApply.getApprover()) - .expertUserId(metaApply.getUserId()) - .auditOption(metaApply.getAuditOpinion()) - .auditStatus(metaApply.getApplyStatus()) - .auditTime(metaApply.getReviewTime()) - .build(); - String extraMaterialStr = metaApply.getExtraMaterial(); -// if (StringUtils.isNotBlank(extraMaterialStr)) { -// ExtraMaterialDO extraMaterialDO = JSONObject.parseObject(extraMaterialStr, ExtraMaterialDO.class); -// ModifyApplyExtraInfo modifyApplyExtraInfo = new ModifyApplyExtraInfo(); -// BizUtils.notEmpty(extraMaterialDO.getEvidenceList(), list -> { -// List fileIdList = CollUtils.fieldList(list, FileBasicInfo::getFileId); -// List attachFiles = fileService.getByIds(fileIdList); -// List tempList = attachFiles.stream().map(r -> { -// FileBasicInfo fileBasicInfo = new FileBasicInfo(); -// fileBasicInfo.setFileId(r.getFileId()); -// fileBasicInfo.setFileName(r.getOriginalFileName()); -// return fileBasicInfo; -// }).collect(Collectors.toList()); -// modifyApplyExtraInfo.setEvidenceList(tempList); -// }); -// modifyApplyExtraInfo.setFactSheet(extraMaterialDO.getFactSheet()); -// metaApplyResultVo.setModifyApplyExtraInfo(modifyApplyExtraInfo); -// } - String applyType = metaApply.getApplyType(); - ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType); - switch (applyTypeEnum) { -// case EXPERT_INFO_MODIFY: -// buildInfoModifyApplyDisplayVO(metaApplyResultVo, metaApply); -// break; - case EXPERT_INTENTION_JOIN: - case EXPERT_INTENTION_LEAVE: - buildIntentionApplyDisplayVO(metaApplyResultVo, metaApply, applyTypeEnum); - break; - case EXPERT_DELIVERY: - case LONG_TERM_LEAVE: - case EXPERT_STORAGE: - default: - break; - } - metaApplyResultVo.setApplyType(applyTypeTrans(applyTypeEnum)); - return metaApplyResultVo; - } - - - public void metaApplyRevoke(Long applyId) { - Long userId = LoginUserUtil.getUserId(); - ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); - if (Objects.isNull(expertMetaApply)) { - throw new BizException("apply not exist"); - } - if (!expertMetaApply.getUserId().equals(userId)) { - throw new BizException("has not right to operate"); - } - String applyStatus = expertMetaApply.getApplyStatus(); - ExpertApplyStatusEnum expertApplyStatusEnum = ExpertApplyStatusEnum.of(applyStatus); - if (!ExpertApplyStatusEnum.PENDING_REVIEW.equals(expertApplyStatusEnum)) { - throw new BizException("apply is already deal"); - } - expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.REVOKED.getKey()); - expertMetaApply.setUpdateOn(LocalDateTime.now()); - iMetaApplyService.updateById(expertMetaApply); - } - - - private void buildIntentionApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply metaApply, ExpertApplyTypeEnum applyTypeEnum) { - String regionCode = metaApply.getRegionCode(); - Integer regionLevel = metaApply.getRegionLevel(); - MetaApplyResultVo.IntentionApplyDisplayVO intentionApplyDisplayVO = new MetaApplyResultVo.IntentionApplyDisplayVO(); - intentionApplyDisplayVO.setExpertApplyId(metaApply.getId()); - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionCode(regionCode); - expertRegionInfo.setRegionLevel(regionLevel); - switch (applyTypeEnum) { - case EXPERT_INTENTION_LEAVE: { - intentionApplyDisplayVO.setReduceExpertRegion(expertRegionInfo); - } - break; - case EXPERT_INTENTION_JOIN: { - intentionApplyDisplayVO.setAddExpertRegion(expertRegionInfo); - } - break; - default: - break; - } - metaApplyResultVo.setIntentionApplyDisplayVo(intentionApplyDisplayVO); - } - - private String applyTypeTrans(ExpertApplyTypeEnum applyTypeEnum) { - switch (applyTypeEnum) { - case EXPERT_INTENTION_JOIN: - case EXPERT_INTENTION_LEAVE: { - return ExpertApplyTypeQueryEnum.EXPERT_INTENTION_CHANGE.getKey(); - } - case EXPERT_INFO_MODIFY: { - return ExpertApplyTypeQueryEnum.EXPERT_INFO_MODIFY.getKey(); - } - case LONG_TERM_LEAVE: { - return ExpertApplyTypeQueryEnum.LONG_TERM_LEAVE.getKey(); - } - case EXPERT_DELIVERY: { - return ExpertApplyTypeQueryEnum.EXPERT_DELIVERY.getKey(); - } - case EXPERT_STORAGE: { - return ExpertApplyTypeQueryEnum.EXPERT_STORAGE.getKey(); - } - default: - return null; - } - } - - private List applyTypeTrans(ExpertApplyTypeQueryEnum applyTypeQueryEnum) { - List applyTypeList = new ArrayList<>(); - switch (applyTypeQueryEnum) { - case EXPERT_INTENTION_CHANGE: { - applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()); - applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey()); - } - break; - case EXPERT_INFO_MODIFY: { - applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); - } - break; - case LONG_TERM_LEAVE: { - applyTypeList.add(ExpertApplyTypeEnum.LONG_TERM_LEAVE.getKey()); - } - break; - case EXPERT_DELIVERY: { - applyTypeList.add(ExpertApplyTypeEnum.EXPERT_DELIVERY.getKey()); - } - break; - case EXPERT_STORAGE: { - applyTypeList.add(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); - } - break; - default: - break; - } - return applyTypeList; - } - - private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query) { - ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); - expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); - expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); - if (StringUtils.isNotBlank(query.getExpertName())) { - expertAdminExpertManageQueryCmd.setExpertName(query.getExpertName()); - } - if (StringUtils.isNotBlank(query.getCompanyName())) { - expertAdminExpertManageQueryCmd.setCompany(query.getCompanyName()); - } - List expertDictionaryQueryList = new ArrayList<>(); - if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { - ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); - expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); - expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); - expertDictionaryQueryList.add(expertDictionaryQuery); - } - - List containsRegion = null; - if (Objects.nonNull(query.getExpertRegionInfo())) { - RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() - , query.getExpertRegionInfo().getRegionCode()); - containsRegion = CollUtil.toList(containsRegionBo); - } - - expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); - expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); - expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); - expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); - return expertAdminExpertManageQueryCmd; - } - - /** - * 装配 专家审核列表筛选返回VO - * - * @param expertMetaApplyList - * @param expertUserFullInfoMap - * @param titleLevelDictMap - * @param expertTypeDictMap - * @return - */ - private List buildExpertApplyMetaVOList(List expertMetaApplyList - , Map expertUserFullInfoMap - , Map> titleLevelDictMap - , Map> expertTypeDictMap) { - List expertApplyMetaVOList = new ArrayList<>(); - for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { - ExpertApplyMetaVO expertApplyMetaVO = new ExpertApplyMetaVO(); - Long userId = expertMetaApply.getUserId(); - ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoMap.get(userId); - expertApplyMetaVO.setId(expertMetaApply.getId()); - expertApplyMetaVO.setUserId(userId); - expertApplyMetaVO.setApplyStatus(expertMetaApply.getApplyStatus()); - - String applyType = expertMetaApply.getApplyType(); - if (Objects.nonNull(applyType)) { - expertApplyMetaVO.setApplyType(applyTypeTrans(ExpertApplyTypeEnum.of(applyType))); - } - expertApplyMetaVO.setName(expertUserFullInfo.getExpertName()); - - RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel()); - - if (Objects.nonNull(regionDTO)) { - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); - expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); - expertRegionInfo.setRegionName(regionDTO.getRegionName()); - expertApplyMetaVO.setExpertRegionInfo(expertRegionInfo); - } - - List titleLevelDictionaryList = titleLevelDictMap.get(userId); - if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { - expertApplyMetaVO.setTitleLevel(titleLevelDictionaryList.stream().map(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); - dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); - dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } - return dictionaryFieldInfo; - }).collect(Collectors.toList())); - } - - // 装配专家类型 - List expertTypeDictionaryList = expertTypeDictMap.get(userId); - if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { - expertApplyMetaVO.setExpertType(expertTypeDictionaryList.stream().map(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); - dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); - dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } - return dictionaryFieldInfo; - }).collect(Collectors.toList())); - } - - expertApplyMetaVO.setCompany(expertUserFullInfo.getCompany()); - expertApplyMetaVO.setPhoneNo(expertUserFullInfo.getPhoneNo()); - expertApplyMetaVO.setApplyTime(expertMetaApply.getCreateOn()); - expertApplyMetaVOList.add(expertApplyMetaVO); - } - return expertApplyMetaVOList; - } - - private LambdaQueryWrapper buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, - List expertIdList) { - // 审核类型 - List applyTypeList = new ArrayList<>(); - if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { - List applyTypeQueryEnumList = applyListReq.getApplyTypeList(); - for (ExpertApplyTypeQueryEnum applyTypeQueryEnum : applyTypeQueryEnumList) { - applyTypeList.addAll(applyTypeTrans(applyTypeQueryEnum)); - } - } - // 审核结果 - List applyStatusList = new ArrayList<>(); - if (CollUtil.isNotEmpty(applyListReq.getApplyStatusList())) { - applyStatusList = CollUtils.fieldList(applyListReq.getApplyStatusList(), ExpertApplyStatusEnum::getKey); - ; - } - - LocalDateTime applyStartTime = applyListReq.getApplyStartTime(); - LocalDateTime applyEndTime = applyListReq.getApplyEndTime(); - - // 不展示撤回的申请记录 - LambdaQueryWrapper expertMetaApplyListQuery = Wrappers.lambdaQuery(ExpertMetaApply.class) - .in(CollectionUtils.isNotEmpty(applyTypeList), ExpertMetaApply::getApplyType, applyTypeList) - .in(CollectionUtils.isNotEmpty(applyStatusList), ExpertMetaApply::getApplyStatus, applyStatusList) - .in(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()) - .in(CollectionUtils.isNotEmpty(expertIdList), ExpertMetaApply::getUserId, expertIdList) - .gt(Objects.nonNull(applyStartTime), ExpertMetaApply::getCreateOn, applyStartTime) - .lt(Objects.nonNull(applyEndTime), ExpertMetaApply::getCreateOn, applyEndTime) - .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) - .orderByDesc(ExpertMetaApply::getCreateOn); - - return expertMetaApplyListQuery; - } - - private ExpertStorageDealCmd buildExpertStorageDealCmd(MetaApplyResultRequest applyResultRequest, - Long expertUserId, - ExpertMetaApply expertMetaApply) { - StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo(); - ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd(); - Boolean applyResult = applyResultRequest.getApplyResult(); - expertStorageDealCmd.setApplyResult(applyResult); - - if (Objects.nonNull(extraInfo)) { - List expertType = extraInfo.getExpertType(); - if (CollUtil.isNotEmpty(expertType)) { - expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> { - ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); - expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); - expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); - return expertDictionaryDTO; - }).collect(Collectors.toList())); - } - List other = extraInfo.getOther(); - if (CollUtil.isNotEmpty(other)) { - expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> { - ExpertTagDTO expertTagDTO = new ExpertTagDTO(); - expertTagDTO.setExpertInfoField(r.getTagFieldName()); - expertTagDTO.setTagCode(r.getTagCode()); - return expertTagDTO; - }).collect(Collectors.toList())); - } - expertStorageDealCmd.setRemark(extraInfo.getRemark()); - } - expertStorageDealCmd.setExpertUserId(expertUserId); - expertStorageDealCmd.setJoinRegionCode(expertMetaApply.getRegionCode()); - expertStorageDealCmd.setJoinRegionLevel(expertMetaApply.getRegionLevel()); - return expertStorageDealCmd; - } - - - private ExpertInfoModifyApplyDealCmd buildExpertInfoModifyApplyDealCmd(MetaApplyResultRequest applyResultRequest, - Long userId, Long applyId) { - ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd = new ExpertInfoModifyApplyDealCmd(); - Boolean applyResult = applyResultRequest.getApplyResult(); - expertInfoModifyApplyDealCmd.setApplyResult(applyResult); - expertInfoModifyApplyDealCmd.setExpertUserId(userId); - expertInfoModifyApplyDealCmd.setApplyId(applyId); - return expertInfoModifyApplyDealCmd; - } - - private ExpertIntentionApplyDealCmd buildExpertIntentionApplyDealCmd(MetaApplyResultRequest applyResultRequest, - ExpertMetaApply expertMetaApply) { - Boolean applyResult = applyResultRequest.getApplyResult(); - String applyType = expertMetaApply.getApplyType(); - ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType); - - ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = new ExpertIntentionApplyDealCmd(); - expertIntentionApplyDealCmd.setApplyResult(applyResult); - expertIntentionApplyDealCmd.setApplyTypeEnum(applyTypeEnum); - expertIntentionApplyDealCmd.setExpertUserId(expertMetaApply.getUserId()); - expertIntentionApplyDealCmd.setExpertRegionCode(expertMetaApply.getRegionCode()); - expertIntentionApplyDealCmd.setExpertRegionLevel(expertMetaApply.getRegionLevel()); - return expertIntentionApplyDealCmd; - } - - /** - * 专家管理员 新增专家使用使用 - * - * @param expertUserId \ - */ - @Transactional(rollbackFor = Exception.class) - public void autoPassExpertApply(Long expertUserId) { - final List applyTypes = Arrays.asList(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), - ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, expertUserId) - .in(ExpertMetaApply::getApplyType, applyTypes) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - List expertIntentionJoinApplyList = iMetaApplyService.list(query); - for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) { - MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); - applyResult.setApplyId(expertMetaApply.getId()); - applyResult.setAuditOpinion("同意"); - applyResult.setApplyResult(true); - metaApplyResult(applyResult); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java deleted file mode 100644 index e7772d5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.ningdatech.pmapi.expert.manage; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.cache.lock.DistributedLock; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.expert.constant.ReviewResultEnum; -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; -import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; -import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; -import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO; -import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; -import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO.ReviewDetailByTypeVO; -import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED; - -/** - *

- * ExpertReviewManage - *

- * - * @author WendyYang - * @since 14:25 2023/2/15 - */ -@Component -@RequiredArgsConstructor -public class ExpertReviewManage { - - private final IExpertReviewService expertReviewService; - private final DistributedLock distributedLock; - private final IMeetingExpertService meetingExpertService; - private final FileService fileService; - private final IMeetingInnerProjectService meetingInnerProjectService; - private final IMeetingService meetingService; - private final IReviewTemplateSettingsService templateSettingsService; - - private static final String EXPERT_REVIEW_KEY = "expert_review:"; - - private String buildExpertReviewKey(Long projectId, Long expertId) { - return EXPERT_REVIEW_KEY + projectId + ":" + expertId; - } - - private ExpertReviewDetailVO buildExpertReviewDetail(ExpertReview review) { - return ExpertReviewDetailVO.builder() - .reviewResult(review.getReviewResult()) - .creator(review.getCreator()) - .projectId(review.getProjectId()) - .templateId(review.getTemplateId()) - .otherAdvice(review.getOtherAdvice()) - .isFinal(review.getIsFinal()) - .createOn(review.getCreateOn()) - .attachFileId(review.getAttachFileId()) - .reviewTemplateOptions(JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class)) - .build(); - } - - public void expertReview(ExpertReviewDetailReq req) { - Long userId = LoginUserUtil.getUserId(); - Long projectId = req.getProjectId(); - Long meetingId = req.getMeetingId(); - String expertReviewKey = buildExpertReviewKey(projectId, userId); - if (!distributedLock.lock(expertReviewKey)) { - throw BizException.wrap("保存评审意见失败,请重试"); - } - try { - List reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); - if (req.getIsFinal()) { - if (reviews.isEmpty()) { - throw BizException.wrap("请先填写个人评审意见"); - } - if (reviews.size() > 1) { - throw BizException.wrap("不可重复填写最终评审意见"); - } - int agreeCnt = meetingExpertService.countExpertByStatusAndMeetingId(AGREED, req.getMeetingId(), null); - if (agreeCnt > 1) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class) - .eq(ExpertReview::getProjectId, req.getProjectId()) - .eq(ExpertReview::getMeetingId, req.getMeetingId()) - .ne(ExpertReview::getCreateBy, userId); - if (expertReviewService.count(query) < agreeCnt - 1) { - throw BizException.wrap("所有组员填写完评审意见后,方可填写最终评审意见"); - } - } - } else { - if (!reviews.isEmpty()) { - throw BizException.wrap("不可重复填写评审意见"); - } - } - ExpertReview review = new ExpertReview(); - review.setReviewResult(req.getReviewResult()); - review.setContent(JSONUtil.toJsonStr(req.getReviewTemplateOptions())); - review.setProjectId(req.getProjectId()); - review.setProjectCode(req.getProjectCode()); - review.setTemplateId(req.getTemplateId()); - review.setMeetingId(req.getMeetingId()); - review.setOtherAdvice(req.getOtherAdvice()); - review.setAttachFileId(req.getAttachFileId()); - review.setIsFinal(req.getIsFinal()); - review.setCreator(LoginUserUtil.getUsername()); - expertReviewService.save(review); - } finally { - distributedLock.releaseLock(expertReviewKey); - } - } - - public ExpertReviewDetailVO getExpertReviewDetail(Long projectId, Long userId, Long meetingId) { - List reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); - reviews.removeIf(ExpertReview::getIsFinal); - if (reviews.isEmpty()) { - throw BizException.wrap("评审记录不存在"); - } - return buildExpertReviewDetail(reviews.get(0)); - } - - public List listReviews(Long projectId, Long meetingId, boolean onlyTeamMember) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); - query.eq(ExpertReview::getProjectId, projectId); - query.eq(ExpertReview::getMeetingId, meetingId); - query.eq(onlyTeamMember, ExpertReview::getIsFinal, Boolean.FALSE); - query.orderByDesc(ExpertReview::getCreateOn); - List reviews = expertReviewService.list(query); - if (reviews.isEmpty()) { - return Collections.emptyList(); - } - List attachFileIds = CollUtils.fieldList(reviews, ExpertReview::getAttachFileId); - Map fileMap = new HashMap<>(attachFileIds.size()); - if (attachFileIds.size() > 0) { - List files = fileService.getByIds(attachFileIds); - files.forEach(w -> fileMap.put(w.getFileId(), w)); - } - return CollUtils.convert(reviews, w -> { - ExpertReviewDetailVO reviewDetail = buildExpertReviewDetail(w); - reviewDetail.setAttachFile(fileMap.get(w.getAttachFileId())); - return reviewDetail; - }); - } - - public ProjectReviewDetailVO projectExpertReviewDetail(String projectCode) { - ProjectReviewDetailVO detail = new ProjectReviewDetailVO(); - List meetingIds = meetingInnerProjectService.listMeetingIdByProjectCode(projectCode); - if (meetingIds.isEmpty()) { - return detail; - } - List meetings = meetingService.listByIds(meetingIds); - Collection tmpMeetingIds = meetings.stream() - .collect(Collectors.groupingBy(Meeting::getType, - Collectors.collectingAndThen(Collectors.toList(), w -> { - w.sort(Comparator.comparing(Meeting::getCreateOn)); - return w.get(w.size() - 1).getId(); - }))).values(); - LambdaQueryWrapper erQuery = Wrappers.lambdaQuery(ExpertReview.class) - .in(ExpertReview::getMeetingId, tmpMeetingIds) - .eq(ExpertReview::getProjectCode, projectCode) - .orderByDesc(ExpertReview::getCreateOn); - List expertReviews = expertReviewService.list(erQuery); - if (expertReviews.isEmpty()) { - return detail; - } - List templateIds = CollUtils.fieldList(expertReviews, ExpertReview::getTemplateId); - List templates = templateSettingsService.listByIds(templateIds); - Map templateMap = CollUtils.listToMap(templates, - ReviewTemplateSettings::getId, - ReviewTemplateSettingsManage::buildTemplateDetail); - detail.setTemplates(templateMap.values()); - Map map = new HashMap<>(8); - expertReviews.forEach(review -> { - ReviewTemplateVO template = templateMap.get(review.getTemplateId()); - ReviewDetailByTypeVO reviewDetailByType = map.computeIfAbsent(template.getTemplateType(), k -> { - ReviewDetailByTypeVO tmpReviewDetail = new ReviewDetailByTypeVO(); - tmpReviewDetail.setReviewType(k); - tmpReviewDetail.setTeamMemberReviews(new ArrayList<>()); - return tmpReviewDetail; - }); - ExpertReviewDetailVO tmpReview = buildExpertReviewDetail(review); - if (review.getIsFinal()) { - reviewDetailByType.setFinalReview(tmpReview); - } else { - reviewDetailByType.getTeamMemberReviews().add(tmpReview); - } - }); - detail.setReviews(map.values()); - return detail; - } - - public List listFinalExpertReviews(Long meetingId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class) - .eq(ExpertReview::getIsFinal, Boolean.TRUE) - .eq(ExpertReview::getMeetingId, meetingId); - return expertReviewService.list(query); - } - - public Map buildExpertReviewToStr(Long meetingId) { - List reviews = listFinalExpertReviews(meetingId); - if (reviews.isEmpty()) { - return Collections.emptyMap(); - } - List templateIds = CollUtils.fieldList(reviews, ExpertReview::getTemplateId); - List ts = templateSettingsService.listByIds(templateIds); - Map tsMap = CollUtils.listToMap(ts, ReviewTemplateSettings::getId); - Map resMap = new HashMap<>(8); - for (ExpertReview review : reviews) { - ReviewTemplateSettings settings = tsMap.get(review.getTemplateId()); - List optionTemplates = JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class); - List options = JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class); - Map optionsMap = CollUtils.listToMap(options, ReviewTemplateOptionDTO::getQuestionSerialNo); - StringBuilder str = new StringBuilder(); - optionTemplates.forEach(ot -> { - ReviewTemplateOptionDTO rto = optionsMap.get(ot.getSerialNo()); - String optionsContent = ot.getOptions().stream() - .filter(w -> rto.getOptionSerialNo().contains(w.getSerialNo())) - .map(ReviewTemplateSettingsDTO.OptionDTO::getOption) - .collect(Collectors.joining("、")); - str.append("").append(ot.getTitle()).append(":").append(optionsContent).append(";"); - }); - str.append("").append("其他意见或建议").append(":") - .append(StrUtil.blankToDefault(review.getOtherAdvice(), "--")).append(";"); - str.append("").append("评审结果").append(":") - .append(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()).append(";"); - resMap.put(review.getProjectId(), str.toString()); - } - return resMap; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java deleted file mode 100644 index 8341463..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ningdatech.pmapi.expert.manage; - -import cn.hutool.json.JSONUtil; -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; -import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; -import com.ningdatech.pmapi.expert.model.enumeration.ReviewTemplateTypeEnum; -import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; -import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; -import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -/** - *

- * ReviewTemplateSettingsManage - *

- * - * @author WendyYang - * @since 09:41 2023/2/15 - */ -@Component -@AllArgsConstructor -public class ReviewTemplateSettingsManage { - - private final IReviewTemplateSettingsService reviewTemplateSettingsService; - - @Transactional(rollbackFor = Exception.class) - public void saveOrUpdate(ReviewTemplateReq req) { - ReviewTemplateTypeEnum type = ReviewTemplateTypeEnum.getByCode(req.getTemplateType()); - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(ReviewTemplateSettings.class) - .eq(ReviewTemplateSettings::getTemplateType, type.getCode()) - .eq(ReviewTemplateSettings::getRegionCode, req.getRegionCode()) - .eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) - .set(ReviewTemplateSettings::getIsLast, Boolean.FALSE); - reviewTemplateSettingsService.update(update); - ReviewTemplateSettings settings = new ReviewTemplateSettings(); - settings.setTemplateType(type.getCode()); - settings.setRegionCode(req.getRegionCode()); - settings.setIsLast(Boolean.TRUE); - settings.setContent(JSONUtil.toJsonStr(req.getTemplates())); - reviewTemplateSettingsService.save(settings); - } - - public ReviewTemplateVO getReviewTemplateSettings(Integer templateType, String regionCode) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ReviewTemplateSettings.class) - .eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) - .eq(ReviewTemplateSettings::getRegionCode, regionCode) - .eq(ReviewTemplateSettings::getTemplateType, templateType) - .last(BizConst.LIMIT_1); - ReviewTemplateSettings settings = reviewTemplateSettingsService.getOne(query); - return buildTemplateDetail(settings); - } - - public ReviewTemplateVO getReviewTemplateSettings(Long templateId) { - ReviewTemplateSettings settings = reviewTemplateSettingsService.getById(templateId); - return buildTemplateDetail(settings); - } - - public List listReviewTemplateSettings(List templateIds) { - List settings = reviewTemplateSettingsService.listByIds(templateIds); - return CollUtils.convert(settings, ReviewTemplateSettingsManage::buildTemplateDetail); - } - - protected static ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) { - if (settings == null) { - throw BizException.wrap("模版不存在"); - } - return ReviewTemplateVO.builder() - .templateId(settings.getId()) - .templateType(settings.getTemplateType()) - .templates(JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class)) - .build(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java deleted file mode 100644 index 0192dde..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.model.query.ListExpertQuery; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/5 上午10:27 - */ -@Repository -public interface ExpertAdminManageMapper { - - /** - * 获取所有符合查询条件的专家user_id - * - * @param query - * @return - */ - List listExpertUserId(@Param("query") ListExpertQuery query); - - List listExpertDictionaryUserId(@Param("query") ListExpertQuery query); - - List listExpertTagUserId(@Param("query") ListExpertQuery query); - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml deleted file mode 100644 index 118c66d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - SELECT user_id FROM nd_expert_user_full_info - - - AND expert_name LIKE CONCAT('%',#{query.expertName, jdbcType=BIGINT},'%') - - - AND company LIKE CONCAT('%',#{query.company, jdbcType=BIGINT},'%') - - - AND expert_account_status IN - - #{expertAccountStatus} - - - - AND region_code = #{query.regionCode} AND region_level = #{query.regionLevel} - - - AND is_ding_user = 'Y' - - - AND is_ding_user = 'N' - - - AND ( - - (= #{regionContains.parentRegionTreeLevel} AND region_code IN ]]> - #{containsRegionCode} - - ) - - ) - - - AND exists(select 1 from expert_intention_work_region eiwr where eiwr.user_id = nd_expert_user_full_info.user_id and - - (= #{intentionRegions.parentRegionTreeLevel} AND region_code IN ]]> - #{intentionRegionCode} - - ) - - ) - - - ORDER BY update_on DESC - - - - SELECT - user_id - FROM - ( - SELECT DISTINCT - et.user_id, - et.expert_info_field - FROM - expert_tag et - WHERE - - (et.expert_info_field = #{expertTagQuery.expertInfoField} - AND et.tag_code IN - - #{tagCode} - ) - - ) temp - GROUP BY - user_id - HAVING - count( user_id )= ${query.expertTagQueryList.size()} - - - - - SELECT - user_id - FROM - ( - SELECT DISTINCT - ed.user_id, - ed.expert_info_field - FROM - expert_dictionary ed - WHERE - - (ed.expert_info_field = #{expertDictionaryQuery.expertInfoField} - AND ed.dictionary_code IN - - #{dictionaryCode} - ) - - ) temp - GROUP BY - user_id - HAVING - count( user_id )= ${query.expertDictionaryQueryList.size()} - - - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java deleted file mode 100644 index 53050a3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-23 - */ -public interface ExpertAvoidCompanyMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml deleted file mode 100644 index cbb557d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.java deleted file mode 100644 index b18281b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-04-17 - */ -public interface ExpertGovBusinessStripMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.xml deleted file mode 100644 index 5329cbf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertGovBusinessStripMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java deleted file mode 100644 index 1867577..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface ExpertIntentionWorkRegionMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml deleted file mode 100644 index f33bbfa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.java deleted file mode 100644 index 77ee648..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-03-01 - */ -public interface ExpertMetaApplyMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.xml deleted file mode 100644 index 6ebe245..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.java deleted file mode 100644 index f63b28d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -public interface ExpertReviewMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.xml deleted file mode 100644 index ca0c3b9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertReviewMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java deleted file mode 100644 index 691f1c5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertSensitiveInfoModifyDetailRecord; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -public interface ExpertSensitiveInfoModifyDetailRecordMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml deleted file mode 100644 index 7a7b93a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertSensitiveInfoModifyDetailRecordMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java deleted file mode 100644 index 884b0be..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface NdExpertUserFullInfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml deleted file mode 100644 index 1819911..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.java deleted file mode 100644 index cc6e563..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.mapper; - -import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 评审模版配置表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-14 - */ -public interface ReviewTemplateSettingsMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.xml deleted file mode 100644 index 11cc746..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ReviewTemplateSettingsMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java deleted file mode 100644 index a01f4bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:03 - * 专家信息字典字段信息 - */ -@Data -@ApiModel("字典字段信息") -public class DictionaryFieldInfo { - - /** - * 字段名称 - */ - @NotBlank - @ApiModelProperty("字典字段名称") - private String dictionaryFieldName; - - /** - * 字典code - */ - @ApiModelProperty(value = "字典code") - private String dictionaryCode; - - - @ApiModelProperty(value = "字典code含义", required = false) - private String dictionaryName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java deleted file mode 100644 index 0596b44..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/4 上午10:18 - */ -@Data -@ApiModel("专家库筛选接口") -public class ExpertAdminExpertManageQuery extends PagePo { - - @ApiModelProperty("专家姓名(精准匹配)") - private String expertName; - - @ApiModelProperty("工作单位(模糊匹配)") - private String company; - - @ApiModelProperty("职称级别字典编码") - private String titleLevelDictionaryCode; - - @ApiModelProperty("单位属性字典编码") - private String companyAttributeDictionaryCode; - - @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") - private String expertAccountStatus; - - @ApiModelProperty("专家区域区域信息") - private ExpertRegionInfo expertRegionInfo; - - @ApiModelProperty("履职意向地区域信息") - private ExpertRegionInfo intentionRegionInfo; - - @ApiModelProperty(value = "是否浙政钉用户") - private Boolean isDingUser; - - @ApiModelProperty("内外围字典编码") - private String expertTypeDictionaryCode; - - @ApiModelProperty("专家来源标签编码") - private String expertSourceTagCode; - - @ApiModelProperty("擅长方向标签编码") - private String goodAtTagCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java deleted file mode 100644 index 83286a5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:16 - */ -@Data -public class ExpertAvoidCompanyInfo { - - @NotBlank - @ApiModelProperty("公司名称") - private String companyName; - - @ApiModelProperty("公司唯一标识 即 调用获取组织架构的树状结构(单位筛选列表) 接口是对应公司的 organizationCode") - private String companyUniqCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java deleted file mode 100644 index 56a64b4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午1:44 - * 专家信息中的基本信息一栏 - */ -@Data -@ApiModel(value = "ExpertBasicInfo", description = "专家基本信息") -public class ExpertBasicInfo { - - /** - * 是否浙政钉用户Y/N - */ - @NotNull - @ApiModelProperty(value = "是否浙政钉用户Y/N") - private Boolean isDingUser; - - /** - * 手机号 - */ - @NotBlank - @ApiModelProperty(value = "手机号") - private String phoneNo; - - /** - * 专家姓名 - */ - @NotBlank - @ApiModelProperty(value = "专家姓名") - private String name; - - /** - * 免冠照图片地址 - */ - @NotBlank - @ApiModelProperty(value = "免冠照图片文件") - private FileBasicInfo avatarFile; - - /** - * 性别 0,1:女,男 - */ - @NotBlank - @ApiModelProperty(value = "性别 0,1:女,男") - private String gender; - - /** - * 政治面貌(字典code) - */ - @NotNull - @ApiModelProperty(value = "政治面貌(字典code)") - private List political; - - /** - * 身份证号码 - */ - @NotBlank - @ApiModelProperty(value = "身份证号码") - private String idCard; - - /** - * 办公电话 - */ - @ApiModelProperty(value = "办公电话") - private String officePhone; - - /** - * 出生日期 - */ - @NotNull - @ApiModelProperty(value = "出生日期") - private LocalDateTime birth; - - /** - * 开户银行 - */ - @NotBlank - @ApiModelProperty(value = "开户银行") - private String bank; - - /** - * 银行卡号 - */ - @NotBlank - @ApiModelProperty(value = "银行卡号") - private String bankNo; - - /** - * 电子邮箱 - */ - @NotBlank - @ApiModelProperty(value = "电子邮箱") - @Email - private String email; - - /** - * 专家来源(标签code) - */ - @NotNull - @ApiModelProperty(value = "专家来源(标签code)") - private List expertSource; - - /** - * 专家层级 - */ - @NotNull - @ApiModelProperty(value = "专家层级") - private ExpertRegionInfo expertRegionInfo; - - /** - * 履职意向 - */ - @NotEmpty - @ApiModelProperty(value = "履职意向") - private List expertIntentionWorkRegions; - - /** - * 专家类型(内外围) - */ - @ApiModelProperty(value = "专家类型(内外围)") - private List expertType; - - /** - * 籍贯 - */ - @ApiModelProperty(value = "籍贯") - private String hometown; - - /** - * 民族 - */ - @ApiModelProperty(value = "民族") - private String nationality; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java deleted file mode 100644 index d9c66bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午1:50 - */ -@Data -@ApiModel(value = "ExpertEduInfo", description = "学历信息") -public class ExpertEduInfo { - - /** - * 毕业院校 - */ - @NotBlank - @ApiModelProperty("毕业院校") - private String school; - - /** - * 毕业时间 - */ - @NotNull - @ApiModelProperty("毕业时间") - private LocalDateTime graduatedAt; - - /** - * 所学专业 - */ - @NotBlank - @ApiModelProperty("所学专业") - private String academicTitle; - - /** - * 学历(字典code) - */ - @NotNull - @ApiModelProperty("学历(字典code)") - private List edu; - - /** - * 毕业证附件信息 - */ - @ApiModelProperty("毕业证附件信息") - private List graduationCertificateFile; - - /** - * 学位(字典code) - */ - @NotNull - @ApiModelProperty("学位(字典code)") - private List degree; - - /** - * 学位证附件信息 - */ - @ApiModelProperty("学位证附件信息") - private List degreeCertificateFile; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java deleted file mode 100644 index b2249e9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午1:58 - */ -@Data -@ApiModel(value = "ExpertJobInfo", description = "职业信息") -public class ExpertJobInfo { - - /** - * 在职状态(字典code) - */ - @NotNull - @ApiModelProperty("在职状态(字典code)") - private List jobStatus; - - /** - * 退休时间 - */ - @ApiModelProperty("退休时间") - private LocalDateTime retiredAt; - - /** - * 工作单位 - */ - @NotBlank - @ApiModelProperty("工作单位,组织结构name") - private String company; - - @ApiModelProperty("工作单位,前端使用标识") - private String companyUniqCode; - - /** - * 单位法人编号 - */ - @NotBlank - @ApiModelProperty(" 单位法人编号") - private String legalEntityCode; - - /** - * 行政职务 - */ - @NotBlank - @ApiModelProperty("行政职务") - private String administrativeDuties; - - /** - * 开始工作时间 - */ - @NotNull - @ApiModelProperty("开始工作时间") - private LocalDateTime startWorkAt; - - /** - * 行政职级(字典code) - */ - @NotNull - @ApiModelProperty("行政职级(字典code)") - private List administrativeRank; - - /** - * 单位类型(字典code) - */ - @NotNull - @ApiModelProperty("单位类型(字典code)") - private List companyAttribute; - - /** - * 工作地址 - */ - @NotBlank - @ApiModelProperty("工作地址") - private String address; - - /** - * 工作经历 - */ - @NotBlank - @ApiModelProperty("工作经历") - private String experience; - - @ApiModelProperty("专家条线") - private List businessStrips; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java deleted file mode 100644 index b23ad75..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/19 下午6:43 - */ -@Data -@ApiModel(description = "其他信息") -public class ExpertOtherInfo { - - @ApiModelProperty(value = "其他标签(标签code)") - private List other; - - @ApiModelProperty(value = "备注") - private String remark; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java deleted file mode 100644 index 98e92d9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:07 - */ -@Data -@ApiModel(description = "专业信息") -public class ExpertProfessionalInfo { - - @NotBlank - @ApiModelProperty(value = "技术职称") - private String technicalTitles; - - @NotNull - @ApiModelProperty(value = "职称级别") - private List titleLevel; - - @ApiModelProperty(value = "职称证明") - private List titleCertificateFile; - - @NotNull - @ApiModelProperty(value = "擅长方向(标签code)") - private List goodAt; - - @NotNull - @ApiModelProperty(value = "技术专长(标签code)") - private List technicalExpertise; - - @NotBlank - @ApiModelProperty(value = " 获奖情况") - private String awards; - - @NotNull - @ApiModelProperty(value = "行业领域(标签code)") - private List industrySector; - - @NotBlank - @ApiModelProperty(value = "表彰奖励") - private String recognitionReward; - - @ApiModelProperty(value = "回避单位列表") - private List avoidCompanyList; - - @ApiModelProperty(value = "其他标签") - private List other; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java deleted file mode 100644 index f56e0b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/27 上午11:52 - */ -@Data -@ApiModel(description = "推荐信息") -public class ExpertRecommendInfo { - - /** - * 推荐方式 - */ - @ApiModelProperty("推荐方式") - private List recommendedWay; - - @ApiModelProperty("推荐证明材料") - private List recommendationProofFile; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java deleted file mode 100644 index 70561dd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/27 下午4:18 - * 提交修改申请额外信息 - */ -@Data -@ApiModel("提交修改申请额外信息,保存于expert_meta_apply表的 extra_material 字段") -public class ExtraMaterialDO { - - /** - * 情况说明 - */ - @ApiModelProperty("申请说明") - private String factSheet; - - /** - * 证明材料 - */ - @ApiModelProperty("证明材料") - private List evidenceList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ModifyApplyExtraInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ModifyApplyExtraInfo.java deleted file mode 100644 index 4327473..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ModifyApplyExtraInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/27 下午4:18 - * 提交修改申请额外信息 - */ -@Data -@ApiModel("提交修改申请额外信息") -public class ModifyApplyExtraInfo { - - /** - * 情况说明 - */ - @ApiModelProperty("申请说明") - private String factSheet; - - /** - * 证明材料 - */ - @ApiModelProperty("证明材料") - private List evidenceList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/RegionDtoMapKey.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/RegionDtoMapKey.java deleted file mode 100644 index d38894d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/RegionDtoMapKey.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import lombok.Data; - -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/7/22 上午10:07 - */ -@Data -public class RegionDtoMapKey { - - /** - * 区域码 - */ - private String regionCode; - - /** - * 地区级别 - */ - private Integer regionLevel; - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RegionDtoMapKey regionDtoMapKey = (RegionDtoMapKey) o; - return regionCode.equals(regionDtoMapKey.getRegionCode()) && - regionLevel.equals(regionDtoMapKey.getRegionLevel()); - } - - @Override - public int hashCode() { - return Objects.hash(regionCode, regionLevel); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java deleted file mode 100644 index 69d05da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - - -import com.ningdatech.pmapi.common.util.DictUtils; -import com.ningdatech.pmapi.common.util.RegionUtils; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.common.util.TagUtils; -import com.ningdatech.pmapi.expert.constant.ExpertSensitiveFieldTypeEnum; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import lombok.Data; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/7/28 上午11:28 - */ -@Data -@ApiModel("需要审核字段部分") -public class SensitiveModifySegment { - - public SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum fieldName, Object original, Object apply) { - this.fieldName = fieldName; - this.original = original; - this.apply = apply; - } - - public SensitiveModifySegment(ExpertSensitiveFieldTypeEnum fieldType, ExpertUserInfoSensitiveFieldEnum fieldName, Object original, Object apply) { - this.fieldType = fieldType; - this.fieldName = fieldName; - this.original = original; - this.apply = apply; - } - - - private ExpertSensitiveFieldTypeEnum fieldType = ExpertSensitiveFieldTypeEnum.expert_sensitive_info_field; - - private ExpertUserInfoSensitiveFieldEnum fieldName; - - private Object original; - - private Object apply; - - public Boolean isValueEquals() { - switch (fieldName) { - case phone_no: - case email: - case company: - case legal_entity_code: { - return StrUtils.trimEquals((String) this.original, (String) this.apply); - } - case administrative_rank: - case title_level: { - return DictUtils.isValueEquals((List) this.original - , (List) this.apply); - } - case good_at: - case technical_expertise: - case industry_sector: - case other: { - return TagUtils.isValueEquals((List) this.original, (List) this.apply); - } - case expert_region: - return RegionUtils.isValueEquals((ExpertRegionInfo) this.original, (ExpertRegionInfo) this.apply); - case expert_intention_work_region: - return RegionUtils.isValueEquals((List) this.original, (List) this.apply); - default: - return Objects.equals(this.original, this.apply); - } - } - - public static Boolean isModify(List segmentList) { - if (CollectionUtils.isEmpty(segmentList)) { - return false; - } - for (SensitiveModifySegment segment : segmentList) { - if (!segment.isValueEquals()) { - return true; - } - } - return false; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java deleted file mode 100644 index 63cde0f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.expert.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:12 - */ -@Data -@ApiModel("标签信息") -public class TagFieldInfo { - - @ApiModelProperty("标签字段名称") - private String tagFieldName; - - @ApiModelProperty("标签字段code") - private String tagCode; - - @ApiModelProperty(value = "标签code含义", required = false) - private String tagName; -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java deleted file mode 100644 index bb0e530..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/bo/ExpertInfoSensitiveFieldCheckBO.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ningdatech.pmapi.expert.model.bo; - - -import com.ningdatech.pmapi.expert.constant.ExpertSensitiveFieldTypeEnum; -import com.ningdatech.pmapi.expert.model.SensitiveModifySegment; -import lombok.Data; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/28 上午11:18 - */ -@Data -public class ExpertInfoSensitiveFieldCheckBO { - - private Boolean hasModify; - - /** - * 专家敏感信息是否修改 - */ - private Boolean isExpertSensitiveInfoModify; - - /** - * 专家敏感信息原值和申请值 - */ - private List expertSensitiveInfoFieldSegmentList; - - /** - * 专家层级是否修改 - */ - private Boolean isExpertRegionModify; - /** - * 专家层级修改原值和申请值 - */ - private List expertRegionFieldSegmentList; - - /** - * 专家履职意向是否修改 - */ - private Boolean isExpertIntentionModify; - - /** - * 专家履职意向修改原值和申请值 - */ - private List expertIntentionFieldSegmentList; - - public ExpertInfoSensitiveFieldCheckBO(List sensitiveModifySegmentList) { - Map> collect = sensitiveModifySegmentList - .stream().collect(Collectors.groupingBy(SensitiveModifySegment::getFieldType)); - - this.expertSensitiveInfoFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_sensitive_info_field); - if (CollectionUtils.isEmpty(expertSensitiveInfoFieldSegmentList)) { - this.expertSensitiveInfoFieldSegmentList = new ArrayList<>(); - } - this.isExpertSensitiveInfoModify = SensitiveModifySegment.isModify(expertSensitiveInfoFieldSegmentList); - - this.expertRegionFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_region_field); - if (CollectionUtils.isEmpty(expertRegionFieldSegmentList)) { - this.expertRegionFieldSegmentList = new ArrayList<>(); - } - this.isExpertRegionModify = SensitiveModifySegment.isModify(expertRegionFieldSegmentList); - - this.expertIntentionFieldSegmentList = collect.get(ExpertSensitiveFieldTypeEnum.expert_intention_field); - if (CollectionUtils.isEmpty(expertIntentionFieldSegmentList)) { - this.expertIntentionFieldSegmentList = new ArrayList<>(); - } - this.isExpertIntentionModify = SensitiveModifySegment.isModify(expertIntentionFieldSegmentList); - - this.hasModify = this.isExpertSensitiveInfoModify || this.isExpertRegionModify || this.isExpertIntentionModify; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java deleted file mode 100644 index 322291f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java +++ /dev/null @@ -1,37 +0,0 @@ -//package com.ningdatech.pmapi.expert.model.cmd; -// -//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO; -//import com.ningdatech.emapi.expert.entity.dto.*; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/7/28 下午2:43 -// */ -//@Data -//public class AdminModifyExpertInfoCmd { -// -// private Long userId; -// -// private ExpertUserFullInfoDTO expertUserInfoDTO; -// -// private List expertDictionaryList; -// -// private List expertTagList; -// -// /** -// * 专家履职意向(区域编码) -// */ -// private List expertIntentionWorkRegionInfo; -// -// /** -// * 回避单位列表 -// */ -// private List expertAvoidCompanyList; -// -// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; -// -// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; -//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java deleted file mode 100644 index 7b00fbc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - - -import com.ningdatech.pmapi.common.model.CommonPageReq; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; -import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:11 - */ -@Data -public class ExpertAdminExpertManageQueryCmd extends CommonPageReq { - - @ApiModelProperty("专家姓名(精准匹配)") - private String expertName; - - @ApiModelProperty("工作单位(模糊匹配)") - private String company; - - @ApiModelProperty("专家账号状态") - private List expertAccountStatusList; - - /** - * 区域编码 - */ - @ApiModelProperty("区域编码") - private String regionCode; - - /** - * 区域级别 - */ - @ApiModelProperty("区域级别") - private Integer regionLevel; - - /** - * 专家管理区域范围 - */ - List regionContainsList; - - /** - * 专家履职意向地区域范围 - */ - List intentionRegionList; - - /** - * 专家字典信息 - */ - private List expertDictionaryQueryList; - - /** - * 专家标签信息 - */ - private List expertTagQueryList; - - /** - * 是否为钉用户 - */ - private Boolean isDingUser; - - /** - * 无数据可供查询 - */ - private transient boolean hasNonData = false; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java deleted file mode 100644 index ece2d3c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/26 下午6:28 - * 专家出库审核处理cmd - */ -@Data -public class ExpertDeliveryDealCmd { - - private Long expertUserId; - - private Boolean applyResult; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java deleted file mode 100644 index c2d0b51..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import com.ningdatech.pmapi.expert.model.dto.*; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午4:41 - */ -@Data -public class ExpertFullInfoSaveCmd { - - private Long userId; - - private ExpertUserFullInfoDTO expertUserInfoDTO; - - private List expertDictionaryList; - - private List expertTagList; - - /** - * 专家履职意向(区域编码) - */ - private List expertIntentionWorkRegionInfo; - - /** - * 回避单位列表 - */ - private List expertAvoidCompanyList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java deleted file mode 100644 index dc09f5a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/28 下午5:35 - */ -@Data -public class ExpertInfoModifyApplyDealCmd { - - private Long expertUserId; - - private Boolean applyResult; - - private Long applyId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java deleted file mode 100644 index f13c1ed..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - - -import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; -import com.ningdatech.pmapi.expert.model.dto.*; -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午2:43 - */ -@Data -public class ExpertInfoModifyCmd { - - private Long userId; - - private ExpertUserFullInfoDTO expertUserInfoDTO; - - private List expertDictionaryList; - - private List expertTagList; - - /** - * 专家履职意向(区域编码) - */ - private List expertIntentionWorkRegionInfo; - - /** - * 回避单位列表 - */ - private List expertAvoidCompanyList; - - private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; - - private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; - - private List businessStrips; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java deleted file mode 100644 index a9787e2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/27 上午9:06 - */ -@Data -public class ExpertIntentionApplyDealCmd { - - private Long expertUserId; - - private Boolean applyResult; - - ExpertApplyTypeEnum applyTypeEnum; - - private String expertRegionCode; - - private Integer expertRegionLevel; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java deleted file mode 100644 index 91b5b9f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午4:59 - */ -@Data -public class ExpertRecommendProofSaveCmd { - - - private Long userId; - - private List recommendationProofFileIdList; - - private List recommendedWay; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java deleted file mode 100644 index d615e19..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - - -import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/26 下午5:40 - */ -@Data -public class ExpertStorageDealCmd { - - private Long expertUserId; - - private Boolean applyResult; - - private String joinRegionCode; - - private Integer joinRegionLevel; - - /** - * 专家类型(内外围) - */ - private List expertType; - - /** - * 其他标签(标签code) - */ - private List other; - - private String remark; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java deleted file mode 100644 index 85a495c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.expert.model.cmd; - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/26 下午2:35 - */ -@Data -@ApiModel("申请列表查询请求") -public class MetaApplyListQuery extends PagePo { - - @ApiModelProperty("审核类型") - private List applyTypeList; - - @ApiModelProperty("审核结果") - private List applyStatusList; - - @ApiModelProperty("工作单位") - private String companyName; - - @ApiModelProperty("专家姓名") - private String expertName; - - @ApiModelProperty("职称级别字典编码") - private String titleLevelDictionaryCode; - - @ApiModelProperty("专家层级") - private ExpertRegionInfo expertRegionInfo; - - @ApiModelProperty("筛选开始时间") - private LocalDateTime applyStartTime; - - @ApiModelProperty("筛选结束时间") - private LocalDateTime applyEndTime; - - @ApiModelProperty("专家类型") - private DictionaryFieldInfo expertType; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java deleted file mode 100644 index 1408d93..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java +++ /dev/null @@ -1,60 +0,0 @@ -//package com.ningdatech.pmapi.expert.model.cmd; -// -//import com.ningdatech.emapi.expert.entity.dto.ExpertAdminRegionDTO; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/8/1 上午10:54 -// */ -//@Data -//public class SaveExpertAdminCmd { -// -// /** -// * 用户id -// */ -// private Long userId; -// -// /** -// * 是否浙政钉用户Y/N -// */ -// private Boolean isDingUser; -// -// /** -// * 手机号 -// */ -// private String phoneNo; -// -// /** -// * 用户名称 -// */ -// private String name; -// -// /** -// * 工作单位 -// */ -// private String company; -// -// /** -// * 公司唯一标识 -// */ -// private String companyUniqCode; -// -// /** -// * 层级 -// */ -// private List regionInfoList; -// -// /** -// * 用户状态(启用/关闭) -// */ -// private Boolean isEnable; -// -// /** -// * 操作者id -// */ -// private Long operatorId; -// -//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java deleted file mode 100644 index 84c1b62..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.expert.model.constant; - -/** - *

- * ExpertAuditMsgTemplate - *

- * - * @author WendyYang - * @since 2023/8/7 - **/ -public interface ExpertAuditMsgTemplate { - - /** - * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请未通过,如有疑问请联系xxx确认。 - */ - String EXPERT_AUDIT_FAIL = "尊敬的%s专家您好,您提交的专家入库申请未通过,如有疑问请联系%s「%s」确认。"; - - /** - * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请已通过,请登录http://60.188.225.145/login查看,如有疑问请联系xxx。 - */ - String EXPERT_AUDIT_PASS = "尊敬的%s专家您好,您提交的专家入库申请已通过,请登录%s查看,如有疑问请联系%s「%s」。"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java deleted file mode 100644 index 0d9b62d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - - -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:36 - */ -@Data -public class ExpertAdminExpertManageListDTO { - - /** - * 用户id - */ - private Long userId; - - /** - * 专家姓名 - */ - private String expertName; - - /** - * 工作单位 - */ - private String company; - - /** - * 单位属性(字典code) - */ - private List companyAttribute; - - /** - * 专家联系方式 - */ - private String phoneNo; - - /** - * 性别 - */ - private String gender; - - /** - * 出生日期 - */ - private LocalDateTime birth; - - /** - * 籍贯 - */ - private String hometown; - - /** - * 民族 - */ - private String nationality; - - /** - * 政治面貌(字典code) - */ - private List political; - - /** - * 身份证号码 - */ - private String idCard; - - /** - * 专家层级 - */ - private ExpertRegionInfo expertRegionInfo; - - /** - * 银行卡号 - */ - private String bankNo; - - /** - * 开户银行 - */ - private String bank; - - /** - * 学历(字典code) - */ - private List edu; - - /** - * 学位(字典code) - */ - private List degree; - - /** - * 职称级别 - */ - private List titleLevel; - - /** - * 推荐方式 - */ - private List recommendedWay; - - /** - * 单位法人编号 - */ - private String legalEntityCode; - - /** - * 专家类型(内外围) - */ - private List expertType; - - /** - * 是否浙政钉用户 - */ - private Boolean isDingUser; - - /** - * 账号状态 - */ - private String expertAccountStatus; - - /** - * 专家来源 - */ - private List expertSource; - - /** - * 创建时间 - */ - private LocalDateTime createTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java deleted file mode 100644 index d1b6a5d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/25 下午5:14 - */ -@Data -public class ExpertAvoidCompanyDTO { - /** - * 公司名称 - */ - private String companyName; - - /** - * 公司唯一标识 - */ - private String companyUniqCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java deleted file mode 100644 index 865332c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 下午5:13 - */ -@Data -public class ExpertDictionaryDTO { - - /** - * 字典编码 - */ - private String dictionaryCode; - - /** - * 手机对应专家信息字段号 - * 政治面貌 political - * 专家来源 expert_source - * 学历 edu - * 学位 degree - * 在职状态 job_status - * 行政职级 administrative_rank - * 内外围(专家类型) expert_type - * 单位类型 company_attribute - * 职称级别 title_level - */ - private String expertInfoField; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java deleted file mode 100644 index 0613820..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/27 上午10:22 - * 专家全量信息表,包含履职意向,专家字典信息,专家标签信息,回避单位信息 - */ -@Data -public class ExpertFullInfoAllDTO { - - private Long userId; - - private ExpertUserFullInfoDTO expertUserInfoDTO; - - private List expertDictionaryList; - - private List expertTagList; - - /** - * 专家履职意向(区域编码) - */ - private List expertIntentionWorkRegionInfo; - - /** - * 专家申请履职意向展示列表 - */ - private List expertApplyIntentionWorkRegionInfo; - - /** - * 回避单位列表 - */ - private List expertAvoidCompanyList; - - private List businessStrips; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java deleted file mode 100644 index 8b3f3a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 下午5:10 - */ -@Data -public class ExpertRegionDTO { - - private String regionCode; - private Integer regionLevel; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java deleted file mode 100644 index f5e048e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 下午5:13 - */ -@Data -public class ExpertTagDTO { - - /** - * 标签code - */ - private String tagCode; - - /** - * 对应专家信息字段 - */ - private String expertInfoField; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java deleted file mode 100644 index 60fca6e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午4:43 - */ -@Data -public class ExpertUserFullInfoDTO { - - private Long id; - - /** - * 用户id - */ - private Long userId; - - /** - * 专家账号状态 - */ - private String expertAccountStatus; - - /** - * 是否浙政钉用户Y/N - */ - private Boolean isDingUser; - - /** - * 专家信息提交步骤 - * 0,1,2 - * 0 :待提交信息
1: 已提交基本信息
2:已提交推荐证明 - */ - private Integer userInfoStep; - - /** - * 手机号 - */ - private String phoneNo; - - /** - * 性别 - * 0,1
女,男 - */ - private String gender; - - /** - * 姓名 - */ - private String name; - - /** - * 免冠照图片文件地址 - */ - private Long avatarFileId; - - /** - * 身份证号码 - */ - private String idCard; - - /** - * 办公电话 - */ - private String officePhone; - - /** - * 出生日期 - */ - private LocalDateTime birth; - - /** - * 银行卡号 - */ - private String bankNo; - - /** - * 开户银行 - */ - private String bank; - - /** - * 电子邮箱 - */ - private String email; - - /** - * 毕业院校 - */ - private String school; - - /** - * 毕业时间 - */ - private LocalDateTime graduatedAt; - - /** - * 所学专业 - */ - private String academicTitle; - - /** - * 毕业证 文件id - */ - private List graduationCertificateFileIdList; - - /** - * 学位证 文件id - */ - private List degreeCertificateFileIdList; - - /** - * 退休时间 - */ - private LocalDateTime retiredAt; - - /** - * 工作单位 - */ - private String company; - - /** - * 工作单位前端使用标识 - */ - private String companyUniqCode; - - /** - * 单位法人编号 - */ - private String legalEntityCode; - - /** - * 行政职务 - */ - private String administrativeDuties; - - /** - * 开始工作时间 - */ - private LocalDateTime startWorkAt; - - /** - * 工作地址 - */ - private String address; - - /** - * 工作经历 - */ - private String experience; - - /** - * 技术职称 - */ - private String technicalTitles; - - /** - * 职称证明 - * 文件id - */ - private List titleCertificateFileIdList; - - /** - * 获奖情况 - */ - private String awards; - - /** - * 表彰奖励 - */ - private String recognitionReward; - - /** - * 推荐证明材料文件id - */ - private List recommendationProofFileIdList; - - /** - * 专家层级(区域编码) - */ - private String regionCode; - - /** - * 区域级别 - */ - private Integer regionLevel; - - /** - * 专家管理员审核备注 - */ - private String remark; - - /** - * 籍贯 - */ - private String hometown; - - /** - * 民族 - */ - private String nationality; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ModifyApplyExtraInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ModifyApplyExtraInfoDTO.java deleted file mode 100644 index 082c5fc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ModifyApplyExtraInfoDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/28 下午3:48 - */ -@Data -public class ModifyApplyExtraInfoDTO { - /** - * 情况说明 - */ - @NotBlank - private String factSheet; - - /** - * 证明材料 - */ - private List evidenceList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateOptionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateOptionDTO.java deleted file mode 100644 index b4637ca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateOptionDTO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * ReviewTemplateOptionVO - *

- * - * @author WendyYang - * @since 16:12 2023/2/15 - */ -@Data -@Builder -public class ReviewTemplateOptionDTO { - - @Tolerate - public ReviewTemplateOptionDTO() { - } - - @ApiModelProperty("问题序号") - @NotNull(message = "问题序号不能为空") - private Integer questionSerialNo; - - @ApiModelProperty("选项序号") - @NotEmpty(message = "选项序号不能为空") - private List optionSerialNo; - - @ApiModelProperty("其他意见或建议") - private String otherAdvice; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateSettingsDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateSettingsDTO.java deleted file mode 100644 index 9321e0e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ReviewTemplateSettingsDTO.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.expert.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * ReviewTemplateSettingsDTO - *

- * - * @author WendyYang - * @since 17:06 2023/2/14 - */ -@Data -public class ReviewTemplateSettingsDTO { - - @ApiModelProperty("序号") - @NotNull(message = "序号不能为空") - private Integer serialNo; - - @ApiModelProperty("标题") - @NotBlank(message = "标题不能为空") - private String title; - - @Valid - @ApiModelProperty("选项") - @NotEmpty(message = "选项不能为空") - private List options; - - @ApiModelProperty("选择类型:1 单选、2 多选") - @NotNull(message = "选择类型不能为空") - private Integer optionType; - - @Data - @ApiModel("选项实体") - public static class OptionDTO { - - @ApiModelProperty("序号") - @NotNull(message = "序号不能为空") - private Integer serialNo; - - @ApiModelProperty("选项内容") - @NotBlank(message = "选项内容不能为空") - private String option; - - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ExpertReview.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ExpertReview.java deleted file mode 100644 index 99d0efe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ExpertReview.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.expert.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 WendyYang - * @since 2023-02-15 - */ -@Data -@TableName("nd_expert_review") -@ApiModel(value = "ExpertReview对象", description = "专家评价") -public class ExpertReview implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - private String projectCode; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("评审模版配置ID") - private Long templateId; - - @ApiModelProperty("评审内容") - private String content; - - @ApiModelProperty("意见或建议") - private String otherAdvice; - - @ApiModelProperty("附件ID") - private Long attachFileId; - - @ApiModelProperty("评审结果") - private Integer reviewResult; - - @ApiModelProperty("创建人姓名") - private String creator; - - @ApiModelProperty("创建人") - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("修改人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("是否是最终意见") - private Boolean isFinal; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java deleted file mode 100644 index f0fea2f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.expert.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 WendyYang - * @since 2023-02-14 - */ -@Data -@TableName("nd_review_template_settings") -@ApiModel(value = "NdReviewTemplateSettings对象", description = "评审模版配置表") -public class ReviewTemplateSettings implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("模版类型:1 初步方案评审模版、2 建设方案评审模版、3 验收方案评审模版") - private Integer templateType; - - @ApiModelProperty("模版内容") - private String content; - - @ApiModelProperty("是否是最新") - private Boolean isLast; - - @ApiModelProperty("区域编码") - private String regionCode; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/enumeration/ReviewTemplateTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/enumeration/ReviewTemplateTypeEnum.java deleted file mode 100644 index 5cf394c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/enumeration/ReviewTemplateTypeEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.expert.model.enumeration; - -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * ReviewTemplateTypeEnum - *

- * - * @author WendyYang - * @since 09:48 2023/2/15 - */ -@Getter -public enum ReviewTemplateTypeEnum { - /** - * 评审模版类型 - */ - PRELIMINARY_SCHEME_REVIEW("初步方案评审", 1), - - CONSTRUCTION_SCHEME_REVIEW("建设方案评审", 2), - - ACCEPTANCE_SCHEME_REVIEW("验收方案评审", 3), - - DEPT_JOIN_REVIEW("部门联审", 4), - - FAIRNESS_REVIEW("公平性审查", 5); - - private final String value; - private final Integer code; - - ReviewTemplateTypeEnum(String value, Integer code) { - this.value = value; - this.code = code; - } - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - public static ReviewTemplateTypeEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("评审模版类型编码无效")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java deleted file mode 100644 index 0220b2f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.expert.model.query; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/5 上午11:16 - */ -@Data -public class ExpertDictionaryQuery { - - private String expertInfoField; - - private List dictionaryCodeList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java deleted file mode 100644 index 164ba63..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.expert.model.query; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/5 上午11:16 - */ -@Data -public class ExpertTagQuery { - - private String expertInfoField; - - private List tagCodeList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java deleted file mode 100644 index 975b9a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.expert.model.query; - -import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/5 上午10:52 - */ -@Data -public class ListExpertQuery { - - private Integer limit; - private Integer offset; - - /** - * 专家姓名(精准匹配) - */ - private String expertName; - - /** - * 工作单位(模糊匹配) - */ - private String company; - - /** - * 专家账号状态 - */ - private List expertAccountStatusList; - - /** - * 区域编码 - */ - private String regionCode; - - /** - * 区域级别 - */ - private Integer regionLevel; - - /** - * 专家管理区域范围 - */ - List regionContainsList; - /** - * 专家管理区域范围 - */ - List intentionRegionList; - - /** - * 专家字典信息 - */ - private List expertDictionaryQueryList; - - /** - * 专家标签信息 - */ - private List expertTagQueryList; - - private Boolean isDingUser; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/AdminExpertBasicInfoModifyRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/AdminExpertBasicInfoModifyRequest.java deleted file mode 100644 index 43342ad..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/AdminExpertBasicInfoModifyRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - - -import com.ningdatech.pmapi.expert.model.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - * @author liuxinxin - * @date 2022/8/19 下午6:40 - */ -@Data -@ApiModel("专家管理员专家信息更新请求") -public class AdminExpertBasicInfoModifyRequest { - - @ApiModelProperty("专家用户id") - private Long expertUserId; - - @NotNull - @ApiModelProperty("基本信息") - private ExpertBasicInfo basicInfo; - - @NotNull - @ApiModelProperty("学历信息") - private ExpertEduInfo eduInfo; - - @NotNull - @ApiModelProperty("职业信息") - private ExpertJobInfo jobInfo; - - @NotNull - @ApiModelProperty("专业信息") - private ExpertProfessionalInfo professionalInfo; - - @NotNull - @ApiModelProperty("推荐信息") - private ExpertRecommendInfo recommendInfo; - - @ApiModelProperty("其他信息") - private ExpertOtherInfo expertOtherInfo; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java deleted file mode 100644 index 67c4ba4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:21 - */ -@Data -@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "社会专家报名接口") -public class ExpertRegistrationRequest extends ExpertUserBasicInfoSubmitRequest { - - @NotBlank(message = "手机验证码不能为空") - @ApiModelProperty("手机验证码") - private String verificationCode; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertReviewDetailReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertReviewDetailReq.java deleted file mode 100644 index b0e4696..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertReviewDetailReq.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * ExpertReviewDetailVO - *

- * - * @author WendyYang - * @since 14:37 2023/2/15 - */ -@Data -public class ExpertReviewDetailReq { - - @ApiModelProperty("模版ID") - @NotNull(message = "模版ID不能为空") - private Long templateId; - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("项目编号") - @NotNull(message = "项目编号不能为空") - private String projectCode; - - @ApiModelProperty("会议ID") - @NotNull(message = "会议ID不能为空") - private Long meetingId; - - @Valid - @ApiModelProperty("配置模版") - @NotEmpty(message = "配置不能为空") - private List reviewTemplateOptions; - - @ApiModelProperty("其他意见或建议") - @NotEmpty(message = "其他意见或建议不能为空") - private String otherAdvice; - - @ApiModelProperty("附件ID") - private Long attachFileId; - - @ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") - @NotNull(message = "评审结果不能为空") - private Integer reviewResult; - - @ApiModelProperty("是否是最终意见") - @NotNull(message = "是否是最终意见不能为空") - private Boolean isFinal; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java deleted file mode 100644 index a242853..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import com.ningdatech.pmapi.expert.model.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:21 - */ -@Data -@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "专家基本信息填写入参") -public class ExpertUserBasicInfoSubmitRequest { - - @NotNull - @ApiModelProperty("基本信息") - private ExpertBasicInfo basicInfo; - - @NotNull - @ApiModelProperty("学历信息") - private ExpertEduInfo eduInfo; - - @NotNull - @ApiModelProperty("职业信息") - private ExpertJobInfo jobInfo; - - @NotNull - @ApiModelProperty("专业信息") - private ExpertProfessionalInfo professionalInfo; - - /** - * 补充推荐方式 - */ - @NotNull - @ApiModelProperty("推荐信息") - private ExpertRecommendInfo recommendInfo; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/GetZzdInfoRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/GetZzdInfoRequest.java deleted file mode 100644 index 9ee3f8d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/GetZzdInfoRequest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/8/29 下午2:54 - */ -@Data -@ApiModel(description = "通过手机号获取浙政钉信息请求") -public class GetZzdInfoRequest { - - @NotBlank - @ApiModelProperty("手机号") - private String phoneNo; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java deleted file mode 100644 index 5272f6f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.validation.annotation.Validated; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/26 下午4:20 - * 申请结果请求基类 - */ -@Data -@Validated -public class MetaApplyResultRequest { - - @NotNull - @ApiModelProperty("申请id") - private Long applyId; - - @NotNull - @ApiModelProperty("审核结果") - private Boolean applyResult; - - @ApiModelProperty("审核意见") - private String auditOpinion; - - @ApiModelProperty("入库审核额外参数,只有入库审核结果审批才需要填写") - private StorageApplyResultExtraInfo storageApplyResultExtraInfo; - - - @Data - @ApiModel("入库审核额外参数") - public static class StorageApplyResultExtraInfo { - @ApiModelProperty("专家类型-内外围") - private List expertType; - - @ApiModelProperty("其他标签(标签code)") - private List other; - - @ApiModelProperty("备注") - private String remark; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ReviewTemplateReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ReviewTemplateReq.java deleted file mode 100644 index 660f7a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ReviewTemplateReq.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.expert.model.req; - -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * ReviewTemplateReq - *

- * - * @author WendyYang - * @since 10:11 2023/2/15 - */ -@Data -public class ReviewTemplateReq { - - @ApiModelProperty("模版类型") - @NotNull(message = "模版类型不能为空") - private Integer templateType; - - @ApiModelProperty("区域编码") - @NotBlank(message = "不能在根节点添加") - private String regionCode; - - @Valid - @NotEmpty(message = "模版不能为空") - @ApiModelProperty("模版数据") - private List templates; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java deleted file mode 100644 index 4bf848e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - - -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:04 - */ -@Data -@ApiModel("专家库列表查询返回model") -public class ExpertAdminExpertManageListVO { - - @ApiModelProperty(value = "用户id") - private Long userId; - - @ApiModelProperty(value = "专家姓名") - private String expertName; - - @ApiModelProperty(value = "职称级别") - private List titleLevel; - - @ApiModelProperty("工作单位") - private String company; - - @ApiModelProperty(" 单位法人编号") - private String legalEntityCode; - - @ApiModelProperty("单位类型(字典code)") - private List companyAttribute; - - @ApiModelProperty(value = "手机号") - private String phoneNo; - - @ApiModelProperty(value = "专家类型(内外围)") - private List expertType; - - @ApiModelProperty(value = "专家层级") - private ExpertRegionInfo expertRegionInfo; - - @ApiModelProperty(value = "是否浙政钉用户") - private Boolean isDingUser; - - @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") - private String expertAccountStatus; - - @ApiModelProperty(value = "专家来源") - private List expertSource; - - @ApiModelProperty(value = "创建时间") - private LocalDateTime createTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java deleted file mode 100644 index b86e76b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/26 上午11:17 - * 专家审核列表展示VO基础类 - */ -@Data -@ApiModel("审核列表展示VO") -public class ExpertApplyMetaVO { - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("用户id") - private Long userId; - - /** - * 审核结果 - */ - @ApiModelProperty("审核结果") - private String applyStatus; - - /** - * 审核类型 - */ - @ApiModelProperty("审核类型") - private String applyType; - - /** - * 专家姓名 - */ - @ApiModelProperty("专家姓名") - private String name; - - /** - * 专家层级 - */ - @ApiModelProperty("专家层级") - private ExpertRegionInfo expertRegionInfo; - - /** - * 职称级别 - */ - @ApiModelProperty("职称级别") - private List titleLevel; - - /** - * 工作单位 - */ - @ApiModelProperty("工作单位") - private String company; - - /** - * 手机号 - */ - @ApiModelProperty("手机号") - private String phoneNo; - - /** - * 申请时间 - */ - @ApiModelProperty("申请时间") - private LocalDateTime applyTime; - - @ApiModelProperty("专家类型") - private List expertType; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertBasicInfoModifyResultVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertBasicInfoModifyResultVO.java deleted file mode 100644 index db79252..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertBasicInfoModifyResultVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author liuxinxin - * @date 2022/7/27 下午4:29 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -@ApiModel("专家信息修改是否需要额外材料") -public class ExpertBasicInfoModifyResultVO { - - /** - * 是否需要提交额外材料 - */ - @ApiModelProperty("是否需要额外材料-涉及修改需要审核数据需要提供额外材料") - private Boolean needExtraInfo; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java deleted file mode 100644 index c3047bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import com.ningdatech.pmapi.expert.model.*; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/25 下午1:43 - */ -@Data -@ApiModel("专家全量信息") -public class ExpertFullInfoVO { - - @ApiModelProperty("专家用户id") - private Long userId; - - @ApiModelProperty("基本信息") - private ExpertBasicInfo basicInfo; - - @ApiModelProperty("学历信息") - private ExpertEduInfo eduInfo; - - @ApiModelProperty("职业信息") - private ExpertJobInfo jobInfo; - - @ApiModelProperty("专业信息") - private ExpertProfessionalInfo professionalInfo; - - @ApiModelProperty("推荐信息") - private ExpertRecommendInfo recommendInfo; - - @ApiModelProperty("其他信息") - private ExpertOtherInfo expertOtherInfo; - - @NotEmpty - @ApiModelProperty("专家申请履职意向展示列表") - private List expertApplyIntentionWorkRegions; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java deleted file mode 100644 index be22bc6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * ExpertReviewDetailVO - *

- * - * @author WendyYang - * @since 14:37 2023/2/15 - */ -@Data -@Builder -public class ExpertReviewDetailVO { - - @Tolerate - public ExpertReviewDetailVO() { - } - - @ApiModelProperty("模版ID") - private Long templateId; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("配置模版") - private List reviewTemplateOptions; - - @ApiModelProperty("其他意见或建议") - private String otherAdvice; - - @ApiModelProperty("附件ID") - private Long attachFileId; - - @ApiModelProperty("附件详情") - private AttachFileVo attachFile; - - @ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") - private Integer reviewResult; - - @ApiModelProperty("是否是最终意见") - private Boolean isFinal; - - @ApiModelProperty("评审时间") - private LocalDateTime createOn; - - @ApiModelProperty("专家名称") - private String creator; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java deleted file mode 100644 index fae2507..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - *

- * LeaveAuditInfoVo - *

- * - * @author WendyYang - * @since 13:46 2022/8/12 - */ -@Data -@Builder -@ApiModel("审核详情返回参数") -public class MetaApplyResultVo { - - @ApiModelProperty("审核人") - private String auditor; - - @ApiModelProperty("审核时间") - private LocalDateTime auditTime; - - @ApiModelProperty("审核意见") - private String auditOption; - - @ApiModelProperty("审核状态") - private String auditStatus; - - @ApiModelProperty("申请时间") - private LocalDateTime applyTime; - - @ApiModelProperty("申请类型") - private String applyType; - - @ApiModelProperty("专家用户userId") - private Long expertUserId; - -// @ApiModelProperty("额外的材料") -// private ModifyApplyExtraInfo modifyApplyExtraInfo; -// -// @ApiModelProperty("信息修改申请展示列表-只有审核类型为信息变更审核时才有值") -// private InfoModifyApplyDisplayVO infoModifyApplyDisplayVo; - - @ApiModelProperty("履职意向修改申请展示列表-只有审核类型为履职意向变更时才会有值") - private IntentionApplyDisplayVO intentionApplyDisplayVo; - - - @Data - @ApiModel("履职意向修改申请展示列表") - public static class IntentionApplyDisplayVO { - - @ApiModelProperty("审核申请id") - private Long expertApplyId; - - @ApiModelProperty("履职意向增加") - private ExpertRegionInfo addExpertRegion; - - @ApiModelProperty("履职意向减少") - private ExpertRegionInfo reduceExpertRegion; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ProjectReviewDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ProjectReviewDetailVO.java deleted file mode 100644 index 8bb3919..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ProjectReviewDetailVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Collection; -import java.util.List; - -/** - *

- * ProjectExpertReviewDetailVO - *

- * - * @author WendyYang - * @since 2023/4/19 - **/ -@Data -public class ProjectReviewDetailVO { - - @ApiModelProperty("评审模版详情") - private Collection templates; - - private Collection reviews; - - @Data - public static class ReviewDetailByTypeVO { - - @ApiModelProperty("评审类型") - private Integer reviewType; - - @ApiModelProperty("最终评审意见") - private ExpertReviewDetailVO finalReview; - - @ApiModelProperty("组员评审意见") - private List teamMemberReviews; - - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ReviewTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ReviewTemplateVO.java deleted file mode 100644 index f887fb4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ReviewTemplateVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * ReviewTemplateReq - *

- * - * @author WendyYang - * @since 10:11 2023/2/15 - */ -@Data -@Builder -public class ReviewTemplateVO { - - @ApiModelProperty("模版ID") - private Long templateId; - - @ApiModelProperty("模版类型") - private Integer templateType; - - @ApiModelProperty("模版数据") - private List templates; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ZzdInfoByMobileVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ZzdInfoByMobileVO.java deleted file mode 100644 index 2db6d40..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ZzdInfoByMobileVO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.expert.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/29 下午3:21 - */ -@Data -@ApiModel("通过浙政钉获取手机号数据展示VO") -public class ZzdInfoByMobileVO { - - @ApiModelProperty("手机号") - private String phoneNo; - - @ApiModelProperty("公司名") - private String companyName; - - @ApiModelProperty("姓名") - private String name; - - @ApiModelProperty("是否是浙政钉用户") - private Boolean isDingUser; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java deleted file mode 100644 index cea8862..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - - -import com.ningdatech.pmapi.common.model.CommonPage; -import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; -import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/8/4 上午11:32 - */ -public interface ExpertAdminManageService { - - /** - * 专家库条件筛选(管理员使用) - * - * @param expertAdminExpertManageQueryCmd - * @return - */ - CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); - - - /** - * 获取所有符合查询条件的专家user_id - * - * @param expertAdminExpertManageQueryCmd - * @return - */ - List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java deleted file mode 100644 index 4908125..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.ningdatech.pmapi.expert.model.cmd.*; -import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午4:39 - */ - -public interface ExpertInfoService { - - void saveExpertInfo(ExpertFullInfoSaveCmd cmd); - - /** - * 专家报名提交 推荐证明材料 - * - * @param expertRecommendProofSaveCmd - */ - Long expertRecommendProofSave(ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd); - - void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd); - - - /** - * 专家信息修改审核结果处理 - * - * @param expertInfoModifyApplyDealCmd \ - */ - void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd); - - /** - * 根据user_id 获取用户全量信息 - * - * @param userId \ - * @return \ - */ - ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId); - - /** - * 专家入库审核处理 - * - * @param cmd \ - **/ - void expertStorageDeal(ExpertStorageDealCmd cmd); - - - /** - * 批量获取用户全量信息 - **/ - List listExpertUserFullInfoAll(List userIds); - - - /** - * 管理员修改专家信息 - */ - List adminModifyExpertInfo(ExpertInfoModifyCmd cmd, Long adminUserId); - -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java deleted file mode 100644 index 5bb31b9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-23 - */ -public interface IExpertAvoidCompanyService extends IService { - - default void removeByUserId(Long userId) { - remove(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java deleted file mode 100644 index 7174149..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-04-17 - */ -public interface IExpertGovBusinessStripService extends IService { - - default List listByUserIds(Collection userIds) { - LambdaQueryWrapper query = Wrappers - .lambdaQuery(ExpertGovBusinessStrip.class) - .in(ExpertGovBusinessStrip::getExpertUserId, userIds); - return list(query); - } - - default boolean removeByUserId(Long userId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertGovBusinessStrip.class) - .eq(ExpertGovBusinessStrip::getExpertUserId, userId); - return remove(query); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java deleted file mode 100644 index b597d54..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertIntentionWorkRegionService extends IService { - - /** - * 根据履职意向地或许满足履职意向地的用户ID集合 - * - * @param regionCode regionCode - * @param regionLevel regionLevel - * @return java.util.List - * @author WendyYang - **/ - List userIdsMatchIntentionRegion(String regionCode, Integer regionLevel); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java deleted file mode 100644 index e9dcba1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-03-01 - */ -public interface IExpertMetaApplyService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java deleted file mode 100644 index 3a77c52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; -import java.util.Map; - -/** - *

- * 服务类 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -public interface IExpertReviewService extends IService { - - /** - * 根据项目ID和专家ID获取评审记录 - * - * @param projectId 项目ID - * @param expertId 专家ID - * @param meetingId 会议ID - * @return 评审记录 - * @author WendyYang - **/ - List listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId); - - /** - * 获取最终评审结果 - * - * @param meetingId 会议ID - * @param projectId 项目ID - * @return {@link ExpertReview} - * @author WendyYang - **/ - ExpertReview getFinalReview(Long meetingId, Long projectId); - - /** - * 获取最终评审结果 - * - * @param meetingId 会议ID - * @return {@link ExpertReview} - * @author WendyYang - **/ - Map listFinalReviewMap(Long meetingId); - - /** - * 获取最终评审结果 - * - * @param meetingId 会议ID - * @return {@link ExpertReview} - * @author WendyYang - **/ - List listFinalReview(Long meetingId); - - /** - * 查某个项目 某一个 阶段的 最终会议 - * @param meetingType - * @return - */ - ExpertReview getFinalReview(String projectCode,Integer meetingType); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java deleted file mode 100644 index 1e7b5db..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertSensitiveInfoModifyDetailRecordService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.ningdatech.pmapi.expert.entity.ExpertSensitiveInfoModifyDetailRecord; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -public interface IExpertSensitiveInfoModifyDetailRecordService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java deleted file mode 100644 index 129e68b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -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.service.IService; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertUserFullInfoService extends IService { - - - /** - * 查询用户信息 - * - * @param userId 用户ID - * @return / - **/ - ExpertUserFullInfo getByUserId(Long userId); - - /** - * 查询用户信息 - * - * @param userId 用户ID - * @return / - **/ - List listByUserId(List userId); - - - /** - * 批量查询专家用户信息 - * - * @param userIds 用户ID - * @return / - */ - List listByUserIds(List userIds); - - default List listCompanyUniqCodeByUserIds(Collection userIds) { - LambdaQueryWrapper query = Wrappers - .lambdaQuery(ExpertUserFullInfo.class) - .select(ExpertUserFullInfo::getCompanyUniqCode) - .in(ExpertUserFullInfo::getUserId, userIds); - return CollUtils.fieldList(list(query), ExpertUserFullInfo::getCompanyUniqCode); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IReviewTemplateSettingsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IReviewTemplateSettingsService.java deleted file mode 100644 index fcf043f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IReviewTemplateSettingsService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.expert.service; - -import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 评审模版配置表 服务类 - *

- * - * @author WendyYang - * @since 2023-02-14 - */ -public interface IReviewTemplateSettingsService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java deleted file mode 100644 index e846c9b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.model.CommonPage; -import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.mapper.ExpertAdminManageMapper; -import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; -import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; -import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; -import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; -import com.ningdatech.pmapi.expert.model.query.ListExpertQuery; -import com.ningdatech.pmapi.expert.service.ExpertAdminManageService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/3/10 上午10:37 - */ -@Service -@RequiredArgsConstructor -public class ExpertAdminManageServiceImpl implements ExpertAdminManageService { - - private final IExpertUserFullInfoService iExpertUserFullInfoService; - private final IExpertDictionaryService iExpertDictionaryService; - private final IExpertTagService iExpertTagService; - private final ExpertAdminManageMapper expertAdminManageMapper; - - private List listExpertUserId(ListExpertQuery listExpertQuery) { - List userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); - - List expertTagQueryList = listExpertQuery.getExpertTagQueryList(); - if (CollectionUtils.isNotEmpty(expertTagQueryList)) { - List tagUserIdList = expertAdminManageMapper.listExpertTagUserId(listExpertQuery); - userIdList.retainAll(tagUserIdList); - } - - List expertDictQueryList = listExpertQuery.getExpertDictionaryQueryList(); - if (CollectionUtils.isNotEmpty(expertDictQueryList)) { - List dictionaryUserIdList = expertAdminManageMapper.listExpertDictionaryUserId(listExpertQuery); - userIdList.retainAll(dictionaryUserIdList); - } - return userIdList; - } - - - @Override - public CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) { - ListExpertQuery listExpertQuery = buildListExpertQuery(req); - List userIdList = listExpertUserId(listExpertQuery); - - List evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); - List evidenceHasBeenSubmittedExpertUserIdList = evidenceHasBeenSubmittedExpertInfoList - .stream().map(ExpertUserFullInfo::getUserId) - .distinct().collect(Collectors.toList()); - - Iterator iterator = userIdList.iterator(); - while (iterator.hasNext()) { - if (!evidenceHasBeenSubmittedExpertUserIdList.contains(iterator.next())) { - userIdList.remove(iterator.next()); - } - } - - CommonPage commonPage = new CommonPage<>(); - commonPage.setCurrentPageNumber(req.getPageNumber()); - commonPage.setItemsTotal((long) userIdList.size()); - - List recordList = new ArrayList<>(); - - if (userIdList.size() != 0) { - List currPageUserIdList = CollUtil.page(req.getPageNumber() - 1, req.getPageSize(), userIdList); - List expertUserList = iExpertUserFullInfoService.listByUserIds(currPageUserIdList); - - // 获取专家字典数据 - LambdaQueryWrapper in = Wrappers.lambdaQuery(ExpertDictionary.class) - .in(ExpertDictionary::getUserId, userIdList); - List expertDictionaryList = iExpertDictionaryService.list(in); - Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); - - // 获取专家标签数据 - LambdaQueryWrapper tagIn = Wrappers.lambdaQuery(ExpertTag.class) - .in(ExpertTag::getUserId, userIdList); - List expertTagList = iExpertTagService.list(tagIn); - Map> expertTagMap = CollUtils.group(expertTagList, ExpertTag::getUserId); - for (ExpertUserFullInfo expertUserFullInfo : expertUserList) { - ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = - ExpertUserInfoAssembler.buildExpertAdminExpertManageListDTO(expertUserFullInfo, expertDictMap, expertTagMap); - recordList.add(expertAdminExpertManageListDTO); - } - } - commonPage.setItems(recordList); - return commonPage; - } - - public ListExpertQuery buildListExpertQuery(ExpertAdminExpertManageQueryCmd queryCmd) { - ListExpertQuery listExpertQuery = new ListExpertQuery(); - listExpertQuery.setExpertName(queryCmd.getExpertName()); - listExpertQuery.setCompany(queryCmd.getCompany()); - listExpertQuery.setExpertDictionaryQueryList(queryCmd.getExpertDictionaryQueryList()); - listExpertQuery.setExpertTagQueryList(queryCmd.getExpertTagQueryList()); - listExpertQuery.setRegionContainsList(queryCmd.getRegionContainsList()); - listExpertQuery.setIntentionRegionList(queryCmd.getIntentionRegionList()); - listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); - listExpertQuery.setLimit(queryCmd.getLimit()); - listExpertQuery.setOffset(queryCmd.getOffset()); - listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); - if (CollectionUtils.isNotEmpty(queryCmd.getExpertAccountStatusList())) { - listExpertQuery.setExpertAccountStatusList( - queryCmd.getExpertAccountStatusList().stream().map(ExpertAccountStatusEnum::getKey).collect(Collectors.toList())); - } - return listExpertQuery; - } - - @Override - public List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) { - ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd); - return listExpertUserId(listExpertQuery); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java deleted file mode 100644 index 4caa943..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; -import com.ningdatech.pmapi.expert.mapper.ExpertAvoidCompanyMapper; -import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-23 - */ -@Service -public class ExpertAvoidCompanyServiceImpl extends ServiceImpl implements IExpertAvoidCompanyService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertGovBusinessStripServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertGovBusinessStripServiceImpl.java deleted file mode 100644 index ec02d72..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertGovBusinessStripServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.ningdatech.pmapi.expert.mapper.ExpertGovBusinessStripMapper; -import com.ningdatech.pmapi.expert.service.IExpertGovBusinessStripService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-04-17 - */ -@Service -public class ExpertGovBusinessStripServiceImpl extends ServiceImpl implements IExpertGovBusinessStripService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java deleted file mode 100644 index 5366000..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ /dev/null @@ -1,877 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.PhoneUtil; -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; -import com.ningdatech.pmapi.common.model.ExpertRegionModifyDiffBO; -import com.ningdatech.pmapi.common.util.ExpertRegionInfoUtils; -import com.ningdatech.pmapi.common.util.GzipUtils; -import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; -import com.ningdatech.pmapi.expert.constant.*; -import com.ningdatech.pmapi.expert.entity.*; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.SensitiveModifySegment; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; -import com.ningdatech.pmapi.expert.model.cmd.*; -import com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate; -import com.ningdatech.pmapi.expert.model.dto.*; -import com.ningdatech.pmapi.expert.service.*; -import com.ningdatech.pmapi.expert.utils.SensitiveModifySegmentUtils; -import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import com.ningdatech.pmapi.sys.service.IRoleService; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.yxt.utils.JSONUtils; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_FAIL; -import static com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_PASS; -import static com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; - -/** - * @author liuxinxin - * @date 2022/7/22 下午4:39 - */ -@Component -@RequiredArgsConstructor -public class ExpertInfoServiceImpl implements ExpertInfoService { - - private final IExpertUserFullInfoService iExpertUserFullInfoService; - private final IExpertTagService iExpertTagService; - private final IExpertDictionaryService iExpertDictionaryService; - private final IExpertAvoidCompanyService iExpertAvoidCompanyService; - private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService; - private final IExpertMetaApplyService iExpertMetaApplyService; - private final IRoleService roleService; - private final IUserRoleService userRoleService; - private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; - private final IUserInfoService userInfoService; - private final YxtCallOrSmsHelper yxtCallOrSmsHelper; - private final IExpertGovBusinessStripService expertGovBusinessStripService; - - @Value("${login.url:}") - private String loginUrl; - - /** - * 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 - * - * @param cmd - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveExpertInfo(ExpertFullInfoSaveCmd cmd) { - Long userId = cmd.getUserId(); - List expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); - List expertDictionaryList = cmd.getExpertDictionaryList(); - List expertIntentionWorkRegionInfoList = cmd.getExpertIntentionWorkRegionInfo(); - List expertTagList = cmd.getExpertTagList(); - ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); - - ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - - ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); - if (Objects.nonNull(expertUserFullInfo)) { - // 专家信息审核通过之前,所有信息无需备份 - iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); - // 删除所有专家标签字段 - iExpertTagService.removeByUserId(userId); - // 删除所有专家字典字段 - iExpertDictionaryService.removeByUserId(userId); - // 删除所有专家履职意向申请 - // 补充审核逻辑 - LambdaQueryWrapper expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, userId) - .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) - .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name()); - iExpertMetaApplyService.remove(expertMetaApplyRemove); - // 删除回避单位 - iExpertAvoidCompanyService.removeByUserId(userId); - } - saveExpertUserFullInfo.setUserId(userId); - saveExpertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.APPLYING.getKey()); - saveExpertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.BASIC_INFORMATION_SUBMITTED.getKey()); - saveExpertUserFullInfo.setUpdateOn(LocalDateTime.now()); - saveExpertUserFullInfo.setCreateOn(LocalDateTime.now()); - iExpertUserFullInfoService.save(saveExpertUserFullInfo); - // 保存所有专家标签字段 - List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); - if (CollectionUtils.isNotEmpty(saveExpertTagList)) { - iExpertTagService.saveBatch(saveExpertTagList); - } - // 保存所有专家字典字段 - List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); - if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { - iExpertDictionaryService.saveBatch(saveExpertDictionaryList); - } - // 保存所有专家履职意向申请 - - // 审核逻辑 - List saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList); - if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { - iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList); - } - // 保存所有专家回避单位 - List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); - if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { - iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); - } - } - - - private ExpertUserFullInfo buildSaveExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { - ExpertUserFullInfo expertUserFullInfo = new ExpertUserFullInfo(); - if (Objects.nonNull(expertUserInfoDTO.getIsDingUser())) { - expertUserFullInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser() ? BoolDisplayEnum.Y.name() : BoolDisplayEnum.N.name()); - } - expertUserFullInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); - expertUserFullInfo.setGender(expertUserInfoDTO.getGender()); - expertUserFullInfo.setExpertName(expertUserInfoDTO.getName()); - expertUserFullInfo.setAvatarFileId(expertUserInfoDTO.getAvatarFileId()); - expertUserFullInfo.setIdCard(expertUserInfoDTO.getIdCard()); - expertUserFullInfo.setOfficePhone(expertUserInfoDTO.getOfficePhone()); - expertUserFullInfo.setBirth(expertUserInfoDTO.getBirth()); - expertUserFullInfo.setBankNo(expertUserInfoDTO.getBankNo()); - expertUserFullInfo.setBank(expertUserInfoDTO.getBank()); - expertUserFullInfo.setEmail(expertUserInfoDTO.getEmail()); - expertUserFullInfo.setHometown(expertUserInfoDTO.getHometown()); - expertUserFullInfo.setNationality(expertUserInfoDTO.getNationality()); - - expertUserFullInfo.setSchool(expertUserInfoDTO.getSchool()); - expertUserFullInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt()); - expertUserFullInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle()); - - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { - expertUserFullInfo.setGraduationCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getGraduationCertificateFileIdList())); - } - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { - expertUserFullInfo.setDegreeCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getDegreeCertificateFileIdList())); - } - expertUserFullInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); - expertUserFullInfo.setCompany(expertUserInfoDTO.getCompany()); - expertUserFullInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); - expertUserFullInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); - expertUserFullInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); - expertUserFullInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); - expertUserFullInfo.setAddress(expertUserInfoDTO.getAddress()); - expertUserFullInfo.setExperience(expertUserInfoDTO.getExperience()); - - expertUserFullInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { - expertUserFullInfo.setTitleCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getTitleCertificateFileIdList())); - } - expertUserFullInfo.setAwards(expertUserInfoDTO.getAwards()); - expertUserFullInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); - - expertUserFullInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); - expertUserFullInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); - if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { - expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); - } - expertUserFullInfo.setRemark(expertUserInfoDTO.getRemark()); - expertUserFullInfo.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode()); - return expertUserFullInfo; - } - - - private List buildSaveExpertTagList(Long userId, List expertTagList) { - if (CollectionUtils.isEmpty(expertTagList)) { - return new ArrayList<>(); - } - return expertTagList.stream().map(r -> { - ExpertTag expertTag = new ExpertTag(); - expertTag.setExpertInfoField(r.getExpertInfoField()); - expertTag.setTagCode(r.getTagCode()); - expertTag.setCreateOn(LocalDateTime.now()); - expertTag.setUpdateOn(LocalDateTime.now()); - expertTag.setUserId(userId); - return expertTag; - }).collect(Collectors.toList()); - } - - private List buildSaveExpertDictionaryList(Long userId, List expertDictionaryList) { - if (CollectionUtils.isEmpty(expertDictionaryList)) { - return new ArrayList<>(); - } - return expertDictionaryList.stream().map(r -> { - ExpertDictionary expertDictionary = new ExpertDictionary(); - expertDictionary.setUserId(userId); - expertDictionary.setExpertInfoField(r.getExpertInfoField()); - expertDictionary.setDictionaryCode(r.getDictionaryCode()); - expertDictionary.setUpdateOn(LocalDateTime.now()); - expertDictionary.setCreateOn(LocalDateTime.now()); - return expertDictionary; - }).collect(Collectors.toList()); - } - - - private List buildSaveExpertAvoidCompanyList(Long userId, List expertAvoidCompanyList) { - if (CollectionUtils.isEmpty(expertAvoidCompanyList)) { - return new ArrayList<>(); - } - return expertAvoidCompanyList.stream().map(r -> { - ExpertAvoidCompany expertAvoidCompany = new ExpertAvoidCompany(); - expertAvoidCompany.setCompanyName(r.getCompanyName()); - expertAvoidCompany.setUserId(userId); - expertAvoidCompany.setCompanyUniqCode(r.getCompanyUniqCode()); - expertAvoidCompany.setCreateOn(LocalDateTime.now()); - expertAvoidCompany.setUpdateOn(LocalDateTime.now()); - return expertAvoidCompany; - }).collect(Collectors.toList()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Long expertRecommendProofSave(ExpertRecommendProofSaveCmd cmd) { - // 保存专家证明材料 - Long userId = cmd.getUserId(); - ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(cmd.getRecommendationProofFileIdList())); - expertUserFullInfo.setUpdateOn(LocalDateTime.now()); - expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey()); - iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo); - - List recommendedWayList = cmd.getRecommendedWay(); - if (CollectionUtils.isNotEmpty(recommendedWayList)) { - List saveExpertDictionaryList = recommendedWayList.stream().map(r -> { - ExpertDictionary expertDictionary = new ExpertDictionary(); - expertDictionary.setUserId(userId); - expertDictionary.setExpertInfoField(r.getExpertInfoField()); - expertDictionary.setDictionaryCode(r.getDictionaryCode()); - expertDictionary.setUpdateOn(LocalDateTime.now()); - expertDictionary.setCreateOn(LocalDateTime.now()); - return expertDictionary; - }).collect(Collectors.toList()); - iExpertDictionaryService.saveBatch(saveExpertDictionaryList); - } - - // 创建入库申请 - ExpertMetaApply expertRegionApply = new ExpertMetaApply(); - expertRegionApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); - expertRegionApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - expertRegionApply.setRegionCode(expertUserFullInfo.getRegionCode()); - expertRegionApply.setRegionLevel(expertUserFullInfo.getRegionLevel()); - expertRegionApply.setUserId(userId); - expertRegionApply.setDisplayEnable(BoolDisplayEnum.Y.name()); - if (LoginUserUtil.isLogin()) { - expertRegionApply.setCreateBy(LoginUserUtil.getUserId()); - } - expertRegionApply.setCreateOn(LocalDateTime.now()); - iExpertMetaApplyService.save(expertRegionApply); - - return expertRegionApply.getId(); - } - - @Override - public ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId) { - ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - if (Objects.isNull(expertUserFullInfo)) { - return null; - } - // 所有专家标签字段 - List expertTagList = iExpertTagService - .list(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); - // 所有专家字典字段 - List expertDictionaryList = iExpertDictionaryService - .list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); - // 专家履职意向列表 - List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService - .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class).eq(ExpertIntentionWorkRegion::getUserId, userId)); - // 专家履职意向申请列表 - List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) - .eq(ExpertMetaApply::getUserId, userId) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) - .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); - // 所有专家回避单位 - List expertAvoidCompanyList = iExpertAvoidCompanyService - .list(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); - - List businessStrips = expertGovBusinessStripService.listByUserIds(Collections.singletonList(userId)); - - return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList - , expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList, businessStrips); - - } - - - private List buildSaveExpertIntentionWorkRegionApplyList(Long userId, List expertIntentionWorkRegionInfoList) { - if (CollectionUtils.isEmpty(expertIntentionWorkRegionInfoList)) { - return new ArrayList<>(); - } - return expertIntentionWorkRegionInfoList.stream().map(r -> { - ExpertMetaApply expertMetaApply = new ExpertMetaApply(); - expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()); - expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - expertMetaApply.setRegionCode(r.getRegionCode()); - expertMetaApply.setRegionLevel(r.getRegionLevel()); - expertMetaApply.setUserId(userId); - expertMetaApply.setDisplayEnable(BoolDisplayEnum.N.name()); - expertMetaApply.setUpdateOn(LocalDateTime.now()); - expertMetaApply.setCreateOn(LocalDateTime.now()); - return expertMetaApply; - }).collect(Collectors.toList()); - } - - - @Override - public void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd cmd) { - Boolean applyResult = cmd.getApplyResult(); - ExpertApplyTypeEnum applyTypeEnum = cmd.getApplyTypeEnum(); - String expertRegionCode = cmd.getExpertRegionCode(); - Integer expertRegionLevel = cmd.getExpertRegionLevel(); - Long expertUserId = cmd.getExpertUserId(); - - if (applyResult) { - switch (applyTypeEnum) { - case EXPERT_INTENTION_JOIN: { - // 新增履职意向地 - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) - .eq(ExpertIntentionWorkRegion::getUserId, expertUserId) - .eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) - .eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); - ExpertIntentionWorkRegion one = iExpertIntentionWorkRegionService.getOne(query); - if (Objects.isNull(one)) { - ExpertIntentionWorkRegion intentionWorkRegion = new ExpertIntentionWorkRegion(); - intentionWorkRegion.setCreateOn(LocalDateTime.now()); - intentionWorkRegion.setUpdateOn(LocalDateTime.now()); - intentionWorkRegion.setRegionCode(expertRegionCode); - intentionWorkRegion.setRegionLevel(expertRegionLevel); - intentionWorkRegion.setUserId(expertUserId); - iExpertIntentionWorkRegionService.save(intentionWorkRegion); - } - } - break; - case EXPERT_INTENTION_LEAVE: { - // 删除履职意向地 - LambdaUpdateWrapper query = Wrappers.lambdaUpdate(ExpertIntentionWorkRegion.class) - .eq(ExpertIntentionWorkRegion::getUserId, expertUserId) - .eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) - .eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); - iExpertIntentionWorkRegionService.remove(query); - } - break; - default: - throw new BizException("illegal request"); - } - } - } - - /** - * 专家入库审核 - * - * @param cmd \ - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void expertStorageDeal(ExpertStorageDealCmd cmd) { - Long expertUserId = cmd.getExpertUserId(); - ExpertUserFullInfo expertInfo = iExpertUserFullInfoService.getByUserId(expertUserId); - UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String content; - if (cmd.getApplyResult()) { - // 修改专家状态为可用 - expertInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); - expertInfo.setRemark(cmd.getRemark()); - expertInfo.setRegionCode(cmd.getJoinRegionCode()); - expertInfo.setRegionLevel(cmd.getJoinRegionLevel()); - // 账号启用 - LambdaUpdateWrapper userInfoUpdate = Wrappers.lambdaUpdate(UserInfo.class) - .eq(UserInfo::getId, expertUserId) - .set(UserInfo::getAvailable, UserAvailableEnum.ENABLE); - userInfoService.update(userInfoUpdate); - - // 保存所有专家标签字段 - List saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther()); - iExpertTagService.saveBatch(saveExpertTagList); - // 保存所有专家字典字段 - List expertType = cmd.getExpertType(); - if (CollUtil.isNotEmpty(expertType)) { - expertType.forEach(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); - List saveExpertDictList = buildSaveExpertDictionaryList(expertUserId, expertType); - iExpertDictionaryService.saveBatch(saveExpertDictList); - } - // 补充专家 专家角色 - Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT)); - if (Objects.nonNull(role)) { - UserRole one = userRoleService.getOne(expertUserId, role.getId()); - if (Objects.isNull(one)) { - UserRole saveUserRole = new UserRole(); - saveUserRole.setUserId(expertUserId); - saveUserRole.setRoleId(role.getId()); - userRoleService.save(saveUserRole); - } - } - content = String.format(EXPERT_AUDIT_PASS, expertInfo.getExpertName(), loginUrl, userDetail.getRealName(), userDetail.getMobile()); - } else { - expertInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); - content = String.format(EXPERT_AUDIT_FAIL, expertInfo.getExpertName(), userDetail.getRealName(), userDetail.getMobile()); - } - iExpertUserFullInfoService.saveOrUpdate(expertInfo); - if (PhoneUtil.isMobile(expertInfo.getPhoneNo())) { - SendSmsContext smsCtx = new SendSmsContext(); - smsCtx.setContent(content); - smsCtx.setReceiveNumber(expertInfo.getPhoneNo()); - yxtCallOrSmsHelper.sendSms(smsCtx); - } - } - - - @Override - public List listExpertUserFullInfoAll(List userIds) { - List expertUserFullInfos = iExpertUserFullInfoService.listByUserIds(userIds); - // 所有专家标签字段 - List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) - .in(ExpertTag::getUserId, userIds)); - Map> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId); - List businessStrips = expertGovBusinessStripService.listByUserIds(userIds); - Map> stripMap = CollUtils.group(businessStrips, ExpertGovBusinessStrip::getExpertUserId); - // 所有专家字典字段 - List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) - .in(ExpertDictionary::getUserId, userIds)); - Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); - // 专家履职意向列表 - List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService - .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) - .in(ExpertIntentionWorkRegion::getUserId, userIds)); - Map> intentionRegionMap = CollUtils.group(expertIntentionWorkRegionList, ExpertIntentionWorkRegion::getUserId); - // 专家履职意向申请列表 - List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) - .in(ExpertMetaApply::getUserId, userIds) - .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) - .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); - Map> metaApplyMap = CollUtils.group(expertMetaApplyList, ExpertMetaApply::getUserId); - // 所有专家回避单位 - List expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class) - .in(ExpertAvoidCompany::getUserId, userIds)); - Map> avoidInfoMap = CollUtils.group(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); - return expertUserFullInfos.stream().map(w -> ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(w, - expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), - expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), - intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), - metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), - avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()), - stripMap.getOrDefault(w.getUserId(), Collections.emptyList()))) - .collect(Collectors.toList()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public List adminModifyExpertInfo(ExpertInfoModifyCmd cmd, Long adminUserId) { - Long userId = cmd.getUserId(); - List expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); - List expertDictionaryList = cmd.getExpertDictionaryList(); - List expertTagList = cmd.getExpertTagList(); - ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); - List applyIdList = new ArrayList<>(); - - ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); - if (Objects.nonNull(originalExpertUserFullInfo)) { - saveExpertUserFullInfo.setId(originalExpertUserFullInfo.getId()); - // 删除所有专家字典字段(需审核敏感字段不删除) - LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getUserId, userId) - .notIn(ExpertDictionary::getExpertInfoField, ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList()); - iExpertDictionaryService.remove(expertDictionaryRemove); - - - // 保存专家来源标签 - if (CollUtil.isNotEmpty(expertTagList)) { - // 删除专家来源标签 重新存入 - iExpertTagService.remove(Wrappers.lambdaQuery(ExpertTag.class) - .eq(ExpertTag::getUserId, userId) -// .eq(ExpertTag::getExpertInfoField, ExpertTagEnum.EXPERT_SOURCE.getKey()) - ); - - List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); - saveExpertTagList = saveExpertTagList.stream() -// .filter(r -> ExpertTagEnum.EXPERT_SOURCE.getKey().equals(r.getExpertInfoField())) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(saveExpertTagList)) { - iExpertTagService.saveBatch(saveExpertTagList); - } - } - } - - saveExpertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); - saveExpertUserFullInfo.setUserId(userId); - // 专家提交修改,以下字段需要审批后才能更新 - saveExpertUserFullInfo.setPhoneNo(null); - saveExpertUserFullInfo.setEmail(null); - saveExpertUserFullInfo.setRegionLevel(null); - saveExpertUserFullInfo.setRegionCode(null); - saveExpertUserFullInfo.setCompany(null); - saveExpertUserFullInfo.setCompanyUniqCode(null); - saveExpertUserFullInfo.setLegalEntityCode(null); - iExpertUserFullInfoService.saveOrUpdate(saveExpertUserFullInfo); - - // 保存所有专家字典字段 - List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); - saveExpertDictionaryList = saveExpertDictionaryList - .stream().filter(r -> !ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList().contains(r.getExpertInfoField())) - .collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { - iExpertDictionaryService.saveBatch(saveExpertDictionaryList); - } - - // 保存所有专家回避单位 - List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); - if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { - // 删除回避单位 - LambdaQueryWrapper expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) - .eq(ExpertAvoidCompany::getUserId, userId); - iExpertAvoidCompanyService.remove(expertAvoidCompanyRemove); - // 重新保存 - iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); - } - // 保存专家条线 - expertGovBusinessStripService.removeByUserId(userId); - if (CollUtil.isNotEmpty(cmd.getBusinessStrips())) { - List strips = CollUtils.convert(cmd.getBusinessStrips(), w -> { - ExpertGovBusinessStrip strip = BeanUtil.copyProperties(w, ExpertGovBusinessStrip.class); - strip.setExpertUserId(userId); - return strip; - }); - expertGovBusinessStripService.saveBatch(strips); - } - // 敏感字段申请 - ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = cmd.getExpertInfoSensitiveFieldCheckBO(); - ModifyApplyExtraInfoDTO modifyApplyExtraInfo = cmd.getModifyApplyExtraInfo(); - if (expertInfoSensitiveFieldCheckBO.getHasModify()) { - // TODO 提交审核前判断是否已经有审核未审核,如果有,无法创建新的审核请求 - if (expertInfoSensitiveFieldCheckBO.getIsExpertSensitiveInfoModify()) { - // 创建信息修改审核 - List expertSensitiveInfoFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertSensitiveInfoFieldSegmentList(); - Long expertInfoModifyApplyId = createExpertInfoModifyApply(expertSensitiveInfoFieldSegmentList, originalExpertUserFullInfo, modifyApplyExtraInfo); - applyIdList.add(expertInfoModifyApplyId); - } - if (expertInfoSensitiveFieldCheckBO.getIsExpertRegionModify()) { - // 创建层级变更审核 - List expertRegionFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertRegionFieldSegmentList(); - Long expertRegionModifyApplyId = createExpertRegionModifyApply(expertRegionFieldSegmentList, originalExpertUserFullInfo, modifyApplyExtraInfo); - applyIdList.add(expertRegionModifyApplyId); - } - - if (expertInfoSensitiveFieldCheckBO.getIsExpertIntentionModify()) { - // 创建专家履职意向变更审核 - List expertIntentionFieldSegmentList = expertInfoSensitiveFieldCheckBO.getExpertIntentionFieldSegmentList(); - SensitiveModifySegment segment = expertIntentionFieldSegmentList.get(0); - List apply = (List) segment.getApply(); - List original = (List) segment.getOriginal(); - ExpertRegionModifyDiffBO expertRegionModifyDiffBO = ExpertRegionInfoUtils.modifyDiff(original, apply); - List addList = expertRegionModifyDiffBO.getAddList(); - List removeList = expertRegionModifyDiffBO.getRemoveList(); - - for (ExpertRegionInfo expertRegionInfo : addList) { - Long expertIntentionModifyApplyId = createExpertIntentionModifyApply(originalExpertUserFullInfo.getUserId() - , modifyApplyExtraInfo, expertRegionInfo, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN); - applyIdList.add(expertIntentionModifyApplyId); - } - for (ExpertRegionInfo expertRegionInfo : removeList) { - Long expertIntentionModifyApplyId = createExpertIntentionModifyApply(originalExpertUserFullInfo.getUserId() - , modifyApplyExtraInfo, expertRegionInfo, ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE); - applyIdList.add(expertIntentionModifyApplyId); - } - } - // 专家管理修改批量通过审核 - // 专家批量通过审核由 facade层调用其他逻辑实现 - } - return applyIdList; - } - - - /** - * 创建信息修改审核 - */ - @Transactional(rollbackFor = Exception.class) - public Long createExpertInfoModifyApply(List expertSensitiveInfoFieldSegmentList - , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { - expertSensitiveInfoFieldSegmentList = expertSensitiveInfoFieldSegmentList.stream().filter(r -> !r.isValueEquals()).collect(Collectors.toList()); - String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertSensitiveInfoFieldSegmentList)); - - ExpertMetaApply expertMetaApply = new ExpertMetaApply(); - expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); - expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - expertMetaApply.setRegionCode(originalExpertUserFullInfo.getRegionCode()); - expertMetaApply.setRegionLevel(originalExpertUserFullInfo.getRegionLevel()); - expertMetaApply.setUserId(originalExpertUserFullInfo.getUserId()); - expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); - expertMetaApply.setCreateOn(LocalDateTime.now()); - expertMetaApply.setCreateBy(LoginUserUtil.getUserId()); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertMetaApplyService.save(expertMetaApply); - - ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); - expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); - expertSensitiveInfoModifyDetailRecord.setUserId(originalExpertUserFullInfo.getUserId()); - expertSensitiveInfoModifyDetailRecord.setOriginalJson(compressedModifyJsonStr); - expertSensitiveInfoModifyDetailRecord.setModifyJson(compressedModifyJsonStr); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); - return expertMetaApply.getId(); - } - - private Long createExpertIntentionModifyApply(Long expertUserId, ModifyApplyExtraInfoDTO modifyApplyExtraInfo - , ExpertRegionInfo expertIntention, ExpertApplyTypeEnum applyTypeEnum) { - ExpertMetaApply expertMetaApply = new ExpertMetaApply(); - expertMetaApply.setApplyType(applyTypeEnum.getKey()); - expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - expertMetaApply.setRegionCode(expertIntention.getRegionCode()); - expertMetaApply.setRegionLevel(expertIntention.getRegionLevel()); - expertMetaApply.setUserId(expertUserId); - expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertMetaApplyService.save(expertMetaApply); - - ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); - expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setUserId(expertUserId); - expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); - return expertMetaApply.getId(); - } - - /** - * 创建层级变更审核 - * - * @param expertRegionFieldSegmentList - * @param originalExpertUserFullInfo - * @param modifyApplyExtraInfo - */ - private Long createExpertRegionModifyApply(List expertRegionFieldSegmentList - , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { - String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertRegionFieldSegmentList)); - SensitiveModifySegment segment = expertRegionFieldSegmentList.get(0); - ExpertRegionInfo apply = (ExpertRegionInfo) segment.getApply(); - - ExpertMetaApply expertMetaApply = new ExpertMetaApply(); - expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); - expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - expertMetaApply.setRegionCode(apply.getRegionCode()); - expertMetaApply.setRegionLevel(apply.getRegionLevel()); - expertMetaApply.setUserId(originalExpertUserFullInfo.getUserId()); - expertMetaApply.setCreateOn(LocalDateTime.now()); - expertMetaApply.setCreateBy(LoginUserUtil.getUserId()); - expertMetaApply.setDisplayEnable(BoolDisplayEnum.Y.name()); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertMetaApply.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertMetaApplyService.save(expertMetaApply); - - ExpertSensitiveInfoModifyDetailRecord expertSensitiveInfoModifyDetailRecord = new ExpertSensitiveInfoModifyDetailRecord(); - expertSensitiveInfoModifyDetailRecord.setCreateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setUpdateOn(LocalDateTime.now()); - expertSensitiveInfoModifyDetailRecord.setUserId(originalExpertUserFullInfo.getUserId()); - expertSensitiveInfoModifyDetailRecord.setMetaApplyId(expertMetaApply.getId()); - expertSensitiveInfoModifyDetailRecord.setOriginalJson(compressedModifyJsonStr); - expertSensitiveInfoModifyDetailRecord.setModifyJson(compressedModifyJsonStr); - if (Objects.nonNull(modifyApplyExtraInfo)) { - expertSensitiveInfoModifyDetailRecord.setExtraMaterial(JSONObject.toJSONString(modifyApplyExtraInfo)); - } - iExpertSensitiveInfoModifyDetailRecordService.save(expertSensitiveInfoModifyDetailRecord); - return expertMetaApply.getId(); - } - - - @Override - public void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd) { - Boolean applyResult = expertInfoModifyApplyDealCmd.getApplyResult(); - Long expertUserId = expertInfoModifyApplyDealCmd.getExpertUserId(); - Long applyId = expertInfoModifyApplyDealCmd.getApplyId(); - if (applyResult) { - ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); - - LambdaQueryWrapper recordQuery = Wrappers.lambdaQuery(ExpertSensitiveInfoModifyDetailRecord.class) - .eq(ExpertSensitiveInfoModifyDetailRecord::getUserId, expertUserId) - .eq(ExpertSensitiveInfoModifyDetailRecord::getMetaApplyId, applyId); - ExpertSensitiveInfoModifyDetailRecord record = iExpertSensitiveInfoModifyDetailRecordService.getOne(recordQuery); - String modifyJson = record.getModifyJson(); - if (StringUtils.isNotEmpty(modifyJson)) { - modifyJson = GzipUtils.uncompress(modifyJson); - } - List sensitiveModifySegments = JSONUtils.parseArray(modifyJson, SensitiveModifySegment.class); - Map collectMap = sensitiveModifySegments - .stream().collect(Collectors.toMap(SensitiveModifySegment::getFieldName, Function.identity())); - - // 更新专家基 expert_user_full_info 表中数据 - assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.phone_no, collectMap); - assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.email, collectMap); - assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company, collectMap); - assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company_uniq_code, collectMap); - assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.legal_entity_code, collectMap); - iExpertUserFullInfoService.saveOrUpdate(originalExpertUserFullInfo); - - // 更新专家字典字段 - executeExpertUserFullInfoDictionaryInfoUpdate(expertUserId, collectMap - , ExpertUserInfoSensitiveFieldEnum.administrative_rank - , ExpertUserInfoSensitiveFieldEnum.title_level); - - // 更新专家标签字段列表 - executeExpertUserFullInfoTagInfoUpdate(expertUserId, collectMap, ExpertUserInfoSensitiveFieldEnum.good_at - , ExpertUserInfoSensitiveFieldEnum.technical_expertise - , ExpertUserInfoSensitiveFieldEnum.industry_sector - , ExpertUserInfoSensitiveFieldEnum.other); - - } - - } - - private void executeExpertUserFullInfoDictionaryInfoUpdate(Long expertUserId, Map collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { - for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { - switch (sensitiveFieldEnum) { - case administrative_rank: - case title_level: { - SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); - if (Objects.nonNull(segment)) { - List dictionaryFieldInfoList = SensitiveModifySegmentUtils.getDictionaryFieldInfoListApply(segment); - updateExpertDictionaryList(expertUserId, dictionaryFieldInfoList, sensitiveFieldEnum.getKey()); - } - } - break; - default: - break; - } - } - } - - - private void executeExpertUserFullInfoTagInfoUpdate(Long expertUserId, Map collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { - for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { - switch (sensitiveFieldEnum) { - case good_at: - case technical_expertise: - case industry_sector: - case other: { - SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); - if (Objects.nonNull(segment)) { - List tagFieldInfoList = SensitiveModifySegmentUtils.getTagFieldInfoListApply(segment); - updateExpertTagList(expertUserId, tagFieldInfoList, sensitiveFieldEnum.getKey()); - } - } - break; - default: - break; - } - } - } - - /** - * 信息修改审核通过后 装配更新用户信息敏感字段 - * - * @param originalInfo / - * @param fieldEnum / - * @param collectMap / - */ - private void assemblerExpertUserFullInfoSensitiveFieldSaveRecord(ExpertUserFullInfo originalInfo, ExpertUserInfoSensitiveFieldEnum fieldEnum - , Map collectMap) { - SensitiveModifySegment segment = collectMap.get(fieldEnum); - if (Objects.nonNull(segment)) { - String segmentApplyValue = (String) segment.getApply(); - switch (fieldEnum) { - case phone_no: - originalInfo.setPhoneNo(segmentApplyValue); - break; - case email: - originalInfo.setEmail(segmentApplyValue); - break; - case company: - originalInfo.setCompany(segmentApplyValue); - break; - case company_uniq_code: - originalInfo.setCompanyUniqCode(segmentApplyValue); - break; - case legal_entity_code: - originalInfo.setLegalEntityCode(segmentApplyValue); - break; - default: - break; - } - } - } - - private void updateExpertTagList(Long expertUserId, List tagFieldInfoList, String... tagExpertInfoTypeArr) { - if (CollectionUtils.isNotEmpty(tagFieldInfoList)) { - // 删除专家字典字段 - LambdaQueryWrapper expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) - .eq(ExpertTag::getUserId, expertUserId) - .in(tagExpertInfoTypeArr.length > 0, ExpertTag::getExpertInfoField, tagExpertInfoTypeArr); - iExpertTagService.remove(expertTagRemove); - List expertDictionarySaveList = tagFieldInfoList.stream().map(r -> { - ExpertTag expertTag = new ExpertTag(); - expertTag.setUpdateOn(LocalDateTime.now()); - expertTag.setUserId(expertUserId); - expertTag.setExpertInfoField(r.getTagFieldName()); - expertTag.setTagCode(r.getTagCode()); - return expertTag; - }).collect(Collectors.toList()); - iExpertTagService.saveBatch(expertDictionarySaveList); - } - } - - private void updateExpertDictionaryList(Long expertUserId, List dictionaryFieldInfoList, String... dictionaryExpertInfoTypeArr) { - if (CollectionUtils.isNotEmpty(dictionaryFieldInfoList)) { - // 删除专家字典字段 - LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getUserId, expertUserId) - .in(dictionaryExpertInfoTypeArr.length > 0, ExpertDictionary::getExpertInfoField, dictionaryExpertInfoTypeArr); - iExpertDictionaryService.remove(expertDictionaryRemove); - List expertDictionarySaveList = dictionaryFieldInfoList.stream().map(r -> { - ExpertDictionary expertDictionary = new ExpertDictionary(); - expertDictionary.setUpdateOn(LocalDateTime.now()); - expertDictionary.setCreateOn(LocalDateTime.now()); - expertDictionary.setUserId(expertUserId); - expertDictionary.setExpertInfoField(r.getDictionaryFieldName()); - expertDictionary.setDictionaryCode(r.getDictionaryCode()); - return expertDictionary; - }).collect(Collectors.toList()); - iExpertDictionaryService.saveBatch(expertDictionarySaveList); - } - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java deleted file mode 100644 index 244f97d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.ningdatech.pmapi.expert.mapper.ExpertIntentionWorkRegionMapper; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertIntentionWorkRegionServiceImpl extends ServiceImpl implements IExpertIntentionWorkRegionService { - - @Override - public List userIdsMatchIntentionRegion(String regionCode, Integer regionLevel) { - LambdaQueryWrapper intentionQuery = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) - .eq(ExpertIntentionWorkRegion::getRegionCode, regionCode) - .eq(ExpertIntentionWorkRegion::getRegionLevel, regionLevel) - .select(ExpertIntentionWorkRegion::getUserId); - List userIdMatchIntentionRegion = list(intentionQuery); - return CollUtils.fieldList(userIdMatchIntentionRegion, ExpertIntentionWorkRegion::getUserId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertMetaApplyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertMetaApplyServiceImpl.java deleted file mode 100644 index 481fbc5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertMetaApplyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.mapper.ExpertMetaApplyMapper; -import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-03-01 - */ -@Service -public class ExpertMetaApplyServiceImpl extends ServiceImpl implements IExpertMetaApplyService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java deleted file mode 100644 index ea6e9ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -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.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.expert.mapper.ExpertReviewMapper; -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.ningdatech.pmapi.expert.model.enumeration.ReviewTemplateTypeEnum; -import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.mapper.MeetingMapper; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@Service -@RequiredArgsConstructor -public class ExpertReviewServiceImpl extends ServiceImpl implements IExpertReviewService { - - private final MeetingMapper meetingMapper; - - @Override - public List listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); - query.eq(ExpertReview::getProjectId, projectId); - query.eq(ExpertReview::getCreateBy, expertId); - query.eq(ExpertReview::getMeetingId, meetingId); - query.orderByAsc(ExpertReview::getCreateOn); - return list(query); - } - - @Override - public ExpertReview getFinalReview(Long meetingId, Long projectId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); - query.eq(ExpertReview::getProjectId, projectId); - query.eq(ExpertReview::getMeetingId, meetingId); - query.eq(ExpertReview::getIsFinal, Boolean.TRUE); - query.last(BizConst.LIMIT_1); - return getOne(query); - } - - @Override - public Map listFinalReviewMap(Long meetingId) { - return CollUtils.listToMap(listFinalReview(meetingId), ExpertReview::getProjectId); - } - - @Override - public List listFinalReview(Long meetingId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); - query.eq(ExpertReview::getMeetingId, meetingId); - query.eq(ExpertReview::getIsFinal, Boolean.TRUE); - return list(query); - } - - @Override - public ExpertReview getFinalReview(String projectCode, Integer meetingType) { - List constructMeetings = meetingMapper.selectList(Wrappers.lambdaQuery(Meeting.class) - .select(Meeting::getId) - .eq(Meeting::getType, meetingType)); - List meetingIds = constructMeetings.stream() - .map(Meeting::getId).collect(Collectors.toList()); - ExpertReview expertReview = null; - if(CollUtil.isNotEmpty(meetingIds)){ - expertReview = this.getOne(Wrappers.lambdaQuery(ExpertReview.class) - .eq(ExpertReview::getProjectCode, projectCode) - .eq(ExpertReview::getIsFinal, Boolean.TRUE) - .in(ExpertReview::getMeetingId,meetingIds) - .last(BizConst.LIMIT_1)); - } - return expertReview; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java deleted file mode 100644 index cc3a924..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertSensitiveInfoModifyDetailRecordServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.ningdatech.pmapi.expert.entity.ExpertSensitiveInfoModifyDetailRecord; -import com.ningdatech.pmapi.expert.mapper.ExpertSensitiveInfoModifyDetailRecordMapper; -import com.ningdatech.pmapi.expert.service.IExpertSensitiveInfoModifyDetailRecordService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@Service -public class ExpertSensitiveInfoModifyDetailRecordServiceImpl extends ServiceImpl implements IExpertSensitiveInfoModifyDetailRecordService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java deleted file mode 100644 index 234d70d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.mapper.NdExpertUserFullInfoMapper; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertUserFullInfoServiceImpl extends ServiceImpl implements IExpertUserFullInfoService { - - @Override - public ExpertUserFullInfo getByUserId(Long userId) { - return getOne(Wrappers.lambdaQuery().eq(ExpertUserFullInfo::getUserId, userId)); - } - - @Override - public List listByUserId(List userIds) { - return list(Wrappers.lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); - } - - @Override - public List listByUserIds(List userIds) { - return list(Wrappers.lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ReviewTemplateSettingsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ReviewTemplateSettingsServiceImpl.java deleted file mode 100644 index 2ab2842..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ReviewTemplateSettingsServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.service.impl; - -import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; -import com.ningdatech.pmapi.expert.mapper.ReviewTemplateSettingsMapper; -import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 评审模版配置表 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-14 - */ -@Service -public class ReviewTemplateSettingsServiceImpl extends ServiceImpl implements IReviewTemplateSettingsService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/utils/SensitiveModifySegmentUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/utils/SensitiveModifySegmentUtils.java deleted file mode 100644 index 7f5467f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/utils/SensitiveModifySegmentUtils.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.expert.utils; - - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; -import com.ningdatech.pmapi.expert.model.SensitiveModifySegment; -import com.ningdatech.pmapi.expert.model.TagFieldInfo; -import com.ningdatech.yxt.utils.JSONUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/8/24 下午3:36 - */ - -public class SensitiveModifySegmentUtils { - - private SensitiveModifySegmentUtils() { - } - - public static List getTagFieldInfoListApply(SensitiveModifySegment segment) { - switch (segment.getFieldName()) { - case good_at: - case technical_expertise: - case industry_sector: - case other: - if (Objects.nonNull(segment.getApply())) { - return JSONUtils.parseArray(segment.getApply().toString(), TagFieldInfo.class); - } - return new ArrayList<>(); - default: - throw new BizException("非法格式"); - } - - } - - public static List getDictionaryFieldInfoListApply(SensitiveModifySegment segment) { - switch (segment.getFieldName()) { - case administrative_rank: - case title_level: { - if (Objects.nonNull(segment.getApply())) { - return JSONUtils.parseArray(segment.getApply().toString(), DictionaryFieldInfo.class); - } - return new ArrayList<>(); - } - default: - throw new BizException("非法格式"); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/DocumentationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/DocumentationController.java deleted file mode 100644 index 5ea2611..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/DocumentationController.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ningdatech.pmapi.filemanage.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.filemanage.manage.DocumentationManage; -import com.ningdatech.pmapi.filemanage.model.dto.DocumentationGroupSaveDTO; -import com.ningdatech.pmapi.filemanage.model.dto.DocumentationSaveDTO; -import com.ningdatech.pmapi.filemanage.model.param.DocumentationListParam; -import com.ningdatech.pmapi.filemanage.model.vo.DocumentationGroupVO; -import com.ningdatech.pmapi.filemanage.model.vo.DocumentationVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import java.util.List; - -/** - * @Classname DocumentationController - * @Description - * @Date 2023/6/6 15:48 - * @Author PoffyZhang - */ -@RestController -@AllArgsConstructor -@Api(tags = "档案管理-资料文档控制器") -@RequestMapping("/api/v1/file-manage/documentation") -@Validated -public class DocumentationController { - - private final DocumentationManage documentationManage; - - @GetMapping("/group/list") - @ApiOperation(value = "分组列表", notes = "分组列表") - public List groupList(){ - return documentationManage.groupList(); - } - - @PostMapping("/group/add") - @ApiOperation(value = "分组添加", notes = "分组添加") - @WebLog("档案管理-资料文档-分组添加") - public String addGroup(@Validated @RequestBody DocumentationGroupSaveDTO dto){ - return documentationManage.addGroup(dto); - } - - @PostMapping("/group/delete/{id}") - @ApiOperation(value = "分组删除", notes = "分组删除") - @WebLog("档案管理-资料文档-分组删除") - public String deleteGroup(@PathVariable Long id){ - return documentationManage.deleteGroup(id); - } - - @GetMapping("/list") - @ApiOperation(value = "文档列表", notes = "文档列表") - public PageVo list(@ModelAttribute DocumentationListParam param){ - return documentationManage.list(param); - } - - @GetMapping("/detail/{id}") - @ApiOperation(value = "文档详情", notes = "文档详情") - public DocumentationVO detail(@PathVariable Long id){ - return documentationManage.detail(id); - } - - @PostMapping("/add") - @ApiOperation(value = "文档添加", notes = "文档添加") - @WebLog("档案管理-资料文档-文档添加") - public String addDoc(@Validated @RequestBody DocumentationSaveDTO dto){ - return documentationManage.addDoc(dto); - } - - @PostMapping("/delete/{id}") - @ApiOperation(value = "文档删除", notes = "文档删除") - @WebLog("档案管理-资料文档-文档删除") - public String deleteDoc(@PathVariable Long id){ - return documentationManage.deleteDoc(id); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java deleted file mode 100644 index 597922a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.filemanage.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.filemanage.manage.ProjectFileManage; -import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectApplyBorrowVO; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; - -/** - * @Classname ProjectFileController - * @Description - * @Date 2023/6/6 15:48 - * @Author PoffyZhang - */ -@RestController -@AllArgsConstructor -@Api(tags = "档案管理-项目档案") -@RequestMapping("/api/v1/file-manage/project-file") -@Validated -public class ProjectFileController { - - private final ProjectFileManage projectFileManage; - - @GetMapping("/list") - @ApiOperation(value = "档案列表", notes = "档案列表") - public PageVo list(@ModelAttribute ProjectFileListParam param){ - return projectFileManage.list(param); - } - - @GetMapping("/{projectId}") - @ApiOperation(value = "档案详情", notes = "档案详情") - public ProjectFileVO file(@PathVariable Long projectId){ - return projectFileManage.file(projectId); - } - - @PostMapping("/want-read/{projectId}") - @ApiOperation(value = "申请借阅", notes = "申请借阅") - @WebLog("档案管理-项目档案-申请借阅") - public String wantRead(@PathVariable Long projectId){ - String instanceId = projectFileManage.startApplyBorrowProcess(projectId); - return "启动申请借阅流程实例 【" + instanceId + "】 成功"; - } - - @GetMapping("/wantRead-detail/{instanceId}") - @ApiOperation(value = "借阅详情", notes = "借阅详情") - public ProjectApplyBorrowVO wantReadDetail(@PathVariable String instanceId){ - return projectFileManage.wantReadDetail(instanceId); - } - - @PostMapping("/download/{projectId}") - @ApiOperation(value = "档案下载",notes = "档案下载") - public void downloadFile(@PathVariable Long projectId,HttpServletResponse response){ - projectFileManage.downloadFile(projectId, response); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/DocumentationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/DocumentationManage.java deleted file mode 100644 index 3e48ec5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/DocumentationManage.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.ningdatech.pmapi.filemanage.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -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.file.entity.File; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.filemanage.model.dto.DocumentationGroupSaveDTO; -import com.ningdatech.pmapi.filemanage.model.dto.DocumentationSaveDTO; -import com.ningdatech.pmapi.filemanage.model.entity.Documentation; -import com.ningdatech.pmapi.filemanage.model.entity.DocumentationGroup; -import com.ningdatech.pmapi.filemanage.model.param.DocumentationListParam; -import com.ningdatech.pmapi.filemanage.model.vo.DocumentationGroupVO; -import com.ningdatech.pmapi.filemanage.model.vo.DocumentationVO; -import com.ningdatech.pmapi.filemanage.service.IDocumentationGroupService; -import com.ningdatech.pmapi.filemanage.service.IDocumentationService; -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.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname DocumentationManage - * @Description - * @Date 2023/6/6 16:04 - * @Author PoffyZhang - */ -@Component -@AllArgsConstructor -@Slf4j -public class DocumentationManage { - - private final IDocumentationService documentationService; - - private final IDocumentationGroupService documentationGroupService; - - private final FileService fileService; - - /** - * - * @return - */ - public List groupList() { - List list = documentationGroupService.list(); - - return list.stream().map(g -> BeanUtil.copyProperties(g,DocumentationGroupVO.class)).collect(Collectors.toList()); - } - - /** - * 文档列表 - * @param param - * @return - */ - public PageVo list(DocumentationListParam param) { - Page page = param.page(); - documentationService.page(page, Wrappers.lambdaQuery(Documentation.class) - .eq(Objects.nonNull(param.getGroupId()), Documentation::getGroupId, param.getGroupId())); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List vos = page.getRecords().stream() - .map(d -> BeanUtil.copyProperties(d,DocumentationVO.class)) - .collect(Collectors.toList()); - - return PageVo.of(vos,page.getTotal()); - } - - /** - * 增加分组 - * @param dto - * @return - */ - public String addGroup(DocumentationGroupSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - if(documentationGroupService.count(Wrappers.lambdaQuery(DocumentationGroup.class) - .eq(DocumentationGroup::getName,dto.getName())) > 0){ - throw new BizException("此分组名 已经存在"); - } - - DocumentationGroup documentationGroup = BeanUtil.copyProperties(dto, DocumentationGroup.class); - documentationGroup.setCreateBy(user.getRealName()); - documentationGroup.setCreateOn(LocalDateTime.now()); - if(documentationGroupService.save(documentationGroup)){ - return "添加成功"; - } - return "添加失败"; - } - - /** - * 删除分组 同时删除文档 - * @param id - * @return - */ - @Transactional - public String deleteGroup(Long id) { - DocumentationGroup group = documentationGroupService.getById(id); - VUtils.isTrue(Objects.isNull(group)).throwMessage("该分组不存在!"); - - // - documentationService.remove(Wrappers.lambdaQuery(Documentation.class) - .eq(Documentation::getGroupId, id)); - documentationGroupService.removeById(id); - - return "删除成功"; - } - - /** - * 上传文档 - * @param dto - * @return - */ - public String addDoc(DocumentationSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - Long fileId = dto.getFileId(); - File file = fileService.getById(fileId); - - VUtils.isTrue(Objects.isNull(file)).throwMessage("该文件不存在!"); - - DocumentationGroup group = documentationGroupService.getById(dto.getGroupId()); - - VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在!"); - - Documentation documentation = new Documentation(); - documentation.setCreateBy(user.getRealName()); - documentation.setCreateOn(LocalDateTime.now()); - documentation.setSize(Objects.nonNull(file.getSize()) ? file.getSize()/1000L : 0L); - documentation.setFileId(fileId); - documentation.setGroupId(dto.getGroupId()); - documentation.setFileName(file.getOriginalFileName()); - if(documentationService.save(documentation)){ - documentation.setSort(documentation.getId().intValue()); - documentationService.updateById(documentation); - } - - return "添加成功"; - } - - /** - * 删除文档 - * @param id - * @return - */ - public String deleteDoc(Long id) { - Documentation doc = documentationService.getById(id); - VUtils.isTrue(Objects.isNull(doc)).throwMessage("该文档不存在!"); - - if(documentationService.removeById(id)){ - return "删除成功"; - } - return "删除失败"; - } - - public DocumentationVO detail(Long id) { - Documentation doc = documentationService.getById(id); - if(Objects.isNull(doc)){ - return null; - } - return BeanUtil.copyProperties(doc,DocumentationVO.class); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java deleted file mode 100644 index cd4829d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ /dev/null @@ -1,566 +0,0 @@ -package com.ningdatech.pmapi.filemanage.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -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.file.entity.File; -import com.ningdatech.file.service.FileService; -import com.ningdatech.file.utils.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.expert.manage.ExpertReviewManage; -import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; -import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO; -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectApplyBorrowVO; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO; -import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileVO; -import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.projectdeclared.manage.ConstructionManage; -import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; -import com.ningdatech.pmapi.projectdeclared.manage.FinalAcceptanceManage; -import com.ningdatech.pmapi.projectdeclared.manage.PurchaseManage; -import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; -import com.ningdatech.pmapi.projectdeclared.service.IContractService; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -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.model.vo.ProjectDetailVO; -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.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.util.LoginUserUtil; -import com.wflow.bean.entity.WflowModels; -import com.wflow.contants.HisProInsEndActId; -import com.wflow.exception.BusinessException; -import com.wflow.workflow.bean.dto.OrgInfoDTO; -import com.wflow.workflow.bean.process.FileBasicInfo; -import com.wflow.workflow.bean.process.ProcessComment; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.bean.vo.ProcessStartParamsVo; -import com.wflow.workflow.service.ProcessInstanceService; -import com.wflow.workflow.service.ProcessModelService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.task.Comment; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * @Classname ProjectFileManage - * @Description - * @Date 2023/6/6 16:04 - * @Author PoffyZhang - */ -@Component -@AllArgsConstructor -@Slf4j -public class ProjectFileManage { - - private final IProjectService projectService; - private final ProjectLibManage projectLibManage; - private final UserInfoHelper userInfoHelper; - private final ProcessModelService processModelService; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - private final ProcessInstanceService processInstanceService; - private final NoticeManage noticeManage; - private final IProjectInstService projectInstService; - private final HistoryService historyService; - private final INdProjectApplyBorrowService projectApplyBorrowService; - private final IDingOrganizationService dingOrganizationService; - private final IProjectApplicationService projectApplicationService; - private final TaskService taskService; - private final IPurchaseService purchaseService; - private final IContractService contractService; - private final ExpertReviewManage expertReviewManage; - private final FileService fileService; - private final PurchaseManage purchaseManage; - private final ConstructionManage constructionManage; - private final FinalAcceptanceManage finalAcceptanceManage; - - public PageVo list(ProjectFileListParam param) { - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = userFullInfo.getEmployeeCode(); - String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - - Page page = param.page(); - projectService.page(page, Wrappers.lambdaQuery(Project.class) - .like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) - .like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) - .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) - .orderByDesc(Project::getUpdateOn)); - - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - // 获取本单位及下属单位的单位code - Set subOrgSet = getSubOrgList(empPosUnitCode); - - List vos = page.getRecords().stream().map(p -> { - ProjectFileListVO vo = new ProjectFileListVO(); - vo.setId(p.getId()); - // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 - if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet, p)) { - vo.setCanRead(Boolean.TRUE); - } - vo.setBuildOrgName(p.getBuildOrgName()); - vo.setPojectCode(p.getProjectCode()); - vo.setProjectName(p.getProjectName()); - // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) - .eq(ProjectApplyBorrow::getProjectId, p.getId()) - .orderByDesc(ProjectApplyBorrow::getCreateOn) - .last("limit 1")); - if (Objects.nonNull(projectApplyBorrow)) { - String instCode = projectApplyBorrow.getInstanceId(); - // 获取流程实例 - HistoricProcessInstance newInstance = - historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); - ProjectInst projectInst = projectInstService - .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); - // 推送省局联审的项目流程实例为EMPTY - if (Objects.nonNull(projectInst)) { - Integer instType = projectInst.getInstType(); - // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 - ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers - .lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) - .eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); - // 延期申请流程还未审核结束 - if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) - && Objects.isNull(newInstance.getEndActivityId())) { - vo.setCanApplyBorrow(Boolean.FALSE); - } - // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && - HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { - vo.setCanApplyBorrow(Boolean.TRUE); - } - } - } - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(vos, page.getTotal()); - } - - private boolean checkCanRead(Set subOrgSet, Project project) { - // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 - HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowProjectIdList = projectApplyBorrowService - .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); - return applyBorrowProjectIdList.contains(project.getId()); - } - - private Set getSubOrgList(String empPosUnitCode) { - HashSet orgSet = new HashSet<>(); - // 先将自己加入子集 - orgSet.add(empPosUnitCode); - Set subOrgList = dingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) - .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); - // 遍历子集 - for (String orgCode : subOrgList) { - orgSet.addAll(getSubOrgList(orgCode)); - } - return orgSet; - } - - public ProjectFileVO file(Long projectId) { - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - - // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 - Project project = projectService.getById(projectId); - Set subOrgList = getSubOrgList(empPosUnitCode); - - if (!checkCanRead(subOrgList, project)) { - throw new BizException("您没有权限查看此项目档案!"); - } - ProjectFileVO projectFileVo = new ProjectFileVO(); - String projectCode = project.getProjectCode(); - ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); - List processDetailVos = projectLibManage.processScheduleDetail(projectId); - ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode); - List purchaseVos = purchaseManage.detailByProjectId(projectId); - ContractVO contractVo = constructionManage.detailContractByProjectId(projectId); - PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId); - FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId); - - projectFileVo.setProjectDetailVo(projectDetailVo); - projectFileVo.setProcessDetailVos(processDetailVos); - projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo); - projectFileVo.setPurchaseVos(purchaseVos); - projectFileVo.setContractVo(contractVo); - projectFileVo.setPreInsVo(preInsVo); - projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo); - - return projectFileVo; - } - - public String wantRead(Long projectId) { - return "申请成功"; - } - - public String startApplyBorrowProcess(Long projectId) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - // 首先要判断 项目当前状态 是不是 已归档 - VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); - - String regionCode = user.getRegionCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到申请借阅流程配置", regionCode)); - } - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - // 放入条件判断的项目字段 - // 把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params, project); - // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); - String instanceId = - processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); - log.info("申请借阅申报成功 【{}】", instanceId); - - // 保存项目借阅实例相关 - projectLibManage.saveProjectByApplyBorrow(project, user, instanceId); - - // 发送给第一个审批人消息 - noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, - MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - public void downloadFile(Long projectId, HttpServletResponse response) { - Project project = projectService.getById(projectId); - // 获取项目各阶段上传文件ID - List fileIdList = Lists.newArrayList(); - getProjectAppendix(project, fileIdList); - if (fileIdList.isEmpty()) { - throw BizException.wrap("暂无档案可供下载"); - } - List files = fileService.listByIds(fileIdList); - if (files.isEmpty()) { - throw BizException.wrap("暂无档案可供下载"); - } - String zipFileName = "项目档案"; - // 设置response的header - response.setContentType("application/zip"); - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); - - try { - // 创建ZipOutputStream - ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); - // 获取文件输入流 - for (File file : files) { - String originalFileName = file.getOriginalFileName(); - String name = originalFileName.substring(0, originalFileName.indexOf(StrPool.DOT)); - String fileName = name + StrPool.UNDERSCORE + file.getId() - + originalFileName.substring(originalFileName.indexOf(StrPool.DOT)); - InputStream fileInputStream = fileService.getFileInputStream(file); - // 文件 - ZipEntry zipEntry = new ZipEntry(fileName); - zos.putNextEntry(zipEntry); - byte[] bytes = new byte[1024]; - int length; - while ((length = fileInputStream.read(bytes)) >= 0) { - zos.write(bytes, 0, length); - } - fileInputStream.close(); - zos.closeEntry(); - } - zos.close(); - } catch (IOException e) { - log.error("项目档案下载失败:", e); - throw BizException.wrap("项目档案下载失败"); - } - } - - private void getProjectAppendix(Project project, List fileIdList) { - Long projectId = project.getId(); - // 项目申报阶段 - // 获取立项依据 - String buildBasis = project.getBuildBasis(); - List buildBasisFileArray = JSON.parseArray(buildBasis, JSONObject.class); - for (JSONObject jsonObject : buildBasisFileArray) { - String fileInfo = jsonObject.getString(CommonConst.FILE_LIST); - List buildBasisFileIdList = getFileIdList(fileInfo); - fileIdList.addAll(buildBasisFileIdList); - } - // 获取附件-初步方案 - String preliminaryPlanFile = project.getPreliminaryPlanFile(); - List prePlanFileIdList = getFileIdList(preliminaryPlanFile); - fileIdList.addAll(prePlanFileIdList); - // 获取附件-佐证材料 - String supMaterialsFile = project.getSupportingMaterialsFile(); - List supMaterialFileIdList = getFileIdList(supMaterialsFile); - fileIdList.addAll(supMaterialFileIdList); - // 获取附件-项目总投资测算明细 - String calTotalInvestFile = project.getCalculationTotalInvestmentFile(); - List calTotalInvestFileIdList = getFileIdList(calTotalInvestFile); - fileIdList.addAll(calTotalInvestFileIdList); - // 获取附件-申报单位主要职责(单位三定方案) - String mainResAppFile = project.getMainResponsibilitiesApplicantFile(); - List mainResAppFileIdList = getFileIdList(mainResAppFile); - fileIdList.addAll(mainResAppFileIdList); - // 获取附件-项目申报书 - String projectApplicationForm = project.getProjectApplicationForm(); - List projectAppFormFileIdList = getFileIdList(projectApplicationForm); - fileIdList.addAll(projectAppFormFileIdList); - // 获取项目应用信息中的文件 - List applicationList = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId)); - for (ProjectApplication projectApplication : applicationList) { - // 获取试点文件 - String experimentsFile = projectApplication.getExperimentsFile(); - List experimentsFileIdList = getFileIdList(experimentsFile); - fileIdList.addAll(experimentsFileIdList); - // 获取应用总投资测算明细 - String appEstimateFile = projectApplication.getApplicationEstimateFile(); - List appEstimateFileIdList = getFileIdList(appEstimateFile); - fileIdList.addAll(appEstimateFileIdList); - } - // 流程审核意见文件 - // 获取项目关联的流程实例 - List projectInstList = - projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId)); - // 从历史评论表中获取对应流程实例的评论附件信息 - for (ProjectInst projectInst : projectInstList) { - String instanceId = projectInst.getInstCode(); - List commentList = taskService.getProcessInstanceComments(instanceId); - for (Comment comment : commentList) { - ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); - List attachments = processComment.getAttachments(); - if (CollUtil.isNotEmpty(attachments)) { - List idList = attachments.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList()); - fileIdList.addAll(idList); - } - } - } - - // 预审申报阶段 - // 预审申报上级条线主管单位审核意见 - String higherLineSuperOrgReviewComments = project.getHigherLineSuperOrgReviewComments(); - if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)) { - List highSuperOrgFileIdList = getFileIdList(higherLineSuperOrgReviewComments); - fileIdList.addAll(highSuperOrgFileIdList); - } - - // 方案申报阶段 - // 获取建设方案文件 - String constructionPlanFile = project.getConstructionPlanFile(); - String str = StrPool.LEFT_SQ_BRACKET + StrPool.RIGHT_SQ_BRACKET; - if (!str.equals(constructionPlanFile)) { - JSONArray array = JSON.parseArray(constructionPlanFile); - array.forEach(o -> { - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(o)); - Long constructFileId = jsonObject.getLong(CommonConst.FILE_ID_STR); - fileIdList.add(constructFileId); - }); - } - - // 立项批复阶段 - // 获取批复文件 - String approvedFile = project.getApprovedFile(); - if (Objects.nonNull(approvedFile)) { - fileIdList.add(Long.valueOf(approvedFile)); - } - // 获取建设方案文件 - String approvedConstructionPlanFile = project.getApprovedConstructionPlanFile(); - if (Objects.nonNull(approvedConstructionPlanFile)) { - fileIdList.add(Long.valueOf(approvedConstructionPlanFile)); - } - - // 采购结果备案阶段 - Purchase purchase = purchaseService - .getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1)); - // 获取投标文件 - if (Objects.nonNull(purchase)) { - String biddingDoc = purchase.getBiddingDoc(); - List biddingFileIdList = getFileIdList(biddingDoc); - fileIdList.addAll(biddingFileIdList); - // 获取招标文件 - String bidDoc = purchase.getBidDoc(); - List bidFileIdList = getFileIdList(bidDoc); - fileIdList.addAll(bidFileIdList); - // 获取中标通知书 - String acceptanceLetter = purchase.getAcceptanceLetter(); - List acceptFileIdList = getFileIdList(acceptanceLetter); - fileIdList.addAll(acceptFileIdList); - } - - // 合同备案阶段 - Contract contract = contractService - .getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); - // 获取合同附件 - if (Objects.nonNull(contract)) { - String attachment = contract.getAttachment(); - List contractFileIdList = getFileIdList(attachment); - fileIdList.addAll(contractFileIdList); - } - // 初验备案阶段 - // 获取初验材料 - String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials(); - getInspectionMaterials(fileIdList, preliminaryInspectionMaterials); - - // 终验申报阶段 - // 获取终验材料 - String finalAcceptanceMaterials = project.getFinalAcceptanceMaterials(); - getInspectionMaterials(fileIdList, finalAcceptanceMaterials); - - // 专家评审记录-如果有初步方案评审会议、部门联审评审会议、建设方案评审会议、验收评审会议对应的附件 - // 获取项目的所有评审意见 - String projectCode = project.getProjectCode(); - ProjectReviewDetailVO projectReviewDetailVO = expertReviewManage.projectExpertReviewDetail(projectCode); - Collection reviews = projectReviewDetailVO.getReviews(); - // 获取最终评审意见附件 - if (CollUtil.isNotEmpty(reviews)) { - List finalReviewFileIdList = reviews.stream().map(r -> { - ExpertReviewDetailVO finalReview = r.getFinalReview(); - return finalReview.getAttachFileId(); - }).collect(Collectors.toList()); - fileIdList.addAll(finalReviewFileIdList); - // 获取组员评审意见 - for (ProjectReviewDetailVO.ReviewDetailByTypeVO review : reviews) { - List teamMemberReviews = review.getTeamMemberReviews(); - for (ExpertReviewDetailVO teamMemberReview : teamMemberReviews) { - Long attachFileId = teamMemberReview.getAttachFileId(); - fileIdList.add(attachFileId); - } - } - } - } - - private void getInspectionMaterials(List fileIdList, String preliminaryInspectionMaterials) { - List fileStrList = JSON.parseArray(preliminaryInspectionMaterials, String.class); - if (CollUtil.isNotEmpty(fileStrList)) { - for (String fileStr : fileStrList) { - JSONObject object = JSON.parseObject(fileStr, JSONObject.class); - String dataStr = object.getString("data"); - List array = JSON.parseArray(dataStr, String.class); - for (String file : array) { - JSONObject fileObject = JSON.parseObject(file, JSONObject.class); - String filesStr = fileObject.getString("files"); - List jsonObjects = JSON.parseArray(filesStr, JSONObject.class); - if (CollUtil.isEmpty(jsonObjects)) { - // 如果没有上传附件,跳过 - continue; - } - for (JSONObject json : jsonObjects) { - String response = json.getString("response"); - JSONObject responseJson = JSON.parseObject(response, JSONObject.class); - String fileData = responseJson.getString("data"); - JSONObject fileInfoObject = JSON.parseObject(fileData, JSONObject.class); - Long fileId = fileInfoObject.getLong("id"); - fileIdList.add(fileId); - } - } - } - } - } - - private List getFileIdList(String buildBasis) { - List prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class); - List prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); - return prePlanFileIdList; - } - - /** - * 查看 借阅的详情 - * - * @param instanceId - * @return - */ - public ProjectApplyBorrowVO wantReadDetail(String instanceId) { - ProjectApplyBorrow apply = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getInstanceId, instanceId) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(apply)) { - return null; - } - - ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply, ProjectApplyBorrowVO.class); - if (StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); - if (Objects.nonNull(user)) { - vo.setApplyBorrowEmployeeName(user.getUsername()); - } - } - if (StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())) { - DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) - .last(BizConst.LIMIT_1)); - if (Objects.nonNull(organization)) { - vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); - } - } - if (Objects.nonNull(vo.getProjectId())) { - Project project = projectService.getById(vo.getProjectId()); - if (Objects.nonNull(project)) { - vo.setProjectName(project.getProjectName()); - } - } - return vo; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.java deleted file mode 100644 index bdf415e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.filemanage.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.filemanage.model.entity.DocumentationGroup; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-02-27 - */ -public interface DocumentationGroupMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.xml deleted file mode 100644 index 2d4547b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationGroupMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.java deleted file mode 100644 index aa3b30b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.filemanage.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.filemanage.model.entity.Documentation; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-02-27 - */ -public interface DocumentationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.xml deleted file mode 100644 index a282e44..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/DocumentationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java deleted file mode 100644 index 50545f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.filemanage.mapper; - -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-06-16 - */ -public interface NdProjectApplyBorrowMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml deleted file mode 100644 index 6a6fa76..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationGroupSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationGroupSaveDTO.java deleted file mode 100644 index e0763fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationGroupSaveDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "DocumentationGroupSaveDTO", description = "DocumentationGroupSaveDTO") -public class DocumentationGroupSaveDTO { - - @ApiModelProperty("分组名") - private String name; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationSaveDTO.java deleted file mode 100644 index 2f66359..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/dto/DocumentationSaveDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "DocumentationSaveDTO", description = "DocumentationSaveDTO") -public class DocumentationSaveDTO { - - @ApiModelProperty("文档分类ID") - @NotNull(message = "请传分组ID") - private Long groupId; - - @ApiModelProperty("文档ID") - @NotNull(message = "请传文档ID") - private Long fileId; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/Documentation.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/Documentation.java deleted file mode 100644 index 5162484..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/Documentation.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.filemanage.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.time.LocalDateTime; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@TableName("nd_documentation") -@ApiModel(value = "nd_documentation", description = "资料文档") -public class Documentation { - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("文件名") - private String fileName; - - @ApiModelProperty("上传人") - private String createBy; - - @ApiModelProperty("上传时间") - private LocalDateTime createOn; - - @ApiModelProperty("文档大小 kb") - private Long size; - - @ApiModelProperty("文档分类ID") - private Long groupId; - - @ApiModelProperty("文档ID") - private Long fileId; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/DocumentationGroup.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/DocumentationGroup.java deleted file mode 100644 index f76cf45..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/DocumentationGroup.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.filemanage.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.time.LocalDateTime; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@TableName("nd_documentation_group") -@ApiModel(value = "nd_documentation_group", description = "资料文档分组") -public class DocumentationGroup { - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("上传人") - private String createBy; - - @ApiModelProperty("上传时间") - private LocalDateTime createOn; - - @ApiModelProperty("分组名") - private String name; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java deleted file mode 100644 index be5fffc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-06-16 - */ -@Data -@TableName("nd_project_apply_borrow") -@ApiModel(value = "NdProjectApplyBorrow对象", description = "") -public class ProjectApplyBorrow implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("借阅项目ID") - private Long projectId; - - @ApiModelProperty("申请借阅员工code") - private String applyBorrowEmployeeCode; - - @ApiModelProperty("申请借阅用户任职单位code") - private String applyBorrowEmpPosUnitCode; - - @ApiModelProperty("申请借阅审批流程ID") - private String instanceId; - - @ApiModelProperty("创建人") - private Long createBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新人") - private Long updateBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("申请借阅是否成功") - private Boolean isSuccess; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/DocumentationListParam.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/DocumentationListParam.java deleted file mode 100644 index 77700ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/DocumentationListParam.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.param; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname DocumentationListParam - * @Description - * @Date 2023/6/6 16:06 - * @Author PoffyZhang - */ -@Data -public class DocumentationListParam extends PagePo { - - @ApiModelProperty("分组ID") - private Long groupId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/ProjectFileListParam.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/ProjectFileListParam.java deleted file mode 100644 index ea87f3f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/ProjectFileListParam.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.param; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname ProjectFileListParam - * @Description - * @Date 2023/6/6 16:06 - * @Author PoffyZhang - */ -@Data -public class ProjectFileListParam extends PagePo { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目单位") - private String buildOrgName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationGroupVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationGroupVO.java deleted file mode 100644 index a46e229..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationGroupVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "nd_documentation_group", description = "资料文档分组") -public class DocumentationGroupVO { - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("上传人") - private String createBy; - - @ApiModelProperty("上传时间") - private LocalDateTime createOn; - - @ApiModelProperty("分组名") - private String name; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationVO.java deleted file mode 100644 index e5eebef..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationVO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "nd_documentation", description = "资料文档") -public class DocumentationVO { - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("文档ID") - private Long fileId; - - @ApiModelProperty("文件名") - private String fileName; - - @ApiModelProperty("上传人") - private String createBy; - - @ApiModelProperty("上传时间") - private LocalDateTime createOn; - - @ApiModelProperty("文档大小 kb") - private Long size; - - @ApiModelProperty("文档分类ID") - private Long groupId; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectApplyBorrowVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectApplyBorrowVO.java deleted file mode 100644 index 9dfdcba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectApplyBorrowVO.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-06-16 - */ -@Data -@ApiModel(value = "ProjectApplyBorrowVO", description = "") -public class ProjectApplyBorrowVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("借阅项目ID") - private Long projectId; - - @ApiModelProperty("借阅项目名") - private String projectName; - - @ApiModelProperty("申请借阅员工code") - private String applyBorrowEmployeeCode; - - @ApiModelProperty("申请借阅员工名字") - private String applyBorrowEmployeeName; - - @ApiModelProperty("申请借阅用户任职单位code") - private String applyBorrowEmpPosUnitCode; - - @ApiModelProperty("申请借阅用户任职单位") - private String applyBorrowEmpPosUnitName; - - @ApiModelProperty("申请借阅审批流程ID") - private String instanceId; - - @ApiModelProperty("创建人") - private Long createBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新人") - private Long updateBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("申请借阅是否成功") - private Boolean isSuccess; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java deleted file mode 100644 index c4b4d90..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @Classname Documentation - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ProjectFileListVO", description = "资料文档") -public class ProjectFileListVO { - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目单位") - private String buildOrgName; - - @ApiModelProperty("项目编号") - private String pojectCode; - - @ApiModelProperty("是否可阅") - private Boolean canRead = Boolean.FALSE; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("是否可以申请借阅") - private Boolean canApplyBorrow = Boolean.TRUE; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java deleted file mode 100644 index c9bc9c6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.filemanage.model.vo; - -import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; -import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname ProjectFileVO - * @Description - * @Date 2023/6/6 14:41 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ProjectFileVO", description = "项目档案") -public class ProjectFileVO { - - @ApiModelProperty("项目档案详情") - private ProjectDetailVO projectDetailVo; - - @ApiModelProperty("流程进度详情") - private List processDetailVos; - - @ApiModelProperty("专家评审详情") - private ProjectReviewDetailVO projectReviewDetailVo; - - @ApiModelProperty("招标登记详情") - private List purchaseVos; - - @ApiModelProperty("合同登记详情") - private ContractVO contractVo; - - @ApiModelProperty("初验登记详情") - private PreInsVO preInsVo; - - @ApiModelProperty("终验信息详情") - private FinalAcceptanceVO finalAcceptanceVo; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationGroupService.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationGroupService.java deleted file mode 100644 index 61a0786..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationGroupService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.filemanage.model.entity.DocumentationGroup; - -public interface IDocumentationGroupService extends IService { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationService.java deleted file mode 100644 index c469d0a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.filemanage.model.entity.Documentation; - -public interface IDocumentationService extends IService { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java deleted file mode 100644 index c4667e7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service; - -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-06-16 - */ -public interface INdProjectApplyBorrowService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationGroupServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationGroupServiceImpl.java deleted file mode 100644 index 35c59b6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationGroupServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.filemanage.mapper.DocumentationGroupMapper; -import com.ningdatech.pmapi.filemanage.model.entity.DocumentationGroup; -import com.ningdatech.pmapi.filemanage.service.IDocumentationGroupService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -@Service -public class DocumentationGroupServiceImpl extends ServiceImpl implements IDocumentationGroupService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationServiceImpl.java deleted file mode 100644 index cf2ba44..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/DocumentationServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.filemanage.mapper.DocumentationMapper; -import com.ningdatech.pmapi.filemanage.model.entity.Documentation; -import com.ningdatech.pmapi.filemanage.service.IDocumentationService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -@Service -public class DocumentationServiceImpl extends ServiceImpl implements IDocumentationService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java deleted file mode 100644 index a76740e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.filemanage.service.impl; - -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.ningdatech.pmapi.filemanage.mapper.NdProjectApplyBorrowMapper; -import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-06-16 - */ -@Service -public class NdProjectApplyBorrowServiceImpl extends ServiceImpl implements INdProjectApplyBorrowService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java deleted file mode 100644 index 28ec8de..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.fiscal.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.fiscal.manage.CompanyFiscalCodeManage; -import com.ningdatech.pmapi.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; -import com.ningdatech.pmapi.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; -import com.ningdatech.pmapi.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -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 Lierbao - * @since 2023-02-10 - */ -@RestController -@RequestMapping("/api/v1/fiscal-code") -@RequiredArgsConstructor -@Api(tags = "印章配置-财政编码配置") -public class CompanyFiscalCodeController { - - private final CompanyFiscalCodeManage companyFiscalCodeManage; - - @ApiOperation(value = "财政编码-配置", notes = "财政编码配置") - @PostMapping("/fiscal-and-seal/configure") - @WebLog("财政编码-配置") - public void fiscalAndSealCodeConfigure(@Valid @RequestBody ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { - companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); - } - - @ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置") - @PostMapping("/fiscal-and-seal/get-configure") - public ResCompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { - return companyFiscalCodeManage.getFiscalCodeConfigure(request); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java deleted file mode 100644 index 0767cf1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.fiscal.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -@Data -@TableName("nd_company_fiscal_code") -@ApiModel(value = "NdCompanyFiscalCode对象", description = "") -public class CompanyFiscalCode implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private String fiscalCode; - - private String organizationCode; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long createBy; - - private Long updateBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java deleted file mode 100644 index e481d4a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ningdatech.pmapi.fiscal.manage; - -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; -import com.ningdatech.pmapi.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; -import com.ningdatech.pmapi.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; -import com.ningdatech.pmapi.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; -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.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:23 - */ -@Component -@RequiredArgsConstructor -public class CompanyFiscalCodeManage { - - private final UserInfoHelper userInfoHelper; - - private final ICompanyFiscalCodeService iCompanyFiscalCodeService; - private final ICompanySignatureService iCompanySignatureService; - - - public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { - Long userId = LoginUserUtil.getUserId(); - - String organizationCode = reqCompanyFiscalCodeAndSealSnPO.getOrganizationCode(); - if (StringUtils.isBlank(organizationCode)) { - organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); - } - // TODO 校验用户权限 - - // 保存财政编码配置 - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); - if (Objects.isNull(companyFiscalCode)) { - companyFiscalCode = new CompanyFiscalCode(); - companyFiscalCode.setOrganizationCode(organizationCode); - companyFiscalCode.setCreateOn(LocalDateTime.now()); - companyFiscalCode.setCreateBy(userId); - } - String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode(); - companyFiscalCode.setFiscalCode(fiscalCode); - companyFiscalCode.setUpdateOn(LocalDateTime.now()); - companyFiscalCode.setUpdateBy(userId); - iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode); - - - // 保存印章配置 - CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); - if (Objects.isNull(companySignature)) { - companySignature = new CompanySignature(); - companySignature.setOrganizationCode(organizationCode); - companySignature.setCreateOn(LocalDateTime.now()); - } - String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn(); - companySignature.setSealSn(sealSn); - companySignature.setUpdateOn(LocalDateTime.now()); - companySignature.setCreateBy(userId); - companySignature.setUpdateBy(userId); - iCompanySignatureService.saveOrUpdate(companySignature); - } - - public ResCompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { - Long userId = LoginUserUtil.getUserId(); - String organizationCode = request.getOrganizationCode(); - if (StringUtils.isBlank(organizationCode)) { - organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); - } - CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); - - ResCompanyFiscalCodeAndSealSnVO returnVO = new ResCompanyFiscalCodeAndSealSnVO(); - if (Objects.isNull(companySignature)) { - return null; - } - returnVO.setCreateTime(companySignature.getCreateOn()); - returnVO.setUpdateTime(companySignature.getUpdateOn()); - returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); - returnVO.setSealSn(companySignature.getSealSn()); - return returnVO; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.java deleted file mode 100644 index d43a626..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.fiscal.mapper; - -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -public interface NdCompanyFiscalCodeMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.xml deleted file mode 100644 index 710124e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/mapper/NdCompanyFiscalCodeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java deleted file mode 100644 index 993abaa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.fiscal.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:24 - */ -@Data -@ApiModel("财政编码配置") -public class ReqCompanyFiscalCodeAndSealSnPO { - -// @NotBlank(message = "组织编码 不能为空") - @ApiModelProperty("组织编码(需传入用户任职单位code)") - private String organizationCode; - - @ApiModelProperty("财政编码") - private String fiscalCode; - - @NotBlank(message = "印章编号 不能为空") - @ApiModelProperty("印章编号") - private String sealSn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java deleted file mode 100644 index d891f53..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.fiscal.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:24 - */ -@Data -@ApiModel("获取财政编码配置") -public class ReqGetCompanyFiscalCodeAndSealSnPO { - - @ApiModelProperty("组织编码(需传入用户任职单位code)") - private String organizationCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java deleted file mode 100644 index 264d73e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.fiscal.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2023/3/23 上午10:58 - */ - -@Data -@ApiModel("财政编码配置VO") -public class ResCompanyFiscalCodeAndSealSnVO { - - @ApiModelProperty("组织编码") - private String organizationCode; - - @ApiModelProperty("财政编码") - private String fiscalCode; - - @ApiModelProperty("印章编号") - private String sealSn; - - @ApiModelProperty("创建时间") - private LocalDateTime createTime; - - @ApiModelProperty("更新时间") - private LocalDateTime updateTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java deleted file mode 100644 index 02690f7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.fiscal.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; - -import java.util.List; -import java.util.Map; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -public interface ICompanyFiscalCodeService extends IService { - - CompanyFiscalCode getByOrganizationCode(String orgCode); - - /** - * 获取 key orgCode fiscalCode - * - * @param orgCodeList - * @return - */ - Map getByOrgFiscalCodeMap(List orgCodeList); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java deleted file mode 100644 index 26315f4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.fiscal.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; -import com.ningdatech.pmapi.fiscal.mapper.NdCompanyFiscalCodeMapper; -import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -@Service - -public class CompanyFiscalCodeServiceImpl extends ServiceImpl implements ICompanyFiscalCodeService { - - - @Override - public CompanyFiscalCode getByOrganizationCode(String orgCode) { - if (StringUtils.isBlank(orgCode)) { - return null; - } - return this.getOne(Wrappers.lambdaQuery(CompanyFiscalCode.class) - .eq(CompanyFiscalCode::getOrganizationCode, orgCode)); - - } - - @Override - public Map getByOrgFiscalCodeMap(List orgCodeList) { - if (CollUtil.isNotEmpty(orgCodeList)) { - return new HashMap(); - } - List companyFiscalCodeList = this.list(Wrappers.lambdaQuery(CompanyFiscalCode.class) - .in(CompanyFiscalCode::getOrganizationCode, orgCodeList)); - - Map orgCodeAndFiscalCodeMap = companyFiscalCodeList.stream() - .collect(Collectors.toMap(CompanyFiscalCode::getOrganizationCode, CompanyFiscalCode::getFiscalCode)); - return orgCodeAndFiscalCodeMap; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/contants/BizProjectContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/contants/BizProjectContant.java deleted file mode 100644 index 3707fea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/contants/BizProjectContant.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.gov.contants; - -/** - * @Classname BizProjectContant - * @Description - * @Date 2023/8/25 11:03 - * @Author PoffyZhang - */ -public interface BizProjectContant { - - String PUSH_URL = "http://10.53.168.41:38088/syn-data-task/open/api/v1/project-receive/save"; - String NOT_EFFECTIVE_URL = "http://10.53.168.41:38088/syn-data-task/open/api/v1/project-receive/not-effective"; - String NOT_EFFECTIVE_CODE = "1"; - - String EFFECTIVE_CODE = "2"; - - class ProjectCollection { - //有效 - public static final String IS_EFFECTIVE = "02"; - //有效 - public static final String NOT_EFFECTIVE = "01"; - public static final String DRAFT = "草稿"; - public static final String OP_INSERT = "insert"; - public static final String OP_UPDATE = "update"; - public static final String OP_DELETE = "delete"; - public static final String PDF_SUFFIX = ".pdf"; - public static final String MONTH = "月"; - - public static final String MISSING_HIS_PROJ_ID = "000000"; - - public static final String MISSING_HIS_PROJ_NAME = "历年项目数据缺失"; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java deleted file mode 100644 index 2c1ff26..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.gov.controller; - - -import com.ningdatech.pmapi.gov.manage.BelongOrgManage; -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -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.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author liuxinxin - * @since 2023-04-18 - */ -@Slf4j -@Validated -@RestController -@RequiredArgsConstructor -@Api(value = "BelongOrgController", tags = "单位所属条线") -@RequestMapping("/api/v1/belong-org") -public class BelongOrgController { - - private final BelongOrgManage belongOrgManage; - - @GetMapping("/business-strip/list") - @ApiOperation("获取条线列表") - public List getGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) { - return belongOrgManage.getGovBusinessStripList(businessStripName); - } - - @GetMapping("/business-strip/expert/analysis") - @ApiOperation("分析专家数据") - public void analysisExpertOrg() { - belongOrgManage.analysisExpertOrg(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java deleted file mode 100644 index c659751..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.ningdatech.pmapi.gov.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.dto.GovOperationProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectListVO; -import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectDetailVO; -import com.ningdatech.pmapi.gov.model.vo.GovProjectDictionaryVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; -import com.ningdatech.pmapi.scheduler.task.SynProvinceOrgTask; -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 javax.validation.Valid; -import java.net.UnknownHostException; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author zpf - * @since 2023-08-21 - */ -@Slf4j -@Validated -@RestController -@RequiredArgsConstructor -@Api(value = "GovProjectCollectionController", tags = "新项目归集") -@RequestMapping("/api/v1/gov-project-collection") -public class GovProjectCollectionController { - - private final GovProjectCollectionManage collectionManage; - - private final SynProjectCollectionTask collectionTask; - - private final SynProvinceOrgTask synProvinceOrgTask; - - @GetMapping("/dictionary") - @ApiOperation("字典") - public List dictionary(@RequestParam(value = "type", required = false) String type) { - return collectionManage.dictionary(type); - } - - @GetMapping("/list") - @ApiOperation("项目归集列表") - public PageVo list(ProjectListReq req) { - return collectionManage.list(req); - } - - @GetMapping("/operation/list") - @ApiOperation("运维项目项目归集列表") - public PageVo operationList(ProjectListReq req) { - return collectionManage.operationList(req); - } - - @GetMapping("/detail/{projId}") - @ApiOperation("项目归集详情") - public GovBizProjectDetailVO detail(@PathVariable String projId) { - return collectionManage.detail(projId); - } - - @GetMapping("/operation/detail/{projId}") - @ApiOperation("运维项目归集详情") - public GovOperationProjectDetailVO operationDetail(@PathVariable String projId) { - return collectionManage.operationDetail(projId); - } - - @PostMapping("/save") - @ApiOperation("项目归集保存") - @WebLog("项目归集保存") - public String save(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { - return collectionManage.save(saveDTO,null); - } - - @PostMapping("/operation/save") - @ApiOperation("运维项目归集保存") - @WebLog("运维项目归集保存") - public String operationSave(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { - return collectionManage.operationSave(saveDTO,null); - } - - @PostMapping("/remove/{projId}") - @ApiOperation("项目归集删除") - @WebLog("项目归集删除") - public String remove(@PathVariable String projId) { - return collectionManage.remove(projId); - } - - @PostMapping("/operation/remove/{projId}") - @ApiOperation("运维项目归集删除") - @WebLog("运维项目归集删除") - public String operationRemove(@PathVariable String projId) { - return collectionManage.operationRemove(projId); - } - - @GetMapping("/draft-list") - @ApiOperation("项目归集草稿箱列表") - public PageVo draftList(ProjectListReq req) { - return collectionManage.draftList(req); - } - - @GetMapping("/operation/draft-list") - @ApiOperation("运维项目归集草稿箱列表") - public PageVo operationDraftList(ProjectListReq req) { - return collectionManage.operationDraftList(req); - } - - @GetMapping("/draft-detail/{draftId}") - @ApiOperation("项目归集草稿箱详情") - public GovBizProjectDetailVO draftDetail(@PathVariable Long draftId) { - return collectionManage.draftDetail(draftId); - } - - @GetMapping("/operation/draft-detail/{draftId}") - @ApiOperation("运维项目归集草稿箱详情") - public GovOperationProjectDetailVO operationDraftDetail(@PathVariable Long draftId) { - return collectionManage.operationDraftDetail(draftId); - } - - @PostMapping("/draft") - @ApiOperation("项目归集暂存草稿箱") - @WebLog("项目归集暂存草稿箱") - public String draft(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { - return collectionManage.draft(saveDTO,null); - } - - @PostMapping("/operation/draft") - @ApiOperation("运维项目归集暂存草稿箱") - @WebLog("运维项目归集暂存草稿箱") - public String operationDraft(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { - return collectionManage.operationDraft(saveDTO,null); - } - - @PostMapping("/draft-remove/{draftId}") - @ApiOperation("项目归集草稿箱删除") - @WebLog("项目归集草稿箱删除") - public String draftRemove(@PathVariable Long draftId) { - return collectionManage.draftRemove(draftId); - } - - @PostMapping("/operation/draft-remove/{draftId}") - @ApiOperation("运维项目归集草稿箱删除") - @WebLog("运维项目归集草稿箱删除") - public String operationDraftRemove(@PathVariable Long draftId) { - return collectionManage.operationDraftRemove(draftId); - } - - @PostMapping("/push-task") - @ApiOperation("主动调用定时器方法") - @WebLog("主动调用定时器方法") - public void pushTask() throws UnknownHostException { - collectionTask.doTask(); - } - - @PostMapping("/push-task-single") - @ApiOperation("主动调用定时器方法") - @WebLog("主动调用定时器方法") - public void pushTaskSingle(@RequestBody List projectCodes) throws UnknownHostException { - collectionTask.doTaskSingle(projectCodes); - } - - @PostMapping("/staging-convert-pdf") - @ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段") - @WebLog("主动转换库存的文件都为PDF文件") - public void stagingConvertPdf(@RequestParam(required = false) String projId) { - collectionTask.stagingConvertPdf(projId); - } - - @PostMapping("/staging-convert-pdf2") - @ApiOperation("把库存的项目归集的文件approval_file重新转换") - @WebLog("把库存的项目归集的文件approval_file重新转换") - public void stagingConvertPdf2(@RequestParam(required = false) String projId) { - collectionTask.stagingConvertPdf2(projId); - } - - @PostMapping("/staging-convert-pdf3") - @ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段 采购") - @WebLog("主动转换库存的文件都为PDF文件 采购") - public void stagingConvertPdf3(@RequestParam(required = false) String projId) { - collectionTask.stagingConvertPdf3(projId); - } - - @PostMapping("/rebuild-project-code") - @ApiOperation("重新生成项目编号") - @WebLog("重新生成项目编号") - public String stagingConvertPdf3(@RequestBody List projIds) { - return collectionManage.rebuildProjectCode(projIds); - } - - @PostMapping("/remove-project") - @ApiOperation("删除申报项目") - @WebLog("删除申报项目") - public String removeProject(@RequestBody List projectCodes){ - return collectionManage.removeProject(projectCodes); - } - - @GetMapping("/syn-province") - @ApiOperation("同步省级单位") - @WebLog("同步省级单位") - public String synProvince() throws UnknownHostException { - synProvinceOrgTask.doTask(); - return "同步成功"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java deleted file mode 100644 index 2536dcb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java +++ /dev/null @@ -1,447 +0,0 @@ -package com.ningdatech.pmapi.gov.convert; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.model.dto.*; -import com.ningdatech.pmapi.gov.model.req.*; -import com.ningdatech.pmapi.gov.model.vo.*; -import com.ningdatech.pmapi.gov.utils.ProjectCollectionUtil; -import org.apache.commons.lang3.StringUtils; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectConvert - * @Description - * @Date 2023/8/25 11:53 - * @Author PoffyZhang - */ -public class ProjectConvert { - - /** - * 6个 转换方法 - * @param saveDTO - * @return - */ - public static ProjectPushReq convert(GovBizProjectSaveDTO saveDTO) { - ProjectPushReq req = new ProjectPushReq(); - req.setBaseinfo(convertBase(saveDTO.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); - req.setApply(convertApply(saveDTO.getApply())); - req.setApprove(convertApprove(saveDTO.getApprove())); - req.setCimplement(convertCimplement(saveDTO.getCimplement())); - req.setMimplement(convertMimplement(saveDTO.getMimplement())); - req.setProcures(convertProcures(saveDTO.getProcures())); - return req; - } - - public static ProjectPushReq convert(GovBizProjectDetailVO vo) { - ProjectPushReq req = new ProjectPushReq(); - req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); - req.setApply(convertApplyVo(vo.getApply())); - req.setApprove(convertApproveVo(vo.getApprove())); - req.setCimplement(convertCimplementVo(vo.getCimplement())); - req.setMimplement(convertMimplementVo(vo.getMimplement())); - req.setProcures(convertProcuresVo(vo.getProcures())); - return req; - } - - public static ProjectPushReq convertWithConvertPdf(GovBizProjectDetailVO vo) { - ProjectPushReq req = new ProjectPushReq(); - req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); - req.setApply(convertApplyVoWithConvertPdf(vo.getApply())); - req.setApprove(convertApproveVoWithConvertPdf(vo.getApprove())); - req.setCimplement(convertCimplementVoWithConvertPdf(vo.getCimplement())); - req.setMimplement(convertMimplementVoWithConvertPdf(vo.getMimplement())); - req.setProcures(convertProcuresVoWithConvertPdf(vo.getProcures())); - return req; - } - - public static ProjectPushReq convertWithConvertPdf(GovOperationProjectDetailVO vo) { - ProjectPushReq req = new ProjectPushReq(); - req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE)); - req.setApply(convertApplyVoWithConvertPdf(vo.getApply())); - req.setApprove(convertApproveVoWithConvertPdf(vo.getApprove())); - req.setCimplement(convertCimplementVoWithConvertPdf(vo.getCimplement())); - req.setMimplement(convertMimplementVoWithConvertPdf(vo.getMimplement())); - req.setProcures(convertProcuresVoWithConvertPdf(vo.getProcures())); - return req; - } - - private static List convertProcures(List procures) { - if(CollUtil.isEmpty(procures)){ - return Collections.emptyList(); - } - - List req = procures.stream() - .map(p -> { - ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); - if(Objects.nonNull(p.getId())){ - r.setTongID(p.getId().intValue()); - } - r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); - r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); - return r; - }) - .collect(Collectors.toList()); - return req; - } - - private static List convertProcuresVo(List procures) { - if(CollUtil.isEmpty(procures)){ - return Collections.emptyList(); - } - - List req = procures.stream() - .map(p -> { - ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); - if(Objects.nonNull(p.getId())){ - r.setTongID(p.getId().intValue()); - } - r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); - r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); - return r; - }) - .collect(Collectors.toList()); - return req; - } - - private static List convertProcuresVoWithConvertPdf(List procures) { - if(CollUtil.isEmpty(procures)){ - return Collections.emptyList(); - } - - List req = procures.stream() - .map(p -> { - ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class); - r.setBiddingFile(StringUtils.isNotBlank(p.getBiddingFilePdf()) ? p.getBiddingFilePdf() : - null); - r.setPurchaseFile(StringUtils.isNotBlank(p.getPurchaseFilePdf()) ? p.getPurchaseFilePdf() : - null); - r.setPurchaseContract(StringUtils.isNotBlank(p.getPurchaseContractPdf()) ? p.getPurchaseContractPdf() : - null); - r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); - r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); - return r; - }) - .collect(Collectors.toList()); - return req; - } - - private static ProjectMimplementReq convertMimplement(GovBizProjectMimplementDTO mimplement) { - ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); - return req; - } - - private static ProjectMimplementReq convertMimplementVo(GovBizProjectMimplementVO mimplement) { - ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); - return req; - } - - private static ProjectMimplementReq convertMimplementVoWithConvertPdf(GovBizProjectMimplementVO mimplement) { - ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class); - if(Objects.isNull(req)){ - return req; - } - req.setBaseUserConsFile(StringUtils.isNotBlank(mimplement.getBaseUserConsFilePdf()) ? mimplement.getBaseUserConsFilePdf() : - mimplement.getBaseUserConsFile()); - req.setBaseChanFile(StringUtils.isNotBlank(mimplement.getBaseChanFilePdf()) ? mimplement.getBaseChanFilePdf() : - mimplement.getBaseChanFile()); - req.setBasePasswAssessFile(StringUtils.isNotBlank(mimplement.getBasePasswAssessFilePdf()) ? mimplement.getBasePasswAssessFilePdf() : - mimplement.getBasePasswAssessFile()); - req.setBaseInforLevelFile(StringUtils.isNotBlank(mimplement.getBaseInforLevelFilePdf()) ? mimplement.getBaseInforLevelFilePdf() : - mimplement.getBaseInforLevelFile()); - req.setBaseEngineerPostpoFile(StringUtils.isNotBlank(mimplement.getBaseEngineerPostpoFilePdf()) ? mimplement.getBaseEngineerPostpoFilePdf() : - mimplement.getBaseEngineerPostpoFile()); - req.setBaseEstaSummFile(StringUtils.isNotBlank(mimplement.getBaseEstaSummFilePdf()) ? mimplement.getBaseEstaSummFilePdf() : - mimplement.getBaseEstaSummFile()); - req.setBaseFinalExpertOpinionFile(StringUtils.isNotBlank(mimplement.getBaseFinalExpertOpinionFilePdf()) ? mimplement.getBaseFinalExpertOpinionFilePdf() : - mimplement.getBaseFinalExpertOpinionFile()); - req.setBaseThirdAcceptFile(StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFilePdf()) ? mimplement.getBaseThirdAcceptFilePdf() : - mimplement.getBaseThirdAcceptFile()); - req.setBaseOperatMaintenSummFile(StringUtils.isNotBlank(mimplement.getBaseOperatMaintenSummFilePdf()) ? mimplement.getBaseOperatMaintenSummFilePdf() : - mimplement.getBaseOperatMaintenSummFile()); - req.setBaseEngineerAlterFile(StringUtils.isNotBlank(mimplement.getBaseEngineerAlterFilePdf()) ? mimplement.getBaseEngineerAlterFilePdf() : - mimplement.getBaseEngineerAlterFile()); - return req; - } - - public static ProjectCimplementReq convertCimplement(GovBizProjectCimplementDTO cimplement) { - ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); - return req; - } - - public static ProjectCimplementReq convertCimplementVo(GovBizProjectCimplementVO cimplement) { - ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); - return req; - } - - public static ProjectCimplementReq convertCimplementVoWithConvertPdf(GovBizProjectCimplementVO cimplement) { - ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class); - if(Objects.isNull(req)){ - return req; - } - req.setBaseChangeFormFile(StringUtils.isNotBlank(cimplement.getBaseChangeFormFilePdf()) ? cimplement.getBaseChangeFormFilePdf() : - cimplement.getBaseChangeFormFile()); - req.setBaseUserConsFile(StringUtils.isNotBlank(cimplement.getBaseUserConsFilePdf()) ? cimplement.getBaseUserConsFilePdf() : - cimplement.getBaseUserConsFile()); - req.setBaseCheckFile(StringUtils.isNotBlank(cimplement.getBaseCheckFilePdf()) ? cimplement.getBaseCheckFilePdf() : - cimplement.getBaseCheckFile()); - req.setBaseChanFile(StringUtils.isNotBlank(cimplement.getBaseChanFilePdf()) ? cimplement.getBaseChanFilePdf() : - cimplement.getBaseChanFile()); - req.setBaseSummReportFile(StringUtils.isNotBlank(cimplement.getBaseSummReportFilePdf()) ? cimplement.getBaseSummReportFilePdf() : - cimplement.getBaseSummReportFile()); - req.setBasePasswAssessFile(StringUtils.isNotBlank(cimplement.getBasePasswAssessFilePdf()) ? cimplement.getBasePasswAssessFilePdf() : - cimplement.getBasePasswAssessFile()); - req.setBaseInforLevelFile(StringUtils.isNotBlank(cimplement.getBaseInforLevelFilePdf()) ? cimplement.getBaseInforLevelFilePdf() : - cimplement.getBaseInforLevelFile()); - req.setBaseEngineerPostpoFile(StringUtils.isNotBlank(cimplement.getBaseEngineerPostpoFilePdf()) ? cimplement.getBaseEngineerPostpoFilePdf() : - cimplement.getBaseEngineerPostpoFile()); - req.setBaseEstaSummFile(StringUtils.isNotBlank(cimplement.getBaseEstaSummFilePdf()) ? cimplement.getBaseEstaSummFilePdf() : - cimplement.getBaseEstaSummFile()); - req.setBaseFinanlAuditFile(StringUtils.isNotBlank(cimplement.getBaseFinanlAuditFilePdf()) ? cimplement.getBaseFinanlAuditFilePdf() : - cimplement.getBaseFinanlAuditFile()); - req.setBaseFinalExpertOpinionFile(StringUtils.isNotBlank(cimplement.getBaseFinalExpertOpinionFilePdf()) ? cimplement.getBaseFinalExpertOpinionFilePdf() : - cimplement.getBaseFinalExpertOpinionFile()); - req.setBaseThirdAcceptFile(StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFilePdf()) ? cimplement.getBaseThirdAcceptFilePdf() : - cimplement.getBaseThirdAcceptFile()); - req.setBaseInitialOpinionFile(StringUtils.isNotBlank(cimplement.getBaseInitialOpinionFilePdf()) ? cimplement.getBaseInitialOpinionFilePdf() : - cimplement.getBaseInitialOpinionFile()); - req.setBaseIrsTestRunFile(StringUtils.isNotBlank(cimplement.getBaseIrsTestRunFilePdf()) ? cimplement.getBaseIrsTestRunFilePdf() : - cimplement.getBaseIrsTestRunFile()); - return req; - } - - public static ProjectApproveReq convertApprove(GovBizProjectApproveDTO approve) { - ProjectApproveReq req = new ProjectApproveReq(); - if(Objects.isNull(approve)){ - return req; - } - req.setBaseProjId(approve.getBaseProjId()); - req.setBaseProjName(approve.getBaseProjName()); - req.setOp(approve.getOp()); - req.setApprovalFile(approve.getApprovalFile()); - req.setBaseReviewCommentsFile(approve.getBaseReviewCommentsFile()); - req.setPreliminaryDesignFile(approve.getPreliminaryDesignFile()); - req.setAreaCode(approve.getAreaCode()); - req.setBaseDevelopCode(approve.getBaseDevelopCode()); - req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); - req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); - req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); - req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); - req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); - req.setBaseReviewResults(approve.getBaseReviewResults()); - req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); - req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); - req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); - return req; - } - - public static ProjectApproveReq convertApproveVo(GovBizProjectApproveVO approve) { - ProjectApproveReq req = new ProjectApproveReq(); - if(Objects.isNull(approve)){ - return req; - } - req.setBaseProjId(approve.getBaseProjId()); - req.setBaseProjName(approve.getBaseProjName()); - req.setOp(approve.getOp()); - req.setApprovalFile(approve.getApprovalFile()); - req.setBaseReviewCommentsFile(approve.getBaseReviewCommentsFile()); - req.setPreliminaryDesignFile(approve.getPreliminaryDesignFile()); - req.setAreaCode(approve.getAreaCode()); - req.setBaseDevelopCode(approve.getBaseDevelopCode()); - req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); - req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); - req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); - req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); - req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); - req.setBaseReviewResults(approve.getBaseReviewResults()); - req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); - req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); - req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); - return req; - } - - public static ProjectApproveReq convertApproveVoWithConvertPdf(GovBizProjectApproveVO approve) { - ProjectApproveReq req = new ProjectApproveReq(); - if(Objects.isNull(approve)){ - return req; - } - req.setBaseProjId(approve.getBaseProjId()); - req.setBaseProjName(approve.getBaseProjName()); - req.setOp(approve.getOp()); - req.setApprovalFile(StringUtils.isNotBlank(approve.getApprovalFilePdf()) ? approve.getApprovalFilePdf() : - null); - req.setBaseReviewCommentsFile(StringUtils.isNotBlank(approve.getBaseReviewCommentsFilePdf()) ? approve.getBaseReviewCommentsFilePdf(): - null); - req.setPreliminaryDesignFile(StringUtils.isNotBlank(approve.getPreliminaryDesignFilePdf()) ? approve.getPreliminaryDesignFilePdf() : - null); - req.setAreaCode(approve.getAreaCode()); - req.setBaseDevelopCode(approve.getBaseDevelopCode()); - req.setBaseProjReplyAmount(Objects.nonNull(approve.getBaseProjReplyAmount()) ? String.valueOf(approve.getBaseProjReplyAmount()) : null); - req.setBaseExpertTotalMoney(Objects.nonNull(approve.getBaseExpertTotalMoney()) ? String.valueOf(approve.getBaseExpertTotalMoney()) : null); - req.setBaseExpertYearMoney(Objects.nonNull(approve.getBaseExpertYearMoney()) ? String.valueOf(approve.getBaseExpertYearMoney()) : null); - req.setReleaseYearMoney(Objects.nonNull(approve.getReleaseYearMoney()) ? String.valueOf(approve.getReleaseYearMoney()) : null); - req.setBaseInitialReviewTotalMoney(Objects.nonNull(approve.getBaseInitialReviewTotalMoney()) ? String.valueOf(approve.getBaseInitialReviewTotalMoney()) : null); - req.setBaseReviewOpinion(approve.getBaseReviewOpinion()); - req.setBaseReviewResults(approve.getBaseReviewResults()); - req.setEqualProtectionLevel(approve.getEqualProtectionLevel()); - req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme()); - req.setSetProjCodeFinan(approve.getSetProjCodeFinan()); - return req; - } - - public static ProjectApplyReq convertApply(GovBizProjectApplyDTO apply) { - ProjectApplyReq req = new ProjectApplyReq(); - if(Objects.isNull(apply)){ - return req; - } - req.setOp(apply.getOp()); - req.setBaseProjId(apply.getBaseProjId()); - req.setBaseProjName(apply.getBaseProjName()); - req.setAreaCode(apply.getAreaCode()); - req.setBaseAccountAppName(apply.getBaseAccountAppName()); - req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); - req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); - req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); - req.setBaseBrainName(apply.getBaseBrainName()); - req.setBaseDevelopCode(apply.getBaseDevelopCode()); - req.setBaseLowestLevel(apply.getBaseLowestLevel()); - req.setBaseHistorProjId(apply.getBaseHistorProjId()); - req.setBaseHistorProjName(apply.getBaseHistorProjName()); - req.setBaseOperatMaintenFile(apply.getBaseOperatMaintenFile()); - req.setBaseProjApplyFile(apply.getBaseProjApplyFile()); - req.setBaseProjBasisFile(apply.getBaseProjBasisFile()); - req.setBaseProjOtherFile(apply.getBaseProjOtherFile()); - req.setBaseResearchReportFile(apply.getBaseResearchReportFile()); - req.setBaseProjConsClass(apply.getBaseProjConsClass()); - req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); - req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); - req.setBaseProjSetYear(apply.getBaseProjSetYear()); - req.setBaseProjSys(apply.getBaseProjSys()); - req.setBaseProjSysCode(apply.getBaseProjSysCode()); - req.setBaseProjDeclAmount(String.valueOf(apply.getBaseProjDeclAmount())); - req.setBaseProjTotalAmount(String.valueOf(apply.getBaseProjTotalAmount())); - req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); - req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); - req.setBaseProjRemark(apply.getBaseProjRemark()); - req.setBeseExpectedResults(apply.getBeseExpectedResults()); - req.setBaseProjBasis(apply.getBaseProjBasis()); - return req; - } - - public static ProjectApplyReq convertApplyVo(GovBizProjectApplyVO apply) { - ProjectApplyReq req = new ProjectApplyReq(); - if(Objects.isNull(apply)){ - return req; - } - req.setOp(apply.getOp()); - req.setBaseProjId(apply.getBaseProjId()); - req.setBaseProjName(apply.getBaseProjName()); - req.setAreaCode(apply.getAreaCode()); - req.setBaseAccountAppName(apply.getBaseAccountAppName()); - req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); - req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); - req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); - req.setBaseBrainName(apply.getBaseBrainName()); - req.setBaseDevelopCode(apply.getBaseDevelopCode()); - req.setBaseLowestLevel(apply.getBaseLowestLevel()); - req.setBaseHistorProjId(apply.getBaseHistorProjId()); - req.setBaseHistorProjName(apply.getBaseHistorProjName()); - req.setBaseOperatMaintenFile(apply.getBaseOperatMaintenFile()); - req.setBaseProjApplyFile(apply.getBaseProjApplyFile()); - req.setBaseProjBasisFile(apply.getBaseProjBasisFile()); - req.setBaseProjOtherFile(apply.getBaseProjOtherFile()); - req.setBaseResearchReportFile(apply.getBaseResearchReportFile()); - req.setBaseProjConsClass(apply.getBaseProjConsClass()); - req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); - req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); - req.setBaseProjSetYear(apply.getBaseProjSetYear()); - req.setBaseProjSys(apply.getBaseProjSys()); - req.setBaseProjSysCode(apply.getBaseProjSysCode()); - req.setBaseProjDeclAmount(String.valueOf(apply.getBaseProjDeclAmount())); - req.setBaseProjTotalAmount(String.valueOf(apply.getBaseProjTotalAmount())); - req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); - req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); - req.setBaseProjRemark(apply.getBaseProjRemark()); - req.setBeseExpectedResults(apply.getBeseExpectedResults()); - req.setBaseProjBasis(apply.getBaseProjBasis()); - return req; - } - - public static ProjectApplyReq convertApplyVoWithConvertPdf(GovBizProjectApplyVO apply) { - ProjectApplyReq req = new ProjectApplyReq(); - if(Objects.isNull(apply)){ - return req; - } - req.setOp(apply.getOp()); - req.setBaseProjId(apply.getBaseProjId()); - req.setBaseProjName(apply.getBaseProjName()); - req.setAreaCode(apply.getAreaCode()); - req.setBaseAccountAppName(apply.getBaseAccountAppName()); - req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); - req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); -// req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); - req.setBaseBrainName(apply.getBaseBrainName()); - req.setBaseDevelopCode(apply.getBaseDevelopCode()); - req.setBaseLowestLevel(apply.getBaseLowestLevel()); - if(Objects.nonNull(apply.getMissing()) && apply.getMissing()){ - req.setBaseHistorProjId(BizProjectContant.ProjectCollection.MISSING_HIS_PROJ_ID); - req.setBaseHistorProjName(BizProjectContant.ProjectCollection.MISSING_HIS_PROJ_NAME); - }else{ - req.setBaseHistorProjId(apply.getBaseHistorProjId()); - req.setBaseHistorProjName(apply.getBaseHistorProjName()); - } - req.setBaseOperatMaintenFile(StringUtils.isNotBlank(apply.getBaseOperatMaintenFilePdf()) ? apply.getBaseOperatMaintenFilePdf() : - apply.getBaseOperatMaintenFile()); - req.setBaseProjApplyFile(StringUtils.isNotBlank(apply.getBaseProjApplyFilePdf()) ? apply.getBaseProjApplyFilePdf() : - apply.getBaseProjApplyFile()); - req.setBaseProjBasisFile(StringUtils.isNotBlank(apply.getBaseProjBasisFilePdf()) ? apply.getBaseProjBasisFilePdf() : - apply.getBaseProjBasisFile()); - req.setBaseProjOtherFile(StringUtils.isNotBlank(apply.getBaseProjOtherFilePdf()) ? apply.getBaseProjOtherFilePdf() : - apply.getBaseProjOtherFile()); - req.setBaseResearchReportFile(StringUtils.isNotBlank(apply.getBaseResearchReportFilePdf()) ? apply.getBaseResearchReportFilePdf() : - apply.getBaseResearchReportFile()); - req.setBaseProjConsClass(apply.getBaseProjConsClass()); - req.setBaseProjDuration((StringUtils.isNotBlank(apply.getBaseProjDuration()) ? apply.getBaseProjDuration() : "0") - + BizProjectContant.ProjectCollection.MONTH); - req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); - req.setBaseProjSetYear(apply.getBaseProjSetYear()); - req.setBaseProjSys(apply.getBaseProjSys()); - req.setBaseProjSysCode(apply.getBaseProjSysCode()); - req.setBaseProjDeclAmount(Objects.nonNull(apply.getBaseProjDeclAmount()) ? String.valueOf(apply.getBaseProjDeclAmount()) : null); - req.setBaseProjTotalAmount(Objects.nonNull(apply.getBaseProjTotalAmount()) ? String.valueOf(apply.getBaseProjTotalAmount()) : null); - req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri()); - req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); - req.setBaseProjRemark(apply.getBaseProjRemark()); - req.setBeseExpectedResults(apply.getBeseExpectedResults()); - req.setBaseProjBasis(apply.getBaseProjBasis()); - return req; - } - - public static ProjectBaseInfoReq convertBase(GovBizProjectBaseinfoDTO baseinfo,String isEffective) { - ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); - req.setIsEffective(isEffective); - return req; - } - - public static ProjectBaseInfoReq convertBaseVo(GovBizProjectBaseinfoVO baseinfo,String isEffective) { - ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); - req.setIsEffective(isEffective); - return req; - } - - public static ProjectBaseInfoReq convertBaseVo(GovOperationProjectBaseinfoVO baseinfo,String isEffective) { - ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class); - req.setIsEffective(isEffective); - return req; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java deleted file mode 100644 index 377861c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.gov.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; - -/** - *

- * - *

- * - * @author liuxinxin - * @since 2023-04-18 - */ -@Data -@TableName("belong_org") -@ApiModel(value = "BelongOrg对象") -public class BelongOrg implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("组织code") - private String orgCode; - - @ApiModelProperty("组织名称") - private String orgName; - - @ApiModelProperty("所属组织code") - private String belongCode; - - @ApiModelProperty("所属组织名称") - private String belongName; - - @ApiModelProperty("组织类型") - private String orgType; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java deleted file mode 100644 index 779048e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ningdatech.pmapi.gov.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; - -import java.io.Serializable; - -/** - *

- * - *

- * - * @author liuxinxin - * @since 2023-04-13 - */ -@TableName("gov_business_strip") -@ApiModel(value = "GovBusinessStrip对象", description = "") -public class GovBusinessStrip implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private String businessStripCode; - - private String businessStripName; - - private String parentCode; - - private String parentName; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public String getBusinessStripCode() { - return businessStripCode; - } - - public void setBusinessStripCode(String businessStripCode) { - this.businessStripCode = businessStripCode; - } - public String getBusinessStripName() { - return businessStripName; - } - - public void setBusinessStripName(String businessStripName) { - this.businessStripName = businessStripName; - } - public String getParentCode() { - return parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - public String getParentName() { - return parentName; - } - - public void setParentName(String parentName) { - this.parentName = parentName; - } - - @Override - public String toString() { - return "GovBusinessStrip{" + - "id=" + id + - ", businessStripCode=" + businessStripCode + - ", businessStripName=" + businessStripName + - ", parentCode=" + parentCode + - ", parentName=" + parentName + - "}"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java deleted file mode 100644 index 136ade5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.gov.enumeration; - -/** - * @author liuxinxin - * @date 2023/4/18 下午2:48 - */ - -public enum BelongTypeEnum { - - /** - * 组织 - */ - ORGANIZATION, - - /** - * 条线 - */ - GOV_BUSINESS_STRIP - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectClassifiedEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectClassifiedEnum.java deleted file mode 100644 index c75a918..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectClassifiedEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.gov.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * GovProjectClassifiedEnum - * - * @return - * @author ZPF - * @since 2023/10/24 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum GovProjectClassifiedEnum { - /** - * 是否涉密 - */ - NOT_CLASSIFIED("01", "非涉密"), - CLASSIFIED("02", "涉密"),; - - private String code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (GovProjectClassifiedEnum t : GovProjectClassifiedEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static GovProjectClassifiedEnum match(String code) { - if (StringUtils.isBlank(code)) { - return null; - } - for (GovProjectClassifiedEnum t : GovProjectClassifiedEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectStatusEnum.java deleted file mode 100644 index 69ef8b1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/GovProjectStatusEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.gov.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * GovProjectStatusEnum - * - * @return - * @author ZPF - * @since 2023/10/24 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum GovProjectStatusEnum { - /** - * 项目归集 状态 - */ - APPROVAL("01", "评审中"), - PENDING("02", "待立项"), - REJECTED("03","已驳回"), - APPROVED("04","已立项"), - PURCHASED("05","已采购"), - HAS_PRE_INS("06","已初验"), - HAS_FINAL_INS("07","已终验"), - TERMINATED("00","已终止"); - - private String code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static GovProjectStatusEnum match(String code) { - if (StringUtils.isBlank(code)) { - return null; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java deleted file mode 100644 index 2524980..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.gov.helper; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.ningdatech.pmapi.gov.entity.BelongOrg; -import com.ningdatech.pmapi.gov.service.IBelongOrgService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/4/21 下午2:07 - */ - -@Component -@RequiredArgsConstructor -public class GovBusinessStripHelper { - - private final IBelongOrgService iBelongOrgService; - - public List assemblerBusinessStripInfoList(List businessStripCodeList) { - List businessStripInfoList = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(businessStripCodeList)) { - Map codeNameMap = iBelongOrgService.list(Wrappers - .lambdaQuery(BelongOrg.class).in(BelongOrg::getOrgCode, businessStripCodeList)) - .stream().collect(Collectors.toMap(BelongOrg::getOrgCode, BelongOrg::getOrgName)); - - businessStripCodeList.forEach(r -> { - ExpertGovBusinessStrip businessStripInfo = new ExpertGovBusinessStrip(); - businessStripInfo.setBusinessStripCode(r); - businessStripInfo.setBusinessStripName(codeNameMap.get(r)); - businessStripInfoList.add(businessStripInfo); - }); - } - return businessStripInfoList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java deleted file mode 100644 index e045ccb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.ningdatech.pmapi.gov.manage; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertGovBusinessStripService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.gov.entity.BelongOrg; -import com.ningdatech.pmapi.gov.enumeration.BelongTypeEnum; -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; -import com.ningdatech.pmapi.gov.service.IBelongOrgService; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.xssf.usermodel.XSSFCell; -import org.apache.poi.xssf.usermodel.XSSFRow; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.io.FileInputStream; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/4/18 下午2:27 - */ - -@Component -@RequiredArgsConstructor -public class BelongOrgManage { - - private final IBelongOrgService iBelongOrgService; - private final IExpertUserFullInfoService expertUserFullInfoService; - private final IDingOrganizationService dingOrganizationService; - private final IExpertGovBusinessStripService expertGovBusinessStripService; - - - public void generateBusinessStripOrg() { - // 条线Set - Set businessStripSet = new HashSet<>(); - - // 组织 Set - Set orgSet = new HashSet<>(); - - try { - //创建工作簿对象 - XSSFWorkbook xssfWorkbook = new XSSFWorkbook(Files.newInputStream(Paths.get("/Users/liuxinxin/Desktop/gov_business_strip_inport.xlsx"))); - //获取工作簿下sheet的个数 - int sheetNum = xssfWorkbook.getNumberOfSheets(); - System.out.println("该excel文件中总共有:" + sheetNum + "个sheet"); - //遍历工作簿中的所有数据 - for (int i = 0; i < sheetNum; i++) { - //读取第i个工作表 - System.out.println("读取第" + (i + 1) + "个sheet"); - XSSFSheet sheet = xssfWorkbook.getSheetAt(i); - //获取最后一行的num,即总行数。此处从0开始 - int maxRow = sheet.getLastRowNum(); - - // 条线code - // 条线名称 - String businessStripOrgCode = sheet.getRow(1).getCell(0) + ""; - String businessStripOrgName = sheet.getRow(1).getCell(1) + ""; - String uniqKey = businessStripOrgCode + "####" + businessStripOrgName; - businessStripSet.add(uniqKey); - - for (int row = 1; row <= maxRow; row++) { - //获取最后单元格num,即总单元格数 ***注意:此处从1开始计数*** - - String cell2 = getCellStr(sheet, row, 2); - String cell3 = getCellStr(sheet, row, 3); - if (StringUtils.isNotBlank(cell2) && StringUtils.isNotBlank(cell3)) { - String orgUniqKey = uniqKey + "&&&" + cell2 + "####" + cell3; - orgSet.add(orgUniqKey); - } - - String cell4 = getCellStr(sheet, row, 4); - String cell5 = getCellStr(sheet, row, 5); - - if (StringUtils.isNotBlank(cell4) && StringUtils.isNotBlank(cell5)) { - String orgUniqKey = uniqKey + "&&&" + cell4 + "####" + cell5; - orgSet.add(orgUniqKey); - } - } - } - } catch (IOException e) { - e.printStackTrace(); - } - List orgList = orgSet.stream().map(BelongOrgManage::buildBelongOrg).collect(Collectors.toList()); - List belongOrgList = businessStripSet.stream().map(BelongOrgManage::buildBusinessStrip).collect(Collectors.toList()); - - iBelongOrgService.saveBatch(orgList); - iBelongOrgService.saveBatch(belongOrgList); - } - - public static BelongOrg buildBusinessStrip(String businessStripStr) { - String[] split = businessStripStr.split("&&&"); - String busStrip = split[0]; - String[] split1 = busStrip.split("####"); - String belongOrgCode = split1[0]; - String belongOrgName = split1[1]; - - BelongOrg belongOrg = new BelongOrg(); - belongOrg.setOrgCode(belongOrgCode); - belongOrg.setOrgName(belongOrgName); - belongOrg.setBelongCode(belongOrgCode); - belongOrg.setBelongName(belongOrgName); - belongOrg.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name()); - return belongOrg; - } - - public static BelongOrg buildBelongOrg(String orgStr) { - String[] split = orgStr.split("&&&"); - String busStrip = split[0]; - String[] split1 = busStrip.split("####"); - String belongOrgCode = split1[0]; - String belongOrgName = split1[1]; - - String org = split[1]; - String[] split2 = org.split("####"); - String orgCode = split2[0]; - String orgName = split2[1]; - - BelongOrg belongOrg = new BelongOrg(); - belongOrg.setOrgCode(orgCode); - belongOrg.setOrgName(orgName); - belongOrg.setBelongCode(belongOrgCode); - belongOrg.setBelongName(belongOrgName); - belongOrg.setOrgType(BelongTypeEnum.ORGANIZATION.name()); - return belongOrg; - } - - public static String getCellStr(XSSFSheet sheet, int row, int col) { - if (Objects.isNull(sheet)) { - return null; - } - XSSFRow row1 = sheet.getRow(row); - if (Objects.isNull(row1)) { - return null; - } - XSSFCell cell = row1.getCell(col); - if (Objects.isNull(cell)) { - return null; - } - return cell + "".trim(); - } - - - public List getGovBusinessStripList(String businessStripName) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(BelongOrg.class) - .like(StrUtil.isNotBlank(businessStripName), BelongOrg::getBelongName, businessStripName) - .eq(BelongOrg::getOrgType, BelongTypeEnum.GOV_BUSINESS_STRIP.name()); - List belongOrgs = iBelongOrgService.list(query); - return belongOrgs.stream().map(r -> { - GovBusinessStripVO govBusinessStripVO = new GovBusinessStripVO(); - govBusinessStripVO.setBusinessStripCode(r.getOrgCode()); - govBusinessStripVO.setBusinessStripName(r.getOrgName()); - return govBusinessStripVO; - }).collect(Collectors.toList()); - } - - @Transactional(rollbackFor = Exception.class) - public void analysisExpertOrg() { - List expertUserFullInfoList = expertUserFullInfoService.list(); - for (ExpertUserFullInfo userFullInfo : expertUserFullInfoList) { - String company = userFullInfo.getCompany(); - - if (StringUtils.isNotBlank(company)) { - // 获取专家信息 - List dingOrganizationList = dingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationName, company.trim())); - - if (CollectionUtils.isNotEmpty(dingOrganizationList)) { - // 获取专家组织code - DingOrganization dingOrganization = dingOrganizationList.get(0); - String organizationCode = dingOrganization.getOrganizationCode(); - - List belongOrgList = iBelongOrgService - .list(Wrappers.lambdaQuery(BelongOrg.class) - .eq(BelongOrg::getOrgCode, organizationCode.trim())); - if (CollectionUtils.isNotEmpty(belongOrgList)) { - // 获取专家条线code - Set belongOrgSet = new HashSet<>(); - List saveList = new ArrayList<>(); - for (BelongOrg belongOrg : belongOrgList) { - if (belongOrgSet.add(belongOrg.getBelongCode())) { - saveList.add(belongOrg); - } - } - expertGovBusinessStripService.remove(Wrappers.lambdaQuery(ExpertGovBusinessStrip.class) - .eq(ExpertGovBusinessStrip::getExpertUserId, userFullInfo.getUserId())); - - List expertBusinessStripSaveRecordList = saveList.stream().map(r -> { - ExpertGovBusinessStrip expertBusinessStrip = new ExpertGovBusinessStrip(); - expertBusinessStrip.setExpertUserId(userFullInfo.getUserId()); - expertBusinessStrip.setBusinessStripCode(r.getBelongCode()); - expertBusinessStrip.setBusinessStripName(r.getBelongName()); - return expertBusinessStrip; - }).collect(Collectors.toList()); - expertGovBusinessStripService.saveBatch(expertBusinessStripSaveRecordList); - } - } - } - - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java deleted file mode 100644 index 9a19aca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ /dev/null @@ -1,2044 +0,0 @@ -package com.ningdatech.pmapi.gov.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -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.google.common.collect.Lists; -import com.google.common.collect.Maps; -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.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.convert.ProjectConvert; -import com.ningdatech.pmapi.gov.model.dto.*; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.model.req.ProjectBaseInfoReq; -import com.ningdatech.pmapi.gov.model.req.ProjectPushReq; -import com.ningdatech.pmapi.gov.model.vo.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; -import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.service.IOperationService; -import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.model.entity.*; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.service.*; -import com.ningdatech.pmapi.provincial.manage.ProvincialManage; -import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; -import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; -import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; -import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.sys.model.entity.Role; -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 com.ningdatech.pmapi.wps.manage.WpsConvertManage; -import com.wflow.bean.entity.WflowCcTasks; -import com.wflow.service.WflowCcTasksService; -import io.swagger.annotations.ApiModelProperty; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.util.IOUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RuntimeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.RestTemplate; - -import java.io.*; -import java.lang.reflect.Field; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; -import java.time.temporal.Temporal; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author zpf - * @date 2023/8/21 下午2:27 - */ - -@Component -@RequiredArgsConstructor -@Slf4j -public class GovProjectCollectionManage { - - private final IGovProjectDictionaryService dictionaryService; - - private final IGovBizProjectApplyService projectApplyService; - - private final IGovBizProjectBaseinfoService baseinfoService; - - private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; - - private final IGovBizProjectApproveService approveService; - - private final IGovBizProjectCimplementService cimplementService; - - private final IGovBizProjectMimplementService mimplementService; - - private final IGovBizProjectProcureService procureService; - - private final GenerateProjectCodeUtil generateProjectCodeUtil; - - private final IGovBizProjectDraftService draftService; - - private final IGovOperationProjectDraftService operationProjectDraftService; - - private final RestTemplate restTemplate; - - private final WpsConvertManage wpsConvertManage; - - private final ThreadPoolTaskScheduler threadPoolTaskScheduler; - - private final FileService fileService; - - @Value("${project.push-url}") - private String pushUrl; - - @Value("${project.no-effective-url}") - private String noEffectiveUrl; - - @Value("${project.delete-all-url}") - private String deleteAllUrl; - - @Value("${spring.profiles.active}") - private String active; - - private final RegionCacheHelper regionCacheHelper; - - private final IProjectService projectService; - private final IProjectApplicationService applicationService; - - private final IProjectInstService projectInstService; - - private final RuntimeService runtimeService; - - private final HistoryService historyService; - - private final WflowCcTasksService ccTasksService; - - private final IOperationService operationService; - - private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; - - private final IProjectStagingService stagingService; - - private final INdProjectStatusChangeService statusChangeService; - - private final IPurchaseService purchaseService; - - private final IProjectTagService projectTagService; - - private final ISupplierSafetyQualificationService supplierSafetyQualificationService; - private final IPreInsAcceptancePersonService preInsAcceptancePersonService; - private final IPersonSafetyInfoService personService; - - public List dictionary(String type) { - - List dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class) - .eq(StringUtils.isNotBlank(type), GovProjectDictionary::getType, type) - .eq(GovProjectDictionary::getDeleted,Boolean.FALSE)); - - if(CollUtil.isEmpty(dictionaries)){ - return Collections.emptyList(); - } - - return dictionaries.stream().map(d -> BeanUtil.copyProperties(d,GovProjectDictionaryVO.class)) - .collect(Collectors.toList()); - } - - /** - * 分页查 项目归集 - * @param req - * @return - */ - public PageVo list(ProjectListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectBaseinfo::getBaseProjType,req.getProjectType()) - .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovBizProjectBaseinfo::getBaseProjId,req.getProjectCodes()) - .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), - GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), - ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) - .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), - GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), - ProjectTypeNewEnum.XU_OPERA.getCode())) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) - .orderByDesc(GovBizProjectBaseinfo::getBizTime); -// permissions(wrapper); - baseinfoService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List projIds = page.getRecords().stream() - .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) - .map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - - Map applyMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projIds)){ - List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,projIds) - .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); - applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); - } - - Map finalApplyMap = applyMap; - List res = page.getRecords().stream().map(p -> { - GovBizProjectListVO vo = new GovBizProjectListVO(); - vo.setBaseAreaCode(p.getBaseAreaCode()); - vo.setBaseAreaName(p.getBaseAreaName()); - vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); - vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); - vo.setBaseProjId(p.getBaseProjId()); - vo.setBaseProjName(p.getBaseProjName()); - if(finalApplyMap.containsKey(p.getBaseProjId())){ - GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); - vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); - vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); - vo.setBaseProjSetYear(apply.getBaseProjSetYear()); - } - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 运维项目归集列表 - * @param req - * @return - */ - public PageVo operationList(ProjectListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectBaseinfo::getBaseProjType,req.getProjectType()) - .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovOperationProjectBaseinfo::getBaseProjId,req.getProjectCodes()) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) - .orderByDesc(GovOperationProjectBaseinfo::getBizTime); - operationProjectBaseinfoService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List projIds = page.getRecords().stream() - .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) - .map(GovOperationProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - - Map applyMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projIds)){ - List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,projIds) - .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); - applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); - } - - Map finalApplyMap = applyMap; - List res = page.getRecords().stream().map(p -> { - GovBizProjectListVO vo = new GovBizProjectListVO(); - vo.setBaseAreaCode(p.getBaseAreaCode()); - vo.setBaseAreaName(p.getBaseAreaName()); - vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); - vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); - vo.setBaseProjId(p.getBaseProjId()); - vo.setBaseProjName(p.getBaseProjName()); - if(finalApplyMap.containsKey(p.getBaseProjId())){ - GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); - vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); - vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); - vo.setBaseProjSetYear(apply.getBaseProjSetYear()); - } - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 草稿箱列表 - * @param req - * @return - */ - public PageVo draftList(ProjectListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectDraft.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectDraft::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectDraft::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectDraft::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectDraft::getBaseProjType,req.getProjectType()) - .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), - GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), - ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) - .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), - GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), - ProjectTypeNewEnum.XU_OPERA.getCode())) - .eq(GovBizProjectDraft::getDeleted,Boolean.FALSE) - .eq(GovBizProjectDraft::getCreateId,user.getUserId()) - .orderByDesc(GovBizProjectDraft::getBizTime); - draftService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream().map(p -> { - GovBizProjectListVO vo = new GovBizProjectListVO(); - vo.setBaseAreaCode(p.getBaseAreaCode()); - vo.setBaseAreaName(p.getBaseAreaName()); - vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); - vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); - vo.setBaseProjId(p.getBaseProjId()); - vo.setBaseProjName(p.getBaseProjName()); - vo.setBaseProjDeclAmount(p.getBaseProjDeclAmount()); - vo.setBaseProjTotalAmount(p.getBaseProjTotalAmount()); - vo.setBaseProjSetYear(p.getBaseProjSetYear()); - vo.setDraftId(p.getId()); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - public PageVo operationDraftList(ProjectListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectDraft.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectDraft::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectDraft::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectDraft::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectDraft::getBaseProjType,req.getProjectType()) - .eq(GovOperationProjectDraft::getDeleted,Boolean.FALSE) - .eq(GovOperationProjectDraft::getCreateId,user.getUserId()) - .orderByDesc(GovOperationProjectDraft::getBizTime); - operationProjectDraftService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream().map(p -> { - GovBizProjectListVO vo = new GovBizProjectListVO(); - vo.setBaseAreaCode(p.getBaseAreaCode()); - vo.setBaseAreaName(p.getBaseAreaName()); - vo.setBaseBuildDeprt(p.getBaseBuildDeprt()); - vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); - vo.setBaseProjId(p.getBaseProjId()); - vo.setBaseProjName(p.getBaseProjName()); - vo.setBaseProjDeclAmount(p.getBaseProjDeclAmount()); - vo.setBaseProjTotalAmount(p.getBaseProjTotalAmount()); - vo.setBaseProjSetYear(p.getBaseProjSetYear()); - vo.setDraftId(p.getId()); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 数据权限 - * @param wrapper - */ - private void permissions(LambdaQueryWrapper wrapper) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - //超管和区域管理员 - if(user.getSuperAdmin() || user.getRegionAdmin()){ - log.info("超管和区管 可以看所有"); - return; - } - - wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); - } - - public Long count(ProjectListReq req) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode()) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) - .orderByDesc(GovBizProjectBaseinfo::getBizTime); - return baseinfoService.count(wrapper); - } - - public Long operationCount(ProjectListReq req) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getAreaCode,req.getRegionCode()) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) - .orderByDesc(GovOperationProjectBaseinfo::getBizTime); - return operationProjectBaseinfoService.count(wrapper); - } - - /** - * 项目归集详情 - * @param projId - * @return - */ - public GovBizProjectDetailVO detail(String projId) { - GovBizProjectDetailVO res = new GovBizProjectDetailVO(); - //1.先查 基本信息 - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projId) - .orderByDesc(GovBizProjectBaseinfo::getBizTime) - .last(BizConst.LIMIT_1)); - - if(Objects.isNull(baseinfo)){ - return res; - } - res.setBaseProjId(baseinfo.getBaseProjId()); - res.setBaseProjName(baseinfo.getBaseProjName()); - res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoVO.class)); - - //2.再查 申报信息 - GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, projId) - .orderByDesc(GovBizProjectApply::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(apply)){ - res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); - } - - //3.再查 审批信息 - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, projId) - .orderByDesc(GovBizProjectApprove::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); - } - - //4 对应查询 实施项目还是运维项目 - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, projId) - .orderByDesc(GovBizProjectCimplement::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); - } - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, projId) - .orderByDesc(GovBizProjectMimplement::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); - } - - //5.最后查询采购信息 - List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, projId) - .orderByDesc(GovBizProjectProcure::getBizTime)); - if(CollUtil.isNotEmpty(procures)){ - res.setProcures(procures.stream() - .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) - .collect(Collectors.toList())); - } - - return res; - } - - public GovOperationProjectDetailVO operationDetail(String projId) { - GovOperationProjectDetailVO res = new GovOperationProjectDetailVO(); - //1.先查 基本信息 - GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, projId) - .orderByDesc(GovOperationProjectBaseinfo::getBizTime) - .last(BizConst.LIMIT_1)); - - if(Objects.isNull(baseinfo)){ - return res; - } - res.setBaseProjId(baseinfo.getBaseProjId()); - res.setBaseProjName(baseinfo.getBaseProjName()); - res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovOperationProjectBaseinfoVO.class)); - - //2.再查 申报信息 - GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, projId) - .orderByDesc(GovBizProjectApply::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(apply)){ - res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); - } - - //3.再查 审批信息 - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, projId) - .orderByDesc(GovBizProjectApprove::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); - } - - //4 对应查询 实施项目还是运维项目 - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, projId) - .orderByDesc(GovBizProjectCimplement::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); - } - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, projId) - .orderByDesc(GovBizProjectMimplement::getBizTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); - } - - //5.最后查询采购信息 - List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, projId) - .orderByDesc(GovBizProjectProcure::getBizTime)); - if(CollUtil.isNotEmpty(procures)){ - res.setProcures(procures.stream() - .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) - .collect(Collectors.toList())); - } - - return res; - } - - /** - * 草稿箱详情 - * @param draftId - * @return - */ - public GovBizProjectDetailVO draftDetail(Long draftId) { - GovBizProjectDetailVO res = new GovBizProjectDetailVO(); - //查询草稿表 - GovBizProjectDraft draft = draftService.getById(draftId); - - if(Objects.isNull(draft)){ - return null; - } - res.setDraftId(draftId); - - //1.基本信息 - res.setBaseProjId(draft.getBaseProjId()); - res.setBaseProjName(draft.getBaseProjName()); - res.setBaseinfo(BeanUtil.copyProperties(draft, GovBizProjectBaseinfoVO.class)); - - //2.申报信息 - res.setApply(BeanUtil.copyProperties(draft, GovBizProjectApplyVO.class)); - - //3.再查 审批信息 - res.setApprove(BeanUtil.copyProperties(draft, GovBizProjectApproveVO.class)); - - //4 对应查询 实施项目还是运维项目 - GovBizProjectCimplementVO cimplementVo = BeanUtil.copyProperties(draft, GovBizProjectCimplementVO.class); - cimplementVo.setBaseChanFile(draft.getBaseChanFileCimplement()); - cimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileCimplement()); - cimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileCimplement()); - cimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileCimplement()); - cimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileCimplement()); - cimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileCimplement()); - cimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileCimplement()); - cimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileCimplement()); - cimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationCimplement()); - cimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsCimplement()); - res.setCimplement(cimplementVo); - GovBizProjectMimplementVO mimplementVo = BeanUtil.copyProperties(draft, GovBizProjectMimplementVO.class); - mimplementVo.setBaseChanFile(draft.getBaseChanFileMimplement()); - mimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileMimplement()); - mimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileMimplement()); - mimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileMimplement()); - mimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileMimplement()); - mimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileMimplement()); - mimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileMimplement()); - mimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileMimplement()); - mimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationMimplement()); - mimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsMimplement()); - res.setMimplement(mimplementVo); - - //5.最后查询采购信息 - if(StringUtils.isNotBlank(draft.getProcure())){ - try{ - res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); - }catch (Exception e){ - log.error("草稿箱采购出错:" + e.getMessage()); - } - } - - return res; - } - - - public GovOperationProjectDetailVO operationDraftDetail(Long draftId) { - GovOperationProjectDetailVO res = new GovOperationProjectDetailVO(); - //查询草稿表 - GovOperationProjectDraft draft = operationProjectDraftService.getById(draftId); - - if(Objects.isNull(draft)){ - return null; - } - res.setDraftId(draftId); - - //1.基本信息 - res.setBaseProjId(draft.getBaseProjId()); - res.setBaseProjName(draft.getBaseProjName()); - res.setBaseinfo(BeanUtil.copyProperties(draft, GovOperationProjectBaseinfoVO.class)); - - //2.申报信息 - res.setApply(BeanUtil.copyProperties(draft, GovBizProjectApplyVO.class)); - - //3.再查 审批信息 - res.setApprove(BeanUtil.copyProperties(draft, GovBizProjectApproveVO.class)); - - //4 对应查询 实施项目还是运维项目 - GovBizProjectCimplementVO cimplementVo = BeanUtil.copyProperties(draft, GovBizProjectCimplementVO.class); - cimplementVo.setBaseChanFile(draft.getBaseChanFileCimplement()); - cimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileCimplement()); - cimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileCimplement()); - cimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileCimplement()); - cimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileCimplement()); - cimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileCimplement()); - cimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileCimplement()); - cimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileCimplement()); - cimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationCimplement()); - cimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsCimplement()); - res.setCimplement(cimplementVo); - GovBizProjectMimplementVO mimplementVo = BeanUtil.copyProperties(draft, GovBizProjectMimplementVO.class); - mimplementVo.setBaseChanFile(draft.getBaseChanFileMimplement()); - mimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileMimplement()); - mimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileMimplement()); - mimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileMimplement()); - mimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileMimplement()); - mimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileMimplement()); - mimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileMimplement()); - mimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileMimplement()); - mimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationMimplement()); - mimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsMimplement()); - res.setMimplement(mimplementVo); - - //5.最后查询采购信息 - if(StringUtils.isNotBlank(draft.getProcure())){ - try{ - res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); - }catch (Exception e){ - log.error("草稿箱采购出错:" + e.getMessage()); - } - } - - return res; - } - - /** - * 项目归集保存 - * @param saveDTO - * @return - */ - @Transactional - public String save(GovBizProjectSaveDTO saveDTO,UserInfoDetails user) { - if(Objects.isNull(user)){ - user = LoginUserUtil.loginUserDetail(); - } - - GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = saveDTO.getBaseProjId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - String baseProjName = base.getBaseProjName(); - - //1.保存基本信息 - GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); - baseinfo.setBaseProjId(baseProjId); - baseinfo.setBaseProjName(baseProjName); - baseinfo.setBaseAreaCode(baseAreaCode); - baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - GovBizProjectBaseinfo oldBaseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - //项目名去重 - checkName(baseProjName,baseProjId); - GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfo.class); - saveBase.setBaseProjName(baseProjName); - saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - if(Objects.nonNull(oldBaseInfo)){ - saveBase.setId(oldBaseInfo.getId()); - saveBase.setBaseAreaCode(null); - }else{ - saveBase.setTongTime(LocalDateTime.now()); - saveBase.setBaseAreaCode(baseAreaCode); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); - } - saveBase.setAreaCode(RegionConst.RC_LS); - saveBase.setBizTime(LocalDateTime.now()); - saveBase.setUpdateBy(user.getUsername()); - saveBase.setUpdateOn(LocalDateTime.now()); - - //如果是新增的话 要生成 项目编号 - if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ - baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - saveBase.setBaseProjId(baseProjId); - } - - baseinfoService.saveOrUpdate(saveBase); - - // 2.保存 申报信息 - GovBizProjectApplyDTO apply = saveDTO.getApply(); - if(Objects.nonNull(apply)){ - apply.setBaseProjId(baseProjId); - apply.setBaseProjName(baseProjName); - GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); - saveApply.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApply)){ - saveApply.setId(oldApply.getId()); - }else{ - saveApply.setTongTime(LocalDateTime.now()); - } - if(Objects.nonNull(saveApply.getBaseProjStartTime()) && - Objects.nonNull(saveApply.getBaseProjEndTime())){ - saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), - saveApply.getBaseProjEndTime())); - } - saveApply.setAreaCode(RegionConst.RC_LS); - saveApply.setBizTime(LocalDateTime.now()); - saveApply.setUpdateBy(user.getUsername()); - saveApply.setUpdateOn(LocalDateTime.now()); - if(projectApplyService.saveOrUpdate(saveApply)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); - } - } - - // 3.保存 审批信息 - GovBizProjectApproveDTO approve = saveDTO.getApprove(); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(baseProjId); - approve.setBaseProjName(baseProjName); - GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); - saveApprove.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApprove)){ - saveApprove.setId(oldApprove.getId()); - }else{ - saveApprove.setTongTime(LocalDateTime.now()); - } - saveApprove.setBizTime(LocalDateTime.now()); - saveApprove.setAreaCode(RegionConst.RC_LS); - saveApprove.setUpdateBy(user.getUsername()); - saveApprove.setUpdateOn(LocalDateTime.now()); - if(approveService.saveOrUpdate(saveApprove)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); - } - } - - // 4.保存 建设项目 实施信息 - GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(baseProjId); - cimplement.setBaseProjName(baseProjName); - cimplement.setBaseBidCode(baseProjId); - cimplement.setBaseBidName(baseProjName); - GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); - saveCimplement.setBaseProjId(baseProjId); - saveCimplement.setBaseBidCode(baseProjId); - saveCimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldCimplement)){ - saveCimplement.setId(oldCimplement.getId()); - }else{ - saveCimplement.setTongTime(LocalDateTime.now()); - } - saveCimplement.setAreaCode(RegionConst.RC_LS); - saveCimplement.setBizTime(LocalDateTime.now()); - saveCimplement.setUpdateBy(user.getUsername()); - saveCimplement.setUpdateOn(LocalDateTime.now()); - if(cimplementService.saveOrUpdate(saveCimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); - } - } - - // 5.保存 运维项目 实施信息 - GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(baseProjId); - mimplement.setBaseProjName(baseProjName); - mimplement.setBaseBidCode(baseProjId); - mimplement.setBaseBidName(baseProjName); - GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); - saveMimplement.setBaseProjId(baseProjId); - saveMimplement.setBaseBidCode(baseProjId); - saveMimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldMimplement)){ - saveMimplement.setId(oldMimplement.getId()); - }else{ - saveMimplement.setTongTime(LocalDateTime.now()); - } - if(Objects.nonNull(saveBase.getAreaCode())){ - saveMimplement.setAreaCode(saveBase.getAreaCode()); - } - saveMimplement.setAreaCode(RegionConst.RC_LS); - saveMimplement.setBizTime(LocalDateTime.now()); - saveMimplement.setUpdateBy(user.getUsername()); - saveMimplement.setUpdateOn(LocalDateTime.now()); - if(mimplementService.saveOrUpdate(saveMimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); - } - } - - // 6.保存 采购信息 - List procures = saveDTO.getProcures(); - - if(Objects.nonNull(procures)){ - procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); - - String finalBaseProjId = baseProjId; - UserInfoDetails finalUser = user; - - Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ - procure.setBaseProjId(finalBaseProjId); - procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); - saveProcure.setBaseProjId(finalBaseProjId); - saveProcure.setId(null); - saveProcure.setAreaCode(RegionConst.RC_LS); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setUpdateBy(finalUser.getUsername()); - saveProcure.setUpdateOn(LocalDateTime.now()); - if(procureService.save(saveProcure)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); - } - index++; - } - - } - - //7. 推送数据(改为定时推送了) -// pushProject(saveDTO); - //如果是草稿箱来的 就要删除 - if(Objects.nonNull(saveDTO.getDraftId())){ - draftService.removeById(saveDTO.getDraftId()); - } - - return BizConst.SAVE_SUCCESS; - } - - /** - * 运维项目保存 - * @param saveDTO - * @param user - * @return - */ - public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ - user = LoginUserUtil.loginUserDetail(); - } - - GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = saveDTO.getBaseProjId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - String baseProjName = base.getBaseProjName(); - - //1.保存基本信息 - GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); - baseinfo.setBaseProjId(baseProjId); - baseinfo.setBaseProjName(baseProjName); - baseinfo.setBaseAreaCode(baseAreaCode); - baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - //项目名去重 - checkNameOperation(baseProjName,baseProjId); - GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovOperationProjectBaseinfo.class); - saveBase.setBaseProjName(baseProjName); - saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - if(Objects.nonNull(oldBaseInfo)){ - saveBase.setId(oldBaseInfo.getId()); - saveBase.setBaseAreaCode(null); - }else{ - saveBase.setBaseAreaCode(baseAreaCode); - saveBase.setTongTime(LocalDateTime.now()); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); - } - saveBase.setAreaCode(RegionConst.RC_LS); - saveBase.setBizTime(LocalDateTime.now()); - saveBase.setUpdateBy(user.getUsername()); - saveBase.setUpdateOn(LocalDateTime.now()); - - //如果是新增的话 要生成 项目编号 - if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ - baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - saveBase.setBaseProjId(baseProjId); - } - - operationProjectBaseinfoService.saveOrUpdate(saveBase); - - // 2.保存 申报信息 - GovBizProjectApplyDTO apply = saveDTO.getApply(); - if(Objects.nonNull(apply)){ - apply.setBaseProjId(baseProjId); - apply.setBaseProjName(baseProjName); - GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); - saveApply.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApply)){ - saveApply.setId(oldApply.getId()); - }else{ - saveApply.setTongTime(LocalDateTime.now()); - } - if(Objects.nonNull(saveApply.getBaseProjStartTime()) && - Objects.nonNull(saveApply.getBaseProjEndTime())){ - saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), - saveApply.getBaseProjEndTime())); - } - saveApply.setAreaCode(RegionConst.RC_LS); - saveApply.setBizTime(LocalDateTime.now()); - saveApply.setUpdateBy(user.getUsername()); - saveApply.setUpdateOn(LocalDateTime.now()); - if(projectApplyService.saveOrUpdate(saveApply)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); - } - } - - // 3.保存 审批信息 - GovBizProjectApproveDTO approve = saveDTO.getApprove(); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(baseProjId); - approve.setBaseProjName(baseProjName); - GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); - saveApprove.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApprove)){ - saveApprove.setId(oldApprove.getId()); - }else{ - saveApprove.setTongTime(LocalDateTime.now()); - } - saveApprove.setBizTime(LocalDateTime.now()); - saveApprove.setAreaCode(RegionConst.RC_LS); - saveApprove.setUpdateBy(user.getUsername()); - saveApprove.setUpdateOn(LocalDateTime.now()); - if(approveService.saveOrUpdate(saveApprove)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); - } - } - - // 4.保存 建设项目 实施信息 - GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(baseProjId); - cimplement.setBaseProjName(baseProjName); - cimplement.setBaseBidCode(baseProjId); - cimplement.setBaseBidName(baseProjName); - GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); - saveCimplement.setBaseProjId(baseProjId); - saveCimplement.setBaseBidCode(baseProjId); - saveCimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldCimplement)){ - saveCimplement.setId(oldCimplement.getId()); - }else{ - saveCimplement.setTongTime(LocalDateTime.now()); - } - saveCimplement.setAreaCode(RegionConst.RC_LS); - saveCimplement.setBizTime(LocalDateTime.now()); - saveCimplement.setUpdateBy(user.getUsername()); - saveCimplement.setUpdateOn(LocalDateTime.now()); - if(cimplementService.saveOrUpdate(saveCimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); - } - } - - // 5.保存 运维项目 实施信息 - GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(baseProjId); - mimplement.setBaseProjName(baseProjName); - mimplement.setBaseBidCode(baseProjId); - mimplement.setBaseBidName(baseProjName); - GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); - saveMimplement.setBaseProjId(baseProjId); - saveMimplement.setBaseBidCode(baseProjId); - saveMimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldMimplement)){ - saveMimplement.setId(oldMimplement.getId()); - }else{ - saveMimplement.setTongTime(LocalDateTime.now()); - } - if(Objects.nonNull(saveBase.getAreaCode())){ - saveMimplement.setAreaCode(saveBase.getAreaCode()); - } - saveMimplement.setAreaCode(RegionConst.RC_LS); - saveMimplement.setBizTime(LocalDateTime.now()); - saveMimplement.setUpdateBy(user.getUsername()); - saveMimplement.setUpdateOn(LocalDateTime.now()); - if(mimplementService.saveOrUpdate(saveMimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); - } - } - - // 6.保存 采购信息 - List procures = saveDTO.getProcures(); - - if(Objects.nonNull(procures)){ - procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); - - String finalBaseProjId = baseProjId; - UserInfoDetails finalUser = user; - - Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ - procure.setBaseProjId(finalBaseProjId); - procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); - saveProcure.setBaseProjId(finalBaseProjId); - saveProcure.setId(null); - saveProcure.setAreaCode(RegionConst.RC_LS); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setUpdateBy(finalUser.getUsername()); - saveProcure.setUpdateOn(LocalDateTime.now()); - if(procureService.save(saveProcure)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); - } - index++; - } - - } - - //7. 推送数据(改为定时推送了) -// pushProject(saveDTO); - //如果是草稿箱来的 就要删除 - if(Objects.nonNull(saveDTO.getDraftId())){ - operationProjectDraftService.removeById(saveDTO.getDraftId()); - } - - return BizConst.SAVE_SUCCESS; - } - - /** - * 计算2个时间的月份 - * @param baseProjStartTime - * @param baseProjEndTime - * @return - */ - public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { - String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - Temporal temporal1 = LocalDate.parse(start); - Temporal temporal2 = LocalDate.parse(end); - // 方法返回为相差月份 - Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); - return ll.toString(); - } - - /** - * 暂存草稿箱 - * @param saveDTO - * @param user - * @return - */ - public String draft(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ - user = LoginUserUtil.loginUserDetail(); - } - - GovBizProjectDraft draft = new GovBizProjectDraft(); - //草稿id - Long draftId = saveDTO.getDraftId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - if(Objects.nonNull(draftId)){ - GovBizProjectDraft oldDraft = draftService.getById(draftId); - VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); - draft.setId(draftId); - }else{ - draft.setTongTime(LocalDateTime.now()); - draft.setBaseAreaCode(baseAreaCode); - draft.setCreateId(user.getUserId()); - draft.setTongTime(LocalDateTime.now()); - } - - //1.保存基本信息 - GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = base.getBaseProjId(); - String baseProjName = base.getBaseProjName(); - //要生成 草稿的项目编号 - if(StringUtils.isBlank(baseProjId)){ - baseProjId = BizProjectContant.ProjectCollection.DRAFT; - } - - // 2.保存 申报信息 - GovBizProjectApplyDTO apply = saveDTO.getApply(); - BeanUtil.copyProperties(apply, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - - // 3.保存 审批信息 - GovBizProjectApproveDTO approve = saveDTO.getApprove(); - BeanUtil.copyProperties(approve, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - - // 4.保存 建设项目 实施信息 - GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ - BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseBidCode(baseProjId + "-1"); - draft.setBaseChanFileCimplement(cimplement.getBaseChanFile()); - draft.setBaseLogAggregationCimplement(cimplement.getBaseLogAggregation()); - draft.setBaseBusinessMetricsCimplement(cimplement.getBaseBusinessMetrics()); - draft.setBaseEstaSummFileCimplement(cimplement.getBaseEstaSummFile()); - draft.setBaseInforLevelFileCimplement(cimplement.getBaseInforLevelFile()); - draft.setBaseEngineerPostpoFileCimplement(cimplement.getBaseEngineerPostpoFile()); - draft.setBaseUserConsFileCimplement(cimplement.getBaseUserConsFile()); - draft.setBasePasswAssessFileCimplement(cimplement.getBasePasswAssessFile()); - draft.setBaseThirdAcceptFileCimplement(cimplement.getBaseThirdAcceptFile()); - draft.setBaseFinalExpertOpinionFileCimplement(cimplement.getBaseFinalExpertOpinionFile()); - } - - // 5.保存 运维项目 实施信息 - GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ - BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); - draft.setBaseBusinessMetricsMimplement(mimplement.getBaseBusinessMetrics()); - draft.setBaseChanFileMimplement(mimplement.getBaseChanFile()); - draft.setBaseEstaSummFileMimplement(mimplement.getBaseEstaSummFile()); - draft.setBaseInforLevelFileMimplement(mimplement.getBaseInforLevelFile()); - draft.setBaseEngineerPostpoFileMimplement(mimplement.getBaseEngineerPostpoFile()); - draft.setBaseThirdAcceptFileMimplement(mimplement.getBaseThirdAcceptFile()); - draft.setBaseUserConsFileMimplement(mimplement.getBaseUserConsFile()); - draft.setBaseFinalExpertOpinionFileMimplement(mimplement.getBaseFinalExpertOpinionFile()); - draft.setBasePasswAssessFileMimplement(mimplement.getBasePasswAssessFile()); - } - - // 6.保存 采购信息 - List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ - draft.setProcure(JSON.toJSONString(procures)); - } - - //最后再保存 基本信息 - BeanUtil.copyProperties(base, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseProjId(baseProjId); - draft.setBaseProjName(baseProjName); - draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - draft.setAreaCode(RegionConst.RC_LS); - draft.setBizTime(LocalDateTime.now()); - draft.setUpdateBy(user.getUsername()); - draft.setUpdateOn(LocalDateTime.now()); - draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); - - draftService.saveOrUpdate(draft); - - return BizConst.SAVE_SUCCESS; - } - - public String operationDraft(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ - user = LoginUserUtil.loginUserDetail(); - } - - GovOperationProjectDraft draft = new GovOperationProjectDraft(); - //草稿id - Long draftId = saveDTO.getDraftId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - if(Objects.nonNull(draftId)){ - GovOperationProjectDraft oldDraft = operationProjectDraftService.getById(draftId); - VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); - draft.setId(draftId); - }else{ - draft.setTongTime(LocalDateTime.now()); - draft.setBaseAreaCode(baseAreaCode); - draft.setCreateId(user.getUserId()); - draft.setTongTime(LocalDateTime.now()); - } - - //1.保存基本信息 - GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = base.getBaseProjId(); - String baseProjName = base.getBaseProjName(); - //要生成 草稿的项目编号 - if(StringUtils.isBlank(baseProjId)){ - baseProjId = BizProjectContant.ProjectCollection.DRAFT; - } - - // 2.保存 申报信息 - GovBizProjectApplyDTO apply = saveDTO.getApply(); - BeanUtil.copyProperties(apply, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - - // 3.保存 审批信息 - GovBizProjectApproveDTO approve = saveDTO.getApprove(); - BeanUtil.copyProperties(approve, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - - // 4.保存 建设项目 实施信息 - GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ - BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseBidCode(baseProjId + "-1"); - draft.setBaseChanFileCimplement(cimplement.getBaseChanFile()); - draft.setBaseLogAggregationCimplement(cimplement.getBaseLogAggregation()); - draft.setBaseBusinessMetricsCimplement(cimplement.getBaseBusinessMetrics()); - draft.setBaseEstaSummFileCimplement(cimplement.getBaseEstaSummFile()); - draft.setBaseInforLevelFileCimplement(cimplement.getBaseInforLevelFile()); - draft.setBaseEngineerPostpoFileCimplement(cimplement.getBaseEngineerPostpoFile()); - draft.setBaseUserConsFileCimplement(cimplement.getBaseUserConsFile()); - draft.setBasePasswAssessFileCimplement(cimplement.getBasePasswAssessFile()); - draft.setBaseThirdAcceptFileCimplement(cimplement.getBaseThirdAcceptFile()); - draft.setBaseFinalExpertOpinionFileCimplement(cimplement.getBaseFinalExpertOpinionFile()); - } - - // 5.保存 运维项目 实施信息 - GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ - BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); - draft.setBaseBusinessMetricsMimplement(mimplement.getBaseBusinessMetrics()); - draft.setBaseChanFileMimplement(mimplement.getBaseChanFile()); - draft.setBaseEstaSummFileMimplement(mimplement.getBaseEstaSummFile()); - draft.setBaseInforLevelFileMimplement(mimplement.getBaseInforLevelFile()); - draft.setBaseEngineerPostpoFileMimplement(mimplement.getBaseEngineerPostpoFile()); - draft.setBaseThirdAcceptFileMimplement(mimplement.getBaseThirdAcceptFile()); - draft.setBaseUserConsFileMimplement(mimplement.getBaseUserConsFile()); - draft.setBaseFinalExpertOpinionFileMimplement(mimplement.getBaseFinalExpertOpinionFile()); - draft.setBasePasswAssessFileMimplement(mimplement.getBasePasswAssessFile()); - } - - // 6.保存 采购信息 - List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ - draft.setProcure(JSON.toJSONString(procures)); - } - - //最后再保存 基本信息 - BeanUtil.copyProperties(base, draft, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - draft.setBaseProjId(baseProjId); - draft.setBaseProjName(baseProjName); - draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - draft.setAreaCode(RegionConst.RC_LS); - draft.setBizTime(LocalDateTime.now()); - draft.setUpdateBy(user.getUsername()); - draft.setUpdateOn(LocalDateTime.now()); - draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); - - operationProjectDraftService.saveOrUpdate(draft); - - return BizConst.SAVE_SUCCESS; - } - - /** - * 删除项目归集 - * @param projId - * @return - */ - public String remove(String projId) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String username = user.getUsername(); - - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projId) - .last(BizConst.LIMIT_1)); - - VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!"); - - //改正逻辑删除 - baseinfo.setDeleted(Boolean.TRUE); - baseinfo.setUpdateBy(username); - baseinfo.setUpdateOn(LocalDateTime.now()); - baseinfoService.updateById(baseinfo); - projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,projId) - .set(GovBizProjectApply::getDeleted,Boolean.TRUE) - .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApply::getUpdateBy,username)); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,projId) - .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) - .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApprove::getUpdateBy,username)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,projId) - .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectCimplement::getUpdateBy,username)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,projId) - .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectMimplement::getUpdateBy,username)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,projId) - .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) - .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectProcure::getUpdateBy,username)); - return BizConst.OP_SUCCESS; - } - public String operationRemove(String projId) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String username = user.getUsername(); - - GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, projId) - .last(BizConst.LIMIT_1)); - - VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("运维项目不存在!"); - - //改正逻辑删除 - baseinfo.setDeleted(Boolean.TRUE); - baseinfo.setUpdateBy(username); - baseinfo.setUpdateOn(LocalDateTime.now()); - operationProjectBaseinfoService.updateById(baseinfo); - - projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,projId) - .set(GovBizProjectApply::getDeleted,Boolean.TRUE) - .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApply::getUpdateBy,username)); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,projId) - .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) - .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApprove::getUpdateBy,username)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,projId) - .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectCimplement::getUpdateBy,username)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,projId) - .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectMimplement::getUpdateBy,username)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,projId) - .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) - .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectProcure::getUpdateBy,username)); - return BizConst.OP_SUCCESS; - } - - /** - * 项目归集 草稿箱删除 - * @param draftId - * @return - */ - public String draftRemove(Long draftId) { - if(draftService.removeById(draftId)){ - return BizConst.OP_SUCCESS; - } - return BizConst.OP_FAIL; - } - - public String operationDraftRemove(Long draftId) { - if(operationProjectDraftService.removeById(draftId)){ - return BizConst.OP_SUCCESS; - } - return BizConst.OP_FAIL; - } - - private void checkName(String baseProjName, String baseProjId) { - VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) - .ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) - .throwMessage("项目名重复"); - } - - private void checkNameOperation(String baseProjName, String baseProjId) { - VUtils.isTrue(operationProjectBaseinfoService.count(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjName,baseProjName) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) - .ne(GovOperationProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) - .throwMessage("项目名重复"); - } - - /** - * 推送项目 - * @param saveDTO - */ - public void pushProject(GovBizProjectSaveDTO saveDTO) { - String url = pushUrl; - ProjectPushReq req = ProjectConvert.convert(saveDTO); - try{ - log.info("推送消息体 {} ,{},{}",saveDTO.getBaseProjId(),url, JSON.toJSONString(req)); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); - ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); - } - } - public void pushProjectVo(GovBizProjectDetailVO vo) { - String url = pushUrl; - ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); - try{ - log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); - ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",vo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); - } - } - - public void pushProjectVo(GovOperationProjectDetailVO vo) { - String url = pushUrl; - ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); - try{ - log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); - ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",vo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); - } - } - - /** - * 把项目置为无效 - * @param baseinfo - */ - private void notEffectiveProject(GovBizProjectBaseinfoDTO baseinfo) { - String url = noEffectiveUrl; - ProjectBaseInfoReq req = ProjectConvert.convertBase(baseinfo,BizProjectContant.NOT_EFFECTIVE_CODE); - try{ - log.info("推送消息体 {},{},{}",baseinfo.getBaseProjId(),url, JSON.toJSONString(req)); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); - ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",baseinfo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); - } - } - - public void deleteAll() { - String url = deleteAllUrl; - try { - log.info("推送删除数据url {}", url); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(null, headers); - ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送删除结果 :{}", response); - } catch (Exception e) { - log.info("推送删除失败,{}", e.getMessage()); - } - } - - /** - * 上传项目归集申报的文件到OSS 前提还要先转为PDF - * @param apply - * @param oldApply - */ - private void uploadFileToProvincialOssApply(GovBizProjectApplyDTO apply, - GovBizProjectApply oldApply,GovBizProjectApply saveApply) { - if(checkFieldNotPdf(apply.getBaseProjBasisFile(),oldApply,"baseProjBasisFile")){ - StringJoiner sj = convertAndUpload(apply.getBaseProjBasisFile()); - saveApply.setBaseProjBasisFilePdf(sj.toString()); - } - if(checkFieldNotPdf(apply.getBaseProjApplyFile(),oldApply,"baseProjApplyFile")){ - StringJoiner sj = convertAndUpload(apply.getBaseProjApplyFile()); - saveApply.setBaseProjApplyFilePdf(sj.toString()); - } - if(checkFieldNotPdf(apply.getBaseOperatMaintenFile(),oldApply,"baseOperatMaintenFile")){ - StringJoiner sj = convertAndUpload(apply.getBaseOperatMaintenFile()); - saveApply.setBaseOperatMaintenFilePdf(sj.toString()); - } - if(checkFieldNotPdf(apply.getBaseResearchReportFile(),oldApply,"baseResearchReportFile")){ - StringJoiner sj = convertAndUpload(apply.getBaseResearchReportFile()); - saveApply.setBaseResearchReportFilePdf(sj.toString()); - } - if(checkFieldNotPdf(apply.getBaseProjOtherFile(),oldApply,"baseProjOtherFile")){ - StringJoiner sj = convertAndUpload(apply.getBaseProjOtherFile()); - saveApply.setBaseProjOtherFilePdf(sj.toString()); - } - projectApplyService.updateById(saveApply); - } - - private void uploadFileToProvincialOssApprove(GovBizProjectApproveDTO approve, GovBizProjectApprove oldApprove, GovBizProjectApprove saveApprove) { - if(checkFieldNotPdf(approve.getApprovalFile(),oldApprove,"approvalFile")){ - StringJoiner sj = convertAndUpload(approve.getApprovalFile()); - saveApprove.setApprovalFilePdf(sj.toString()); - } - if(checkFieldNotPdf(approve.getBaseReviewCommentsFile(),oldApprove,"baseReviewCommentsFile")){ - StringJoiner sj = convertAndUpload(approve.getBaseReviewCommentsFile()); - saveApprove.setBaseReviewCommentsFilePdf(sj.toString()); - } - if(checkFieldNotPdf(approve.getPreliminaryDesignFile(),oldApprove,"preliminaryDesignFile")){ - StringJoiner sj = convertAndUpload(approve.getPreliminaryDesignFile()); - saveApprove.setPreliminaryDesignFilePdf(sj.toString()); - } - approveService.updateById(saveApprove); - } - - private void uploadFileToProvincialOssCimplement(GovBizProjectCimplementDTO cimplement, - GovBizProjectCimplement oldCimplement, GovBizProjectCimplement saveCimplement) { - if(checkFieldNotPdf(cimplement.getBaseChanFile(),oldCimplement,"baseChanFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseChanFile()); - saveCimplement.setBaseChanFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseCheckFile(),oldCimplement,"baseCheckFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseCheckFile()); - saveCimplement.setBaseCheckFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseInforLevelFile(),oldCimplement,"baseInforLevelFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseInforLevelFile()); - saveCimplement.setBaseInforLevelFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseChangeFormFile(),oldCimplement,"baseChangeFormFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseChangeFormFile()); - saveCimplement.setBaseChangeFormFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseEstaSummFile(),oldCimplement,"baseEstaSummFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseEstaSummFile()); - saveCimplement.setBaseEstaSummFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); - saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseFinalExpertOpinionFile(),oldCimplement,"baseFinalExpertOpinionFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseFinalExpertOpinionFile()); - saveCimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseThirdAcceptFile(),oldCimplement,"baseThirdAcceptFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseThirdAcceptFile()); - saveCimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseUserConsFile(),oldCimplement,"baseUserConsFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseUserConsFile()); - saveCimplement.setBaseUserConsFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseFinanlAuditFile(),oldCimplement,"baseFinanlAuditFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseFinanlAuditFile()); - saveCimplement.setBaseFinanlAuditFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); - saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseInitialOpinionFile(),oldCimplement,"baseInitialOpinionFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseInitialOpinionFile()); - saveCimplement.setBaseInitialOpinionFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBasePasswAssessFile(),oldCimplement,"basePasswAssessFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBasePasswAssessFile()); - saveCimplement.setBasePasswAssessFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseSummReportFile(),oldCimplement,"baseSummReportFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseSummReportFile()); - saveCimplement.setBaseSummReportFilePdf(sj.toString()); - } - if(checkFieldNotPdf(cimplement.getBaseIrsTestRunFile(),oldCimplement,"baseIrsTestRunFile")){ - StringJoiner sj = convertAndUpload(cimplement.getBaseIrsTestRunFile()); - saveCimplement.setBaseIrsTestRunFilePdf(sj.toString()); - } - cimplementService.updateById(saveCimplement); - } - - private void uploadFileToProvincialOssMimplement(GovBizProjectMimplementDTO mimplement, GovBizProjectMimplement oldMimplement, GovBizProjectMimplement saveMimplement) { - if(checkFieldNotPdf(mimplement.getBaseChanFile(),oldMimplement,"baseChanFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseChanFile()); - saveMimplement.setBaseChanFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseInforLevelFile(),oldMimplement,"baseInforLevelFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseInforLevelFile()); - saveMimplement.setBaseInforLevelFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBasePasswAssessFile(),oldMimplement,"basePasswAssessFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBasePasswAssessFile()); - saveMimplement.setBasePasswAssessFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseThirdAcceptFile(),oldMimplement,"baseThirdAcceptFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseThirdAcceptFile()); - saveMimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseEstaSummFile(),oldMimplement,"baseEstaSummFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseEstaSummFile()); - saveMimplement.setBaseEstaSummFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseUserConsFile(),oldMimplement,"baseUserConsFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseUserConsFile()); - saveMimplement.setBaseUserConsFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseOperatMaintenSummFile(),oldMimplement,"baseOperatMaintenSummFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseOperatMaintenSummFile()); - saveMimplement.setBaseOperatMaintenSummFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseFinalExpertOpinionFile(),oldMimplement,"baseFinalExpertOpinionFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseFinalExpertOpinionFile()); - saveMimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseEngineerPostpoFile(),oldMimplement,"baseEngineerPostpoFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerPostpoFile()); - saveMimplement.setBaseEngineerPostpoFilePdf(sj.toString()); - } - if(checkFieldNotPdf(mimplement.getBaseEngineerAlterFile(),oldMimplement,"baseEngineerAlterFile")){ - StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerAlterFile()); - saveMimplement.setBaseEngineerAlterFilePdf(sj.toString()); - } - mimplementService.updateById(saveMimplement); - } - - /** - * 采购文件处理 - * @param procure - * @param o - * @param saveProcure - */ - private void uploadFileToProvincialOssProcure(GovBizProjectProcureDTO procure, Object o, GovBizProjectProcure saveProcure) { - if(checkFieldNotPdf(procure.getPurchaseFile(),o,"purchaseFile")){ - StringJoiner sj = convertAndUpload(procure.getPurchaseFile()); - saveProcure.setPurchaseFilePdf(sj.toString()); - } - if(checkFieldNotPdf(procure.getBiddingFile(),o,"biddingFile")){ - StringJoiner sj = convertAndUpload(procure.getBiddingFile()); - saveProcure.setBiddingFilePdf(sj.toString()); - } - if(checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract")){ - StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); - saveProcure.setPurchaseContractPdf(sj.toString()); - } - procureService.updateById(saveProcure); - } - - public StringJoiner convertAndUpload(String baseProjBasisFile) { - String[] baseProjBasisFileArr = baseProjBasisFile.split(";"); - StringJoiner sj = new StringJoiner(";"); - for(String bpb : baseProjBasisFileArr){ - try{ - JSONArray fileArray = JSON.parseArray(bpb); - fileArray.forEach(j -> { - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); - String suffix = jsonObject.getString("suffix"); - //如果已经是PDF 就不用转换了 - byte[] btyes = null; - String originalFileName = jsonObject.getString("originalFileName"); - if(StringUtils.isNotBlank(suffix) && suffix.equals("pdf")){ - com.ningdatech.file.entity.File file = fileService.getById(jsonObject.getLong("id")); - if(Objects.isNull(file)){ - throw new RuntimeException("转换PDF文件失败:" + originalFileName); - } - InputStream inputStream = fileService.getFileInputStream(file); - try { - btyes = IOUtils.toByteArray(inputStream); - } catch (IOException e) { - throw new RuntimeException("转换PDF文件失败:" + originalFileName,e); - } - }else{ - btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); - } - - if(!BizConst.DEV.equals(active)){ - originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); - } -// upload(btyes,"/temp",originalFileName); - String oss = ProvincialManage.uploadToOss(btyes, originalFileName); - sj.add(oss); - }); - }catch (Exception e){ - log.error("解析文件出错!" + e); - } - - } - return sj; - } - - private Boolean checkFieldNotPdf(String field, Object record, String fieldName){ - if(StringUtils.isBlank(field)){ - return Boolean.FALSE; - } - - //如果没有老值 - if(Objects.isNull(record)){ - return Boolean.TRUE; - } - - //和老值做个对比 不一样则true - Class clazz = record.getClass(); - String oldFiled = StringUtils.EMPTY; - try { - Field fieldDeclared = clazz.getDeclaredField(fieldName); - fieldDeclared.setAccessible(Boolean.TRUE); - oldFiled = Objects.nonNull(fieldDeclared.get(record)) ? String.valueOf(fieldDeclared.get(record)) : null; - } catch (NoSuchFieldException e) { - log.error("转换PDF文件出错" + e); - } catch (IllegalAccessException e) { - log.error("转换PDF文件出错" + e); - } - - if(StringUtils.isBlank(oldFiled)){ - return Boolean.TRUE; - } - - //如果一模一样 就不用上传了 - if(oldFiled.equals(field)){ - return Boolean.FALSE; - } - - return Boolean.TRUE; - } - - /** - * @param bytes byte数组 - * @param fileRoute 文件路径 - * @param fileName 文件名 - */ - public static void upload(byte[] bytes,String fileRoute,String fileName) { - try { - File directory=new File(fileRoute); - if (!directory.exists()){ - directory.mkdirs(); - } - File file = new File(directory, fileName); - BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); - bos.write(bytes); - bos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public String rebuildProjectCode(List baseProjIds){ - if(CollUtil.isEmpty(baseProjIds)){ - throw new BizException("项目编号不能为空"); - } - Integer successNum = 0; - for(String baseProjId : baseProjIds){ - //两种情况 - //1.项目归集 - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(baseinfo)){ - rebuildGuiji(baseProjId); - successNum ++; - } - - //2.运维备案 - GovOperationProjectBaseinfo operation = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovOperationProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(operation)){ - rebuildOperation(baseProjId); - successNum ++; - } - } - return "运行成功 重新生成" + successNum + "个项目编号"; - } - - private void rebuildGuiji(String baseProjId) { - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApply::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ - System.out.println("项目不存在 直接下一个"); - return; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - - baseinfo.setBaseProjId(newProjId); - baseinfoService.updateById(baseinfo); - apply.setBaseProjId(newProjId); - projectApplyService.updateById(apply); - - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApprove::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(newProjId); - approveService.updateById(approve); - } - - - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectCimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(newProjId); - cimplement.setBaseBidCode(newProjId); - cimplementService.updateById(cimplement); - } - - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectMimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(newProjId); - mimplement.setBaseBidCode(newProjId); - mimplementService.updateById(mimplement); - } - - List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - - for(GovBizProjectProcure procure : procures){ - procure.setBaseProjId(newProjId); - procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); - procureService.updateById(procure); - } - } - - private void rebuildOperation(String baseProjId) { - GovOperationProjectBaseinfo operationBase = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovOperationProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApply::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(operationBase)){ - System.out.println("运维备案项目不存在 直接下一个"); - return; - } - GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - - operationBase.setBaseProjId(newProjId); - operationProjectBaseinfoService.updateById(operationBase); - apply.setBaseProjId(newProjId); - projectApplyService.updateById(apply); - - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApprove::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(newProjId); - approveService.updateById(approve); - } - - - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectCimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(newProjId); - cimplement.setBaseBidCode(newProjId); - cimplementService.updateById(cimplement); - } - - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectMimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(newProjId); - mimplement.setBaseBidCode(newProjId); - mimplementService.updateById(mimplement); - } - - List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - - for(GovBizProjectProcure procure : procures){ - procure.setBaseProjId(newProjId); - procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); - procureService.updateById(procure); - } - } - - public String removeProject(List projectCodes) { - if(CollUtil.isEmpty(projectCodes)){ - throw new BizException("项目编号不能为空!"); - } - - for(String projectCode : projectCodes){ - //项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - - List projectIds = projects.stream().map(Project::getId).collect(Collectors.toList()); - - //1.删除应用 - applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,projectCode)); - - //2.删除相关流程 - List projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIds)); - for(ProjectInst projectInst : projectInsts){ - //实例 - try{ - runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); - }catch (Exception e){ - - } - try{ - historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); - }catch (Exception e){ - - } - //抄送 - ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); - } - projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); - - //3.删除实施表 - operationService.remove(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode,projectCode)); - - //4.删除续建项目资金表 - renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); - - //5.暂存表 - stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) - .in(ProjectStaging::getProjectId,projectIds)); - - //6.状态变更表 - statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId,projectIds)); - - //7.采购表 - purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId,projectIds)); - - //8.标签 - projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode,projectCode)); - - //9.初验人员 - preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .in(PreInsAcceptancePerson::getProjectId,projectIds)); - - //10.供应商安全质量 - supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) - .eq(SupplierSafetyQualification::getProjectCode,projectCode)); - - //11.安全人员 - personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) - .eq(PersonSafetyInfo::getProjectCode,projectCode)); - - //12.最后删除项目 - projectService.remove(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - } - return "删除成功"; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java deleted file mode 100644 index 8fbbac1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.entity.BelongOrg; - -/** - *

- * Mapper 接口 - *

- * - * @author liuxinxin - * @since 2023-04-18 - */ -public interface BelongOrgMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApplyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApplyMapper.java deleted file mode 100644 index fef1bea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApplyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectApplyMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApproveMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApproveMapper.java deleted file mode 100644 index 9323e5d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectApproveMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectApproveMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectBaseinfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectBaseinfoMapper.java deleted file mode 100644 index 9870946..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectBaseinfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectBaseinfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectCimplementMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectCimplementMapper.java deleted file mode 100644 index fa8fd7c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectCimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectCimplement; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectCimplementMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectDraftMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectDraftMapper.java deleted file mode 100644 index 934dc17..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectDraftMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectDraftMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectMimplementMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectMimplementMapper.java deleted file mode 100644 index 5ec11da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectMimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectMimplement; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectMimplementMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectProcureMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectProcureMapper.java deleted file mode 100644 index f876458..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectProcureMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectProcure; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovBizProjectProcureMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectBaseinfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectBaseinfoMapper.java deleted file mode 100644 index 8df15b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectBaseinfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovOperationProjectBaseinfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectDraftMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectDraftMapper.java deleted file mode 100644 index c301fb0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectDraftMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectDraft; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovOperationProjectDraftMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectTobePushMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectTobePushMapper.java deleted file mode 100644 index 4a613d9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovOperationProjectTobePushMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectTobePush; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovOperationProjectTobePushMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java deleted file mode 100644 index 0a7fd35..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface GovProjectDictionaryMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java deleted file mode 100644 index 019fa6e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目申报信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectApply对象", description = "项目申报表") -public class GovBizProjectApplyDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("发改委项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编号") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("领域大脑 一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编号") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目开始时间") - private LocalDateTime baseProjStartTime; - - @ApiModelProperty("项目结束时间") - private LocalDateTime baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("项目年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private BigDecimal baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private BigDecimal baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源 区域code") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApproveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApproveDTO.java deleted file mode 100644 index 91950f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApproveDTO.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目审核信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") -public class GovBizProjectApproveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("'发改项目代码'") - private String baseDevelopCode; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private BigDecimal baseExpertTotalMoney; - - @ApiModelProperty("'建议年度预算'") - private BigDecimal baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private BigDecimal baseInitialReviewTotalMoney; - - @ApiModelProperty("'建议批复年度预算'") - private BigDecimal baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private BigDecimal releaseYearMoney; - - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java deleted file mode 100644 index 78f8829..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") -public class GovBizProjectBaseinfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDeprtDing; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectCimplementDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectCimplementDTO.java deleted file mode 100644 index c2fe3fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectCimplementDTO.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectCimplement对象", description = "项目实施信息表") -public class GovBizProjectCimplementDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("生产批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectMimplementDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectMimplementDTO.java deleted file mode 100644 index e9903c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectMimplementDTO.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectMimplement对象", description = "运维项目实施信息表") -public class GovBizProjectMimplementDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectProcureDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectProcureDTO.java deleted file mode 100644 index c677811..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectProcureDTO.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目采购信息 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") -public class GovBizProjectProcureDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private LocalDateTime baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private BigDecimal baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private LocalDateTime basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private BigDecimal paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java deleted file mode 100644 index a2dbbd7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.gov.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.util.List; - -/** - *

- * 项目归集总VO - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectSaveDTO", description = "项目归集总详情DTO") -public class GovBizProjectSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("草稿id") - private Long draftId; - - @ApiModelProperty("项目基本信息") - private GovBizProjectBaseinfoDTO baseinfo; - - @ApiModelProperty("项目申报信息") - private GovBizProjectApplyDTO apply; - - @ApiModelProperty("项目审批信息") - private GovBizProjectApproveDTO approve; - - @ApiModelProperty("实施项目实施信息") - private GovBizProjectCimplementDTO cimplement; - - @ApiModelProperty("运维项目实施信息") - private GovBizProjectMimplementDTO mimplement; - - @ApiModelProperty("项目采购信息") - private List procures; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java deleted file mode 100644 index 01fa14d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.ningdatech.pmapi.gov.model.dto; - -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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") -public class GovOperationProjectBaseinfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("是否推送 省局归集") - private Boolean push; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDeprtDing; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectSaveDTO.java deleted file mode 100644 index f2768f1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectSaveDTO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.gov.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - *

- * 项目归集总VO - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovOperationProjectSaveDTO", description = "运维项目总详情DTO") -public class GovOperationProjectSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("草稿id") - private Long draftId; - - @ApiModelProperty("项目基本信息") - private GovOperationProjectBaseinfoDTO baseinfo; - - @ApiModelProperty("项目申报信息") - private GovBizProjectApplyDTO apply; - - @ApiModelProperty("项目审批信息") - private GovBizProjectApproveDTO approve; - - @ApiModelProperty("实施项目实施信息") - private GovBizProjectCimplementDTO cimplement; - - @ApiModelProperty("运维项目实施信息") - private GovBizProjectMimplementDTO mimplement; - - @ApiModelProperty("项目采购信息") - private List procures; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java deleted file mode 100644 index a7c82df..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目申报信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@TableName("gov_biz_project_apply") -@ApiModel(value = "GovBizProjectApply对象", description = "项目申报信息表") -public class GovBizProjectApply implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("发改委项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编号") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("领域大脑 一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编号") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目开始时间") - private LocalDateTime baseProjStartTime; - - @ApiModelProperty("项目结束时间") - private LocalDateTime baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("项目年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private BigDecimal baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private BigDecimal baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源 区域code") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("立项依据材料PDF版") - private String baseProjBasisFilePdf; - - @ApiModelProperty("项目申报书PDF版") - private String baseProjApplyFilePdf; - - @ApiModelProperty("运维方案PDF版") - private String baseOperatMaintenFilePdf; - - @ApiModelProperty("可研报告PDF版") - private String baseResearchReportFilePdf; - - @ApiModelProperty("其它文件PDF版") - private String baseProjOtherFilePdf; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApprove.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApprove.java deleted file mode 100644 index 6230edb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApprove.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目审核信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@TableName("gov_biz_project_approve") -@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") -public class GovBizProjectApprove implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private BigDecimal baseExpertTotalMoney; - - @ApiModelProperty("建议年度预算") - private BigDecimal baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private BigDecimal baseInitialReviewTotalMoney; - - @ApiModelProperty("'建议批复年度预算'") - private BigDecimal baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private BigDecimal releaseYearMoney; - - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("立项批复文件") - private String approvalFilePdf; - - @ApiModelProperty("评审意见附件PDF") - private String baseReviewCommentsFilePdf; - - @ApiModelProperty("初步设计方案批复函PDF") - private String preliminaryDesignFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java deleted file mode 100644 index 28b4172..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目基本信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@TableName("gov_biz_project_baseinfo") -@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目基本信息表") -public class GovBizProjectBaseinfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectCimplement.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectCimplement.java deleted file mode 100644 index 6ac1acd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectCimplement.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.ningdatech.pmapi.gov.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("gov_biz_project_cimplement") -@ApiModel(value = "GovBizProjectCimplement对象", description = "项目实施信息表") -public class GovBizProjectCimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("生产批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("生产批复文件PDF") - private String baseChanFilePdf; - - @ApiModelProperty("初验意见PDF") - private String baseInitialOpinionFilePdf; - - @ApiModelProperty("信息安全等级保护测评报告PDF") - private String baseInforLevelFilePdf; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFilePdf; - - @ApiModelProperty("第三方验收测试报告PDF") - private String baseThirdAcceptFilePdf; - - @ApiModelProperty("建设核查表PDF") - private String baseCheckFilePdf; - - @ApiModelProperty("财务审计报告PDF") - private String baseFinanlAuditFilePdf; - - @ApiModelProperty("用户使用报告PDF") - private String baseUserConsFilePdf; - - @ApiModelProperty("监理总结报告PDF") - private String baseEstaSummFilePdf; - - @ApiModelProperty("IRS应用试运行报告PDF") - private String baseIrsTestRunFilePdf; - - @ApiModelProperty("项目总结报告PDF") - private String baseSummReportFilePdf; - - @ApiModelProperty("终审意见PDF") - private String baseFinalExpertOpinionFilePdf; - - @ApiModelProperty("项目延期申请表PDF") - private String baseEngineerPostpoFilePdf; - - @ApiModelProperty("变更申请单PDF") - private String baseChangeFormFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectDraft.java deleted file mode 100644 index 0f891a6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectDraft.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname GovBizProjectDraft - * @Description - * @Date 2023/9/5 11:05 - * @Author PoffyZhang - */ -@Data -@TableName("gov_biz_project_draft") -@ApiModel(value = "GovBizProjectDraft", description = "草稿") -public class GovBizProjectDraft implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - private String baseProjId; - private String baseProjName; - private String baseAreaName; - private String baseAreaCode; - private String baseProjIsConfidentiality; - private String baseProjType; - private String baseConstructionType; - private String baseProjSetProg; - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - private String baseProvManDeprt; - private String baseProvManDeprtDing; - private String baseManDeprt; - private String baseManDeprtDing; - private String baseManDepartUsci; - private String baseBuildDeprt; - private String baseBuildDeprtDing; - private String baseBuildDepartUsci; - private String baseProjPrincipal; - private String baseProjPrincipalCall; - private String baseProjContacts; - private String baseProjContactsCall; - private Boolean deleted; - - private String baseDevelopCode; - private String setProjCodeFinan; - private String baseHistorProjName; - private String baseHistorProjId; - private String baseHistorProjYear; - private String baseProjSys; - private String baseProjSysCode; - private String baseAccountAppName; - private String baseBrainName; - private String baseCoreBusiness; - private String baseCoreBusinessCode; - private LocalDateTime baseProjStartTime; - private LocalDateTime baseProjEndTime; - private LocalDateTime baseProjDuration; - private String baseProjSetYear; - private String baseProjAmountOri; - private String baseBasisAmountOri; - private BigDecimal baseProjTotalAmount; - private BigDecimal baseProjDeclAmount; - private String baseProjConsClass; - private String baseLowestLevel; - private String baseProjBasis; - private String baseBasisEstablish; - private String baseProjBasisFile; - private String baseProjIntro; - private String beseExpectedResults; - private String baseResearchReportFile; - private String baseProjApplyFile; - private String baseOperatMaintenFile; - private String baseProjOtherFile; - private String baseProjRemark; - - private String baseReviewResults; - private String baseReviewOpinion; - private String baseReviewCommentsFile; - private BigDecimal baseExpertTotalMoney; - private BigDecimal baseExpertYearMoney; - private String approvalFile; - private BigDecimal baseInitialReviewTotalMoney; - private BigDecimal baseProjReplyAmount; - private String equalProtectionLevel; - private String preliminaryDesignScheme; - private String preliminaryDesignFile; - private BigDecimal releaseYearMoney; - - private String baseBidCode; - private String baseBidName; - - private String baseInitialOpinionFile; - private String baseInforLevelFileCimplement; - private String basePasswAssessFileCimplement; - private String baseThirdAcceptFileCimplement; - private String baseCheckFile; - private String baseFinanlAuditFile; - private String baseUserConsFileCimplement; - private String baseEstaSummFileCimplement; - private String baseIrsTestRunFile; - private String baseSummReportFile; - private String baseLogAggregationCimplement; - private String baseBusinessMetricsCimplement; - private String baseFinalExpertOpinionFileCimplement; - private String baseEngineerPostpoFileCimplement; - private String baseChangeFormFile; - private String baseChanFileCimplement; - - private String baseInforLevelFileMimplement; - private String basePasswAssessFileMimplement; - private String baseThirdAcceptFileMimplement; - private String baseUserConsFileMimplement; - private String baseEstaSummFileMimplement; - private String baseOperatMaintenSummFile; - private String baseLogAggregationMimplement; - private String baseBusinessMetricsMimplement; - private String baseFinalExpertOpinionFileMimplement; - private String baseEngineerPostpoFileMimplement; - private String baseEngineerAlterFile; - private String baseChanFileMimplement; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; - - private String procure; - - private String areaCode; - private LocalDateTime bizTime; - private String op; - private LocalDateTime tongTime; - private LocalDateTime updateOn; - private String updateBy; - private Long createId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectMimplement.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectMimplement.java deleted file mode 100644 index 24ff394..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectMimplement.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.ningdatech.pmapi.gov.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("gov_biz_project_mimplement") -@ApiModel(value = "GovBizProjectMimplement对象", description = "运维项目实施信息表") -public class GovBizProjectMimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("信息安全等级保护测评报告PDF") - private String baseInforLevelFilePdf; - - @ApiModelProperty("商业密码应用评估报告PDF") - private String basePasswAssessFilePdf; - - @ApiModelProperty("第三方验收测试报告PDF") - private String baseThirdAcceptFilePdf; - - @ApiModelProperty("用户使用报告PDF") - private String baseUserConsFilePdf; - - @ApiModelProperty("监理总结报告PDF") - private String baseEstaSummFilePdf; - - @ApiModelProperty("运维总结报告PDF") - private String baseOperatMaintenSummFilePdf; - - @ApiModelProperty("终审意见PDF") - private String baseFinalExpertOpinionFilePdf; - - @ApiModelProperty("项目延期申请表PDF") - private String baseEngineerPostpoFilePdf; - - @ApiModelProperty("变更报告PDF") - private String baseEngineerAlterFilePdf; - - @ApiModelProperty("变更批复文件PDF") - private String baseChanFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectProcure.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectProcure.java deleted file mode 100644 index 286a3e9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectProcure.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目采购信息 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@TableName("gov_biz_project_procure") -@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") -public class GovBizProjectProcure implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private LocalDateTime baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private BigDecimal baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private LocalDateTime basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private BigDecimal paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("招标(采购)文件PDF") - private String purchaseFilePdf; - - @ApiModelProperty("采购合同PDF") - private String purchaseContractPdf; - - @ApiModelProperty("中标(成交)通知书PDF") - private String biddingFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java deleted file mode 100644 index b29057b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.ningdatech.pmapi.gov.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-10-07 - */ -@Data -@TableName("gov_operation_project_baseinfo") -@ApiModel(value = "GovOperationProjectBaseinfo对象", description = "运维项目基本信息表") -public class GovOperationProjectBaseinfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("是否推送 省局归集") - private Boolean push; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectDraft.java deleted file mode 100644 index c0e523f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectDraft.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname GovBizProjectDraft - * @Description - * @Date 2023/9/5 11:05 - * @Author PoffyZhang - */ -@Data -@TableName("gov_operation_project_draft") -@ApiModel(value = "GovOperationProjectDraft", description = "草稿") -public class GovOperationProjectDraft implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - private Boolean push; - private String baseProjId; - private String baseProjName; - private String baseAreaName; - private String baseAreaCode; - private String baseProjIsConfidentiality; - private String baseProjType; - private String baseConstructionType; - private String baseProjSetProg; - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - private String baseProvManDeprt; - private String baseProvManDeprtDing; - private String baseManDeprt; - private String baseManDeprtDing; - private String baseManDepartUsci; - private String baseBuildDeprt; - private String baseBuildDeprtDing; - private String baseBuildDepartUsci; - private String baseProjPrincipal; - private String baseProjPrincipalCall; - private String baseProjContacts; - private String baseProjContactsCall; - private Boolean deleted; - - private String baseDevelopCode; - private String setProjCodeFinan; - private String baseHistorProjName; - private String baseHistorProjId; - private String baseHistorProjYear; - private String baseProjSys; - private String baseProjSysCode; - private String baseAccountAppName; - private String baseBrainName; - private String baseCoreBusiness; - private String baseCoreBusinessCode; - private LocalDateTime baseProjStartTime; - private LocalDateTime baseProjEndTime; - private LocalDateTime baseProjDuration; - private String baseProjSetYear; - private String baseProjAmountOri; - private String baseBasisAmountOri; - private BigDecimal baseProjTotalAmount; - private BigDecimal baseProjDeclAmount; - private String baseProjConsClass; - private String baseLowestLevel; - private String baseProjBasis; - private String baseBasisEstablish; - private String baseProjBasisFile; - private String baseProjIntro; - private String beseExpectedResults; - private String baseResearchReportFile; - private String baseProjApplyFile; - private String baseOperatMaintenFile; - private String baseProjOtherFile; - private String baseProjRemark; - - private String baseReviewResults; - private String baseReviewOpinion; - private String baseReviewCommentsFile; - private BigDecimal baseExpertTotalMoney; - private BigDecimal baseExpertYearMoney; - private String approvalFile; - private BigDecimal baseInitialReviewTotalMoney; - private BigDecimal baseProjReplyAmount; - private String equalProtectionLevel; - private String preliminaryDesignScheme; - private String preliminaryDesignFile; - private BigDecimal releaseYearMoney; - - private String baseBidCode; - private String baseBidName; - - private String baseInitialOpinionFile; - private String baseInforLevelFileCimplement; - private String basePasswAssessFileCimplement; - private String baseThirdAcceptFileCimplement; - private String baseCheckFile; - private String baseFinanlAuditFile; - private String baseUserConsFileCimplement; - private String baseEstaSummFileCimplement; - private String baseIrsTestRunFile; - private String baseSummReportFile; - private String baseLogAggregationCimplement; - private String baseBusinessMetricsCimplement; - private String baseFinalExpertOpinionFileCimplement; - private String baseEngineerPostpoFileCimplement; - private String baseChangeFormFile; - private String baseChanFileCimplement; - - private String baseInforLevelFileMimplement; - private String basePasswAssessFileMimplement; - private String baseThirdAcceptFileMimplement; - private String baseUserConsFileMimplement; - private String baseEstaSummFileMimplement; - private String baseOperatMaintenSummFile; - private String baseLogAggregationMimplement; - private String baseBusinessMetricsMimplement; - private String baseFinalExpertOpinionFileMimplement; - private String baseEngineerPostpoFileMimplement; - private String baseEngineerAlterFile; - private String baseChanFileMimplement; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; - - private String procure; - - private String areaCode; - private LocalDateTime bizTime; - private String op; - private LocalDateTime tongTime; - private LocalDateTime updateOn; - private String updateBy; - private Long createId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectTobePush.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectTobePush.java deleted file mode 100644 index 044f53d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectTobePush.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.ningdatech.pmapi.gov.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname GovBizProjectDraft - * @Description - * @Date 2023/9/5 11:05 - * @Author PoffyZhang - */ -@Data -@TableName("gov_operation_project_tobe_push") -@ApiModel(value = "GovOperationProjectTobePush", description = "待推送申报项目和运维项目") -public class GovOperationProjectTobePush implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private String baseProjId; - private String baseProjName; - private String baseAreaName; - private String baseAreaCode; - private String baseProjIsConfidentiality; - private String baseProjType; - private String baseConstructionType; - private String baseProjSetProg; - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - private String baseProvManDeprt; - private String baseProvManDeprtDing; - private String baseManDeprt; - private String baseManDeprtDing; - private String baseManDepartUsci; - private String baseBuildDeprt; - private String baseBuildDeprtDing; - private String baseBuildDepartUsci; - private String baseProjPrincipal; - private String baseProjPrincipalCall; - private String baseProjContacts; - private String baseProjContactsCall; - private Boolean deleted; - - private String baseDevelopCode; - private String setProjCodeFinan; - private String baseHistorProjName; - private String baseHistorProjId; - private String baseHistorProjYear; - private String baseProjSys; - private String baseProjSysCode; - private String baseAccountAppName; - private String baseBrainName; - private String baseCoreBusiness; - private String baseCoreBusinessCode; - private LocalDateTime baseProjStartTime; - private LocalDateTime baseProjEndTime; - private LocalDateTime baseProjDuration; - private String baseProjSetYear; - private String baseProjAmountOri; - private String baseBasisAmountOri; - private BigDecimal baseProjTotalAmount; - private BigDecimal baseProjDeclAmount; - private String baseProjConsClass; - private String baseLowestLevel; - private String baseProjBasis; - private String baseBasisEstablish; - private String baseProjBasisFile; - private String baseProjIntro; - private String beseExpectedResults; - private String baseResearchReportFile; - private String baseProjApplyFile; - private String baseOperatMaintenFile; - private String baseProjOtherFile; - private String baseProjRemark; - - private String baseReviewResults; - private String baseReviewOpinion; - private String baseReviewCommentsFile; - private BigDecimal baseExpertTotalMoney; - private BigDecimal baseExpertYearMoney; - private String approvalFile; - private BigDecimal baseInitialReviewTotalMoney; - private BigDecimal baseProjReplyAmount; - private String equalProtectionLevel; - private String preliminaryDesignScheme; - private String preliminaryDesignFile; - private BigDecimal releaseYearMoney; - - private String baseBidCode; - private String baseBidName; - - private String baseInitialOpinionFile; - private String baseInforLevelFileCimplement; - private String basePasswAssessFileCimplement; - private String baseThirdAcceptFileCimplement; - private String baseCheckFile; - private String baseFinanlAuditFile; - private String baseUserConsFileCimplement; - private String baseEstaSummFileCimplement; - private String baseIrsTestRunFile; - private String baseSummReportFile; - private String baseLogAggregationCimplement; - private String baseBusinessMetricsCimplement; - private String baseFinalExpertOpinionFileCimplement; - private String baseEngineerPostpoFileCimplement; - private String baseChangeFormFile; - private String baseChanFileCimplement; - - private String baseInforLevelFileMimplement; - private String basePasswAssessFileMimplement; - private String baseThirdAcceptFileMimplement; - private String baseUserConsFileMimplement; - private String baseEstaSummFileMimplement; - private String baseOperatMaintenSummFile; - private String baseLogAggregationMimplement; - private String baseBusinessMetricsMimplement; - private String baseFinalExpertOpinionFileMimplement; - private String baseEngineerPostpoFileMimplement; - private String baseEngineerAlterFile; - private String baseChanFileMimplement; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; - - private String procure; - - private String areaCode; - private LocalDateTime bizTime; - private String op; - private LocalDateTime tongTime; - private LocalDateTime updateOn; - private String updateBy; - private Long createId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java deleted file mode 100644 index 121a7b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.gov.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("gov_project_dictionary") -@ApiModel(value = "GovProjectDictionary对象", description = "项目字典表") -public class GovProjectDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private String createBy; - private LocalDateTime createOn; - - @ApiModelProperty("类型") - private String type; - - @ApiModelProperty("值") - private String value; - - @ApiModelProperty("展示值") - private String label; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("是否删除") - private Boolean deleted; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApplyReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApplyReq.java deleted file mode 100644 index 46f0d66..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApplyReq.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_apply") -@ApiModel(value = "SzlsDaBiz331100ProjectApply对象", description = "项目申报信息") -public class ProjectApplyReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("历年项目代码") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("“领域大脑”一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编码") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目起始时间") - private String baseProjStartTime; - - @ApiModelProperty("项目终止时间") - private String baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("预算年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private String baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private String baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可行性研究报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApproveReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApproveReq.java deleted file mode 100644 index 2689d9f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectApproveReq.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_approve") -@ApiModel(value = "SzlsDaBiz331100ProjectApprove对象", description = "项目立项评审信息") -public class ProjectApproveReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private String baseExpertTotalMoney; - - @ApiModelProperty("建议年度预算") - private String baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private String baseInitialReviewTotalMoney; - - @ApiModelProperty("建议批复年度预算") - private String baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private String releaseYearMoney; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectBaseInfoReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectBaseInfoReq.java deleted file mode 100644 index a68fbf7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectBaseInfoReq.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_baseinfo") -@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") -public class ProjectBaseInfoReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("所属区划") - private String baseAreaName; - - @ApiModelProperty("所属区划编码") - private String baseAreaCode; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位浙政钉ID") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位浙政钉ID") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位统一社会信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位(申报单位)") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位浙政钉ID") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位统一社会信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人手机号") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectCimplementReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectCimplementReq.java deleted file mode 100644 index 47e5c3d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectCimplementReq.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_cimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectCimplement对象", description = "建设项目实施信息") -public class ProjectCimplementReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectMimplementReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectMimplementReq.java deleted file mode 100644 index 5458e31..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectMimplementReq.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_mimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectMimplement对象", description = "运维项目实施信息") -public class ProjectMimplementReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectProcureReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectProcureReq.java deleted file mode 100644 index 72f9561..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectProcureReq.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -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 CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_procure") -@ApiModel(value = "SzlsDaBiz331100ProjectProcure对象", description = "项目采购信息") -public class ProjectProcureReq implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private String baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private String baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private String basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private String paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectPushReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectPushReq.java deleted file mode 100644 index 47a52d2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/req/ProjectPushReq.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.gov.model.req; - -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @Classname ProjectPushReq - * @Description - * @Date 2023/8/25 9:45 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ProjectPushReq", description = "项目保存") -public class ProjectPushReq { - - @NotNull(message = "项目基本信息不能为空") - private ProjectBaseInfoReq baseinfo; - - @NotNull(message = "项目申报信息不能为空") - private ProjectApplyReq apply; - - @NotNull(message = "项目审批信息不能为空") - private ProjectApproveReq approve; - - private ProjectCimplementReq cimplement; - - private ProjectMimplementReq mimplement; - - private List procures; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java deleted file mode 100644 index a825c3c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目申报信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectApply对象", description = "项目申报表") -public class GovBizProjectApplyVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("发改委项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编号") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("领域大脑 一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编号") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目开始时间") - private LocalDateTime baseProjStartTime; - - @ApiModelProperty("项目结束时间") - private LocalDateTime baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("项目年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private BigDecimal baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private BigDecimal baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源 区域code") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("立项依据材料PDF版") - private String baseProjBasisFilePdf; - - @ApiModelProperty("项目申报书PDF版") - private String baseProjApplyFilePdf; - - @ApiModelProperty("运维方案PDF版") - private String baseOperatMaintenFilePdf; - - @ApiModelProperty("可研报告PDF版") - private String baseResearchReportFilePdf; - - @ApiModelProperty("其它文件PDF版") - private String baseProjOtherFilePdf; - - @ApiModelProperty("是否确实历史项目") - private Boolean missing; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApproveVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApproveVO.java deleted file mode 100644 index bc5b792..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApproveVO.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目审核信息表 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目审核信息表") -public class GovBizProjectApproveVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("'发改项目代码'") - private String baseDevelopCode; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private BigDecimal baseExpertTotalMoney; - - @ApiModelProperty("'建议年度预算'") - private BigDecimal baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private BigDecimal baseInitialReviewTotalMoney; - - @ApiModelProperty("'建议批复年度预算'") - private BigDecimal baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private BigDecimal releaseYearMoney; - - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("立项批复文件") - private String approvalFilePdf; - - @ApiModelProperty("评审意见附件PDF") - private String baseReviewCommentsFilePdf; - - @ApiModelProperty("初步设计方案批复函PDF") - private String preliminaryDesignFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java deleted file mode 100644 index 3acbdcd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") -public class GovBizProjectBaseinfoVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDepartDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectCimplementVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectCimplementVO.java deleted file mode 100644 index d3546fc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectCimplementVO.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectCimplement对象", description = "项目实施信息表") -public class GovBizProjectCimplementVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("生产批复文件PDF") - private String baseChanFilePdf; - - @ApiModelProperty("初验意见PDF") - private String baseInitialOpinionFilePdf; - - @ApiModelProperty("信息安全等级保护测评报告PDF") - private String baseInforLevelFilePdf; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFilePdf; - - @ApiModelProperty("第三方验收测试报告PDF") - private String baseThirdAcceptFilePdf; - - @ApiModelProperty("建设核查表PDF") - private String baseCheckFilePdf; - - @ApiModelProperty("财务审计报告PDF") - private String baseFinanlAuditFilePdf; - - @ApiModelProperty("用户使用报告PDF") - private String baseUserConsFilePdf; - - @ApiModelProperty("监理总结报告PDF") - private String baseEstaSummFilePdf; - - @ApiModelProperty("IRS应用试运行报告PDF") - private String baseIrsTestRunFilePdf; - - @ApiModelProperty("项目总结报告PDF") - private String baseSummReportFilePdf; - - @ApiModelProperty("终审意见PDF") - private String baseFinalExpertOpinionFilePdf; - - @ApiModelProperty("项目延期申请表PDF") - private String baseEngineerPostpoFilePdf; - - @ApiModelProperty("变更申请单PDF") - private String baseChangeFormFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java deleted file mode 100644 index c45999d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 项目归集总VO - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectDetailVO", description = "项目归集总详情VO") -public class GovBizProjectDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("草稿id") - private Long draftId; - - @ApiModelProperty("项目基本信息") - private GovBizProjectBaseinfoVO baseinfo; - - @ApiModelProperty("项目申报信息") - private GovBizProjectApplyVO apply; - - @ApiModelProperty("项目审批信息") - private GovBizProjectApproveVO approve; - - @ApiModelProperty("实施项目实施信息") - private GovBizProjectCimplementVO cimplement; - - @ApiModelProperty("运维项目实施信息") - private GovBizProjectMimplementVO mimplement; - - @ApiModelProperty("项目采购信息") - private List procures; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectListVO.java deleted file mode 100644 index f1d8b4f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectListVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - *

- * 项目归集列表VO - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectListVO", description = "项目归集列表VO") -public class GovBizProjectListVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("项目年度") - private String baseProjSetYear; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("项目总投资") - private BigDecimal baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private BigDecimal baseProjDeclAmount; - - @ApiModelProperty("草稿编号") - private Long draftId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectMimplementVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectMimplementVO.java deleted file mode 100644 index 12453b7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectMimplementVO.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectMimplement对象", description = "运维项目实施信息表") -public class GovBizProjectMimplementVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("'商业密码应用评估报告'") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("'是否完成日志数据归集'") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终审意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("信息安全等级保护测评报告PDF") - private String baseInforLevelFilePdf; - - @ApiModelProperty("商业密码应用评估报告PDF") - private String basePasswAssessFilePdf; - - @ApiModelProperty("第三方验收测试报告PDF") - private String baseThirdAcceptFilePdf; - - @ApiModelProperty("用户使用报告PDF") - private String baseUserConsFilePdf; - - @ApiModelProperty("监理总结报告PDF") - private String baseEstaSummFilePdf; - - @ApiModelProperty("运维总结报告PDF") - private String baseOperatMaintenSummFilePdf; - - @ApiModelProperty("终审意见PDF") - private String baseFinalExpertOpinionFilePdf; - - @ApiModelProperty("项目延期申请表PDF") - private String baseEngineerPostpoFilePdf; - - @ApiModelProperty("变更报告PDF") - private String baseEngineerAlterFilePdf; - - @ApiModelProperty("变更批复文件PDF") - private String baseChanFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectProcureVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectProcureVO.java deleted file mode 100644 index fd90509..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectProcureVO.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目采购信息 - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovBizProjectProcure对象", description = "项目采购信息") -public class GovBizProjectProcureVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("标段编号") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("'财政项目代码'") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private LocalDateTime baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private BigDecimal baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private LocalDateTime basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private BigDecimal paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; - - @ApiModelProperty("招标(采购)文件PDF") - private String purchaseFilePdf; - - @ApiModelProperty("采购合同PDF") - private String purchaseContractPdf; - - @ApiModelProperty("中标(成交)通知书PDF") - private String biddingFilePdf; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java deleted file mode 100644 index 5189107..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author Liuxinxin - * @since 2023-03-08 - */ -@Data -@ApiModel(value = "条线VO") -public class GovBusinessStripVO { - - @ApiModelProperty("条线code") - private String businessStripCode; - - @ApiModelProperty("条线名称") - private String businessStripName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java deleted file mode 100644 index c8b99d2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovBizProjectBaseinfo对象", description = "项目基本信息表") -public class GovOperationProjectBaseinfoVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("是否推送 省局归集") - private Boolean push; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("基本项目区域code") - private String baseAreaCode; - - @ApiModelProperty("基本项目区域名") - private String baseAreaName; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位钉id") - private String baseProvManDepartDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位ding code") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位社会统一信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位Ding Code") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位社会统一信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人联系方式") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("生产时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("逻辑删除") - private Boolean deleted; - - @ApiModelProperty("最后修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectDetailVO.java deleted file mode 100644 index 087361d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectDetailVO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.gov.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - *

- * 运维项目总详情VO - *

- * - * @author ZPF - * @since 2023-08-02 - */ -@Data -@ApiModel(value = "GovOperationProjectDetailVO", description = "运维项目总详情VO") -public class GovOperationProjectDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - private String baseProjId; - - @ApiModelProperty("基本项目名称") - private String baseProjName; - - @ApiModelProperty("草稿id") - private Long draftId; - - @ApiModelProperty("项目基本信息") - private GovOperationProjectBaseinfoVO baseinfo; - - @ApiModelProperty("项目申报信息") - private GovBizProjectApplyVO apply; - - @ApiModelProperty("项目审批信息") - private GovBizProjectApproveVO approve; - - @ApiModelProperty("实施项目实施信息") - private GovBizProjectCimplementVO cimplement; - - @ApiModelProperty("运维项目实施信息") - private GovBizProjectMimplementVO mimplement; - - @ApiModelProperty("项目采购信息") - private List procures; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java deleted file mode 100644 index d940080..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.gov.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 = "GovProjectDictionaryVO", description = "项目字典表") -public class GovProjectDictionaryVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - private String createBy; - private LocalDateTime createOn; - - @ApiModelProperty("类型") - private String type; - - @ApiModelProperty("值") - private String value; - - @ApiModelProperty("展示值") - private String label; - - @ApiModelProperty("备注") - private String remark; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java deleted file mode 100644 index 8bc2a63..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.entity.BelongOrg; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author liuxinxin - * @since 2023-04-18 - */ -public interface IBelongOrgService extends IService { - - List listNameByCodes(Collection stripCodes); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApplyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApplyService.java deleted file mode 100644 index 3ee8e68..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApplyService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectApplyService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApproveService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApproveService.java deleted file mode 100644 index a936348..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectApproveService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectApproveService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectBaseinfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectBaseinfoService.java deleted file mode 100644 index 17e592c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectBaseinfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectBaseinfoService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectCimplementService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectCimplementService.java deleted file mode 100644 index bb37a73..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectCimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectCimplement; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectCimplementService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectDraftService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectDraftService.java deleted file mode 100644 index 5f74241..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectDraftService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectDraftService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectMimplementService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectMimplementService.java deleted file mode 100644 index 21de314..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectMimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectMimplement; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectMimplementService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectProcureService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectProcureService.java deleted file mode 100644 index 28b4b3e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectProcureService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectProcure; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovBizProjectProcureService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectBaseinfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectBaseinfoService.java deleted file mode 100644 index 768b1ba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectBaseinfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovOperationProjectBaseinfoService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectDraftService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectDraftService.java deleted file mode 100644 index ca8a100..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectDraftService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectDraft; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovOperationProjectDraftService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectTobePushService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectTobePushService.java deleted file mode 100644 index 8da38ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovOperationProjectTobePushService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectTobePush; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovOperationProjectTobePushService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java deleted file mode 100644 index 01852cf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.gov.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -public interface IGovProjectDictionaryService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java deleted file mode 100644 index 71ceb58..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.gov.entity.BelongOrg; -import com.ningdatech.pmapi.gov.mapper.BelongOrgMapper; -import com.ningdatech.pmapi.gov.service.IBelongOrgService; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author liuxinxin - * @since 2023-04-18 - */ -@Service -public class BelongOrgServiceImpl extends ServiceImpl implements IBelongOrgService { - - @Override - public List listNameByCodes(Collection stripCodes) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(BelongOrg.class) - .in(BelongOrg::getOrgCode, stripCodes); - return CollUtils.fieldList(list(query), BelongOrg::getOrgName); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApplyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApplyServiceImpl.java deleted file mode 100644 index d38edd7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApplyServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectApplyMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectApplyServiceImpl extends - ServiceImpl implements IGovBizProjectApplyService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApproveServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApproveServiceImpl.java deleted file mode 100644 index af280da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectApproveServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectApproveMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApproveService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectApproveServiceImpl extends - ServiceImpl implements IGovBizProjectApproveService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java deleted file mode 100644 index 8fd2107..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectBaseinfoServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectBaseinfoMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectBaseinfoServiceImpl extends - ServiceImpl implements IGovBizProjectBaseinfoService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectCimplementServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectCimplementServiceImpl.java deleted file mode 100644 index 8b50f88..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectCimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectCimplementMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectCimplement; -import com.ningdatech.pmapi.gov.service.IGovBizProjectCimplementService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectCimplementServiceImpl extends - ServiceImpl implements IGovBizProjectCimplementService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectDraftServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectDraftServiceImpl.java deleted file mode 100644 index 11a00c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectDraftServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectDraftMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft; -import com.ningdatech.pmapi.gov.service.IGovBizProjectDraftService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectDraftServiceImpl extends - ServiceImpl implements IGovBizProjectDraftService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectMimplementServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectMimplementServiceImpl.java deleted file mode 100644 index 6ea1b71..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectMimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectMimplementMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectMimplement; -import com.ningdatech.pmapi.gov.service.IGovBizProjectMimplementService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectMimplementServiceImpl extends - ServiceImpl implements IGovBizProjectMimplementService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectProcureServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectProcureServiceImpl.java deleted file mode 100644 index d3f6fb3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectProcureServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovBizProjectProcureMapper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectProcure; -import com.ningdatech.pmapi.gov.service.IGovBizProjectProcureService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovBizProjectProcureServiceImpl extends - ServiceImpl implements IGovBizProjectProcureService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java deleted file mode 100644 index faa1809..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectBaseinfoServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovOperationProjectBaseinfoMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovOperationProjectBaseinfoServiceImpl extends - ServiceImpl implements IGovOperationProjectBaseinfoService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectDraftServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectDraftServiceImpl.java deleted file mode 100644 index 7bd97e6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectDraftServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovOperationProjectDraftMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectDraft; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectDraftService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovOperationProjectDraftServiceImpl extends - ServiceImpl implements IGovOperationProjectDraftService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectTobePushServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectTobePushServiceImpl.java deleted file mode 100644 index 65a8a7b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovOperationProjectTobePushServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovOperationProjectTobePushMapper; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectTobePush; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectTobePushService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-10-25 - */ -@Service -public class GovOperationProjectTobePushServiceImpl extends - ServiceImpl implements IGovOperationProjectTobePushService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java deleted file mode 100644 index 4e6b74d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.gov.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.gov.mapper.GovProjectDictionaryMapper; -import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; -import com.ningdatech.pmapi.gov.service.IGovProjectDictionaryService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-08-23 - */ -@Service -public class GovProjectDictionaryServiceImpl extends - ServiceImpl implements IGovProjectDictionaryService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java deleted file mode 100644 index bf9caca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.gov.utils; - -import com.ningdatech.pmapi.common.constant.CommonConst; -import org.apache.commons.lang3.StringUtils; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Objects; - -/** - * @Classname ProjectCollectionUtil - * @Description - * @Date 2023/9/14 9:07 - * @Author PoffyZhang - */ -public class ProjectCollectionUtil { - - public static String convertLocalDateTime(LocalDateTime localDateTime){ - if(Objects.isNull(localDateTime)){ - return StringUtils.EMPTY; - } - return localDateTime.format(DateTimeFormatter.ofPattern(CommonConst.NORMAL_TIME_PATTERN)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java deleted file mode 100644 index c324563..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java +++ /dev/null @@ -1,377 +0,0 @@ -package com.ningdatech.pmapi.gov.utils; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.file.entity.File; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.gov.enumeration.GovProjectClassifiedEnum; -import com.ningdatech.pmapi.gov.model.vo.*; -import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import java.math.BigDecimal; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectCollectionUtil - * @Description - * @Date 2023/9/14 9:07 - * @Author PoffyZhang - */ -@Slf4j -public class ProjectConvertUtil { - - /** - * 申报项目 转为 项目归集 - * @param project - * @return - */ - public static GovBizProjectDetailVO declaredToCollection(ProjectDetailVO project, FileService fileService){ - GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); - if(Objects.isNull(project)){ - return projectCollection; - } - String projectCode = project.getProjectCode(); - String projectName = project.getProjectName(); - projectCollection.setBaseProjId(projectCode); - projectCollection.setBaseProjName(projectName); - projectCollection.setBaseinfo(buildBaseinfo(project)); - projectCollection.setApply(buildApply(project)); - projectCollection.setApprove(buildApprove(project,fileService)); - String projectType = project.getProjectType(); - ProjectTypeNewEnum match = ProjectTypeNewEnum.match(projectType); - if(Objects.nonNull(match)){ - switch (match){ - case SJ_BUILD: - case FIRST_BUILD: - case SZ_BUILD: - projectCollection.setCimplement(buildCim(project)); - break; - case NEW_OPERA: - case XU_OPERA: - projectCollection.setMimplement(buildMim(project)); - break; - default: - break; - } - } - projectCollection.setProcures(buildProcure(project)); - return projectCollection; - } - - //转化基本信息 - private static GovBizProjectBaseinfoVO buildBaseinfo(ProjectDetailVO project) { - GovBizProjectBaseinfoVO baseinfo = new GovBizProjectBaseinfoVO(); - baseinfo.setBaseProjId(project.getProjectCode()); - baseinfo.setBaseProjName(project.getProjectName()); - baseinfo.setAreaCode(RegionConst.RC_LS); - baseinfo.setBaseAreaCode(project.getAreaCode() + RegionConst.NINE_CODE_LAST); - baseinfo.setBaseAreaName(project.getArea()); - baseinfo.setBaseBuildDeprt(project.getBuildOrgName()); - baseinfo.setBaseBuildDeprtDing(project.getBuildOrgCode()); - baseinfo.setBaseBuildDepartUsci(project.getOrgCreditCode()); - baseinfo.setBaseConstructionType(project.getBaseConstructionType()); - baseinfo.setBaseManDeprt(project.getSuperOrg()); - baseinfo.setBaseManDeprtDing(project.getSuperOrgCode()); - baseinfo.setBaseManDepartUsci(project.getSuperOrgCreditCode()); - baseinfo.setBaseProjContacts(project.getContactName()); - baseinfo.setBaseProjContactsCall(project.getContactPhone()); - baseinfo.setBaseProjIsConfidentiality(GovProjectClassifiedEnum.NOT_CLASSIFIED.getCode()); - baseinfo.setBaseProjPrincipal(project.getResponsibleMan()); - baseinfo.setBaseProjPrincipalCall(project.getResponsibleManMobile()); - baseinfo.setBaseProvManDeprt(project.getHigherSuperOrg()); - baseinfo.setBaseProvManDepartDing(project.getHigherSuperOrgCode()); - baseinfo.setBaseProvManDeprtType(project.getBaseProvManDeprtType()); - ProjectStatusEnum match = ProjectStatusEnum.match(project.getStatus()); - if(Objects.nonNull(match)){ - if(Objects.nonNull(match.getCollectionStatus())){ - baseinfo.setBaseProjSetProg(match.getCollectionStatus().getCode()); - } - } - baseinfo.setBaseProjType(project.getProjectType()); - baseinfo.setDeleted(Boolean.FALSE); - return baseinfo; - } - - //转化申报信息 - private static GovBizProjectApplyVO buildApply(ProjectDetailVO project) { - GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); -// apply.setBaseProjId(project.getProjectCode()); - apply.setBaseProjName(project.getProjectName()); - apply.setAreaCode(RegionConst.RC_LS); - apply.setBaseHistorProjId(project.getBaseHistorProjId()); - apply.setBaseBasisEstablish(project.getBaseBasisEstablish()); - List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ - String appName = projectApplications.stream().map(app -> { - if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { - return app.getRelatedExistsApplication(); - } - return app.getApplicationName(); - }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - String appCode = projectApplications.stream().map(app -> { - if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { - return app.getRelatedExistsApplicationCode(); - } - return app.getAppCode(); - }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - String accountName = projectApplications.stream() - .map(app -> StringUtils.isNotBlank(app.getAccountAppName()) ? app.getAccountAppName() : null) - .filter(Objects::nonNull) - .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - apply.setBaseAccountAppName(accountName); - apply.setBaseProjSys(appName); - apply.setBaseProjSysCode(appCode); - } - apply.setBaseBasisAmountOri(project.getBaseBasisAmountOri()); - String coreBusiness = project.getCoreBusiness(); - if(StringUtils.isNotBlank(coreBusiness)){ - try{ - JSONArray coreJson = JSON.parseArray(coreBusiness); - String matters = coreJson.stream().map(j -> { - JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); - return matterJson.getString("matterName"); - }).filter(Objects::nonNull) - .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - String matterCodes = coreJson.stream().map(j -> { - JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); - return matterJson.getString("oid"); - }).filter(Objects::nonNull) - .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - apply.setBaseCoreBusiness(matters); - apply.setBaseCoreBusinessCode(matterCodes); - }catch (Exception e){ - log.error("项目转化失败",e); - } - } - apply.setBaseDevelopCode(project.getDevelopCode()); - apply.setBaseLowestLevel(project.getLowestLevel()); - apply.setBaseHistorProjName(project.getBaseHistorProjName()); - apply.setBaseHistorProjYear(project.getBaseHistorProjYear()); - apply.setBaseProjApplyFile(project.getProjectApplicationForm()); - String beginTime = project.getBeginTime(); - String endTime = project.getEndTime(); - if(StringUtils.isNotBlank(beginTime)){ - apply.setBaseProjStartTime(BizUtils.convertLocalDateTime(beginTime)); - } - if(StringUtils.isNotBlank(endTime)){ - apply.setBaseProjEndTime(BizUtils.convertLocalDateTime(endTime)); - } - if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){ - try{ - String yearEnd = endTime.split(StrPool.DASH)[0]; - String yearStart = beginTime.split(StrPool.DASH)[0]; - String monthEnd = endTime.split(StrPool.DASH)[1]; - String monthStart = beginTime.split(StrPool.DASH)[1]; - Integer duration = Integer.parseInt(monthEnd) - Integer.parseInt(monthStart) + - (Integer.parseInt(yearEnd) - Integer.parseInt(yearStart)) * 12; - apply.setBaseProjDuration(String.valueOf(duration)); - }catch (Exception e){ - log.error("日期转换失败:",e); - } - } - apply.setBaseProjConsClass(project.getBuildLevel()); - apply.setBaseProjIntro(project.getProjectIntroduction()); - apply.setBaseProjBasis(project.getBaseProjBasis()); - apply.setBaseProjBasisFile(project.getBaseProjBasisFile()); - apply.setBaseProjDeclAmount(project.getAnnualPlanAmount()); - apply.setBaseProjTotalAmount(project.getDeclareAmount()); - apply.setBaseProjSetYear(Objects.nonNull(project.getProjectYear()) - ? String.valueOf(project.getProjectYear()) : null); - apply.setBaseProjRemark(project.getProjectRemarks()); - apply.setBaseProjOtherFile(project.getBaseProjOtherFile()); - apply.setBaseResearchReportFile(project.getBaseResearchReportFile()); - apply.setBeseExpectedResults(project.getBeseExpectedResults()); - apply.setSetProjCodeFinan(project.getFinancialCode()); - apply.setMissing(StringUtils.isNotBlank(project.getBaseHistorProjId()) ? Boolean.FALSE : Boolean.TRUE); - return apply; - } - - //转化审批信息 - private static GovBizProjectApproveVO buildApprove(ProjectDetailVO project,FileService fileService) { - GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); -// approve.setBaseProjId(project.getProjectCode()); - approve.setBaseProjName(project.getProjectName()); - File file = fileService.getById(project.getApprovedFile()); - if(Objects.nonNull(file)){ - approve.setApprovalFile(JSON.toJSONString(Lists.newArrayList(file))); - } - approve.setAreaCode(RegionConst.RC_LS); - approve.setDeleted(Boolean.FALSE); - approve.setBaseDevelopCode(project.getDevelopCode()); - approve.setBaseExpertTotalMoney(project.getProposeTotalInvest()); - approve.setBaseExpertYearMoney(project.getProposeAnnualBudget()); - approve.setBaseInitialReviewTotalMoney(project.getApprovalAmount()); - approve.setBaseProjReplyAmount(project.getApprovalBudget()); - approve.setBaseReviewCommentsFile(project.getProposeAttachFiles()); - List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ - Integer max = 0; - for(ProjectApplicationVO app : projectApplications){ - max = Math.max(app.getSecrecyGrade(),max); - } - if(max > 0){ - approve.setEqualProtectionLevel(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,max)); - } - } - approve.setPreliminaryDesignScheme(project.getPreliminaryPlanFile()); - approve.setPreliminaryDesignFile(project.getPreliminaryInspectionMaterials()); - approve.setBaseReviewOpinion(project.getProposeAttach()); - if(Objects.nonNull(project.getBaseReviewResults())){ - approve.setBaseReviewResults(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, - project.getBaseReviewResults())); - } - List purchases = project.getPurchases(); - if(CollUtil.isNotEmpty(purchases)){ - purchases.stream().map(PurchaseVO::getTransactionAmount) - .filter(Objects::nonNull).reduce(BigDecimal::add) - .ifPresent(j -> approve.setReleaseYearMoney(j)); - - } - return approve; - } - - //转化建设 实施 - private static GovBizProjectCimplementVO buildCim(ProjectDetailVO project) { - GovBizProjectCimplementVO cim = new GovBizProjectCimplementVO(); -// cim.setBaseProjId(project.getProjectCode()); - cim.setBaseProjName(project.getProjectName()); - cim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); - cim.setAreaCode(RegionConst.RC_LS); - cim.setDeleted(Boolean.FALSE); - cim.setBaseDevelopCode(project.getDevelopCode()); - //总结报告 - cim.setBaseSummReportFile(searchReportFile(project,5,2)); - //监理总结报告 - cim.setBaseEstaSummFile(searchReportFile(project,5,3)); - //建设核查表 - cim.setBaseCheckFile(searchReportFile(project,3,2)); - cim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); - cim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); - List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ - String appCode = projectApplications.stream().map(app -> { - if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { - return app.getRelatedExistsApplicationCode(); - } - return app.getAppCode(); - }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - cim.setBaseProjSysCode(appCode); - } - return cim; - } - - //转化运维实施 - private static GovBizProjectMimplementVO buildMim(ProjectDetailVO project) { - GovBizProjectMimplementVO mim = new GovBizProjectMimplementVO(); -// mim.setBaseProjId(project.getProjectCode()); - mim.setBaseProjName(project.getProjectName()); - mim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); - mim.setAreaCode(RegionConst.RC_LS); - mim.setDeleted(Boolean.FALSE); - mim.setBaseDevelopCode(project.getDevelopCode()); - //监理总结报告 - mim.setBaseEstaSummFile(searchReportFile(project,5,3)); - //建设核查表 -// mim.setBaseCheckFile(searchReportFile(project,3,2)); - mim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); -// mim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); - List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ - String appCode = projectApplications.stream().map(app -> { - if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { - return app.getRelatedExistsApplicationCode(); - } - return app.getAppCode(); - }).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); - mim.setBaseProjSysCode(appCode); - } - return mim; - } - - //转化采购信息 - private static List buildProcure(ProjectDetailVO project) { - List purchases = project.getPurchases(); - ContractVO contract = project.getContract(); - final BigDecimal[] paymentTotal = {BigDecimal.ZERO}; - if(Objects.nonNull(contract)){ - List payments = contract.getPayments(); - payments.stream().map(PaymentPlanVO::getPaymentAmount) - .reduce(BigDecimal::add) - .ifPresent(b -> paymentTotal[0] = b); - } - if(CollUtil.isNotEmpty(purchases)){ - return purchases.stream().map(p -> { - GovBizProjectProcureVO purchase = new GovBizProjectProcureVO(); - purchase.setBaseProjName(project.getProjectName()); - purchase.setAreaCode(RegionConst.RC_LS); - purchase.setDeleted(Boolean.FALSE); - purchase.setBaseBidName(p.getBidName()); - purchase.setBasePurchasingAgencies(p.getAgency()); - purchase.setBaseUnifiedCreditCode(p.getPurchaseSocialCreditCode()); - purchase.setBaseConsDeprt(p.getSupplier()); - purchase.setBaseConsDeprtUsci(p.getSupplierSocialCreditCode()); - purchase.setBasePaymentTime(p.getTransactionTime()); - purchase.setBaseProjPurchaseAmount(p.getTransactionAmount()); - purchase.setBaseProjPurchaseWay(p.getPurchaseMethod()); - purchase.setBasePurchaseCode(p.getBudgetExecConfirmNo()); - purchase.setBaseWinningBidTime(p.getTransactionTime()); - purchase.setBiddingFile(p.getAcceptanceLetter()); - purchase.setPaymentProgress(paymentTotal[0]); - if(Objects.nonNull(contract)){ - purchase.setPurchaseContract(contract.getAttachment()); - } - purchase.setSetProjCodeFinan(project.getFinancialCode()); - purchase.setPurchaseFile(p.getBidDoc()); - return purchase; - }).collect(Collectors.toList()); - } - return Collections.emptyList(); - } - - /** - * 查询项目 初验终验的 报告 - * @param project - * @return - */ - private static String searchReportFile(ProjectDetailVO project,Integer firstIndex,Integer secondIndex) { - if(Objects.isNull(project)){ - return null; - } - if(StringUtils.isNotBlank(project.getFinalAcceptanceMaterials())){ - return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); - }else if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){ - return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); - } - return null; - } - - private static String searchReportFileInner(String fileStr,Integer firstIndex,Integer secondIndex) { - try{ - JSONArray jsonArray = JSON.parseArray(fileStr); - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jsonArray.get(firstIndex - 1))); - JSONArray data = jsonObject.getJSONArray("data"); - JSONObject wangong = JSON.parseObject(JSON.toJSONString(data.get(secondIndex - 1))); - JSONArray files = wangong.getJSONArray("files"); - return JSON.toJSONString(files); - }catch (Exception e){ - log.error("解析文件失败:",e); - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/config/IrsSealPlatformProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/config/IrsSealPlatformProperties.java deleted file mode 100644 index 01942e6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/config/IrsSealPlatformProperties.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.irs.config; - -import lombok.Data; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** - * @author liuxinxin - * @date 2023/3/16 下午6:03 - */ - -@Component -@Data -public class IrsSealPlatformProperties { - public static String projectId; - - public static String projectSecret; - - public static String accessKey; - - public static String secretKey; - - public static String apiUrl; - - @Value("${irs.seal-platform.project-id}") - public void setProjectId(String projectId) { - IrsSealPlatformProperties.projectId = projectId; - } - - @Value("${irs.seal-platform.project-secret}") - public void setProjectSecret(String projectSecret) { - IrsSealPlatformProperties.projectSecret = projectSecret; - } - - @Value("${irs.seal-platform.access-key}") - public void setAccessKey(String accessKey) { - IrsSealPlatformProperties.accessKey = accessKey; - } - - @Value("${irs.seal-platform.secret-key}") - public void setSecretKey(String secretKey) { - IrsSealPlatformProperties.secretKey = secretKey; - } - - @Value("${irs.seal-platform.api-url}") - public void setApiUrl(String apiUrl) { - IrsSealPlatformProperties.apiUrl = apiUrl; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java deleted file mode 100644 index 40289c2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.irs.controller; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.irs.manage.AppIrsManage; -import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; -import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.security.NoSuchAlgorithmException; - -/** - * @Classname ApplicationController - * @Description - * @Date 2023/7/12 9:26 - * @Author PoffyZhang - */ -@RestController -@RequestMapping("/api/v1/irs/app") -@AllArgsConstructor -@Slf4j -@Valid -public class ApplicationController { - - private final AppIrsManage appIrsManage; - - @PostMapping("/push-project-app") - @WebLog("推送项目和应用关系") - public Boolean pushProjectApp(@Valid @RequestBody PushProjectAppToIrsDTO dto) throws Exception { - return appIrsManage.pushProjectApp(dto); - } - - @GetMapping("/sreach-app") - public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { - return appIrsManage.searchApp(apply); - } - - @GetMapping("/sreach-apps") - public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { - return appIrsManage.searchApps(apply); - } - - @GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}") - public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) { - return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java deleted file mode 100644 index a0aece2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.irs.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; -import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; -import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; -import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -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.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.io.UnsupportedEncodingException; -import java.net.UnknownHostException; -import java.security.NoSuchAlgorithmException; -import java.util.List; - -/** - * @Classname IrsController - * @Description irs 一些下拉框信息 - * @Date 2023/3/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/irs") -@Api(value = "irs", tags = "irs-信息查询") -@RequiredArgsConstructor -public class IrsController { - - private final IrsManage irsManage; - - private final SynProjectCoreBizTask projectCoreBizTask; - - @ApiOperation(value = "irs应用列表", notes = "irs应用列表") - @WebLog("irs应用列表") - @GetMapping("/application-list") - public List applicationList(@RequestParam(required = false) String areaCode) { - return irsManage.applicationList(areaCode); - } - - @ApiOperation(value = "试点任务列表", notes = "试点任务列表") - @WebLog("试点任务列表") - @GetMapping("/piot-tasks") - public List piotTasks() { - return irsManage.listPiotTasks(); - } - - @ApiOperation(value = "获取企业社会信用编码", notes = "获取企业社会信用编码") - @GetMapping("/get-credit-code") - public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { - return irsManage.getCreditCode(); - } - - @ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") - @GetMapping("/refresh-core-biz") - public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException { - if(StringUtils.isNotBlank(orgCode)){ - projectCoreBizTask.doTask(orgCode); - }else{ - projectCoreBizTask.doTask(); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsProjectController.java deleted file mode 100644 index ccc60e4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsProjectController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.irs.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectOutputVO; -import com.ningdatech.pmapi.irs.manage.IrsProjectManage; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 IrsController - * @Description irs 一些下拉框信息 - * @Date 2023/3/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/irs/project/") -@Api(value = "irs", tags = "irs-IRS项目信息") -@RequiredArgsConstructor -public class IrsProjectController { - - private final IrsProjectManage irsProjectManage; - - @ApiOperation(value = "IRS项目列表", notes = "IRS项目列表") - @GetMapping("/list") - public PageVo list(ProjectListReq projectListReq) { - return irsProjectManage.list(projectListReq); - } -} 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 deleted file mode 100644 index 0f40b6f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/OrganizationController.java +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 36e8983..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java +++ /dev/null @@ -1,398 +0,0 @@ -package com.ningdatech.pmapi.irs.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.crypto.digest.MD5; -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.basic.function.VUtils; -import com.ningdatech.irs.service.IRefreshTokenService; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; -import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; -import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; -import com.ningdatech.pmapi.irs.model.res.ApiResponse; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname AppIrsManage - * @Description - * @Date 2023/7/12 11:43 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class AppIrsManage { - - private final IProjectService projectService; - - private final IProjectApplicationService applicationService; - - private final StateMachineUtils stateMachineUtils; - - @Value("${irs.push-app.appKey}") - private String pushAppKey; - - @Value("${irs.push-app.appScret}") - private String pushAppScret; - - @Value("${irs.push-app.url}") - private String pushUrl; - - @Value("${irs.search-app.appKey}") - private String searchAppKey; - - @Value("${irs.search-app.appScret}") - private String searchAppScret; - - @Value("${irs.search-app.url}") - private String searchUrl; - @Resource - private IRefreshTokenService refreshTokenService; - - @Value("${irs.interface-refresh.request-token-url}") - private String govRequestTokenUrl; - @Value("${irs.interface-refresh.refresh-token-url}") - private String govRefreshTokenUrl; - - @Value("${irs.push-project-detail.url}") - private String pushProjectUrl; - - @Value("${irs.push-project-detail.appKey}") - private String pushProjectAppKey; - - @Value("${irs.push-project-detail.appSecret}") - private String pushProjectAppSecret; - - //=============数字资源指标获取======================================================================================== - - @Value("${irs.digital-resource-indicators.app-key}") - private String driAppKey; - - @Value("${irs.digital-resource-indicators.app-secret}") - private String driAppSecret; - - @Value("${irs.digital-resource-indicators.interface-name}") - private String driInterfaceName; - - @Value("${irs.digital-resource-indicators.url}") - private String driUrl; - - /** - * 推送 项目和应用关系 - * - * @param dto - * @return - * @throws NoSuchAlgorithmException - */ - public Boolean pushProjectApp(PushProjectAppToIrsDTO dto) throws Exception { - String appCode = dto.getAppCode(); - Long appId = dto.getAppId(); - String projectCode = dto.getProjectCode(); - ProjectApplication app = applicationService.getById(appId); - VUtils.isTrue(Objects.isNull(app)).throwMessage("应用不存在!"); - VUtils.isTrue(CommonEnum.NO.getCode().equals(app.getIsFirst())).throwMessage("应用不是初次新建!"); - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); - - ApiApplyDTO apiApply = new ApiApplyDTO(); - apiApply.setAppId(appCode); - JSONObject jsonObject = this.searchApp(apiApply); - ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class); - VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); - - long timestamp = System.currentTimeMillis(); - String areaCode = project.getAreaCode(); - String projectName = project.getProjectName(); - String requestSecret = refreshTokenService.refreshToken(pushAppKey, pushAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name()); - String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); - String capTime = String.valueOf(timestamp); - String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); - String url = pushUrl + "?requestTime=" + timestamp + - "&sign=" + sign + "&appKey=" + pushAppKey + "&capCode=" + capCode + "&capTime=" + capTime + - "&baseProjSys=" + apiApplySearchResult.getName() + "&areaCode=" + areaCode + "&baseProjName=" + projectName + - "&baseProjId=" + project.getProjectCode() + - "&isEffective=1&baseProjSysCode=" + appCode; - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, ApiResponse.class); - - log.info("推送 项目和应用结果 : {}", JSON.toJSONString(forEntity)); - - ApiResponse body = forEntity.getBody(); - - if (Objects.isNull(body) || Objects.isNull(body.getCode()) - || 0 != body.getCode()) { - return Boolean.FALSE; - } - - //保存关系 - app.setAppCode(appCode); - if (applicationService.updateById(app)) { - /** - * 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 - * 如果都已经注册 要调用状态机 进入下一个状态 - */ - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, project.getId())); - //筛选出 初次新建的app 但是没有appCode的 - apps = apps.stream().filter(a -> { - if (CommonEnum.YES.getCode().equals(a.getIsFirst()) && - StringUtils.isBlank(app.getAppCode())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }) - .collect(Collectors.toList()); - - //如果筛选出来的 为空的话 就调用状态机 - if (CollUtil.isEmpty(apps)) { - stateMachineUtils.pass(project); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); - } - } - - return body.getSuccess(); - } - - /** - * 查询app - * - * @param apply - * @return - * @throws NoSuchAlgorithmException - */ - public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String appCode = apply.getAppId(); - String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name()); - String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); - String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + - "&appKey=" + searchAppKey + "&" + - "pageSize=10&pageNum=1&appCode=" + appCode + - "&areaCode=&deptCode=&name="; - log.info("url : {}", url); - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) { - JSONObject body = JSON.parseObject(forEntity.getBody()); - if (Objects.isNull(body)) { - return null; - } - JSONObject datas = body.getJSONObject("datas"); - if (Objects.isNull(datas)) { - return null; - } - JSONObject data = datas.getJSONObject("data"); - if (Objects.isNull(data)) { - return null; - } - JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); - if (CollUtil.isEmpty(apiApplySearchResult)) { - return null; - } - return apiApplySearchResult.getJSONObject(0); - } - return null; - } - - public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String areaCode = StringUtils.isNotBlank(apply.getAreaCode()) ? - convertAreaCode(apply.getAreaCode()) : null; - String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl, - HttpMethod.POST.name()); - String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); - String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + - "&appKey=" + searchAppKey + "&pageSize=1000&" + - "pageNum=1&areaCode=" + areaCode + - "&deptCode=&name="; - log.info("查询应用目录:{}",url); - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - log.info("查询应用目录 : {}", forEntity.getStatusCode()); - - if (Objects.nonNull(forEntity.getBody())) { - JSONObject body = JSON.parseObject(forEntity.getBody()); - if (Objects.isNull(body)) { - return null; - } - JSONObject datas = body.getJSONObject("datas"); - if (Objects.isNull(datas)) { - return null; - } - JSONObject data = datas.getJSONObject("data"); - if (Objects.isNull(data)) { - return null; - } - JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); - return apiApplySearchResult; - } - return null; - } - - /** - * 如果是市本级的 结尾改成01 还要转换开发区的code - * @param areaCode - * @return - */ - private String convertAreaCode(String areaCode) { - if(RegionConst.RC_LS.equals(areaCode) || RegionConst.LS_KF.equals(areaCode)){ - return RegionConst.RC_LS_SBJ_IRS; - } - return areaCode; - } - - public String testGuibing() throws Exception { - long timestamp = System.currentTimeMillis(); - String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; - String appKey = "A331101453557202109017383"; - String method = "POST"; - String interfaceName = "5crv7i4727abLCv0"; - String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); - log.info("secret :{}", secret); - String sign = MD5.create().digestHex(appKey + secret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if (Objects.nonNull(factory)) { - restTemplate = new RestTemplate(factory); - } else { - restTemplate = new RestTemplate(); - } - String appId = "A330000100000202105005790"; - String capCode = CryptUtils.encryptHMAC(timestamp + appId, "bcb4fc0f517fc168ee543fcf4d231f3b"); - String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + - "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + - "&sign=" + sign + "&appKey=" + appKey + - "&capCode=" + capCode + "&capTime=" + timestamp + - "&appId=" + appId; - log.info("url :{}", url); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - } - - /** - * 推送项目详情 - * - * @return - */ - public String pushProjectDetail(ProjectDTO projectDto) { - long timestamp = System.currentTimeMillis(); - String appSecret = pushProjectAppSecret; - String appKey = pushProjectAppKey; - String method = HttpMethod.POST.name(); - String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); - log.info("secret :{}", secret); - String sign = MD5.create().digestHex(appKey + secret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if (Objects.nonNull(factory)) { - restTemplate = new RestTemplate(factory); - } else { - restTemplate = new RestTemplate(); - } - String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" - String baseProjSetYear = String.valueOf(projectDto.getProjectYear());//"2022" - String baseProjId = projectDto.getProjectCode();//"331123220130969000000" - String baseManDeprt = projectDto.getBuildOrgName();//"遂昌县大数据和金融发展中心" - String baseProjBasis = projectDto.getBaseProjBasis();//"2" - String baseLowestLevel = projectDto.getBaseLowestLevel();//"C" - String ProjPrincipalCall = projectDto.getResponsibleManMobile();//"13884366607" - //内容类别 - String baseConstructionType = projectDto.getBaseConstructionType();//"01" - String baseProjType = projectDto.getBaseProjType();//"1" - String baseProjContacts = projectDto.getContactName();//"毛以林" - String isEffective = "02"; // 有效 - String baseConsDeprtDing = projectDto.getBuildOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1"; - String baseProjSetProg = projectDto.getBaseProjSetProg();//"04" - String baseProjContactsCall = projectDto.getContactPhone();//"13857049999" - String baseProjName = projectDto.getProjectName();//"遂昌县大数据和金融发展中心天工系统" - String baseProjConsClass = projectDto.getBaseProjConsClass();//"C" - String areaCode = projectDto.getAreaCode();//"331123000" - String baseAreaName = projectDto.getArea();//"遂昌县"; - String baseManDeprtDing = projectDto.getSuperOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1"; - String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; - String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; - String capCode = null; - try { - capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); - } catch (Exception e) { - log.error(e.getMessage()); - } - - String url = pushProjectUrl + "?" + - "requestTime=" + timestamp + "&sign=" + sign + - "&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + - "&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + - "&baseManDeprt=" + baseManDeprt + "&baseProjBasis=" + baseProjBasis + - "&baseLowestLevel=" + baseLowestLevel + "&ProjPrincipalCall=" + ProjPrincipalCall + - "&baseConstructionType=" + baseConstructionType + "&baseProjType=" + baseProjType + - "&baseProjContacts=" + baseProjContacts + "&isEffective=" + isEffective + - "&baseConsDeprtDing=" + baseConsDeprtDing + "&baseProjSetProg=" + baseProjSetProg + - "&baseProjContactsCall=" + baseProjContactsCall + "&baseProjName=" + baseProjName + - "&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + - "&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + - "&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; - log.info("url :{}", url); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - } - - public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) { - long timestamp = System.currentTimeMillis(); - String appSecret = driAppSecret; - String appKey = driAppKey; - String method = HttpMethod.POST.name(); - String interfaceName = driInterfaceName; - String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); - log.info("secret : {}", secret); - String sign = MD5.create().digestHex(appKey + secret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if (Objects.nonNull(factory)) { - restTemplate = new RestTemplate(factory); - } else { - restTemplate = new RestTemplate(); - } - - String url = driUrl + "?" + - "requestTime=" + timestamp + "&sign=" + sign + - "&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize; - log.info("url :{}", url); - ResponseEntity forEntity = restTemplate.getForEntity(url, JSONObject.class); - log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString()); - return forEntity.getBody(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/IrsProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/IrsProjectManage.java deleted file mode 100644 index 5d0df94..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/IrsProjectManage.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.pmapi.irs.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.model.PageVo; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -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.model.vo.ProjectLibListItemVO; -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.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname IrsProjectManage - * @Description - * @Date 2023/8/15 11:43 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class IrsProjectManage { - - private final IProjectService projectService; - - /** - * IRS档案 项目列表 - * @param req - * @return - */ - public PageVo list(ProjectListReq req) { - Page page = req.page(); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) - .eq(StringUtils.isNotBlank(req.getAreaCode()),Project::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) - .eq(StringUtils.isNotBlank(req.getProjectType()),Project::getProjectType,req.getProjectType()) - .eq(Objects.nonNull(req.getStatus()),Project::getStatus,req.getStatus()) - .eq(Objects.nonNull(req.getStage()),Project::getStage,req.getStage()) - .ge(Objects.nonNull(req.getApproveAmountMin()),Project::getApprovalAmount,req.getApproveAmountMin()) - .le(Objects.nonNull(req.getApproveAmountMax()),Project::getApprovalAmount,req.getApproveAmountMax()) - .eq(Objects.nonNull(req.getProjectYear()),Project::getProjectYear,req.getProjectYear()) - .ge(Objects.nonNull(req.getCreateOnMin()),Project::getCreateOn,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),Project::getCreateOn,req.getCreateOnMax()) - .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) - .gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) - .eq(Project::getNewest,Boolean.TRUE) - .eq(Project::getIncludeApplication, CommonEnum.YES.getCode()) - .orderByDesc(Project::getUpdateOn); - buildPermission(wrapper,user); - projectService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - List res = page.getRecords().stream().map(p -> { - ProjectLibListItemVO vo = BeanUtil.copyProperties(p,ProjectLibListItemVO.class); - return vo; - }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); - } - - private void buildPermission(LambdaQueryWrapper wrapper, UserInfoDetails user) { - if(user.getSuperAdmin()){ - log.info("超管 都可看 项目档案列表"); - }else if(user.getRegionAdmin()){ - wrapper.eq(Project::getAreaCode,user.getRegionCode()); - }else{ - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - } - } -} 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 deleted file mode 100644 index 5ee9b33..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ningdatech.pmapi.irs.manage; - -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 com.ningdatech.pmapi.common.util.RefreshKeyUtil; -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, - 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=" + (StringUtils.isNotBlank(orgCode)?orgCode:StringUtils.EMPTY) + - "&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("core biz :{}",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/mapper/ProjectCoreBizMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java deleted file mode 100644 index dca3ec1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.irs.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-09-13 - */ -public interface ProjectCoreBizMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplyDTO.java deleted file mode 100644 index 47f065d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplyDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class ApiApplyDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - private int id; - private String orgId; - private String userId; - private String isDeleted; - private String name; - private String appId; - private String type; - private String status; - private String sysStateTime; - private String deptName; - private String deptCode; - private String fiveAreas; - private String constructionLevel; - private String isUnifiedConstruction; - private String deployType; - private String principal; - private String employeeCode; - private String areaCode; - private String areaName; - private String createTime; - private String modifiedTime; - -} 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 deleted file mode 100644 index a58f952..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ApiApplySearchResult implements Serializable { - - private static final long serialVersionUID = 1L; - - private int id; - private String orgId; - private String userId; - private String isDeleted; - private String name; - private String appId; - private String type; - private String status; - private String sysStateTime; - private String systemAreas; - private String deptName; - private String deptCode; - private String fiveAreas; - private String constructionLevel; - private String isUnifiedConstruction; - private String deployType; - private String principal; - private String employeeCode; - private String areaName; - private String createTime; - private String modifiedTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java deleted file mode 100644 index 6a65546..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.apache.poi.ss.formula.functions.T; - -import java.io.Serializable; -import java.util.List; - -/** - * @Classname ApiDTO - * @Description - * @Date 2023/7/13 18:03 - * @Author PoffyZhang - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ApiDTO implements Serializable { - private static final long serialVersionUID = 1L; - - private String code; - private String msg; - private ApiSearchResult data; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiSearchResult.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiSearchResult.java deleted file mode 100644 index a6c32dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiSearchResult.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ApiSearchResult implements Serializable { - - private static final long serialVersionUID = 1L; - - private Boolean success; - private Integer code; - private String message; - private Integer totalCount; - private Integer pageSize; - private Integer pageNum; - private List apiApplySearchResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ForwardDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ForwardDTO.java deleted file mode 100644 index f34e997..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ForwardDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Map; - -/** - * @Classname ForwardDTO - * @Description - * @Date 2023/7/13 18:03 - * @Author PoffyZhang - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ForwardDTO implements Serializable { - private static final long serialVersionUID = 1L; - - private String url; - private String secret; - private String appKey; - private String sign; - private Long requestTime; - private Map data; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/PushProjectAppToIrsDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/PushProjectAppToIrsDTO.java deleted file mode 100644 index 3f03492..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/PushProjectAppToIrsDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.irs.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * @Classname PushProjectAppToIrsDto - * @Description - * @Date 2023/7/12 11:39 - * @Author PoffyZhang - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class PushProjectAppToIrsDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("我们系统的appId") - @NotNull(message = "appId 不能为空") - private Long appId; - - @ApiModelProperty("app code") - @NotBlank(message = "appCode 不能为空") - private String appCode; - - @ApiModelProperty("项目编码") - @NotBlank(message = "项目编码 不能为空") - private String projectCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java deleted file mode 100644 index e885b61..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.irs.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.time.LocalDateTime; - -/** - * @Classname ProjectCoreBiz - * @Description - * @Date 2023/9/13 15:33 - * @Author PoffyZhang - */ -@Data -@TableName("nd_project_core_biz") -@ApiModel(value = "项目核心业务对象") -public class ProjectCoreBiz { - @TableId(type = IdType.AUTO) - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("irs那边的ID") - private Long irsId; - - @ApiModelProperty("生成的业务编号") - private String matterCode; - - @ApiModelProperty("业务名") - private String matterName; - - @ApiModelProperty("企业名") - private String orgName; - - @ApiModelProperty("企业钉code") - private String orgCode; - - @ApiModelProperty("区域名") - private String areaName; - - @ApiModelProperty("状态") - private String userState; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/res/ApiResponse.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/res/ApiResponse.java deleted file mode 100644 index 8495580..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/res/ApiResponse.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.ningdatech.pmapi.irs.model.res; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * ApiResponse - 统一的接口返回值封装 - *

- * - * @author WendyYang - * @since 14:29 2022/9/29 - */ -@Data -@NoArgsConstructor -public class ApiResponse implements Serializable { - private static final long serialVersionUID = 532384723325394156L; - - public static final int SUCCESS_CODE = 200; - - public static final String SUCCESS_MSG = "success"; - - public static final int ERROR_CODE = 500; - - public static final String ERROR_MSG = "Internal server error"; - - /** - * 状态码 - */ - private Integer code; - - /** - * 返回内容 - */ - private String message; - - /** - * 返回数据 - */ - private T data; - - - private Boolean success; - /** - * 全参构造函数 - * - * @param code 状态码 - * @param message 返回内容 - * @param data 返回数据 - */ - private ApiResponse(Integer code, String message, T data,Boolean success) { - this.code = code; - this.message = message; - this.data = data; - this.success = success; - } - - /** - * 构造一个自定义的API返回 - * - * @param code 状态码 - * @param message 返回内容 - * @param data 返回数据 - * @return ApiResponse - */ - public static ApiResponse of(Integer code, String message, T data,Boolean success) { - return new ApiResponse(code, message, data,success); - } - - /** - * 构造一个成功且不带数据的API返回 - * - * @return ApiResponse - */ - public static ApiResponse ofSuccess() { - return ofSuccess(null); - } - - /** - * 构造一个成功且带数据的API返回 - * - * @param data 返回数据 - * @return ApiResponse - */ - public static ApiResponse ofSuccess(T data) { - return ofStatus(Status.OK, data,Boolean.TRUE); - } - - /** - * 构造一个成功且自定义消息的API返回 - * - * @param message 返回内容 - * @return ApiResponse - */ - public static ApiResponse ofMessage(String message) { - return of(Status.OK.getCode(), message, null,Boolean.TRUE); - } - - /** - * 构造一个有状态的API返回 - * - * @param status 状态 {@link Status} - * @return ApiResponse - */ - public static ApiResponse ofStatus(ApiStatus status) { - return ofStatus(status, null,Boolean.TRUE); - } - - /** - * 构造一个有状态且带数据的API返回 - * - * @param status 状态 {@link Status} - * @param data 返回数据 - * @return ApiResponse - */ - public static ApiResponse ofStatus(ApiStatus status, T data,Boolean success) { - return of(status.getCode(), status.getReasonPhrase(), data,success); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java deleted file mode 100644 index bffcdf0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.irs.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.gov.entity.BelongOrg; -import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Zpf - * @since 2023-09-13 - */ -public interface IProjectCoreBizService extends IService { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java deleted file mode 100644 index 7788785..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.irs.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.irs.mapper.ProjectCoreBizMapper; -import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; -import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-09-13 - */ -@Service -public class ProjectCoreBizServiceImpl extends ServiceImpl - implements IProjectCoreBizService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java deleted file mode 100644 index 4ee104b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.ningdatech.pmapi.irs.sign; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.irs.config.IrsSealPlatformProperties; -import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import sun.misc.BASE64Decoder; -import sun.misc.BASE64Encoder; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import javax.xml.bind.DatatypeConverter; -import java.io.*; -import java.net.URI; -import java.net.URL; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.Key; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; -@Slf4j -public class IRSAPIRequest { - - /** - * pdf文件盖章 - * 接口地址:/V1/accounts/outerAccounts/create - * - * @return - */ - public static String createSignPdf(SignReqDTO req) { - String pdfEncode64 = req.getPdfEncode64(); - Float posX = req.getPosX(); - Float posY = req.getPosY(); - String sealSn = req.getSealSn(); - String fileName = req.getFileName(); - String posPage = req.getPosPage(); - Integer signType = req.getSignType(); - String resp; - try { - JSONObject ReqData = new JSONObject(); - ReqData.put("fileBase64", pdfEncode64); - ReqData.put("sealSn", sealSn); - ReqData.put("posX", posX); - ReqData.put("posY", posY); - ReqData.put("signType", signType); - ReqData.put("posPage", posPage); - ReqData.put("fileName", fileName); - resp = post(ReqData, "post"); - } catch (Exception e) { - throw new BizException("调用IRS盖章接口失败,印章编号为:" + sealSn + StrPool.SEMICOLON + e.getMessage()); - } - // return obj; - JSONObject jsonObject = JSON.parseObject(resp, JSONObject.class); - String data = jsonObject.getString("data"); - JSONObject object = JSON.parseObject(data, JSONObject.class); - // 获取盖好章的PDF文件内容Base64字符串 - return object.getString("signFileB64"); - } - - - public static String post(JSONObject data, String requestMethod) throws Exception { - - //计算irs请求头里面参数信息 - DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); - dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); - String date = dateFormat.format(new Date()); - URL url = new URL(IrsSealPlatformProperties.apiUrl); - URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery(), null); - String canonicalQueryString = getCanonicalQueryString(uri.getQuery()); - String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + IrsSealPlatformProperties.accessKey + "\n" + date + "\n"; - Mac hasher = Mac.getInstance("HmacSHA256"); - hasher.init(new SecretKeySpec(IrsSealPlatformProperties.secretKey.getBytes(), "HmacSHA256")); - byte[] hash = hasher.doFinal(message.getBytes()); - DatatypeConverter.printHexBinary(hash); - String sign = DatatypeConverter.printBase64Binary(hash); - - // 计算电子印章组件signature值 - byte[] stream = data.toString().getBytes(StandardCharsets.UTF_8); - // 签名数据,根据签名算法,对请求数据进行签名 - String signature = sign(stream); - // 设置HTTP请求头 - HttpEntityEnclosingRequestBase req = new HttpPost(IrsSealPlatformProperties.apiUrl); - // project-id为用户的projectId - req.addHeader("appId", IrsSealPlatformProperties.projectId); - // signature为之前生成的签名 - req.addHeader("signature", signature); - req.addHeader("X-BG-HMAC-SIGNATURE", sign); - req.addHeader("X-BG-HMAC-ALGORITHM", "hmac-sha256"); - req.addHeader("X-BG-HMAC-ACCESS-KEY", IrsSealPlatformProperties.accessKey); - req.addHeader("X-BG-DATE-TIME", date); - req.addHeader("Content-Type", "application/json"); - - // 设置HTTP请求体 - HttpEntity entity = new ByteArrayEntity(stream, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), "UTF-8")); - req.setEntity(entity); - - // 执行请求 - // 自定义 RequestConfig 设置请求超时时间 - RequestConfig requestConfig = RequestConfig.custom() - // 连接超时时间,单位:毫秒 - .setConnectTimeout(5000) - // 连接请求超时时间,单位:毫秒 - .setConnectionRequestTimeout(5000) - // 数据读取超时时间,单位:毫秒 - .setSocketTimeout(5000) - .build(); - // 通过 HttpClientBuilder 的 custom() 方法创建自定义的 HttpClient - CloseableHttpClient customHttpClient = HttpClients.custom() - .setDefaultRequestConfig(requestConfig) - .build(); - HttpResponse res = customHttpClient.execute(req); - int statusCode = res.getStatusLine().getStatusCode(); - log.info(String.valueOf(statusCode)); - if (200 != statusCode) { - log.info(String.valueOf(statusCode)); - } - // 获取响应 - InputStream in = res.getEntity().getContent(); - - byte[] resp = readStream(in); - String strRes = new String(resp, StandardCharsets.UTF_8); - log.info(strRes); - customHttpClient.close(); - return strRes; - } - - private static String sign(byte[] stream) throws Exception { - // 获取消息验证码类的实例,算法选择"HmacSHA256" - Mac mac = Mac.getInstance("HmacSHA256"); - - // 获取安全密钥 - Key secKey = new SecretKeySpec(IrsSealPlatformProperties.projectSecret.getBytes(StandardCharsets.UTF_8), mac.getAlgorithm()); - - // 初始化 - mac.init(secKey); - - // 获得签名 - byte[] sign = mac.doFinal(stream); - - // 将byte[]格式的签名用binary编码转化为字符串返回 - return binaryEncode(sign); - - } - - private static String sign1(byte[] stream) throws Exception { - // 获取消息验证码类的实例,算法选择"HmacSHA256" - Mac mac = Mac.getInstance("HmacSHA256"); - - // 获取安全密钥 - Key secKey = new SecretKeySpec(IrsSealPlatformProperties.secretKey.getBytes(StandardCharsets.UTF_8), mac.getAlgorithm()); - - // 初始化 - mac.init(secKey); - - // 获得签名 - byte[] sign = mac.doFinal(stream); - - // 将byte[]格式的签名用binary编码转化为字符串返回 - return binaryEncode(sign); - - } - - public static String binaryEncode(byte[] data) { - final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - - StringBuilder builder = new StringBuilder(); - - for (byte i : data) { - builder.append(hexDigits[i >>> 4 & 0xf]); - builder.append(hexDigits[i & 0xf]); - } - - return builder.toString(); - } - - public static byte[] readStream(InputStream in) throws IOException { - - ByteArrayOutputStream output = new ByteArrayOutputStream(); - - byte[] buffer = new byte[1024 * 10]; - try { - int n; - while ((n = in.read(buffer)) != -1) { - output.write(buffer, 0, n); - } - return output.toByteArray(); - } finally { - in.close(); - output.close(); - } - } - - /** - * Description: 将pdf文件转换为Base64编码 - *

- * // * @param 要转的的pdf文件 - * - * @Author fuyuwei - * Create Date: 2015年8月3日 下午9:52:30 - */ - public static String PDFToBase64(File file) { - FileInputStream fin = null; - BufferedInputStream bin = null; - ByteArrayOutputStream baos; - BufferedOutputStream bout = null; - try { - fin = new FileInputStream(file); - bin = new BufferedInputStream(fin); - baos = new ByteArrayOutputStream(); - bout = new BufferedOutputStream(baos); - byte[] buffer = new byte[1024]; - int len = bin.read(buffer); - while (len != -1) { - bout.write(buffer, 0, len); - len = bin.read(buffer); - } - //刷新此输出流并强制写出所有缓冲的输出字节 - bout.flush(); - byte[] bytes = baos.toByteArray(); - return String.valueOf(Base64.getEncoder().encode(bytes)); - - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - fin.close(); - bin.close(); - bout.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return null; - } - - /** - * Description: 将base64编码内容转换为Pdf - *

- * // * @param base64编码内容,文件的存储路径(含文件名) - * - * @Author fuyuwei - * Create Date: 2015年7月30日 上午9:40:23 - */ - public static void base64StringToPdf(String base64Content, String filePath) { - BASE64Decoder decoder = new BASE64Decoder(); - BufferedInputStream bis; - FileOutputStream fos; - BufferedOutputStream bos; - - try { - // base64编码内容转换为字节数组 - byte[] bytes = decoder.decodeBuffer(base64Content); - ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes); - bis = new BufferedInputStream(byteInputStream); - File file = new File(filePath); - File path = file.getParentFile(); - if (!path.exists()) { - path.mkdirs(); - } - fos = new FileOutputStream(file); - bos = new BufferedOutputStream(fos); - - byte[] buffer = new byte[1024]; - int length = bis.read(buffer); - while (length != -1) { - bos.write(buffer, 0, length); - length = bis.read(buffer); - } - bos.flush(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - //closeStream(bis, fos, bos); - } - } - - - private static String getCanonicalQueryString(String query) { - if (query == null || query.trim().isEmpty()) { - return ""; - } - List> queryParamList = new ArrayList<>(); - String[] params = query.split("&"); - for (String param : params) { - int eqIndex = param.indexOf("="); - String key = param.substring(0, eqIndex); - String value = param.substring(eqIndex + 1); - Pair pair = Pair.of(key, value); - queryParamList.add(pair); - } - - List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); - List> encodeParamList = new ArrayList<>(); - sortedParamList.forEach(param -> { - try { - String key = URLEncoder.encode(param.getKey(), "utf-8"); - String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8").replaceAll("\\%2B", "%20").replaceAll("\\+", "%20").replaceAll("\\%21", "!").replaceAll("\\%27", "'").replaceAll("\\%28", "(").replaceAll("\\%29", ")").replaceAll("\\%7E", "~").replaceAll("\\%25", "%"); - encodeParamList.add(Pair.of(key, value)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("encoding error"); - } - }); - - StringBuilder queryParamString = new StringBuilder(); - for (Pair encodeParam : encodeParamList) { - queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); - queryParamString.append("&"); - } - return queryParamString.substring(0, queryParamString.length() - 1); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/utils/RefreshTokenUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/utils/RefreshTokenUtil.java deleted file mode 100644 index e9da6cd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/utils/RefreshTokenUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.irs.utils; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - -import java.security.NoSuchAlgorithmException; -import java.util.Objects; - -/** - * @Classname RefreshTokenManage - * @Description - * @Date 2023/7/20 15:53 - * @Author PoffyZhang - */ -@Slf4j -public class RefreshTokenUtil { - - public static String refrshByAppScret() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String appSecret = "e066f496194540afa829c66983d4710e"; - String appKey = "8fb070a1f1194b2ebffdc6f596bb8a96"; - String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if(Objects.nonNull(factory)){ - restTemplate = new RestTemplate(factory); - }else{ - restTemplate = new RestTemplate(); - } - String url = "https://interface.ls.local/a/api/refreshTokenKey?appKey=" + appKey + - "&requestTime=" + timestamp + "&sign=" + sign; - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - String body = forEntity.getBody(); - log.info(body); - - JSONObject bodyJson = JSON.parseObject(body); - JSONObject datas = bodyJson.getJSONObject("datas"); - String requestSecret = datas.getString("requestSecret"); - log.info("requestSecret :{}",requestSecret); - return requestSecret; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/controller/ExpertLeaveController.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/controller/ExpertLeaveController.java deleted file mode 100644 index a8b853d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/controller/ExpertLeaveController.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.leave.controller; - - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.leave.entity.po.LeaveCreateReq; -import com.ningdatech.pmapi.leave.entity.po.LeaveListByCreatorReq; -import com.ningdatech.pmapi.leave.entity.vo.LeaveDetailVO; -import com.ningdatech.pmapi.leave.entity.vo.LeaveListItemVO; -import com.ningdatech.pmapi.leave.manage.LeaveManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.ObjectUtils; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - *

- * 前端控制器 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -@Api(tags = "请假管理控制器") -@RestController -@AllArgsConstructor -@RequestMapping("/api/v1/leave/") -public class ExpertLeaveController { - - private final LeaveManage leaveManage; - - @ApiOperation("请假") - @PostMapping("/save") - @WebLog("请假") - public IdVo askForLeave(@Valid @RequestBody LeaveCreateReq po) { - return leaveManage.askForLeave(po); - } - - @ApiOperation("请假详情") - @GetMapping(value = {"/detail/{leaveId}", "/detail/{auditId}/byApply"}) - public LeaveDetailVO detail(@PathVariable(required = false) Long leaveId, - @PathVariable(required = false) Long auditId) { - if (ObjectUtils.allNull(leaveId, auditId)) { - throw BizException.wrap("请假ID或申请ID不能为空"); - } - return leaveManage.leaveDetail(leaveId, auditId); - } - - @ApiOperation("我的请假列表(发起人)") - @WebLog("我的请假列表(发起人)") - @GetMapping("/leaveListByCreator") - public PageVo leaveListByCreator(LeaveListByCreatorReq po) { - return leaveManage.leaveListByCreator(po); - } - - @ApiOperation("销假") - @WebLog("销假") - @GetMapping("/endLeave") - public void endLeave(Long leaveId) { - leaveManage.endLeave(leaveId); - } - - @ApiOperation("撤销") - @WebLog("撤销") - @GetMapping("/cancel") - public void cancelLeave(Long leaveId) { - leaveManage.cancel(leaveId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeave.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeave.java deleted file mode 100644 index 12ed67f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeave.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.domain; - -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 WendyYang - * @since 2022-08-11 - */ -@Data -@TableName("expert_leave") -@ApiModel(value = "ExpertLeave对象", description = "请假记录表") -public class ExpertLeave implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("请假类型") - private Integer type; - - @ApiModelProperty("请假说明") - private String remark; - - @ApiModelProperty("附件ID") - private String attachment; - - @ApiModelProperty("审核表ID") - private Long auditId; - - @ApiModelProperty("请假人ID") - private Long leaveUserId; - - @ApiModelProperty("创建人名称") - private String creator; - - @ApiModelProperty("创建人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long createBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("修改人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @ApiModelProperty("请假开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("请假结束时间") - private LocalDateTime endTime; - - @ApiModelProperty("销假时间") - private LocalDateTime cancelTime; - - @ApiModelProperty("固定时段模式") - private String fixedType; - - private Long meetingId; - - private Integer status; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeaveDetail.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeaveDetail.java deleted file mode 100644 index f252b58..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/domain/ExpertLeaveDetail.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.domain; - -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 java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 专家请假详情表(维度:天) - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -@Data -@NoArgsConstructor -@TableName("expert_leave_detail") -@ApiModel(value = "ExpertLeaveDetail对象", description = "专家请假详情表(维度:天)") -public class ExpertLeaveDetail implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("专家请假ID") - private Long expertLeaveId; - - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - - public ExpertLeaveDetail(Long expertLeaveId, LocalDateTime startTime, LocalDateTime endTime) { - this.expertLeaveId = expertLeaveId; - this.startTime = startTime; - this.endTime = endTime; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveStatusEnum.java deleted file mode 100644 index 5581add..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveStatusEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.enumeration; - -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * LeaveStatus - *

- * - * @author WendyYang - * @since 09:39 2022/8/12 - */ -@Getter -public enum LeaveStatusEnum { - - /** - * 请假状态 - */ - APPLYING(1, "审核中"), - PASSED(2, "审核通过"), - PASSED_END(3, "审核通过且销假"), - UN_PASSED(4, "审核不通过"), - CANCELED(5, "发起人撤销"); - private final Integer code; - private final String name; - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - LeaveStatusEnum(Integer code, String name) { - this.code = code; - this.name = name; - } - - public static LeaveStatusEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的请假状态")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveTypeEnum.java deleted file mode 100644 index 11b6467..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/enumeration/LeaveTypeEnum.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.enumeration; - -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * LeaveType-请假类型 - *

- * - * @author WendyYang - * @since 10:23 2022/8/11 - */ -@Getter -public enum LeaveTypeEnum { - - TEMPORARY(3, "临时请假"), - LONG_TERM(1, "长期请假"), - FIXED_TERM(2, "固定时段请假"); - - private final Integer code; - private final String name; - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - LeaveTypeEnum(Integer code, String name) { - this.code = code; - this.name = name; - } - - public static LeaveTypeEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的请假类型")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveCreateReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveCreateReq.java deleted file mode 100644 index fa4f0e0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveCreateReq.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.po; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.leave.entity.enumeration.LeaveTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.apache.commons.lang3.ObjectUtils; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * LeaveCreatePo - *

- * - * @author WendyYang - * @since 10:30 2022/8/11 - */ -@Data -@ApiModel("请假创建实体") -public class LeaveCreateReq { - - @ApiModelProperty("请假类型:1 长期请假、2 固定时段请假、3 临时请假") - @NotNull(message = "请假类型不能为空") - private Integer type; - - @ApiModelProperty("请假开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("请假结束时间") - private LocalDateTime endTime; - - @ApiModelProperty("请假说明") - @NotBlank(message = "请假说明不能为空") - private String postscript; - - @ApiModelProperty("附件ID") - private List attachments; - - @ApiModelProperty("固定时段") - private List fixedType; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("专家ID:管理员替专家请假时传参") - private Long expertId; - - public void paramCheck(LeaveTypeEnum leaveTypeEnum) { - if (leaveTypeEnum.equals(LeaveTypeEnum.TEMPORARY)) { - if (this.getMeetingId() == null) { - throw new BizException("会议ID不能为空"); - } - } else { - if (ObjectUtils.anyNull(this.getStartTime(), this.getEndTime())) { - throw new BizException("开始时间或结束时间不能为空"); - } - if (!this.getStartTime().isBefore(this.getEndTime())) { - throw new BizException("无效的请假时间"); - } - if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM)) { - if (this.getFixedType() == null || this.getFixedType().isEmpty()) { - throw new BizException("固定时段不能为空"); - } - } - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveListByCreatorReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveListByCreatorReq.java deleted file mode 100644 index 3661c62..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/po/LeaveListByCreatorReq.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.po; - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.sms.constant.DatePattern; -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; - -/** - *

- * LeaveListByCreatorPo - *

- * - * @author WendyYang - * @since 19:32 2022/8/11 - */ -@Data -@ApiModel("我的请假列表参数实体") -@EqualsAndHashCode(callSuper = true) -public class LeaveListByCreatorReq extends PagePo { - - @ApiModelProperty("开始时间") - @DateTimeFormat(pattern = DatePattern.YMD_HMS) - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - @DateTimeFormat(pattern = DatePattern.YMD_HMS) - private LocalDateTime endTime; - - @ApiModelProperty("请假类型") - private Integer leaveType; - - @ApiModelProperty("审核状态") - private String auditStatus; - - @ApiModelProperty("专家ID") - private Long expertId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveDetailVO.java deleted file mode 100644 index ce91b39..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveDetailVO.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.vo; - -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import lombok.Builder; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * LeaveDetailVo - *

- * - * @author WendyYang - * @since 11:48 2022/8/12 - */ -@Data -@Builder -public class LeaveDetailVO { - - private Long id; - - private String postscript; - - private LocalDateTime startTime; - - private LocalDateTime endTime; - - private LocalDateTime actualEndTime; - - private Integer status; - - private List attachments; - - private Integer type; - - private List fixedType; - - private LocalDateTime createOn; - - private String createBy; - - private Long auditId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveListItemVO.java deleted file mode 100644 index ec9320f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/entity/vo/LeaveListItemVO.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.leave.entity.vo; - -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * LeaveListItemByCreatorVo - *

- * - * @author WendyYang - * @since 20:53 2022/8/11 - */ -@Data -@ApiModel("我得请假列表实体(发起人)") -public class LeaveListItemVO { - - @ApiModelProperty("请假ID") - private Long leaveId; - - @ApiModelProperty("审核ID") - private Long auditId; - - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - - @ApiModelProperty("实际结束时间") - private LocalDateTime actualEndTime; - - @ApiModelProperty("请假说明") - private String postscript; - - @ApiModelProperty("说明材料") - private List attachments; - - @ApiModelProperty("请假类型") - private Integer leaveType; - - @ApiModelProperty("相关会议") - private String meetingName; - - @ApiModelProperty("审核状态") - private String auditStatus; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("审核意见") - private String auditOption; - - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java deleted file mode 100644 index 31c9735..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java +++ /dev/null @@ -1,529 +0,0 @@ -package com.ningdatech.pmapi.leave.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.Assert; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.ningdatech.pmapi.common.model.entity.KeyValDTO; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.model.dto.ModifyApplyExtraInfoDTO; -import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeave; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeaveDetail; -import com.ningdatech.pmapi.leave.entity.enumeration.LeaveStatusEnum; -import com.ningdatech.pmapi.leave.entity.enumeration.LeaveTypeEnum; -import com.ningdatech.pmapi.leave.entity.po.LeaveCreateReq; -import com.ningdatech.pmapi.leave.entity.po.LeaveListByCreatorReq; -import com.ningdatech.pmapi.leave.entity.vo.LeaveDetailVO; -import com.ningdatech.pmapi.leave.entity.vo.LeaveListItemVO; -import com.ningdatech.pmapi.leave.service.IExpertLeaveDetailService; -import com.ningdatech.pmapi.leave.service.IExpertLeaveService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.meeting.task.ExpertRandomInviteTask; -import com.ningdatech.pmapi.sms.utils.DateUtil; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.AllArgsConstructor; -import org.springframework.aop.framework.AopContext; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - - -/** - *

- * LeaveManage - *

- * - * @author WendyYang - * @since 10:38 2022/8/11 - */ -@Component -@AllArgsConstructor -public class LeaveManage { - - private final ExpertRandomInviteTask inviteTask; - private final IMeetingService meetingService; - private final IMeetingExpertService meetingExpertService; - private final IExpertLeaveService leaveService; - private final IExpertLeaveDetailService leaveDetailService; - private final IExpertMetaApplyService metaApplyService; - private final FileService fileService; - private final IExpertUserFullInfoService userFullInfoService; - private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; - - private static final int HOURS_BEFORE_MEETING = 2; - - public void cancelMeetingExpertByLeave(Long meetingExpertId, ExpertAttendStatusEnum status) { - MeetingExpert update = buildMeetingExpertUpdate(meetingExpertId, status); - meetingExpertService.updateById(update); - } - - private MeetingExpert buildMeetingExpertUpdate(Long meetingExpertId, ExpertAttendStatusEnum status) { - MeetingExpert expert = new MeetingExpert(); - expert.setId(meetingExpertId); - expert.setStatus(status.getCode()); - return expert; - } - - private List listMeetingExpert(Long expertId, List> leaveTimes) { - // 先查询专家参与的所有会议 - LambdaQueryWrapper meetingExpertQuery = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getExpertId, expertId) - .in(MeetingExpert::getStatus, Arrays.asList(ExpertAttendStatusEnum.NOTICING.getCode(), - ExpertAttendStatusEnum.AGREED.getCode())); - List meetingExperts = meetingExpertService.list(meetingExpertQuery); - if (meetingExperts.isEmpty()) { - return Collections.emptyList(); - } - // 只需要查询待确认的或者是同意参加的 - Map expertMap = meetingExperts.stream() - .collect(Collectors.groupingBy(MeetingExpert::getMeetingId, - Collectors.collectingAndThen(Collectors.toList(), w -> { - w.sort(Comparator.comparing(MeetingExpert::getUpdateOn).reversed()); - return w.get(0); - }))); - List meetingIds = CollUtils.fieldList(expertMap.values(), MeetingExpert::getMeetingId); - LocalDateTime startTime = leaveTimes.get(0).getKey(), endTime = leaveTimes.get(leaveTimes.size() - 1).getValue(); - LambdaQueryWrapper meetingQuery = Wrappers.lambdaQuery(Meeting.class) - .in(Meeting::getId, meetingIds) - .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) - .and(w -> w.between(Meeting::getStartTime, startTime, endTime) - .or(or -> or.between(Meeting::getEndTime, startTime, endTime))); - List meetingList = meetingService.list(meetingQuery); - List matchMeetingIds = meetingList.stream() - .filter(w -> leaveTimes.stream() - .anyMatch(tp -> DateUtil.intersect(w.getStartTime(), w.getEndTime(), tp.getKey(), tp.getValue()))) - .map(Meeting::getId).collect(Collectors.toList()); - if (matchMeetingIds.isEmpty()) { - return Collections.emptyList(); - } - return matchMeetingIds.stream().map(expertMap::get).collect(Collectors.toList()); - } - - @Transactional(rollbackFor = Exception.class) - public IdVo askForLeave(LeaveCreateReq po) { - Long leaveUserId, applyUserId = Objects.requireNonNull(LoginUserUtil.getUserId()); - leaveUserId = po.getExpertId() != null ? po.getExpertId() : applyUserId; - boolean leaveForSelf = leaveUserId.equals(applyUserId); - if (!leaveForSelf) { - Assert.isFalse(leaveService.existsToBeReviewed(leaveUserId), "该专家存在待审核请假申请,请及时审核"); - } - LeaveTypeEnum type = LeaveTypeEnum.getByCode(po.getType()); - // 校验参数是否合法 - po.paramCheck(type); - ExpertLeave leave = new ExpertLeave(); - if (po.getAttachments() != null) { - leave.setAttachment(CollUtils.joinByComma(po.getAttachments())); - } - leave.setType(po.getType()); - leave.setRemark(po.getPostscript()); - leave.setLeaveUserId(leaveUserId); - leave.setCreator(LoginUserUtil.getUsername()); - List> leaveDetailTimes = new ArrayList<>(); - if (type.equals(LeaveTypeEnum.FIXED_TERM) || type.equals(LeaveTypeEnum.LONG_TERM)) { - leaveProcessByDateRange(po, leaveUserId, leave, leaveDetailTimes); - } else if (LeaveTypeEnum.TEMPORARY.equals(type)) { - leaveProcessByTemporary(po, leaveUserId, leave, leaveDetailTimes); - } - if (type != LeaveTypeEnum.TEMPORARY) { - ExpertMetaApply apply = getExpertMetaApply(po, leaveUserId, applyUserId); - leave.setAuditId(apply.getId()); - if (!leaveForSelf) { - leave.setStatus(LeaveStatusEnum.PASSED.getCode()); - } - } - leave.setStartTime(po.getStartTime()); - leave.setEndTime(po.getEndTime()); - leave.setCancelTime(po.getEndTime()); - leaveService.save(leave); - List detailList = CollUtils.convert(leaveDetailTimes, w -> new ExpertLeaveDetail(leave.getId(), w.getKey(), w.getValue())); - leaveDetailService.saveBatch(detailList); - return IdVo.of(leave.getId()); - } - - private void leaveProcessByTemporary(LeaveCreateReq po, Long leaveUserId, ExpertLeave leave, List> leaveDetailTimes) { - // 临时请假 - Meeting meeting = meetingService.getById(po.getMeetingId()); - if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("该会议已取消"); - } - po.setStartTime(meeting.getStartTime()); - po.setEndTime(meeting.getEndTime()); - if (LocalDateTime.now().plusHours(HOURS_BEFORE_MEETING).isAfter(po.getStartTime())) { - throw BizException.wrap("会议开始前" + HOURS_BEFORE_MEETING + "小时,不能在线请假,请电话该会议的联系人。"); - } - MeetingExpert expert = meetingExpertService.getByMeetingIdAndExpertId(po.getMeetingId(), leaveUserId); - if (!ExpertAttendStatusEnum.AGREED.eq(expert.getStatus())) { - // 非确认参加状态无法临时请假 - throw BizException.wrap("未同意参加该会议,无法临时请假"); - } - LocalDateTime tempStart = po.getStartTime(); - while (!tempStart.isAfter(po.getEndTime())) { - LocalDateTime tempEnd = tempStart.toLocalDate().atTime(DateUtil.LOCAL_TIME_3D); - leaveDetailTimes.add(KeyValDTO.of(tempStart, DateUtil.min(tempEnd, po.getEndTime()))); - tempStart = tempStart.plusDays(1).toLocalDate().atStartOfDay(); - } - LeaveManage proxy = (LeaveManage) AopContext.currentProxy(); - proxy.cancelMeetingExpertByLeave(expert.getId(), ExpertAttendStatusEnum.ON_LEAVE); - if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { - inviteTask.notifyInviteTask(meeting.getId(), Boolean.FALSE); - } - if (meeting.getConfirmedRoster()) { - LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getConfirmedRoster, Boolean.FALSE) - .eq(Meeting::getId, meeting.getId()); - meetingService.update(mUpdate); - } - meetingCallOrMsgHelper.sendExpertLeaveMsg(expert, meeting); - // 临时请假无需审核 - leave.setAuditId(0L); - leave.setStatus(LeaveStatusEnum.PASSED.getCode()); - } - - private void leaveProcessByDateRange(LeaveCreateReq req, Long leaveUserId, ExpertLeave leave, List> leaveDetailTimes) { - boolean fixedTerm = CollUtil.isNotEmpty(req.getFixedType()); - if (fixedTerm) { - // 固定时段请假 - leave.setFixedType(CollUtils.joinByComma(req.getFixedType())); - } - LocalDateTime tempStart = req.getStartTime(); - while (!tempStart.isAfter(req.getEndTime())) { - boolean add = true; - if (fixedTerm) { - int weekday = tempStart.getDayOfWeek().getValue(); - add = req.getFixedType().contains(weekday); - } - if (add) { - LocalDateTime tempEnd = tempStart.toLocalDate().atTime(DateUtil.LOCAL_TIME_3D); - leaveDetailTimes.add(KeyValDTO.of(tempStart, DateUtil.min(tempEnd, req.getEndTime()))); - } - tempStart = tempStart.plusDays(1).toLocalDate().atStartOfDay(); - } - if (leaveDetailTimes.isEmpty()) { - throw BizException.wrap("请假时间无效"); - } - if (leaveDetailService.existsLeaveByUserIdAndTime(leaveUserId, leaveDetailTimes)) { - throw BizException.wrap("该请假时段内已存在请假"); - } - List meetingExperts = listMeetingExpert(leaveUserId, leaveDetailTimes); - if (!meetingExperts.isEmpty()) { - if (meetingExperts.stream().anyMatch(w -> ExpertAttendStatusEnum.AGREED.eq(w.getStatus()))) { - throw BizException.wrap("有待参加会议,请先处理完会议,再发起请假"); - } - List expertsUpdate = meetingExperts.stream() - .map(w -> buildMeetingExpertUpdate(w.getExpertId(), ExpertAttendStatusEnum.ON_LEAVE)) - .collect(Collectors.toList()); - meetingExpertService.updateBatchById(expertsUpdate); - } - leave.setStatus(LeaveStatusEnum.APPLYING.getCode()); - } - - private ExpertMetaApply getExpertMetaApply(LeaveCreateReq po, Long leaveUserId, Long applyUserId) { - // 非临时请假需要审批 - LocalDateTime now = LocalDateTime.now(); - ExpertMetaApply apply = new ExpertMetaApply(); - apply.setCreateOn(now); - apply.setUpdateOn(now); - apply.setApplyType(ExpertApplyTypeEnum.LONG_TERM_LEAVE.getKey()); - if (applyUserId.equals(leaveUserId)) { - apply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); - } else { - // 专家管理员发起请假自动通过 - apply.setReviewTime(now); - apply.setApprover(LoginUserUtil.getUsername()); - apply.setApproverUserId(applyUserId); - apply.setApplyStatus(ExpertApplyStatusEnum.PASSED.getKey()); - } - apply.setUserId(leaveUserId); - apply.setApplicantId(applyUserId); - ExpertUserFullInfo userInfo = userFullInfoService.getByUserId(apply.getUserId()); - apply.setRegionCode(userInfo.getRegionCode()); - apply.setRegionLevel(userInfo.getRegionLevel()); - ModifyApplyExtraInfoDTO extraInfo = new ModifyApplyExtraInfoDTO(); - extraInfo.setFactSheet(po.getPostscript()); - if (po.getAttachments() != null) { - List infoList = CollUtils.convert(po.getAttachments(), w -> { - FileBasicInfo info = new FileBasicInfo(); - info.setFileId(w); - return info; - }); - extraInfo.setEvidenceList(infoList); - } - apply.setExtraMaterial(JSONUtil.toJsonStr(extraInfo)); - metaApplyService.save(apply); - return apply; - } - - public PageVo leaveListByCreator(LeaveListByCreatorReq po) { - if (po.getExpertId() == null) { - po.setExpertId(LoginUserUtil.getUserId()); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) - .orderByDesc(ExpertLeave::getCreateOn); - if (po.getLeaveType() != null && po.getLeaveType().equals(LeaveTypeEnum.TEMPORARY.getCode())) { - // 临时请假 - if (po.getAuditStatus() != null && !po.getAuditStatus().equals(ExpertApplyStatusEnum.PASSED.getKey())) { - return PageVo.empty(); - } - query.eq(ExpertLeave::getAuditId, 0L); - query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); - } else { - if (StrUtils.isNotBlank(po.getAuditStatus())) { - LambdaQueryWrapper queryApply = Wrappers.lambdaQuery(ExpertMetaApply.class) - .select(ExpertMetaApply::getId) - .eq(ExpertMetaApply::getUserId, po.getExpertId()) - .eq(ExpertMetaApply::getApplyStatus, po.getAuditStatus()); - List applyList = metaApplyService.list(queryApply); - List auditIds = CollUtils.fieldList(applyList, ExpertMetaApply::getId); - if (po.getAuditStatus().equals(ExpertApplyStatusEnum.PASSED.getKey())) { - query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); - auditIds.add(0L); - } - if (auditIds.isEmpty()) { - return PageVo.empty(); - } - query.in(ExpertLeave::getAuditId, auditIds); - } else { - query.eq(ExpertLeave::getLeaveUserId, po.getExpertId()); - } - query.eq(po.getLeaveType() != null, ExpertLeave::getType, po.getLeaveType()); - } - if (po.getStartTime() != null && po.getEndTime() != null) { - query.and(wrapper -> wrapper.between(ExpertLeave::getStartTime, po.getStartTime(), po.getEndTime()) - .or(or -> or.between(ExpertLeave::getEndTime, po.getStartTime(), po.getEndTime()))); - } - Page page = leaveService.page(po.page(), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List meetingIds = new ArrayList<>(), auditIds = new ArrayList<>(), fileIds = new ArrayList<>(); - page.getRecords().forEach(w -> { - if (w.getMeetingId() != 0) { - meetingIds.add(w.getMeetingId()); - } - if (w.getAuditId() != 0) { - auditIds.add(w.getAuditId()); - } - if (!w.getAttachment().isEmpty()) { - List tempFileIds = BizUtils.splitToLong(w.getAttachment()); - fileIds.addAll(tempFileIds); - } - }); - Map meetingMap = new HashMap<>(16); - if (!meetingIds.isEmpty()) { - meetingMap.putAll(CollUtils.listToMap(meetingService.listByIds(meetingIds), Meeting::getId)); - } - Map applyMap = new HashMap<>(16); - if (!auditIds.isEmpty()) { - applyMap.putAll(CollUtils.listToMap(metaApplyService.listByIds(auditIds), ExpertMetaApply::getId)); - } - Map fileMap = new HashMap<>(fileIds.size()); - if (!fileIds.isEmpty()) { - fileMap.putAll(CollUtils.listToMap(fileService.getByIds(fileIds), AttachFileVo::getFileId)); - } - List dataList = CollUtils.convert(page.getRecords(), w -> { - LeaveListItemVO item = new LeaveListItemVO(); - item.setLeaveType(w.getType()); - item.setPostscript(w.getRemark()); - item.setAuditId(w.getAuditId()); - item.setLeaveId(w.getId()); - item.setStartTime(w.getStartTime()); - item.setEndTime(w.getEndTime()); - ExpertMetaApply apply = applyMap.get(w.getAuditId()); - item.setAuditOption(apply != null ? apply.getAuditOpinion() : StrUtil.EMPTY); - item.setStatus(w.getStatus()); - item.setAuditStatus(apply != null ? apply.getApplyStatus() : ExpertApplyStatusEnum.PASSED.getKey()); - item.setActualEndTime(w.getCancelTime()); - Meeting meeting = meetingMap.get(w.getMeetingId()); - item.setMeetingName(meeting != null ? meeting.getName() : StrUtil.EMPTY); - item.setAttachments(new ArrayList<>()); - if (!w.getAttachment().isEmpty()) { - Arrays.stream(w.getAttachment().split(",")).forEach(fileId -> item.getAttachments().add(fileMap.get(Long.parseLong(fileId)))); - } - return item; - }); - return PageVo.of(dataList, page.getTotal()); - } - - public void endLeave(Long leaveId) { - ExpertLeave leave = leaveService.getById(leaveId); - if (LeaveTypeEnum.TEMPORARY.eq(leave.getType())) { - throw BizException.wrap("临时请假不支持销假"); - } - LeaveStatusEnum status = LeaveStatusEnum.getByCode(leave.getStatus()); - if (!status.equals(LeaveStatusEnum.PASSED) || LocalDateTime.now().isAfter(leave.getEndTime())) { - throw BizException.wrap("该请假不支持销假"); - } - LocalDateTime actualEndTime = LocalDateTime.now(); - LambdaUpdateWrapper updater = Wrappers.lambdaUpdate(ExpertLeave.class) - .set(ExpertLeave::getCancelTime, actualEndTime) - .set(ExpertLeave::getUpdateOn, actualEndTime) - .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) - .set(ExpertLeave::getStatus, LeaveStatusEnum.PASSED_END.getCode()) - .eq(ExpertLeave::getId, leave.getId()); - leaveService.update(updater); - LambdaQueryWrapper deleter = Wrappers.lambdaQuery(ExpertLeaveDetail.class) - .ge(ExpertLeaveDetail::getStartTime, actualEndTime.toLocalDate()) - .eq(ExpertLeaveDetail::getExpertLeaveId, leaveId); - leaveDetailService.remove(deleter); - } - - public void cancel(Long leaveId) { - ExpertLeave leave = leaveService.getById(leaveId); - if (LeaveTypeEnum.TEMPORARY.eq(leave.getType())) { - throw BizException.wrap("临时请假不支持撤销"); - } - if (LeaveStatusEnum.APPLYING.eq(leave.getStatus())) { - throw BizException.wrap("该请假不支持撤销"); - } - LocalDateTime actualEndTime = LocalDateTime.now(); - // 修改请假状态 - LambdaUpdateWrapper updater = Wrappers.lambdaUpdate(ExpertLeave.class) - .set(ExpertLeave::getUpdateOn, actualEndTime) - .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) - .set(ExpertLeave::getStatus, LeaveStatusEnum.CANCELED.getCode()) - .eq(ExpertLeave::getId, leave.getId()); - leaveService.update(updater); - // 删除请假详情 - LambdaQueryWrapper deleter = Wrappers.lambdaQuery(ExpertLeaveDetail.class) - .eq(ExpertLeaveDetail::getExpertLeaveId, leaveId); - leaveDetailService.remove(deleter); - // 修改审核表 - LambdaUpdateWrapper updaterApply = Wrappers.lambdaUpdate(ExpertMetaApply.class) - .set(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) - .set(ExpertMetaApply::getUpdateOn, LocalDateTime.now()) - .set(ExpertMetaApply::getAuditOpinion, "发起人撤销") - .eq(ExpertMetaApply::getId, leave.getAuditId()); - metaApplyService.update(updaterApply); - } - - public LeaveDetailVO leaveDetail(Long leaveId, Long auditId) { - ExpertLeave leave; - if (leaveId != null) { - leave = leaveService.getById(leaveId); - } else { - leave = leaveService.getByAuditId(auditId); - } - LeaveDetailVO detail = LeaveDetailVO.builder() - .createOn(leave.getCreateOn()) - .createBy(leave.getCreator()) - .postscript(leave.getRemark()) - .id(leave.getId()) - .status(leave.getStatus()) - .startTime(leave.getStartTime()) - .endTime(leave.getEndTime()) - .attachments(new ArrayList<>()) - .type(leave.getType()) - .actualEndTime(leave.getCancelTime()) - .auditId(leave.getAuditId()) - .build(); - if (LeaveTypeEnum.FIXED_TERM.eq(leave.getType())) { - detail.setFixedType(BizUtils.splitToNum(leave.getFixedType(), Integer.class)); - } - if (StrUtils.isNotBlank(leave.getAttachment())) { - List fileIds = BizUtils.splitToLong(leave.getAttachment()); - List files = fileService.getByIds(fileIds); - detail.getAttachments().addAll(files); - } - return detail; - } - - public List listLeaveUserIdByTime(LocalDateTime start, LocalDateTime end) { - LambdaQueryWrapper leaveDetailQuery = Wrappers.lambdaQuery(ExpertLeaveDetail.class) - .select(ExpertLeaveDetail::getExpertLeaveId) - .and(wrapper -> wrapper.between(ExpertLeaveDetail::getStartTime, start, end) - .or(wrapper1 -> wrapper1.between(ExpertLeaveDetail::getEndTime, start, end))); - List detailList = leaveDetailService.list(leaveDetailQuery); - if (detailList.isEmpty()) { - return new ArrayList<>(); - } - List leaveIdList = CollUtils.fieldList(detailList, ExpertLeaveDetail::getExpertLeaveId); - LambdaQueryWrapper leaveQuery = Wrappers.lambdaQuery(ExpertLeave.class) - .select(ExpertLeave::getCreateBy) - .in(ExpertLeave::getId, leaveIdList) - .in(ExpertLeave::getStatus, - LeaveStatusEnum.APPLYING.getCode(), - LeaveStatusEnum.PASSED.getCode(), - LeaveStatusEnum.PASSED_END.getCode()); - List leaveList = leaveService.list(leaveQuery); - return CollUtils.fieldList(leaveList, ExpertLeave::getCreateBy); - } - - @Transactional(rollbackFor = Exception.class) - public void leaveAuditCallback(boolean status, Long applyId) { - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(ExpertLeave.class) - .set(ExpertLeave::getUpdateBy, LoginUserUtil.getUserId()) - .set(ExpertLeave::getUpdateOn, LocalDateTime.now()) - .eq(ExpertLeave::getAuditId, applyId); - ExpertLeave leave = leaveService.getByAuditId(applyId); - ExpertUserFullInfo leaveUser = userFullInfoService.getByUserId(leave.getLeaveUserId()); - if (status) { - update.set(ExpertLeave::getStatus, LeaveStatusEnum.PASSED.getCode()); - } else { - ExpertMetaApply metaApply = metaApplyService.getById(applyId); - update.set(ExpertLeave::getStatus, LeaveStatusEnum.UN_PASSED.getCode()); - LambdaQueryWrapper delete = Wrappers.lambdaQuery(ExpertLeaveDetail.class) - .eq(ExpertLeaveDetail::getExpertLeaveId, leave.getId()); - leaveDetailService.remove(delete); - } - leaveService.update(update); - } - - public Map> listLeaveIdByDate(LocalDate startDate, LocalDate endDate, Long expertId) { - List leaveDetails = leaveDetailService.listByDateAndLeaveUserId(startDate, endDate, expertId); - return leaveDetails.stream().collect(Collectors.groupingBy(w -> w.getStartTime().toLocalDate(), - Collectors.mapping(ExpertLeaveDetail::getExpertLeaveId, Collectors.toSet()))); - } - - public PageVo listLeaveApplyingAndCouldBeStop(PagePo po) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) - .eq(ExpertLeave::getLeaveUserId, LoginUserUtil.getUserId()) - .and(wrapper -> wrapper.eq(ExpertLeave::getStatus, LeaveStatusEnum.APPLYING.getCode()) - .or(wrapper1 -> wrapper1.eq(ExpertLeave::getStatus, LeaveStatusEnum.PASSED.getCode()) - .gt(ExpertLeave::getCancelTime, LocalDateTime.now()))); - Page page = leaveService.page(new Page<>(po.getPageNumber(), po.getPageSize()), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List result = CollUtils.convert(page.getRecords(), w -> { - LeaveListItemVO item = new LeaveListItemVO(); - item.setStartTime(w.getStartTime()); - item.setEndTime(w.getEndTime()); - item.setStatus(w.getStatus()); - item.setLeaveType(w.getType()); - item.setLeaveId(w.getId()); - return item; - }); - return PageVo.of(result, page.getTotal()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.java deleted file mode 100644 index 7e86713..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.leave.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.common.model.entity.KeyValDTO; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeaveDetail; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * 专家请假详情表(维度:天) Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -public interface ExpertLeaveDetailMapper extends BaseMapper { - - /** - * 查询时间段之内的请假信息(请假状态:已通过、销假) - * - * @param leaveUserId 请假人ID - * @param startDate 开始时间 - * @param endDate 结束时间 - * @return 请假详情 - * @author WendyYang - **/ - List selectLeaveIdByDateAndExpertId(@Param("leaveUserId") Long leaveUserId, - @Param("startDate") LocalDate startDate, - @Param("endDate") LocalDate endDate); - - /** - * 查询用户在指定时间之内是否有请假 - * - * @param leaveUserId 用户ID - * @param times 时间集合 - * @return 请假天数 - * @author WendyYang - **/ - Integer existsLeaveByLeaveUserIdAndTime(@Param("leaveUserId") Long leaveUserId, - @Param("times") List> times); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.xml deleted file mode 100644 index 4d5b63e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveDetailMapper.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.java deleted file mode 100644 index 4b78046..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.leave.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeave; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -public interface ExpertLeaveMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.xml deleted file mode 100644 index c95f146..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/mapper/ExpertLeaveMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveDetailService.java deleted file mode 100644 index b1df329..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveDetailService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.leave.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.common.model.entity.KeyValDTO; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeaveDetail; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * 专家请假详情表(维度:天) 服务类 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -public interface IExpertLeaveDetailService extends IService { - - List listByDateAndLeaveUserId(LocalDate startDate, LocalDate endDate, Long leaveUserId); - - boolean existsLeaveByUserIdAndTime(Long userId, List> times); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveService.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveService.java deleted file mode 100644 index f54512c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/IExpertLeaveService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.leave.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeave; - -/** - *

- * 服务类 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -public interface IExpertLeaveService extends IService { - - ExpertLeave getByAuditId(Long auditId); - - /** - * 是否存在待审核请假记录 - * - * @param expertId 专家ID - * @return boolean - */ - boolean existsToBeReviewed(Long expertId); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveDetailServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveDetailServiceImpl.java deleted file mode 100644 index 937100f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveDetailServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.leave.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.common.model.entity.KeyValDTO; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeaveDetail; -import com.ningdatech.pmapi.leave.mapper.ExpertLeaveDetailMapper; -import com.ningdatech.pmapi.leave.service.IExpertLeaveDetailService; -import org.springframework.stereotype.Service; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * 专家请假详情表(维度:天) 服务实现类 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -@Service -public class ExpertLeaveDetailServiceImpl extends ServiceImpl implements IExpertLeaveDetailService { - - @Override - public List listByDateAndLeaveUserId(LocalDate startDate, LocalDate endDate, Long leaveUserId) { - return baseMapper.selectLeaveIdByDateAndExpertId(leaveUserId, startDate, endDate.plusDays(1)); - } - - @Override - public boolean existsLeaveByUserIdAndTime(Long userId, List> times) { - return baseMapper.existsLeaveByLeaveUserIdAndTime(userId, times) != null; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveServiceImpl.java deleted file mode 100644 index dda0f17..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/service/impl/ExpertLeaveServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.leave.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.leave.entity.domain.ExpertLeave; -import com.ningdatech.pmapi.leave.entity.enumeration.LeaveStatusEnum; -import com.ningdatech.pmapi.leave.mapper.ExpertLeaveMapper; -import com.ningdatech.pmapi.leave.service.IExpertLeaveService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2022-08-11 - */ -@Service -public class ExpertLeaveServiceImpl extends ServiceImpl implements IExpertLeaveService { - - @Override - public ExpertLeave getByAuditId(Long auditId) { - if (auditId == 0) { - return null; - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) - .eq(ExpertLeave::getAuditId, auditId); - return getOne(query); - } - - @Override - public boolean existsToBeReviewed(Long expertId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertLeave.class) - .eq(ExpertLeave::getLeaveUserId, expertId) - .eq(ExpertLeave::getStatus, LeaveStatusEnum.APPLYING.getCode()); - return baseMapper.exists(query); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java deleted file mode 100644 index 546da59..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.meeting.builder; - -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; - -/** - *

- * ExpertInviteBuilder - *

- * - * @author WendyYang - * @since 21:30 2022/11/21 - */ -public class ExpertInviteBuilder { - - private ExpertInviteBuilder() { - } - - public static MeetingExpert getExpertByRandom(Long meetingId, ExpertUserFullInfo user, Long ruleId) { - return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.RANDOM); - } - - private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteTypeEnum type) { - MeetingExpert expert = new MeetingExpert(); - expert.setMeetingId(meetingId); - expert.setMobile(user.getPhoneNo()); - expert.setExpertId(user.getUserId()); - expert.setExpertName(user.getExpertName()); - expert.setRuleId(ruleId); - expert.setInviteType(type.getCode()); - return expert; - } - - public static MeetingExpert getExpertByAppoint(Long meetingId, ExpertUserFullInfo user, Long ruleId) { - return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.APPOINT); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/YxtSmsContextBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/YxtSmsContextBuilder.java deleted file mode 100644 index 4d150cd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/YxtSmsContextBuilder.java +++ /dev/null @@ -1,129 +0,0 @@ -//package com.ningdatech.pmapi.meeting.builder; -// -// -//import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -//import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -//import com.ningdatech.pmapi.sms.utils.DateUtil; -// -//import java.time.format.DateTimeFormatter; -//import java.util.ArrayList; -//import java.util.List; -// -///** -// *

-// * YxtSmsContextBuilder -// *

-// * -// * @author WendyYang -// * @since 14:19 2022/11/17 -// */ -//public class YxtSmsContextBuilder { -// -// private YxtSmsContextBuilder() { -// } -// -// public static List smsToExpertByCancelMeeting(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.MEETING_CANCEL, -// me.getExpertName(), meeting.getCancelRemark(), meetingTime, meetingType, meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static List smsToExpertBySendNotice(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.SEND_MEETING_NOTICE, -// me.getExpertName(), me.getUpdateOn().format(DateUtil.DTF_YMD_HM), -// meetingType, meetingTime, meeting.getRegionDetail(), meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToExpertByReplace(Meeting meeting, MeetingExpert expert, String meetingType) { -// SendSmsContext context = new SendSmsContext(); -// String holdCompany = meeting.getHoldCompanyBracket(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.EXPERT_REPLACED, -// expert.getExpertName(), -// meeting.getStartTime().format(DateUtil.DTF_YMD_HM), -// meetingType, -// meeting.getContact() -// )); -// context.setReceiveNumber(expert.getMobile()); -// return context; -// } -// -// public static List smsToExpertByMeetingChange(Meeting old, Meeting curr, List experts, String meetingType) { -// List contexts = new ArrayList<>(); -// String holdCompany = curr.getHoldCompanyBracket(); -// String sTimeOld = old.getStartTime().format(DateUtil.DTF_YMD_HM); -// String sTimeNew = curr.getStartTime().format(DateUtil.DTF_YMD_HM); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// String content = String.format(YxtSmsTemplateConst.MEETING_INGO_CHANGE, me.getExpertName(), -// sTimeOld, meetingType, sTimeNew, curr.getRegionDetail(), curr.getContact()); -// context.setContent(holdCompany + content); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToInvitorByExpertLeave(UserBasicInfo invitor, String meetingName, String expertName) { -// SendSmsContext context = new SendSmsContext(); -// context.setReceiveNumber(invitor.getPhoneNo()); -// context.setContent(String.format(YxtSmsTemplateConst.TEMP_LEAVE_APPLY, invitor.getNickName(), -// meetingName, expertName, WebProperties.webUrl)); -// return context; -// } -// -// public static SendSmsContext smsToExpertByLeavePassed(ExpertLeave leave, String leaveUser, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_PASSED, leaveUser, -// leave.getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS)), -// leave.getEndTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS))); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsToExpertBtLeaveReject(String leaveUser, String mobile, String opinion) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_REFUSED, leaveUser, opinion); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsByRandomInviteStop(String inviterName, String meetingName, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_INVITE_STOP, -// inviterName, meetingName, WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// -// public static SendSmsContext meetingInviteCompleteNotice(Meeting meeting) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_EXTRACTION_COMPLETED, -// meeting.getConnecter(), meeting.getName(), WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(meeting.getContact()); -// return context; -// } -//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java deleted file mode 100644 index 3a865db..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/constant/MeetingMsgTemplateConst.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.meeting.constant; - -/** - *

- * MeetingMsgConst - *

- * - * @author WendyYang - * @since 2023/4/20 - **/ -public interface MeetingMsgTemplateConst { - - /** - * 已结束:自动抽取结束,结束时给会议发起人发送浙政钉工作通知、短信:“注意,xxx会议自动抽取已结束,请及时确认是否召开会议”。 - */ - String INVITE_END = "注意,%s会议自动抽取已结束,请及时确认是否召开会议"; - - /** - * 确认名单:尊敬的【姓名】专家您好,您于【确认时间】接受了信息化项目评审会议邀请,会议时间:【会议时间】,会议地点:【会议地点】。请准时参加评审会议。如有疑问请联系【联系人】(【联系方式】)。 - */ - String CONFIRMED_ROSTER = "尊敬的%s专家您好,您于%s接受了信息化项目评审会议邀请,会议时间:%s,会议地点:%s。请准时参加评审会议。如有疑问请联系%s(%s)。"; - - /** - * 会议取消:尊敬的{name}专家,因会议取消说明,原定于开会时间的会议类型会议已取消。给您带来不便,敬请谅解。如有疑问请咨询会议联系人「会议联系人联系方式」。 - */ - String MEETING_CANCEL = "尊敬的%s专家,原定于%s的%s会议已取消。给您带来不便,敬请谅解。如有疑问请咨询会议联系人「%s」。"; - - String EXPERT_LEAVE_RANDOM = "请注意,%s会议有专家请假,将重新抽取以替换该专家。"; - - String EXPERT_LEAVE_APPOINT = "请注意,%s会议的%s专家请假,请及时登录系统替换该专家。"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java deleted file mode 100644 index 2578f8e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.meeting.controller; - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.meeting.entity.req.MeetingCalenderReq; -import com.ningdatech.pmapi.meeting.entity.vo.*; -import com.ningdatech.pmapi.meeting.manage.DashboardManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * DashboardController - *

- * - * @author WendyYang - * @since 22:19 2022/8/24 - */ -@Api(tags = "工作台相关接口") -@RestController -@AllArgsConstructor -@RequestMapping("/api/v1/dashboard") -public class ExpertDashboardController { - - private final DashboardManage dashboardManage; - - @ApiOperation("会议日历") - @GetMapping("/meetingCalender") - @WebLog(value = "会议日历") - public List meetingCalender(@Valid MeetingCalenderReq po) { - return dashboardManage.meetingCalender(po); - } - - @ApiOperation("待办:专家评价列表") - @GetMapping("/todo/expertEvaluation") - public PageVo expertEvaluationToDo(PagePo po) { - return dashboardManage.expertEvaluationToDo(po); - } - - @ApiOperation("待办:专家待替换列表") - @GetMapping("/todo/expertReplace") - public PageVo expertReplaceToDo(PagePo po) { - return dashboardManage.expertReplaceTodoList(po); - } - - @ApiOperation("待办:专家待确认列表") - @GetMapping("/todo/expertConfirm") - public PageVo expertConfirmToDo(PagePo po) { - return dashboardManage.expertConfirmToDo(po); - } - - @ApiOperation("会议数量统计") - @GetMapping("/meetingCountSummary") - @WebLog(value = "会议数量统计") - public MeetingCountSummaryVO meetingCountSummary() { - return dashboardManage.meetingCountSummary(); - } - - @ApiOperation("专家工作台:会议数量统计") - @GetMapping("/meetingCountByExpert") - @WebLog(value = "专家工作台:会议数量统计") - public MeetingCountByExpertVO meetingCountByExpert() { - return dashboardManage.meetingCountByExpert(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java deleted file mode 100644 index 2d16b00..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.ningdatech.pmapi.meeting.controller; - - -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.meeting.entity.dto.ReviewProjectDTO; -import com.ningdatech.pmapi.meeting.entity.req.*; -import com.ningdatech.pmapi.meeting.entity.vo.*; -import com.ningdatech.pmapi.meeting.manage.MeetingManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 会议 前端控制器 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Validated -@RestController -@AllArgsConstructor -@Api(tags = "会议管理") -@RequestMapping("/api/v1/meeting") -public class MeetingController { - - private final MeetingManage meetingManage; - - @PostMapping("/create") - @ApiOperation(value = "新建会议") - @WebLog(value = "新建会议") - public IdVo meetingCreate(@Valid @RequestBody MeetingCreateReq req) { - return meetingManage.meetingCreateAndInviteExpert(req); - } - - @PostMapping("/continueInvite") - @ApiOperation(value = "续抽专家") - @WebLog(value = "续抽专家") - public void continueInvite(@Valid @RequestBody MeetingIdReq req) { - meetingManage.continueInvite(req.getMeetingId()); - } - - @PostMapping("/convertToAppoint") - @ApiOperation(value = "转为指定抽取") - @WebLog(value = "转为指定抽取") - public void convertToAppoint(@Valid @RequestBody MeetingIdReq req) { - meetingManage.convertToAppoint(req.getMeetingId()); - } - - @PostMapping("/expertInviteByCreate") - @ApiOperation(value = "新建会议-专家抽取", hidden = true) - @WebLog(value = "新建会议-专家抽取") - public void expertInviteByCreate(@Valid @RequestBody ExpertInviteReq po) { - meetingManage.expertInviteByCreate(po); - } - - @ApiOperation("专家抽取数量校验") - @PostMapping("/expertCountOnChange") - public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteReq po) { - return meetingManage.expertCountOnChange(po); - } - - @ApiOperation("管理员会议列表") - @GetMapping("/manager/meetingList") - public PageVo meetingListByManager(MeetingListReq req) { - return meetingManage.meetingListForManager(req); - } - - @ApiOperation("专家会议列表") - @GetMapping("/expert/meetingList") - public PageVo meetingListByExpert(MeetingListReq po) { - return meetingManage.meetingListForExpert(po); - } - - @ApiOperation("专家请假会议列表") - @GetMapping("/expert/meetingListForLeave") - public PageVo meetingListForLeave(MeetingLeaveListReq req) { - return meetingManage.meetingListForLeave(req); - } - - @ApiOperation("项目详情-基本信息") - @GetMapping("/basicInfo/{meetingId}") - @WebLog(value = "项目详情-基本信息",response = true,project = true) - public MeetingDetailBasicVO meetingBasic(@PathVariable Long meetingId) { - return meetingManage.getMeetingDetail(meetingId); - } - - @ApiOperation("抽取情况") - @GetMapping("/inviteExpertList/{meetingId}") - @WebLog(value = "邀请情况详请") - public ExpertInviteDetailVO inviteExpertList(@PathVariable Long meetingId) { - return meetingManage.inviteExpertList(meetingId); - } - - @ApiOperation("会议基础信息修改") - @PostMapping("/basicInfo/modify") - @WebLog(value = "会议基础信息修改") - public void meetingBasicInfoModify(@Valid @RequestBody MeetingBasicInfoModifyReq po) { - meetingManage.meetingBasicInfoModify(po); - } - - @ApiOperation("会议详情-抽取规则") - @GetMapping("/inviteRuleDetail/{meetingId}") - @WebLog(value = "会议详情-抽取规则") - public InviteRuleDetailVO inviteRuleDetail(@PathVariable Long meetingId) { - return meetingManage.inviteRuleDetail(meetingId); - } - - @ApiOperation("停止抽取") - @GetMapping("/stopInvite/{meetingId}") - @WebLog(value = "停止抽取") - public void stopInvite(@PathVariable Long meetingId) { - meetingManage.stopRandomInvite(meetingId); - } - - @ApiOperation("取消会议") - @PostMapping("/cancel") - @WebLog(value = "取消会议") - public void cancelMeeting(@Valid @RequestBody MeetingCancelReq po) { - meetingManage.cancelMeeting(po); - } - - @ApiOperation("邀请函信息") - @GetMapping("/expertInviteDetail") - @WebLog(value = "邀请函信息") - public ExpertInvitationDetailVO expertInvitationDetail(@RequestParam(required = false) Long expertId, - @RequestParam Long meetingId) { - return meetingManage.expertInvitationDetail(meetingId, expertId); - } - - @ApiOperation("补充专家(指定抽取)") - @PostMapping("/expert/batchAppoint") - @WebLog(value = "批量补充专家") - public void batchAppointExperts(@Valid @RequestBody BatchAppointExpertsReq po) { - meetingManage.batchAppointExperts(po); - } - - @ApiOperation("确认参加") - @PostMapping("/expert/confirm") - @WebLog(value = "确认参加") - public void confirmAttendByManager(@RequestBody ExpertConfirmReq req) { - meetingManage.confirmAttendByManager(req); - } - - @ApiOperation("专家移除") - @PostMapping("/expertRemove") - @WebLog(value = "专家移除") - public void expertRemove(@Valid @RequestBody ExpertRemoveReq req) { - meetingManage.expertRemove(req); - } - - @ApiOperation("释放专家") - @PostMapping("/expert/release") - @WebLog(value = "释放专家") - public void releaseExperts(@RequestBody MeetingCancelReq req) { - meetingManage.releaseExperts(req); - } - - @ApiOperation("设置专家组长") - @PostMapping("setUpHeadman") - @WebLog(value = "设置专家组长") - public void setUpHeadman(@RequestBody ExpertConfirmReq req) { - meetingManage.setUpHeadman(req); - } - - @ApiOperation("重发短信 | 确认名单") - @PostMapping("/confirmedRoster") - @WebLog(value = "重发短信") - public void resendSms(@RequestBody ConfirmedRosterReq req) { - meetingManage.confirmedRoster(req); - } - - @GetMapping("/listReviewProject") - @ApiOperation("评审会议列表") - public PageVo listReviewProject(ReviewProjectListReq req) { - return meetingManage.pageReviewProject(req); - } - - @GetMapping("/option/project") - @ApiOperation("项目列表(创建会议添加项目)") - public PageVo projectList(MeetingOptionProjectReq req) { - return meetingManage.optionProject(req); - } - - @GetMapping("/{meetingId}/projects") - @ApiOperation("会议关联项目列表") - public List projectsByMeetingId(@PathVariable Long meetingId) { - return meetingManage.projectsByMeetingId(meetingId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java deleted file mode 100644 index 2398c1f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.controller; - - -import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; -import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Basic; -import com.ningdatech.pmapi.meeting.manage.MeetingExpertJudgeManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - *

- * 前端控制器 - *

- * - * @author WendyYang - * @since 2023-07-31 - */ -@Api(tags = "履职评价管理") -@AllArgsConstructor -@RestController -@RequestMapping("/api/v1/meeting/expert-judge") -public class MeetingExpertJudgeController { - - private final MeetingExpertJudgeManage expertJudgeManage; - - @ApiOperation("保存履职评价") - @PostMapping("/submit") - public void saveExpertJudge(@Validated(Basic.class) @RequestBody MeetingExpertJudgeReq req) { - expertJudgeManage.saveExpertJudge(req); - } - - @ApiOperation("查看履职评价") - @GetMapping("/detail/{meetingExpertId}") - public MeetingExpertJudgeReq expertJudgeDetail(@PathVariable Long meetingExpertId) { - return expertJudgeManage.expertJudgeDetail(meetingExpertId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExportController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExportController.java deleted file mode 100644 index 9829397..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExportController.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.meeting.controller; - -import com.ningdatech.pmapi.meeting.manage.ExpertExportManage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletResponse; - -/** - *

- * MeetingExportController - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Api(tags = "会议信息导出") -@RestController -@AllArgsConstructor -@RequestMapping("/api/v1/meeting/export") -public class MeetingExportController { - - - private final ExpertExportManage expertExportManage; - - - @GetMapping("/expertFeeTable/{meetingId}") - @ApiOperation("专家费用单导出") - public void exportFeeForExpert(@PathVariable Long meetingId, HttpServletResponse response) { - expertExportManage.exportFeeForExpert(meetingId, response); - } - - @GetMapping("/expertReviewTable/{meetingId}") - @ApiOperation("专家评审单导出") - public void exportExpertReviewTable(@PathVariable Long meetingId, HttpServletResponse response) { - expertExportManage.expertReviewTable(meetingId, response); - } - - @GetMapping("/laborFeeAuditTable/{meetingId}") - @ApiOperation("劳务费发放单导出") - public void exportLaborFeeAuditTable(@PathVariable Long meetingId, HttpServletResponse response) { - expertExportManage.laborFeeAuditTable(meetingId, response); - } - - @GetMapping("/expertInviteTable/{meetingId}") - @ApiOperation("专家抽取表导出") - public void exportExpertInviteTable(@PathVariable Long meetingId, HttpServletResponse response) { - expertExportManage.expertInviteTable(meetingId, response); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/config/WebProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/config/WebProperties.java deleted file mode 100644 index 5ca9a9e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/config/WebProperties.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.config; - -import lombok.Data; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** - *

- * SystemProperties - *

- * - * @author WendyYang - * @since 14:39 2022/9/15 - */ -@Data -@Component -public class WebProperties { - - public static String expertRegistrationUrl; - - public static String webUrl; - - public static String provincialUrl; - - @Value("${expert-registration.url:/expertEnroll}") - private void setExpertRegistrationUrl(String url) { - expertRegistrationUrl = url; - } - - @Value("${web.url:}") - private void setWebUrl(String url) { - webUrl = url; - } - - /** - * 省局项目管理调用跳转地址 - */ - @Value("${web.provincial:}") - private void setProvincial(String provincial) { - provincialUrl = provincial; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java deleted file mode 100644 index 52e3203..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -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; - -/** - *

- * ExpertInviteAvoidRule - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Data -@TableName("meeting_expert_invite_avoid_rule") -@ApiModel(value = "ExpertInviteAvoidRule对象") -public class ExpertInviteAvoidRule implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("事务ID") - private Long meetingId; - - @ApiModelProperty("回避专家ID") - private String avoidExpertIds; - - @ApiModelProperty("回避单位ID") - private String avoidUnitIds; - - @ApiModelProperty("回避条线ID") - private String avoidOrgIds; - - @ApiModelProperty("回避类型") - private Integer avoidType; - - @ApiModelProperty("每周参与次数") - private Integer weekInviteCount; - - @ApiModelProperty("创建人ID") - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @ApiModelProperty("修改人ID") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteIgnoreTime.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteIgnoreTime.java deleted file mode 100644 index a70a9f2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteIgnoreTime.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -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; -import java.time.LocalTime; - -/** - *

- * 专家抽取免打扰时间设置 - *

- * - * @author WendyYang - * @since 2022-11-21 - */ -@Data -@TableName("expert_invite_ignore_time") -@ApiModel(value = "ExpertInviteIgnoreTime对象", description = "专家抽取免打扰时间设置") -public class ExpertInviteIgnoreTime implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("是否启用") - private Boolean enable; - - @ApiModelProperty("开始时间") - private LocalTime startTime; - - @ApiModelProperty("截止时间") - private LocalTime endTime; - - @ApiModelProperty("创建人ID") - private Long createBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改人ID") - private Long updateBy; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java deleted file mode 100644 index 797f631..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -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; - -/** - *

- * ExpertInviteRule - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Data -@TableName("meeting_expert_invite_rule") -@ApiModel(value = "ExpertInviteRule对象") -public class ExpertInviteRule implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private Long meetingId; - - @ApiModelProperty("抽取规则") - private String inviteRule; - - @ApiModelProperty("创建人ID") - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @ApiModelProperty("修改人ID") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("抽取类型:1 自定义规则、2 指定邀请") - private Integer inviteType; - - @ApiModelProperty("抽取数量") - private Integer inviteCount; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java deleted file mode 100644 index ea3202a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -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 WendyYang - * @since 2022-07-26 - */ -@Data -@TableName("meeting") -@ApiModel(value = "Meeting对象", description = "会议") -public class Meeting implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("事务名称") - private String name; - - @ApiModelProperty("事务类型") - private String type; - - @ApiModelProperty("评审耗时:1 半天、2 一天") - private Integer meetingUsageTime; - - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - - @ApiModelProperty("评委出席时间") - private LocalDateTime judgesAttendanceTime; - - @ApiModelProperty("地区编码") - private String regionCode; - - @ApiModelProperty("地区层级") - private Integer regionLevel; - - @ApiModelProperty("联系人") - private String connecter; - - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("创建人") - private String creator; - - @ApiModelProperty("会议地址") - private String meetingAddress; - - private Integer status; - - @ApiModelProperty("抽取状态") - private Boolean inviteStatus; - - @ApiModelProperty("是否确认名单") - private Boolean confirmedRoster; - - @ApiModelProperty("举办单位") - private String holdOrg; - - @ApiModelProperty("举办单位ID") - private String holdOrgCode; - - @ApiModelProperty("是否为内部项目") - private Boolean isInnerProject; - - @ApiModelProperty("抽取类型") - private Integer inviteType; - - @ApiModelProperty("创建人ID") - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("修改人ID") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java deleted file mode 100644 index a19cd8d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 事务专家表 - *

- * - * @author WendyYang - * @since 2022-07-27 - */ -@Data -@Builder -@TableName("meeting_expert") -@ApiModel(value = "MeetingExpert对象", description = "事务专家表") -public class MeetingExpert implements Serializable { - - @Tolerate - public MeetingExpert() { - } - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("事务ID") - private Long meetingId; - - @ApiModelProperty("专家ID") - private Long expertId; - - @ApiModelProperty("邀请规则ID") - private Long ruleId; - - private String mobile; - - private String expertName; - - @ApiModelProperty("当前状态") - private Integer status; - - @ApiModelProperty("是否是专家组长") - private Boolean isHeadman; - - @ApiModelProperty("邀请类型") - private Integer inviteType; - - @ApiModelProperty("是否已确认名单") - private Boolean confirmedRoster; - - private String submitKey; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertEvaluation.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertEvaluation.java deleted file mode 100644 index c8462aa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertEvaluation.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.ningdatech.pmapi.sys.model.entity.BaseEntity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * 专家评价表 - *

- * - * @author WendyYang - * @since 2022-07-25 - */ -@Data -@TableName("meeting_expert_evaluation") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "MeetingExpertEvaluation对象", description = "专家评价表") -public class MeetingExpertEvaluation extends BaseEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("专家事务关联ID") - private Long expertMeetingId; - - @ApiModelProperty("事务ID") - private Long meetingId; - - @ApiModelProperty("专家ID") - private Long expertId; - - @TableField(value = "is_attended") - @ApiModelProperty("是否参加") - private Boolean attended; - - @TableField(value = "is_in_time") - @ApiModelProperty("是否准时参加") - private Boolean inTime; - - @TableField(value = "is_violated") - @ApiModelProperty("是否违规") - private Boolean violated; - - @ApiModelProperty("参与程度") - private Integer initiative; - - @ApiModelProperty("建设性建议") - private String advice; - - @ApiModelProperty("评审结果情况") - private String evaluateResult; - - @ApiModelProperty("违规情况") - private String violation; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java deleted file mode 100644 index 73de8bc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 会议专家履职评价表 - *

- * - * @author WendyYang - * @since 2023-07-31 - */ -@Data -@TableName("meeting_expert_judge") -@ApiModel(value = "MeetingExpertJudge对象") -public class MeetingExpertJudge implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("会议ID") - private Long meetingId; - - private Long expertId; - - @ApiModelProperty("会议专家ID") - private Long meetingExpertId; - - @ApiModelProperty("评分(1~10)") - private Integer score; - - @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") - private Integer attended; - - @ApiModelProperty("参与程度:1 积极、2 消极") - private Integer performance; - - @ApiModelProperty("是否提出建议:true 是、false 否") - private Boolean advised; - - @ApiModelProperty("是否早退:true 早退、false 未早退") - private Boolean leaveEarly; - - @ApiModelProperty("是否违规:true 是、false 否") - private Boolean brokeRule; - - @ApiModelProperty("违规内容") - private String brokeRuleContent; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingInnerProject.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingInnerProject.java deleted file mode 100644 index f17d70f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingInnerProject.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -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; - -/** - *

- * 会议评审内部项目表 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -@Data -@TableName("meeting_inner_project") -@ApiModel(value = "MeetingInnerProject对象", description = "会议评审内部项目表") -public class MeetingInnerProject implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingOuterProject.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingOuterProject.java deleted file mode 100644 index 1aa86b2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingOuterProject.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.domain; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 会议评审外部项目 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -@Data -@TableName("meeting_outer_project") -@ApiModel(value = "MeetingOuterProject对象", description = "会议评审外部项目") -public class MeetingOuterProject implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AbstractInviteRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AbstractInviteRule.java deleted file mode 100644 index bd965b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AbstractInviteRule.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * AbstractExpertExtractRule - *

- * - * @author WendyYang - * @since 10:10 2022/7/26 - */ -@Data -@ApiModel("抽取规则") -public abstract class AbstractInviteRule { - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("专家抽取数量") - @NotNull(message = "专家抽取数量不能为空", groups = {RuleSave.class}) - private Integer count; - - @ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取") - @NotNull(message = "抽取类型不能为空", groups = {RuleSave.class, CountCheck.class}) - private Integer inviteType; - - public interface RuleSave { - } - - public interface CountCheck { - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AppointInviteRuleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AppointInviteRuleDTO.java deleted file mode 100644 index d860c51..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AppointInviteRuleDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import javax.validation.constraints.NotEmpty; -import java.util.List; - -/** - *

- * AppointExtractRuleDto - *

- * - * @author WendyYang - * @since 10:19 2022/7/26 - */ -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@ApiModel("指定抽取规则") -public class AppointInviteRuleDTO extends AbstractInviteRule { - - @NotEmpty(message = "邀请说明不能为空", groups = {RuleSave.class}) - @ApiModelProperty("邀请说明") - private String inviteDesc; - - @NotEmpty(message = "专家ID不能为空", groups = {RuleSave.class, CountCheck.class}) - @ApiModelProperty("专家ID") - private List expertIdList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java deleted file mode 100644 index f6afd52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * 专家邀请回避规则 - *

- * - * @author WendyYang - * @since 10:22 2022/7/26 - */ -@Data -@ApiModel("回避信息") -public class AvoidRuleDTO { - - - @ApiModelProperty("回避类型:1 回避同单位、2 回避同条线、3 不回避") - private Integer avoidType; - - @ApiModelProperty("回避单位") - private List avoidUnitIdList; - - @ApiModelProperty("回避条线") - private List avoidOrgIdList; - - @ApiModelProperty("每周邀请次数") - private Integer weekInviteCount; - - @ApiModelProperty("回避专家") - private List expertIds; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/CountConfirmByMeetingIdDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/CountConfirmByMeetingIdDTO.java deleted file mode 100644 index af9ab8a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/CountConfirmByMeetingIdDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -/** - *

- * CountConfirmByMeetingIdDto - *

- * - * @author WendyYang - * @since 14:21 2022/8/8 - */ -@Data -@Builder -@AllArgsConstructor -public class CountConfirmByMeetingIdDTO { - - @Tolerate - public CountConfirmByMeetingIdDTO() { - } - - private Long meetingId; - - private Integer total; - - private Integer confirmed; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertChooseDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertChooseDTO.java deleted file mode 100644 index e76145e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertChooseDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertChooseDto - *

- * - * @author WendyYang - * @since 00:44 2022/7/27 - */ -@Data -@AllArgsConstructor -public class ExpertChooseDTO { - - private List experts; - - private Integer total; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertDictChooseDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertDictChooseDTO.java deleted file mode 100644 index 053c533..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertDictChooseDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertDictChooseDTO - *

- * - * @author WendyYang - * @since 15:49 2022/8/9 - */ -@Data -public class ExpertDictChooseDTO { - - @ApiModelProperty("专家字典类型") - private String expertDict; - - @ApiModelProperty("字典编码") - private List dictCodes; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertFeeExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertFeeExportDTO.java deleted file mode 100644 index 0c2effe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertFeeExportDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertFeeExportDTO - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Data -public class ExpertFeeExportDTO { - - private String projectName; - - private String meetingAddress; - - private String meetingTime; - - private List experts; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInfoDTO.java deleted file mode 100644 index 5b350a8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInfoDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.math.BigDecimal; - -/** - *

- * ExpertInfoDTO - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Data -public class ExpertInfoDTO { - - private Integer no; - - private String name; - - private String bank; - - private String bankNo; - - private String mobile; - - private String sex; - - private String company; - - private String job; - - private BigDecimal fee; - - private String idcard; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInviteTableDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInviteTableDTO.java deleted file mode 100644 index fcef7fe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertInviteTableDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertInviteTableDTO - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Data -public class ExpertInviteTableDTO { - - private List experts; - - private String projectCode; - - private String projectName; - - private String meetingCreateBy; - - private String meetingUsageTime; - - private String meetingAddress; - - private String meetingTime; - - private String buildOrg; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertReviewTableDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertReviewTableDTO.java deleted file mode 100644 index b74b69b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertReviewTableDTO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.io.Serializable; - -/** - *

- * ExpertReviewTableDTO - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Data -public class ExpertReviewTableDTO implements Serializable { - - private static final long serialVersionUID = 3383159744182234397L; - - private String projectName; - - private String meetingTime; - - private String meetingAddress; - - private String holdOrg; - - private String reviewResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertTagChooseDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertTagChooseDTO.java deleted file mode 100644 index 6f10cf0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertTagChooseDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertTagChooseDTO - *

- * - * @author WendyYang - * @since 19:45 2022/7/26 - */ -@Data -public class ExpertTagChooseDTO { - - @ApiModelProperty("专家标签") - private String expertTag; - - @ApiModelProperty("标签编码") - private List tagCodes; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java deleted file mode 100644 index ba77705..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.time.LocalDateTime; - -/** - *

- * MeetingInviteDTO - *

- * - * @author WendyYang - * @since 19:21 2023/3/7 - */ -@Data -public final class InviteCacheDTO { - - private Long meetingId; - - /** - * 拒绝的专家是否可以再次邀请 - */ - private Boolean reInvite; - - /** - * 任务触发时间 - */ - private LocalDateTime taskStartTime; - - public static InviteCacheDTO of(Long meetingId, Boolean reInvite, LocalDateTime startTime) { - InviteCacheDTO bo = new InviteCacheDTO(); - bo.setMeetingId(meetingId); - bo.setReInvite(reInvite); - bo.setTaskStartTime(startTime); - return bo; - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/LaborFeeAuditTableDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/LaborFeeAuditTableDTO.java deleted file mode 100644 index f4cb201..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/LaborFeeAuditTableDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.util.List; - -/** - *

- * LaborFeeAuditTableDTO - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Data -public class LaborFeeAuditTableDTO { - - private String projectName; - - private String meetingTime; - - private Integer expertCount; - - private List experts; - - private String meetingUsageTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java deleted file mode 100644 index bf2fca7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -/** - *

- * MeetingAndAttendStatusDto - *

- * - * @author WendyYang - * @since 22:48 2022/8/22 - */ -@Data -public class MeetingAndAttendStatusDTO { - - private Long meetingId; - - private Long meetingExpertId; - - private Long expertId; - - private Integer status; - - private Boolean attended; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java deleted file mode 100644 index 437c598..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * MeetingBasicDto - *

- * - * @author WendyYang - * @since 09:35 2022/7/26 - */ -@Data -@ApiModel("会议基本信息") -public class MeetingBasicDTO { - - @NotNull(message = "是否是系统内部项目不能为空") - @ApiModelProperty("是否是系统内部项目") - private Boolean isInnerProject; - - @NotEmpty(message = "事务名称不能为空") - @ApiModelProperty("事务名称") - private String name; - - @NotEmpty(message = "事务类型不能为空") - @ApiModelProperty("事务类型") - private String type; - - @NotNull(message = "开始时间不能为空") - @ApiModelProperty("开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @NotNull(message = "结束时间不能为空") - @ApiModelProperty("结束时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @NotNull(message = "评审耗时不能为空") - @ApiModelProperty("评审耗时:1 半天、2 一天") - private Integer meetingUsageTime; - - @NotNull(message = "评委出席时间不能为空") - @ApiModelProperty("评委出席时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime judgesAttendanceTime; - - @NotEmpty(message = "评审地点不能为空") - @ApiModelProperty("评审地点") - private String meetingAddress; - - @NotEmpty(message = "联系人不能为空") - @ApiModelProperty("联系人") - private String connecter; - - @NotEmpty(message = "联系方式不能为空") - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("内部项目ID") - private List innerProjects; - - @ApiModelProperty("外部项目") - private List projects; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java deleted file mode 100644 index 59fef4d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; - -/** - *

- * MeetingEvalProjectDTO - *

- * - * @author WendyYang - * @since 17:18 2023/2/28 - */ -@Data -public class MeetingReviewProjectDTO { - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("评审结果") - private String reviewResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MergeExpertIdDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MergeExpertIdDTO.java deleted file mode 100644 index 328e14a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MergeExpertIdDTO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.util.List; - -/** - *

- * MergeExpertIdDTO - *

- * - * @author WendyYang - * @since 2023/4/14 - **/ -@Data -public class MergeExpertIdDTO { - - private List expertIdsIn; - - private List expertIdsNotIn; - - private Boolean skip; - - public static MergeExpertIdDTO noExpert() { - MergeExpertIdDTO condition = new MergeExpertIdDTO(); - condition.setSkip(Boolean.TRUE); - return condition; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ProjectIdCodeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ProjectIdCodeDTO.java deleted file mode 100644 index 94b8641..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ProjectIdCodeDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * ProjectIdCodeDTO - *

- * - * @author WendyYang - * @since 2023/4/28 - **/ -@Data -public class ProjectIdCodeDTO { - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编码") - private String projectCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/RandomInviteRuleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/RandomInviteRuleDTO.java deleted file mode 100644 index acf8d3b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/RandomInviteRuleDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import com.ningdatech.pmapi.common.model.ReqRegionDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * RandomExtractRuleDto - *

- * - * @author WendyYang - * @since 10:18 2022/7/26 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel("随机抽取规则") -public class RandomInviteRuleDTO extends AbstractInviteRule { - - @ApiModelProperty("专家字典信息") - private List expertDicts; - - @ApiModelProperty("履职意向地编码") - private String intentionRegionCode; - - @ApiModelProperty("履职意向地层级") - private Integer intentionRegionLevel; - - private List expertRegionList; - - @ApiModelProperty("专家标签") - private List expertTags; - - @ApiModelProperty("专家最长响应时间") - @NotNull(message = "专家最长响应时间不能为空", groups = {RuleSave.class}) - private Integer waitForCallbackMinutes; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ReviewProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ReviewProjectDTO.java deleted file mode 100644 index 2a882fd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ReviewProjectDTO.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ningdatech.pmapi.sms.constant.DatePattern; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * ReviewProjectDTO - *

- * - * @author WendyYang - * @since 10:27 2023/3/8 - */ -@Data -public class ReviewProjectDTO { - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("申报单位") - private String buildOrgName; - - @ApiModelProperty("评审时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime reviewTime; - - @ApiModelProperty("评审结束时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime endReviewTime; - - @ApiModelProperty("评审类型") - private Integer reviewType; - - @ApiModelProperty("联系人") - private String connecter; - - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("业务领域") - private String bizDomain; - - @ApiModelProperty("是否是专家组长") - private Boolean isHeadman; - - @ApiModelProperty("是否已评价:0 未自评、1 已自评、2 已终评") - private Integer reviewed; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/YxtCallBackDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/YxtCallBackDTO.java deleted file mode 100644 index 4a1a5a2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/YxtCallBackDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2023 json.cn - */ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -import java.time.LocalDateTime; - -/** - *

- * 电话结果回调内容 - *

- * - * @author WendyYang - * @since 2023/4/17 - **/ -@Data -public class YxtCallBackDTO { - - private Integer duration; - - private String pressKey; - - private String receiveNumber; - - private LocalDateTime dialEndTime; - - private Integer resultCode; - - private Integer retryNumber; - - private String failCode; - - private LocalDateTime dialBeginTime; - - private String sendNumber; - - private String failReason; - - private String transactionId; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java deleted file mode 100644 index 2d4a4d5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import com.ningdatech.basic.exception.BizException; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * AvoidTypeEnum - *

- * - * @author WendyYang - * @since 2023/8/17 - **/ -@Getter -@AllArgsConstructor -public enum AvoidTypeEnum { - - CURR_UNIT(1, "同单位"), - CURR_STRIP(2, "同条线"), - NONE(3, "不回避"); - - private final Integer code; - private final String remark; - - public static AvoidTypeEnum getByCode(int code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> BizException.wrap("回避类型无效")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java deleted file mode 100644 index a0f8746..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * ExpertAttendStatus - *

- * - * @author WendyYang - * @since 09:23 2022/8/9 - */ -@Getter -@AllArgsConstructor -public enum ExpertAttendStatusEnum { - - NOTICING("通知中", 0), - UNANSWERED("未应答", 1), - AGREED("同意参加", 3), - REFUSED("拒绝参加", 4), - ON_LEAVE("已请假", 5), - RELEASED("已释放", 7); - - private final String value; - private final Integer code; - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - public static ExpertAttendStatusEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.eq(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的邀请状态")); - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java deleted file mode 100644 index 98c9801..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * ExpertExtractRuleType - *

- * - * @author WendyYang - * @since 10:11 2022/7/26 - */ -@Getter -public enum ExpertInviteTypeEnum { - - /** - * 专家抽取类型 - */ - RANDOM(1, "随机邀请"), - APPOINT(2, "指定邀请"); - - private final Integer code; - private final String name; - - ExpertInviteTypeEnum(Integer code, String name) { - this.code = code; - this.name = name; - } - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - public static ExpertInviteTypeEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的邀请类型")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertJudgeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertJudgeEnum.java deleted file mode 100644 index cfea76b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertJudgeEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - *

- * ExpertJudgeEnum - *

- * - * @author WendyYang - * @since 2023/8/3 - **/ -public class ExpertJudgeEnum { - - private ExpertJudgeEnum() { - } - - @Getter - @AllArgsConstructor - public enum AttendStatus { - ON_TIME(1, "准时"), - BE_LATE(2, "迟到"), - ABSENT(3, "缺席"); - - private final Integer code; - private final String value; - - public boolean eq(Integer code) { - return this.code.equals(code); - } - } - - @Getter - @AllArgsConstructor - public enum Performance { - - POSITIVE(1, "积极"), - NEGATIVE(2, "消极"); - - private final Integer code; - private final String value; - - public boolean eq(Integer code) { - return this.code.equals(code); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingAttendStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingAttendStatusEnum.java deleted file mode 100644 index 293aade..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingAttendStatusEnum.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * 专家参会状态 - *

- * - * @author WendyYang - * @since 20:30 2023/3/2 - */ -@Getter -@AllArgsConstructor -public enum MeetingAttendStatusEnum { - - TO_ATTEND("待参加", 1), - ATTENDED("已参加", 2), - ON_LEAVE("已请假", 3), - UN_ATTEND("缺席", 4); - - private final String value; - private final Integer code; - - public static MeetingAttendStatusEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("专家参会状态编码无效")); - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingDateTermTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingDateTermTypeEnum.java deleted file mode 100644 index d209ce5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingDateTermTypeEnum.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * MeetingDateTermType - *

- * - * @author WendyYang - * @since 09:54 2022/8/15 - */ -@Getter -@AllArgsConstructor -public enum MeetingDateTermTypeEnum { - - /** - * 会议日期类型 - */ - ONE_DAY(1, "一天"), - MORE_THAN_ONE(2, "两天及以上"); - - private final Integer code; - private final String value; - - public static MeetingDateTermTypeEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的会议日期类型编码")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingReviewTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingReviewTypeEnum.java deleted file mode 100644 index 3d8df0c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingReviewTypeEnum.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * MeetingReviewTypeEnum - *

- * - * @author WendyYang - * @since 16:32 2023/3/15 - */ -@Getter -@AllArgsConstructor -public enum MeetingReviewTypeEnum { - - /** - * 会议评审类型 - */ - PRELIMINARY_SCHEME_REVIEW("初步方案评审", "1"), - - CONSTRUCTION_SCHEME_REVIEW("建设方案评审", "2"), - - ACCEPTANCE_SCHEME_REVIEW("验收方案评审", "3"), - - DEPT_JOIN_REVIEW("部门联审", "4"), - - FAIRNESS_REVIEW( "公平性审查","5"); - - private final String value; - private final String code; - - public boolean eq(String code) { - return this.getCode().equals(code); - } - - public static MeetingReviewTypeEnum getByCode(String code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的会议评审类型编码")); - } - - public static String getValue(String code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .map(MeetingReviewTypeEnum::getValue) - .findFirst() - .orElse("未知"); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusByDashboard.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusByDashboard.java deleted file mode 100644 index 1aeac9e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusByDashboard.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -/** - *

- * MeetingStatusByDashboard - *

- * - * @author WendyYang - * @since 14:02 2022/8/30 - */ -public enum MeetingStatusByDashboard { - - /** - * 已完成 - */ - COMPLETED, - /** - * 已取消 - */ - CANCELED, - /** - * 待召开 - */ - TO_BE_HELD, - /** - * 已召开 - */ - HELD - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusEnum.java deleted file mode 100644 index ee83d20..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/MeetingStatusEnum.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * MeetingStatus - *

- * - * @author WendyYang - * @since 11:14 2022/8/8 - */ -@Getter -@AllArgsConstructor -public enum MeetingStatusEnum { - - /** - * 会议状态 - */ - NORMAL("正常", 1), - CANCELED("已取消", 3); - - private final String value; - private final Integer code; - - public boolean eq(Integer code) { - return this.getCode().equals(code); - } - - public static MeetingStatusEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.getCode().equals(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("会议状态编码无效")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/BatchAppointExpertsReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/BatchAppointExpertsReq.java deleted file mode 100644 index 97eb763..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/BatchAppointExpertsReq.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * BatchAppointExpertsPo - *

- * - * @author WendyYang - * @since 15:49 2022/8/26 - */ -@Data -@ApiModel("补充专家参数实体") -public class BatchAppointExpertsReq { - - @NotEmpty(message = "专家ID不能为空") - @ApiModelProperty("专家ID") - private List expertIdList; - - @NotNull(message = "会议ID不能为空") - @ApiModelProperty("会议ID") - private Long meetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java deleted file mode 100644 index e16b55f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * 会议确认名单实体 - *

- * - * @author WendyYang - * @since 10:43 2022/8/26 - */ -@Data -@ApiModel("会议确认名单实体") -public class ConfirmedRosterReq { - - @NotNull(message = "会议ID不能为空") - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty - private Boolean reconfirmed; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertConfirmReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertConfirmReq.java deleted file mode 100644 index 712d189..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertConfirmReq.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * 确认参加参数类 - *

- * - * @author WendyYang - * @since 08:59 2022/8/10 - */ -@Data -@ApiModel("确认参加") -public class ExpertConfirmReq { - - @NotNull(message = "会议ID不能为空") - @ApiModelProperty("会议ID") - private Long meetingId; - - @NotNull(message = "专家会议ID不能为空") - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - - @ApiModelProperty("是否确认参加会议") - private Boolean agreed; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertEvaluationReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertEvaluationReq.java deleted file mode 100644 index c882d33..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertEvaluationReq.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * ExpertEvaluationPo - *

- * - * @author WendyYang - * @since 15:30 2022/7/25 - */ -@Data -@ApiModel("专家评价实体") -public class ExpertEvaluationReq { - - @ApiModelProperty("专家事务关联ID") - @NotNull(message = "专家事务关联ID不能为空") - private Long expertMeetingId; - - @ApiModelProperty("是否参加") - @NotNull(message = "是否参加不能为空") - private Boolean attended; - - @ApiModelProperty("是否准时参加") - private Boolean inTime; - - @ApiModelProperty("是否违规") - @NotNull(message = "是否违规不能为空") - private Boolean violated; - - @ApiModelProperty("违规情况") - private String violation; - - @ApiModelProperty("参与程度:1 很积极...5 很消极") - @NotNull(message = "参与程度不能为空") - private Integer initiative; - - @ApiModelProperty("建设性的建议") - private String advice; - - @ApiModelProperty("评审结果") - private String evaluateResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java deleted file mode 100644 index 8fa5833..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteIgnoreTimeModifyReq.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalTime; - -/** - *

- * 专家抽取免打扰时间设置 - *

- * - * @author WendyYang - * @since 2022-11-21 - */ -@Data -@ApiModel("专家抽取免打扰时间设置") -public class ExpertInviteIgnoreTimeModifyReq { - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("是否启用:true 是、false 否") - private Boolean enable; - - @ApiModelProperty("开始时间(格式:HH:mm)") - @JSONField(format = "HH:mm") - private LocalTime startTime; - - @ApiModelProperty("截止时间(格式:HH:mm)") - @JSONField(format = "HH:mm") - private LocalTime endTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java deleted file mode 100644 index b28599d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * MeetingCreatePo - *

- * - * @author WendyYang - * @since 10:32 2022/7/26 - */ -@Data -@ApiModel("专家抽取新家实体") -public class ExpertInviteReq { - - @ApiModelProperty("会议ID") - private Long meetingId; - - @NotNull(message = "抽取类型不能为空") - @ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取") - private Integer inviteType; - - @Valid - @NotNull(message = "回避信息不能为空") - @ApiModelProperty("回避信息") - private AvoidRuleDTO avoidRule; - - @Valid - @ApiModelProperty("随机抽取规则") - private List randomRules; - - @Valid - @ApiModelProperty("指定抽取规则") - private AppointInviteRuleDTO appointRule; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertRemoveReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertRemoveReq.java deleted file mode 100644 index 6d5eaf6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertRemoveReq.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * ExpertRemovePo - *

- * - * @author WendyYang - * @since 08:59 2022/8/10 - */ -@Data -@ApiModel("专家移除实体") -public class ExpertRemoveReq { - - @NotNull(message = "会议ID不能为空") - @ApiModelProperty("会议ID") - private Long meetingId; - - @NotNull(message = "专家会议ID不能为空") - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertReplaceReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertReplaceReq.java deleted file mode 100644 index ee9327d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertReplaceReq.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * ExpertRemovePo - *

- * - * @author WendyYang - * @since 08:59 2022/8/10 - */ -@Data -@ApiModel("专家替换实体") -public class ExpertReplaceReq { - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("专家ID") - private Long expertId; - - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingBasicInfoModifyReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingBasicInfoModifyReq.java deleted file mode 100644 index 18b1dd8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingBasicInfoModifyReq.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * MeetingBasicInfoModifyPo - *

- * - * @author WendyYang - * @since 11:15 2022/8/17 - */ -@Data -public class MeetingBasicInfoModifyReq { - - @ApiModelProperty("会议ID") - @NotNull(message = "会议ID不能为空") - private Long id; - - @NotEmpty(message = "会议名称不能为空") - @ApiModelProperty("会议名称") - private String name; - - @NotEmpty(message = "会议类型不能为空") - @ApiModelProperty("会议类型") - private String type; - - @NotNull(message = "开始时间不能为空") - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @NotNull(message = "结束时间不能为空") - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - - @NotEmpty(message = "地区编码不能为空") - @ApiModelProperty("地区编码") - private String regionCode; - - @NotNull(message = "地区编码层级不能为空") - @ApiModelProperty("地区编码层级") - private Integer regionLevel; - - @NotEmpty(message = "地址详情不能为空") - @ApiModelProperty("地址详情") - private String regionDetail; - - @NotEmpty(message = "联系人不能为空") - @ApiModelProperty("联系人") - private String connecter; - - @NotEmpty(message = "联系方式不能为空") - @ApiModelProperty("联系方式") - private String contact; - - @NotEmpty(message = "会议说明不能为空") - @ApiModelProperty("会议说明") - private String description; - - @ApiModelProperty("附件ID") - private List attachmentIds; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("创建人") - private String author; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCalenderReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCalenderReq.java deleted file mode 100644 index 03e1f68..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCalenderReq.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotNull; -import java.time.LocalDate; - -/** - *

- * MeetingCalenderPo - *

- * - * @author WendyYang - * @since 22:38 2022/8/24 - */ -@Data -public class MeetingCalenderReq { - - @NotNull(message = "开始日期不能为空") - @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate startDate; - - @NotNull(message = "结束日期不能为空") - @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate endDate; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCancelReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCancelReq.java deleted file mode 100644 index b87a8e1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCancelReq.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * MeetingCancelPo - *

- * - * @author WendyYang - * @since 10:43 2022/8/26 - */ -@Data -@ApiModel("会议取消实体") -public class MeetingCancelReq { - - @NotNull(message = "会议ID不能为空") - @ApiModelProperty("会议ID") - private Long meetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java deleted file mode 100644 index 480e3c0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -/** - *

- * MeetingCreateReq - *

- * - * @author WendyYang - * @since 14:33 2023/2/28 - */ -@Data -public class MeetingCreateReq { - - @Valid - @NotNull(message = "会议基本信息不能为空") - @ApiModelProperty("会议基本信息") - private MeetingBasicDTO meetingBasicInfo; - - @Valid - @NotNull(message = "会议邀请规则不能为空") - @ApiModelProperty("会议邀请规则") - private ExpertInviteReq expertInviteRule; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertIdReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertIdReq.java deleted file mode 100644 index 2291f2c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertIdReq.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * MeetingExpertIdReq - *

- * - * @author WendyYang - * @since 14:11 2023/3/3 - */ -@Data -public class MeetingExpertIdReq { - - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java deleted file mode 100644 index 841c551..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum; -import org.hibernate.validator.constraints.Range; - -/** - *

- * MeetingExpertJudgeReq - *

- * - * @author WendyYang - * @since 2023/7/31 - **/ -@Data -public class MeetingExpertJudgeReq { - - private Long id; - - @NotNull(message = "会议ID不能为空", groups = Basic.class) - private Long meetingId; - - @NotNull(message = "会议专家ID不能为空", groups = Basic.class) - private Long meetingExpertId; - - @ApiModelProperty("评分(1~10)") - @NotNull(message = "评分不能为空", groups = Basic.class) - @Range(min = 1, max = 10, message = "评分范围为:1~10") - private Integer score; - - /** - * @see ExpertJudgeEnum.AttendStatus - */ - @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") - @NotNull(message = "是否参加不能为空", groups = Basic.class) - private Integer attended; - - /** - * @see ExpertJudgeEnum.Performance - */ - @ApiModelProperty("参与程度:1 积极、2 消极") - @NotNull(message = "参与度不能为空", groups = Attend.class) - private Integer performance; - - @ApiModelProperty("是否提出建议:true 是、false 否") - @NotNull(message = "是否提出建议不能为空", groups = Attend.class) - private Boolean advised; - - @ApiModelProperty("是否早退:true 早退、false 未早退") - @NotNull(message = "是否早退不能为空", groups = Attend.class) - private Boolean leaveEarly; - - @ApiModelProperty("是否违规:true 是、false 否") - @NotNull(message = "是否违规不能为空", groups = Attend.class) - private Boolean brokeRule; - - @ApiModelProperty("违规内容") - private String brokeRuleContent; - - @JSONField(format = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createOn; - - //================================================================================================================== - - public interface Attend { - } - - public interface Basic { - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingIdReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingIdReq.java deleted file mode 100644 index f783032..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingIdReq.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * MeetingIdReq - *

- * - * @author WendyYang - * @since 17:10 2023/3/7 - */ -@Data -public class MeetingIdReq { - - @ApiModelProperty("会议ID") - private Long meetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java deleted file mode 100644 index 379b79b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.basic.model.PagePo; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * MeetingListForLeaveReq - *

- * - * @author WendyYang - * @since 17:03 2023/4/3 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class MeetingLeaveListReq extends PagePo { - - private Long expertId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListByExpertReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListByExpertReq.java deleted file mode 100644 index ce2003a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListByExpertReq.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.basic.model.PagePo; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * MeetingListByExpertPo - *

- * - * @author WendyYang - * @since 17:02 2022/8/23 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class MeetingListByExpertReq extends PagePo { - - private Long expertId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java deleted file mode 100644 index 11a7043..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.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; - -/** - *

- * MeetingListByManagerPo - *

- * - * @author WendyYang - * @since 11:07 2022/8/8 - */ -@Data -@ApiModel("专家抽取员事务列表请求参数") -@EqualsAndHashCode(callSuper = true) -public class MeetingListReq extends PagePo { - - @ApiModelProperty("会议名称") - private String name; - - @ApiModelProperty("会议开始时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @ApiModelProperty("会议结束时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @ApiModelProperty("事务状态") - private Integer status; - - @ApiModelProperty("会议类型") - private String meetingType; - - @ApiModelProperty("专家ID") - private Long expertId; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("区域编码") - private String regionCode; - - @ApiModelProperty("区域层级") - private Integer regionLevel; - - @ApiModelProperty("参会名单是否确认") - private Boolean confirmedRoster; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingOptionProjectReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingOptionProjectReq.java deleted file mode 100644 index 9b43890..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingOptionProjectReq.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.basic.model.PagePo; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * MeetingOptionProjectReq - *

- * - * @author WendyYang - * @since 11:50 2023/3/16 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class MeetingOptionProjectReq extends PagePo { - - private String meetingType; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingResultReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingResultReq.java deleted file mode 100644 index ee600c7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingResultReq.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * MeetingResultPo - *

- * - * @author WendyYang - * @since 21:20 2022/8/8 - */ -@Data -@ApiModel("会议结果上传实体") -public class MeetingResultReq { - - @NotNull(message = "事务ID不能为空") - @ApiModelProperty("事务ID") - private Long meetingId; - - @NotBlank(message = "会议结果说明不能为空") - @ApiModelProperty("会议结果说明") - private String resultDescription; - - @ApiModelProperty("附件ID") - private List attachments; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ReviewProjectListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ReviewProjectListReq.java deleted file mode 100644 index 0aaeca8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ReviewProjectListReq.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - *

- * ReviewProjectListReq - *

- * - * @author WendyYang - * @since 10:54 2023/3/8 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class ReviewProjectListReq extends PagePo { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("建设单位") - private String buildOrgName; - - private Long userId; - - @ApiModelProperty("是否已评审") - private Boolean reviewed; - - private LocalDateTime reviewTimeMin; - - private LocalDateTime reviewTimeMax; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java deleted file mode 100644 index d93c100..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * 指定邀请规则 - *

- * - * @author WendyYang - * @since 11:26 2023/3/1 - */ -@Data -@ApiModel("指定邀请规则") -public class AppointRuleVO { - - @ApiModelProperty("邀请说明") - private String inviteDesc; - - @ApiModelProperty("指定邀请专家") - private List experts; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java deleted file mode 100644 index 171a3fe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * 回避信息 - *

- * - * @author WendyYang - * @since 11:25 2023/3/1 - */ -@Data -@ApiModel("回避信息") -public class AvoidInfoVO { - - @ApiModelProperty("回避类型:1 回避同单位、2 回避同条线、3 不回避") - private Integer avoidType; - - @ApiModelProperty("回避单位") - private List avoidUnitIds; - - @ApiModelProperty("回避单位名称") - private List avoidUnits; - - @ApiModelProperty("回避条线") - private List avoidOrgIds; - - @ApiModelProperty("回避条线名称") - private List avoidOrgs; - - @ApiModelProperty("每周邀请次数") - private Integer weekInviteCount; - - @ApiModelProperty("回避专家") - private List experts; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertAttendSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertAttendSummaryVO.java deleted file mode 100644 index d3323df..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertAttendSummaryVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * ExpertAttendSummaryVo - *

- * - * @author WendyYang - * @since 11:18 2022/8/28 - */ -@Data -public class ExpertAttendSummaryVO { - - private transient Long expertId; - - @ApiModelProperty("专家姓名") - private String expertName; - - @ApiModelProperty("专家出席次数") - private Integer attendCount; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertBasicInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertBasicInfoVO.java deleted file mode 100644 index aecb8e9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertBasicInfoVO.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.util.List; - -/** - *

- * ExpertBasicInfoVo - *

- * - * @author WendyYang - * @since 15:58 2022/8/8 - */ -@Data -@Builder -public class ExpertBasicInfoVO { - - @Tolerate - public ExpertBasicInfoVO() { - } - - @ApiModelProperty("专家ID") - private Long expertId; - - @ApiModelProperty("专家姓名") - private String name; - - @ApiModelProperty("专家层级") - private List regions; - - @ApiModelProperty("职称级别") - private String jobLevel; - - @ApiModelProperty("单位属性") - private String companyType; - - @ApiModelProperty("工作单位") - private String company; - - @ApiModelProperty("联系方式") - private String contact; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertCountOnChangeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertCountOnChangeVO.java deleted file mode 100644 index 6646d75..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertCountOnChangeVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - *

- * ExpertCountOnChangeVo - *

- * - * @author WendyYang - * @since 10:02 2022/8/8 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@ApiModel("专家抽取数量校验实体") -public class ExpertCountOnChangeVO { - - @ApiModelProperty("每个随机规则对应的可抽取数量") - private List countList; - - @ApiModelProperty("参数是否通过校验:true 是、false 否") - private Boolean status; - - @ApiModelProperty("错误提醒") - private String message; - - public void addCountList(Integer count) { - this.countList.add(count); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationListVO.java deleted file mode 100644 index cf0113c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationListVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * ExpertEvaluationListVo - *

- * - * @author WendyYang - * @since 16:03 2022/8/8 - */ -@Data -@ApiModel("专家评价列表") -public class ExpertEvaluationListVO { - - @ApiModelProperty("专家评价ID") - private Long evaluationId; - - @ApiModelProperty("专家信息") - private ExpertBasicInfoVO expert; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java deleted file mode 100644 index f7e1b48..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertEvaluationToDoListItemVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - *

- * ExpertEvaluationToDoListItemVo - *

- * - * @author WendyYang - * @since 13:58 2022/8/29 - */ -@Data -@ApiModel("专家评价待办列表") -@EqualsAndHashCode(callSuper = true) -public class ExpertEvaluationToDoListItemVO extends ExpertBasicInfoVO { - - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("会议开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("会议结束时间") - private LocalDateTime endTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInvitationDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInvitationDetailVO.java deleted file mode 100644 index 4064346..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInvitationDetailVO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * ExpertInvitationDetailVo - *

- * - * @author WendyYang - * @since 13:51 2022/8/27 - */ -@Data -@Builder -public class ExpertInvitationDetailVO { - - @Tolerate - public ExpertInvitationDetailVO() { - } - - @ApiModelProperty("专家确认时间") - private LocalDateTime inviteTime; - - @ApiModelProperty("会议举办单位") - private String holdOrg; - - @ApiModelProperty("会议开始时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @ApiModelProperty("会议结束时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("举办地址详情") - private String regionDetail; - - private List regions; - - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("联系人") - private String connecter; - - @ApiModelProperty("专家名称") - private String expertName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java deleted file mode 100644 index ce06f39..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * ExpertInviteDetailVO - *

- * - * @author WendyYang - * @since 08:58 2022/8/9 - */ -@Data -@ApiModel("专家邀请情况实体") -public class ExpertInviteDetailVO { - - @ApiModelProperty("是否已停止邀请") - private Boolean invitedStopped; - - @ApiModelProperty("是否已确认名单") - private Boolean confirmedRoster; - - @ApiModelProperty("邀请名单") - private List inviteExpertList; - - @ApiModelProperty("抽取情况") - private List inviteStatistics; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java deleted file mode 100644 index 606f133..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteIgnoreTimeListVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.time.LocalTime; - -/** - *

- * 专家抽取免打扰时间设置 - *

- * - * @author WendyYang - * @since 2022-11-21 - */ -@Data -@ApiModel("专家抽取免打扰时间设置") -public class ExpertInviteIgnoreTimeListVO { - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("是否启用:true 是、false 否") - private Boolean enable; - - @ApiModelProperty("开始时间") - @JSONField(format = "HH:mm") - private LocalTime startTime; - - @ApiModelProperty("截止时间") - @JSONField(format = "HH:mm") - private LocalTime endTime; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertListItemFoEvaluationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertListItemFoEvaluationVO.java deleted file mode 100644 index f2bcfed..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertListItemFoEvaluationVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * MeetingExpertListItemFoEvaluationVo - *

- * - * @author WendyYang - * @since 10:06 2022/8/24 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel("专家评价专家列表视图实体") -public class ExpertListItemFoEvaluationVO extends ExpertBasicInfoVO { - - @ApiModelProperty("是否已评价:true 已评价、false 未评价") - private boolean evaluated; - - @ApiModelProperty("评价ID") - private Long evaluationId; - - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertReplaceTodoListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertReplaceTodoListItemVO.java deleted file mode 100644 index 9325bab..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertReplaceTodoListItemVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - *

- * ExpertReplaceTodoListItemVo - *

- * - * @author WendyYang - * @since 16:46 2022/8/29 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class ExpertReplaceTodoListItemVO extends ExpertBasicInfoVO { - - @ApiModelProperty("会议ID") - private Long meetingId; - - private Long expertMeetingId; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("邀请结果") - private Integer status; - - @ApiModelProperty("邀请方式") - private String inviteType; - - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java deleted file mode 100644 index fdb0583..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - *

- * RandomInviteListItemVO - *

- * - * @author WendyYang - * @since 16:48 2023/3/3 - */ -@Data -@ApiModel("邀请名单实体") -@EqualsAndHashCode(callSuper = true) -public class InviteExpertListItemVO extends ExpertBasicInfoVO { - - @ApiModelProperty("邀请规则ID") - private Long ruleId; - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("手机号") - private String mobile; - - @ApiModelProperty("是否是专家组长") - private Boolean isHeadman; - - @ApiModelProperty("专家会议ID") - private Long expertMeetingId; - - @ApiModelProperty("电话通知状态") - private String noticeStatus; - - @ApiModelProperty("邀请状态") - private Integer status; - - @ApiModelProperty("抽取类型") - private Integer inviteType; - - @ApiModelProperty("通知时间") - private LocalDateTime noticeTime; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java deleted file mode 100644 index 4e3f0ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * InviteRuleDetailVo - *

- * - * @author WendyYang - * @since 14:58 2022/8/17 - */ -@Data -public class InviteRuleDetailVO { - - @ApiModelProperty("随机邀请规则") - private List randomRules; - - @ApiModelProperty("指定抽取规则") - private AppointRuleVO appointRule; - - @ApiModelProperty("回避信息") - private AvoidInfoVO avoidInfo; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteStatisticsByRuleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteStatisticsByRuleVO.java deleted file mode 100644 index 1e62231..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteStatisticsByRuleVO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * InviteStatisticsVO - *

- * - * @author WendyYang - * @since 18:07 2023/3/4 - */ -@Data -public class InviteStatisticsByRuleVO { - - @ApiModelProperty("抽取规则ID") - private Long ruleId; - - @ApiModelProperty("抽取人数") - private Integer inviteCnt; - - @ApiModelProperty("同意人数") - private Integer agreeCnt; - - @ApiModelProperty("实抽人数") - private Integer noticedCnt; - - public static InviteStatisticsByRuleVO init(Long ruleId) { - InviteStatisticsByRuleVO statistics = new InviteStatisticsByRuleVO(); - statistics.setRuleId(ruleId); - statistics.setNoticedCnt(0); - statistics.setInviteCnt(0); - statistics.setAgreeCnt(0); - return statistics; - } - - public void incrInviteCnt() { - this.inviteCnt++; - } - - public void incrAgreeCnt() { - this.agreeCnt++; - } - - public void incrNoticedCnt() { - this.noticedCnt++; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java deleted file mode 100644 index c502c6e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; - -/** - *

- * MeetingByManagerVo - *

- * - * @author WendyYang - * @since 11:43 2022/8/8 - */ -@Data -@Builder -@ApiModel("会议实体(管理员列表)") -public class MeetingByManagerVO { - - @Tolerate - public MeetingByManagerVO() { - } - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("会议专家ID") - private Long meetingExpertId; - - @ApiModelProperty("会议开始时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @ApiModelProperty("会议结束时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @ApiModelProperty("会议状态") - private Integer status; - - @ApiModelProperty("抽取类型") - private Integer inviteType; - - @ApiModelProperty("抽取状态") - private Boolean inviteStatus; - - @ApiModelProperty("名单确认状态") - private Boolean confirmedRoster; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("会议类型编码") - private String meetingType; - - @ApiModelProperty("会议类型名称") - private String meetingTypeName; - - @ApiModelProperty("专家状态") - private Integer expertStatus; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("联系人") - private String connecter; - - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("是否评价") - private Boolean hasJudge; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCalenderItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCalenderItemVO.java deleted file mode 100644 index 76607ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCalenderItemVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.List; - -/** - *

- * MeetingCalenderItemVo - *

- * - * @author WendyYang - * @since 22:57 2022/8/24 - */ -@Data -@ApiModel("会议日历视图实体") -public class MeetingCalenderItemVO { - - @ApiModelProperty("当前日期") - private LocalDate today; - - @ApiModelProperty("是否请假") - private Boolean hasLeave; - - @ApiModelProperty("请假ID") - private Collection leaveIds; - - @ApiModelProperty("是否有会议") - private Boolean hasMeeting; - - @ApiModelProperty("会议信息") - private List meetings; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingConfirmToDoListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingConfirmToDoListItemVO.java deleted file mode 100644 index 499d7e1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingConfirmToDoListItemVO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * MeetingConfirmToDoListItem - *

- * - * @author WendyYang - * @since 15:20 2022/8/29 - */ -@Data -public class MeetingConfirmToDoListItemVO { - - @ApiModelProperty("会议ID") - private Long meetingId; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("会议开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("会议结束时间") - private LocalDateTime endTime; - - @ApiModelProperty("会议类型") - private String type; - - @ApiModelProperty("举办地址详情") - private String regionDetail; - - @ApiModelProperty("举办地址") - private List regions; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("邀请总人数") - private Integer totalExpert; - - @ApiModelProperty("确认总人数") - private Integer confirmedExpert; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountByExpertVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountByExpertVO.java deleted file mode 100644 index c36eef6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountByExpertVO.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -/** - *

- * MeetingCountByExpertVo - *

- * - * @author WendyYang - * @since 10:23 2022/10/19 - */ -@Data -@AllArgsConstructor -@ApiModel("专家工作台:会议数量统计视图") -public class MeetingCountByExpertVO { - - @ApiModelProperty("待参加数量") - private Integer toBeAttended; - - @ApiModelProperty("已参加数量") - private Integer attended; - - @ApiModelProperty("请假数量") - private Integer leaved; - - public static MeetingCountByExpertVO init() { - return new MeetingCountByExpertVO(0, 0, 0); - } - - public void incrToBeAttended() { - this.toBeAttended += 1; - } - - public void incrAttended() { - this.attended += 1; - } - - public void incrLeaved() { - this.leaved += 1; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountSummaryVO.java deleted file mode 100644 index 5cc643e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingCountSummaryVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; - -/** - *

- * MeetingCountSummaryVo - *

- * - * @author WendyYang - * @since 09:43 2022/8/30 - */ -@Data -@Builder -@ApiModel("会议数量统计视图实体") -public class MeetingCountSummaryVO { - - @ApiModelProperty("已完成") - private Integer completed; - - @ApiModelProperty("已取消") - private Integer canceled; - - @ApiModelProperty("待召开") - private Integer toBeHeld; - - @ApiModelProperty("已召开") - private Integer held; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java deleted file mode 100644 index 7b5d798..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingReviewProjectDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * MeetingDetailBasicVo - *

- * - * @author WendyYang - * @since 15:16 2022/8/8 - */ -@Data -@Builder -@ApiModel("会议详情基本信息") -public class MeetingDetailBasicVO { - - @Tolerate - public MeetingDetailBasicVO() { - } - - private Long meetingId; - - @ApiModelProperty("会议名称") - private String meetingName; - - @ApiModelProperty("会议类型名称") - private String typeName; - - private String regionCode; - - @ApiModelProperty("会议类型代码") - private String meetingType; - - @ApiModelProperty("开始时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @ApiModelProperty("评委到场时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime judgesAttendanceTime; - - @ApiModelProperty("会议耗时") - private Integer meetingUsageTime; - - @ApiModelProperty("联系人") - private String connecter; - - @ApiModelProperty("创建人") - private String creator; - - @ApiModelProperty("评审地点") - private String meetingAddress; - - @ApiModelProperty("联系方式") - private String contact; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("会议状态") - private Integer status; - - @ApiModelProperty("取消说明") - private String cancelRemark; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("抽取单位") - private String holdOrg; - - @ApiModelProperty("抽取信息") - private InviteRuleDetailVO inviteRule; - - @ApiModelProperty("评审项目信息") - private List projects; - - @ApiModelProperty("是否已停止邀请") - private Boolean invitedStopped; - - @ApiModelProperty("是否已确认名单") - private Boolean confirmedRoster; - - @ApiModelProperty("邀请类型") - private Integer inviteType; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingResultVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingResultVO.java deleted file mode 100644 index 66be470..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingResultVO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * MeetingResultVo - *

- * - * @author WendyYang - * @since 21:28 2022/8/8 - */ -@Data -public class MeetingResultVO { - - @ApiModelProperty("事务ID") - private Long meetingId; - - @ApiModelProperty("会议结果说明") - private String resultDescription; - - @ApiModelProperty("附件信息") - private List attachments; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java deleted file mode 100644 index 72dcdb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * MeetingReviewProjectVO - *

- * - * @author WendyYang - * @since 13:57 2023/3/20 - */ -@Data -@Builder -public class MeetingReviewProjectVO { - - @Tolerate - public MeetingReviewProjectVO() { - } - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("申报年度") - private Integer projectYear; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("评审结果") - private String reviewResult; - - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/RandomInviteRuleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/RandomInviteRuleVO.java deleted file mode 100644 index 7d1f745..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/RandomInviteRuleVO.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.vo; - -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.List; - -/** - *

- * RandomInviteRuleVo - *

- * - * @author WendyYang - * @since 09:55 2022/8/26 - */ -@Data -@ApiModel("随机抽取规则视图实体") -@EqualsAndHashCode(callSuper = true) -public class RandomInviteRuleVO extends RandomInviteRuleDTO { - - @ApiModelProperty("履职意向地(回显使用)") - private List intentionRegions; - - @ApiModelProperty("专家层级意向地(回显使用)") - private List expertRegions; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java deleted file mode 100644 index b899612..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.AbstractInviteRule; -import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.*; - -/** - *

- * ExpertInviteHelper - *

- * - * @author WendyYang - * @since 16:35 2022/11/21 - */ -@Slf4j -@Component -@AllArgsConstructor -public class ExpertInviteHelper { - - private final IMeetingService meetingService; - private final IMeetingExpertService meetingExpertService; - private final IExpertUserFullInfoService expertUserFullInfoService; - - /** - * 获取时间段内被抽中的专家(通知中、确认参加) - * - * @param start 开始时间 - * @param end 结束时间 - * @return java.util.List - * @author WendyYang - **/ - public List listInvitedExpertByTime(LocalDateTime start, LocalDateTime end) { - LambdaQueryWrapper meetingQuery = Wrappers.lambdaQuery(Meeting.class) - .select(Meeting::getId) - .eq(Meeting::getStatus, MeetingStatusEnum.NORMAL.getCode()) - .and(wrapper -> wrapper.between(Meeting::getStartTime, start, end) - .or(wrapper1 -> wrapper1.between(Meeting::getEndTime, start, end))); - List meetings = meetingService.list(meetingQuery); - if (meetings.isEmpty()) { - return Collections.emptyList(); - } - List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); - LambdaQueryWrapper meetingExpertQuery = Wrappers.lambdaQuery(MeetingExpert.class) - .select(MeetingExpert::getExpertId) - .in(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode(), ExpertAttendStatusEnum.NOTICING.getCode()) - .in(MeetingExpert::getMeetingId, meetingIds); - List meetingExperts = meetingExpertService.list(meetingExpertQuery); - return CollUtils.fieldList(meetingExperts, MeetingExpert::getExpertId); - } - - public Set listExpertLeaveOrInvited(LocalDateTime start, LocalDateTime end) { - return new HashSet<>(listInvitedExpertByTime(start, end)); - } - - public Set getAvoidExpert(List appoints, AvoidRuleDTO avoid, LocalDateTime start, LocalDateTime end) { - Set expertIds = new HashSet<>(); - Optional.ofNullable(appoints).ifPresent(expertIds::addAll); - Optional.ofNullable(avoid) - .flatMap(w -> Optional.ofNullable(w.getExpertIds())) - .ifPresent(expertIds::addAll); - // 过滤掉请假专家 - expertIds.addAll(listInvitedExpertByTime(start, end)); - return expertIds; - } - - public Map checkAppointExpert(AppointInviteRuleDTO appointRule) { - if (appointRule == null) { - return Collections.emptyMap(); - } - List expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIdList()); - return CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); - } - - /** - * 构建邀请规则 - * - * @param rule 邀请规则 - * @param meetingId 会议ID - * @return {@link ExpertInviteRule} - * @author WendyYang - **/ - public static ExpertInviteRule getExpertInviteRule(AbstractInviteRule rule, Long meetingId) { - ExpertInviteRule result = new ExpertInviteRule(); - result.setInviteRule(JSONObject.toJSONString(rule)); - result.setInviteCount(rule.getCount()); - result.setInviteType(rule.getInviteType()); - result.setMeetingId(meetingId); - return result; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java deleted file mode 100644 index 7922215..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import cn.hutool.core.util.RandomUtil; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang3.RandomUtils; - -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * 专家抽取算法 - *

- * - * @author WendyYang - * @since 2023/4/14 - **/ -public class ExpertRandomInviteAlgorithm { - - private ExpertRandomInviteAlgorithm() { - - } - - private static boolean expertMatchNone(List experts, ExpertUserFullInfo userInfo) { - return experts.stream().noneMatch(w -> w.getExpertId().equals(userInfo.getUserId())); - } - - /** - * 每个单位只抽取一人 - * - * @param expertGroupByUnit 需要抽取的人 - * @param expertsByRecentMeeting 最近会议抽取到的专家 - * @param count 抽取数量 - * @return 抽取到的专家信息 - * @author WendyYang - **/ - public static List inviteGroupByUnit(Map> expertGroupByUnit, - List> expertsByRecentMeeting, - Integer count) { - if (MapUtils.isEmpty(expertGroupByUnit)) { - return Collections.emptyList(); - } - if (expertsByRecentMeeting.isEmpty()) { - return expertGroupByUnit.values().stream() - .map(RandomUtil::randomEle) - .limit(count).collect(Collectors.toList()); - } else { - List result = new ArrayList<>(); - List keySet = new ArrayList<>(expertGroupByUnit.keySet()); - for (int i = 0; i < count; i++) { - String company = keySet.get(RandomUtils.nextInt(0, keySet.size())); - List expertsByCompany = expertGroupByUnit.get(company); - for (int j = 0; j < expertsByRecentMeeting.size(); j++) { - List experts = expertsByRecentMeeting.get(j); - List notInvitedUsers = expertsByCompany.stream() - .filter(w -> expertMatchNone(experts, w)) - .collect(Collectors.toList()); - if (!notInvitedUsers.isEmpty()) { - result.add(RandomUtil.randomEle(notInvitedUsers)); - break; - } else if (j == (expertsByRecentMeeting.size() - 1)) { - result.add(RandomUtil.randomEle(expertsByCompany)); - } - } - if (result.size() < count) { - keySet.remove(company); - if (keySet.isEmpty()) { - break; - } - } - } - return result; - } - } - - public static List inviteGroupByStrip(Map> expertStripGroup, - List userFullInfoList, - List> expertsByRecentMeeting, - Integer count) { - if (MapUtils.isEmpty(expertStripGroup)) { - return Collections.emptyList(); - } - Map userMap = CollUtils.listToMap(userFullInfoList, ExpertUserFullInfo::getUserId); - if (expertsByRecentMeeting.isEmpty()) { - return expertStripGroup.values().stream() - .map(w -> { - ExpertUserFullInfo euf; - while (true) { - ExpertGovBusinessStrip ele = RandomUtil.randomEle(w); - euf = userMap.remove(ele.getExpertUserId()); - if (euf != null || w.isEmpty() || userMap.isEmpty()) { - break; - } - w.remove(ele); - } - return euf; - }).filter(Objects::nonNull) - .limit(count) - .collect(Collectors.toList()); - } else { - List lockedUsers = new ArrayList<>(); - List strips = new ArrayList<>(expertStripGroup.keySet()); - for (int i = 0; i < count; i++) { - String strip = strips.get(RandomUtils.nextInt(0, strips.size())); - List expertsByStrip = expertStripGroup.get(strip); - for (int j = 0; j < expertsByRecentMeeting.size(); j++) { - List experts = expertsByRecentMeeting.get(j); - List notInvitedUsers = expertsByStrip.stream() - .map(w -> userMap.get(w.getExpertUserId())) - .filter(w -> w != null && expertMatchNone(experts, w)) - .collect(Collectors.toList()); - if (!notInvitedUsers.isEmpty()) { - ExpertUserFullInfo usf = RandomUtil.randomEle(notInvitedUsers); - // 防止一个专家多条线 - userMap.remove(usf.getUserId()); - lockedUsers.add(usf); - break; - } else if (j == (expertsByRecentMeeting.size() - 1)) { - ExpertUserFullInfo euf; - ExpertGovBusinessStrip egs = RandomUtil.randomEle(expertsByStrip); - while (true) { - euf = userMap.remove(egs.getExpertUserId()); - if (euf != null || expertsByStrip.isEmpty() || userMap.isEmpty()) { - break; - } - expertsByStrip.remove(egs); - } - if (euf != null) { - lockedUsers.add(euf); - } - } - if (userMap.isEmpty()) { - return lockedUsers; - } - } - if (lockedUsers.size() < count) { - strips.remove(strip); - if (strips.isEmpty()) { - break; - } - } - } - return lockedUsers; - } - } - - /** - * 随机抽取专家 - * - * @param userFullInfos 可抽取的所有专家 - * @param expertsByRecentMeeting 最近会议抽取到的专家 - * @param count 抽取数量 - * @return 抽取到的专家信息 - * @author WendyYang - **/ - public static List inviteWithoutCompany(List userFullInfos, - List> expertsByRecentMeeting, - Integer count) { - List result; - if (expertsByRecentMeeting.isEmpty()) { - result = RandomUtil.randomEleList(userFullInfos, count); - } else { - result = new ArrayList<>(); - for (List experts : expertsByRecentMeeting) { - List notInvitedUsers = userFullInfos.stream() - .filter(w -> expertMatchNone(experts, w)) - .collect(Collectors.toList()); - if (!notInvitedUsers.isEmpty()) { - result.addAll(notInvitedUsers); - if (result.size() >= count) { - return result.subList(0, count); - } - userFullInfos.removeAll(notInvitedUsers); - } - } - if (userFullInfos.isEmpty()) { - return result; - } - int restCnt = Math.min(count - result.size(), userFullInfos.size()); - if (userFullInfos.size() > restCnt) { - result.addAll(RandomUtil.randomEleList(userFullInfos, restCnt)); - } else { - result.addAll(userFullInfos); - } - } - return result; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java deleted file mode 100644 index 9de3586..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.meeting.constant.MeetingMsgTemplateConst; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingReviewTypeEnum; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sms.constant.VoiceSmsTemplateConst; -import com.ningdatech.pmapi.sms.utils.DateUtil; -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.service.INotifyService; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; -import com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * MeetingMsgHelper - *

- * - * @author WendyYang - * @since 2023/4/20 - **/ -@Component -@AllArgsConstructor -public class MeetingCallOrMsgHelper { - - private final IUserInfoService userInfoService; - private final YxtCallOrSmsHelper yxtCallOrSmsHelper; - private final INdWorkNoticeStagingService workNoticeStagingService; - private final IDingEmployeeInfoService dingEmployeeInfoService; - private final IDingOrganizationService dingOrganizationService; - private final INotifyService notifyService; - - private static String officialTime(LocalDateTime time) { - return time.format(DateUtil.DTF_YMD_HM); - } - - private Notify getNotify(Long userId, String msg, MsgTypeEnum type, Map extraPara) { - Notify notify = new Notify(); - notify.setUserId(userId); - notify.setContent(msg); - notify.setType(type.name()); - notify.setReaded(Boolean.FALSE); - notify.setCreateTime(LocalDateTime.now()); - String extraJson = JSON.toJSONString(extraPara); - notify.setExtraInfo(extraJson); - return notify; - } - - private WorkNoticeInfo getSendWorkNoticeInfo(Long accountId) { - WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); - workNoticeInfo.setAccountId(accountId); - // 根据浙政钉用户ID获取部门code - DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getAccountId, accountId) - .eq(DingEmployeeInfo::getMainJob, String.valueOf(Boolean.TRUE)) - .last("limit 1")); - String organizationCode = employeeInfo.getOrganizationCode(); - workNoticeInfo.setOrganizationCode(organizationCode); - // 根据部门code获取部门名称 - DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, organizationCode)); - String organizationName = dingOrganization.getOrganizationName(); - workNoticeInfo.setOrganizationName(organizationName); - // 构建唯一的消息ID - String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE - + organizationName + accountId + StrUtil.UNDERLINE + System.currentTimeMillis(); - workNoticeInfo.setBizMsgId(bizMsgId); - String receiverUserId = String.valueOf(accountId); - workNoticeInfo.setReceiverUserId(receiverUserId); - return workNoticeInfo; - } - - @Transactional(rollbackFor = Exception.class) - public void sendInviteStopMsg(Long userId, Long meetingId, String meetingName) { - UserInfo info = userInfoService.getById(userId); - String msgContent = String.format(MeetingMsgTemplateConst.INVITE_END, meetingName); - // 音信通消息 - SendSmsContext yxtContent = new SendSmsContext(); - yxtContent.setContent(msgContent); - yxtContent.setReceiveNumber(info.getMobile()); - yxtCallOrSmsHelper.sendSms(yxtContent); - // 发送工作通知 - if (info.getAccountId() != null) { - WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); - swn.setMsg(msgContent); - workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); - Map map = new HashMap<>(2); - map.put("meetingId", meetingId); - Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); - notifyService.save(notify); - } - } - - @Transactional(rollbackFor = Exception.class) - public void sendConfirmedRosterMsg(List experts, Meeting meeting) { - List userIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); - List userInfos = userInfoService.listByIds(userIds); - Map userMap = CollUtils.listToMap(userInfos, UserInfo::getId); - String sTime = officialTime(meeting.getStartTime()); - String eTime = officialTime(meeting.getEndTime()); - String meetingTime = sTime + "至" + eTime; - List yxtContents = new ArrayList<>(); - List notifies = new ArrayList<>(); - List workingNotices = new ArrayList<>(); - experts.forEach(w -> { - String msgContent = String.format(MeetingMsgTemplateConst.CONFIRMED_ROSTER, - w.getExpertName(), officialTime(w.getCreateOn()), meetingTime, meeting.getMeetingAddress(), - meeting.getConnecter(), meeting.getContact()); - // 音信通消息 - SendSmsContext yxtContent = new SendSmsContext(); - yxtContent.setContent(msgContent); - yxtContent.setReceiveNumber(w.getMobile()); - yxtContents.add(yxtContent); - UserInfo info = userMap.get(w.getExpertId()); - // 发送工作通知 - if (info.getAccountId() != null) { - WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); - swn.setMsg(msgContent); - workingNotices.add(swn); - Map map = new HashMap<>(2); - map.put("meetingId", meeting.getId()); - Notify notify = getNotify(info.getId(), msgContent, MsgTypeEnum.EXPERT_REVIEW, map); - notifies.add(notify); - } - }); - notifyService.saveBatch(notifies); - yxtCallOrSmsHelper.sendSms(yxtContents); - workNoticeStagingService.addByWorkNotice(workingNotices, MsgTypeEnum.EXPERT_REVIEW); - } - - - public void sendCancelMeetingMsg(List experts, Meeting meeting) { - String startTime = officialTime(meeting.getStartTime()); - String meetingType = MeetingReviewTypeEnum.getValue(meeting.getType()); - List contexts = experts.stream().map(w -> { - String content = String.format(MeetingMsgTemplateConst.MEETING_CANCEL, - w.getExpertName(), startTime, meetingType, meeting.getContact()); - SendSmsContext context = new SendSmsContext(); - context.setReceiveNumber(w.getMobile()); - context.setContent(content); - return context; - }).collect(Collectors.toList()); - yxtCallOrSmsHelper.sendSms(contexts); - } - - /** - * 提交专家通知音信通任务 - * - * @param meeting 会议信息 - * @param experts 待通知专家 - * @author WendyYang - **/ - public void callExpertByMeeting(Meeting meeting, List experts) { - String voiceContent = String.format(VoiceSmsTemplateConst.OFFLINE_TEMPLATE, - meeting.getHoldOrg(), meeting.getName(), officialTime(meeting.getStartTime()), - meeting.getMeetingAddress()); - List callContexts = CollUtils.convert(experts, w -> { - SubmitTaskCallContext context = new SubmitTaskCallContext(); - context.setContent(voiceContent); - context.setReceiveNumber(w.getMobile()); - return context; - }); - String submitKey = yxtCallOrSmsHelper.submitCallTask(callContexts); - experts.forEach(w -> w.setSubmitKey(submitKey)); - } - - public void sendExpertLeaveMsg(MeetingExpert expert, Meeting meeting) { - Long userId = meeting.getCreateBy(); - String msgContent; - if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { - msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_RANDOM, meeting.getName()); - } else { - msgContent = String.format(MeetingMsgTemplateConst.EXPERT_LEAVE_APPOINT, meeting.getName(), expert.getExpertName()); - } - UserInfo info = userInfoService.getById(userId); - SendSmsContext yxtContent = new SendSmsContext(); - yxtContent.setContent(msgContent); - yxtContent.setReceiveNumber(info.getMobile()); - yxtCallOrSmsHelper.sendSms(yxtContent); - // 发送工作通知 - if (info.getAccountId() != null) { - WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); - swn.setMsg(msgContent); - workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); - Map map = new HashMap<>(2); - map.put("meetingId", meeting.getId()); - Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); - notifyService.save(notify); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingDataScopeHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingDataScopeHelper.java deleted file mode 100644 index 6c4d68e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingDataScopeHelper.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.entity.ViewRegionDTO; -import com.ningdatech.pmapi.sys.model.entity.Role; -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 org.springframework.stereotype.Component; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - *

- * MeetingDataScopeHelper - *

- * - * @author WendyYang - * @since 2023/4/27 - **/ -@Component -@AllArgsConstructor -public class MeetingDataScopeHelper { - - private final RegionCacheHelper regionCacheHelper; - - private static RoleEnum getRolePriorityMax() { - List roleList = LoginUserUtil.loginUserDetail().getUserRoleList(); - List roleCodeList = CollUtils.fieldList(roleList, Role::getCode); - if (roleCodeList.contains(RoleEnum.SUPER_ADMIN.name())) { - return RoleEnum.SUPER_ADMIN; - } - if (roleCodeList.contains(RoleEnum.REGION_MANAGER.name())) { - return RoleEnum.REGION_MANAGER; - } - return RoleEnum.EXPERT_ADMIN; - } - - public ViewRegionDTO meetingListViewRegions() { - RoleEnum role = getRolePriorityMax(); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - Integer regionLevel = user.getRegionLevel(); - Collection regions; - switch (role) { - case SUPER_ADMIN: - regions = null; - break; - case REGION_MANAGER: - regions = regionCacheHelper.listChildRegionCodeList(regionCode, regionLevel); - break; - case EXPERT_ADMIN: - regions = Collections.singletonList(regionCode); - break; - default: - regions = Collections.emptyList(); - break; - } - return new ViewRegionDTO(regions, regionLevel); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java deleted file mode 100644 index 984d8cd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java +++ /dev/null @@ -1,251 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.Assert; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; -import com.ningdatech.pmapi.expert.model.dto.ExpertUserFullInfoDTO; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingReviewTypeEnum; -import com.ningdatech.pmapi.meeting.entity.req.MeetingListReq; -import com.ningdatech.pmapi.meeting.entity.vo.ExpertBasicInfoVO; -import com.ningdatech.pmapi.meeting.entity.vo.MeetingByManagerVO; -import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService; -import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.AllArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.*; - -/** - *

- * MeetingManageHelper - *

- * - * @author WendyYang - * @since 17:23 2022/8/23 - */ -@Component -@AllArgsConstructor -public class MeetingManageHelper { - - private final DictionaryCache dictionaryCache; - private final ExpertInfoService expertInfoService; - private final IExpertUserFullInfoService expertUserFullInfoService; - private final IMeetingExpertService meetingExpertService; - private final IExpertInviteRuleService inviteRuleService; - private final IExpertInviteAvoidRuleService inviteAvoidRuleService; - private final RegionCacheHelper regionCacheHelper; - - public void checkReviewProject(MeetingBasicDTO meetingBasic) { - if (meetingBasic.getIsInnerProject()) { - Assert.notEmpty(meetingBasic.getInnerProjects(), "评审项目不能为空"); - } else { - Assert.notEmpty(meetingBasic.getProjects(), "评审项目不能为空"); - } - } - - /** - * 校验会议是否还可继续抽取 - */ - public boolean checkCouldBeInvitedContinue(Long meetingId) { - Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); - List experts = meetingExpertService.listExpertLastByMeetingId(meetingId); - if (experts.isEmpty()) { - return Boolean.TRUE; - } - Map> expertMap = CollUtils.group(experts, MeetingExpert::getRuleId); - for (Map.Entry entry : ruleMap.entrySet()) { - List tmpExperts = expertMap.get(entry.getKey()); - if (CollUtil.isEmpty(tmpExperts)) { - return Boolean.TRUE; - } - int count = 0; - for (MeetingExpert w : tmpExperts) { - boolean status = ExpertAttendStatusEnum.AGREED.eq(w.getStatus()) || - ExpertAttendStatusEnum.NOTICING.eq(w.getStatus()); - if (status) { - count++; - } - } - if (count < entry.getValue().getCount()) { - return Boolean.TRUE; - } - } - return Boolean.FALSE; - } - - public MeetingByManagerVO buildByMeeting(Meeting meeting) { - return MeetingByManagerVO.builder() - .meetingId(meeting.getId()) - .meetingType(meeting.getType()) - .meetingTypeName(MeetingReviewTypeEnum.getValue(meeting.getType())) - .meetingName(meeting.getName()) - .startTime(meeting.getStartTime()) - .endTime(meeting.getEndTime()) - .inviteType(meeting.getInviteType()) - .confirmedRoster(meeting.getConfirmedRoster()) - .inviteStatus(meeting.getInviteStatus()) - .status(meeting.getStatus()) - .createOn(meeting.getCreateOn()) - .connecter(meeting.getConnecter()) - .contact(meeting.getContact()) - .build(); - } - - public void buildMeetingQuery(LambdaQueryWrapper query, MeetingListReq req) { - if (StrUtils.isNotBlank(req.getRegionCode())) { - List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); - List regionCodes = CollUtils.fieldList(regions, RegionDTO::getRegionCode); - query.in(Meeting::getRegionCode, regionCodes).ge(Meeting::getRegionLevel, req.getRegionLevel()); - } - if (StrUtil.isNotBlank(req.getName())) { - query.like(Meeting::getName, req.getName()); - } - if (StrUtil.isNotBlank(req.getMeetingType())) { - query.eq(Meeting::getType, req.getMeetingType()); - } - if (req.getStartTime() != null) { - query.ge(Meeting::getStartTime, req.getStartTime()); - } - if (req.getEndTime() != null) { - query.le(Meeting::getEndTime, req.getEndTime()); - } - if (req.getConfirmedRoster() != null) { - query.eq(Meeting::getConfirmedRoster, req.getConfirmedRoster()); - } - if (StrUtils.isNotBlank(req.getProjectName())) { - String projectName = "%" + req.getProjectName() + "%"; - query.and(q1 -> q1.exists("select 1 from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id" + - " where mip.meeting_id = meeting.id and np.project_name like {0}", projectName) - .or(q2 -> q2.exists("select 1 from meeting_outer_project mop where mop.meeting_id = meeting.id" + - " and mop.project_name like {0}", projectName))); - } - } - - /** - * 构建用户基本信息 - * - * @param userIds 用户ID - * @return java.util.Map - * @author WendyYang - **/ - public Map getExpertBasicInfo(List userIds) { - List expertInfos = expertInfoService.listExpertUserFullInfoAll(userIds); - return CollUtils.listToMap(expertInfos, ExpertFullInfoAllDTO::getUserId, w -> { - ExpertBasicInfoVO basicInfoVo = new ExpertBasicInfoVO(); - ExpertUserFullInfoDTO userInfo = w.getExpertUserInfoDTO(); - basicInfoVo.setName(userInfo.getName()); - basicInfoVo.setExpertId(w.getUserId()); - basicInfoVo.setContact(userInfo.getPhoneNo()); - basicInfoVo.setCompany(userInfo.getCompany()); - Optional first = w.getExpertDictionaryList().stream() - .filter(dict -> dict.getExpertInfoField().equals(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())) - .findFirst(); - if (first.isPresent()) { - DictionaryDTO dictInfo = dictionaryCache.getByCode(first.get().getDictionaryCode()); - basicInfoVo.setJobLevel(dictInfo.getName()); - } else { - basicInfoVo.setJobLevel(""); - } - basicInfoVo.setCompanyType(""); - return basicInfoVo; - }); - } - - public AvoidRuleDTO getAvoidInfoDto(Long meetingId) { - ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); - AvoidRuleDTO result = new AvoidRuleDTO(); - result.setAvoidOrgIdList(StrUtil.split(avoidRule.getAvoidOrgIds(), ",")); - result.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); - result.setAvoidUnitIdList(StrUtil.split(avoidRule.getAvoidUnitIds(), ",")); - result.setWeekInviteCount(result.getWeekInviteCount()); - return result; - } - - public void saveAvoidInfo(Long meetingId, List expertIds) { - ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); - avoidRule.setAvoidExpertIds(CollUtils.joinByComma(expertIds)); - inviteAvoidRuleService.saveOrUpdate(avoidRule); - } - - /** - * 校验是否能够进行指定邀请 - * - * @param meetingId 会议ID - * @param expertIds 专家ID - * @param inviteType 邀请类型 - * @return 符合邀请规则的专家 - * @author WendyYang - **/ - public List appointExpertCheck(Long meetingId, Integer inviteType, List expertIds) { - List experts = expertUserFullInfoService.listByUserId(expertIds); - AvoidRuleDTO avoidRule; - if (ExpertInviteTypeEnum.RANDOM.eq(inviteType)) { - avoidRule = getAvoidInfoDto(meetingId); - } else { - avoidRule = null; - } - experts.forEach(expert -> { - if (avoidRule != null) { - if (avoidRule.getAvoidUnitIdList().contains(expert.getCompany())) { - throw BizException.wrap("请移除已回避单位的专家"); - } - if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds()) && avoidRule.getExpertIds().contains(expert.getUserId())) { - throw BizException.wrap("请移除已回避的专家"); - } - } - // 校验专家状态 - ExpertAccountStatusEnum accountStatus = ExpertAccountStatusEnum.of(expert.getExpertAccountStatus()); - if (!accountStatus.equals(ExpertAccountStatusEnum.AVAILABLE)) { - throw BizException.wrap("专家%s不可被抽取", expert.getExpertName()); - } - }); - Map expertMap = CollUtils.listToMap(experts, ExpertUserFullInfo::getUserId); - List meetingExperts = meetingExpertService.listByMeetingId(meetingId); - if (!meetingExperts.isEmpty()) { - Comparator comparator = Comparator.comparing(MeetingExpert::getUpdateOn).reversed(); - Collection values = BizUtils.groupFirst(meetingExperts, MeetingExpert::getExpertId, comparator); - values.forEach(w -> { - ExpertUserFullInfo expertInfo = expertMap.get(w.getExpertId()); - if (expertInfo != null) { - String expertName = expertInfo.getExpertName(); - switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) { - case AGREED: - throw BizException.wrap("专家 %s 已同意参加", expertName); - case NOTICING: - throw BizException.wrap("专家 %s 正在通知中", expertName); - default: - break; - } - } - }); - } - return experts; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/YxtCallOrSmsHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/YxtCallOrSmsHelper.java deleted file mode 100644 index ee765ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/YxtCallOrSmsHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.meeting.helper; - -import com.ningdatech.yxt.client.YxtClient; -import com.ningdatech.yxt.constants.YxtSmsSignEnum; -import com.ningdatech.yxt.model.cmd.SendSmsCmd; -import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; -import com.ningdatech.yxt.model.cmd.SubmitTaskCallResponse; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; - -import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; -import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.of; - -/** - *

- * YxtCallOrSmsHelper - *

- * - * @author WendyYang - * @since 23:59 2022/8/31 - */ -@Component -@AllArgsConstructor -public class YxtCallOrSmsHelper { - - private final YxtClient yxtClient; - - public String submitCallTask(List callContexts) { - SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts)); - return callResponse.getSubmitKey(); - } - - public void sendSms(List smsList) { - yxtClient.submitSmsTask(new SendSmsCmd() {{ - setContextList(smsList); - setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - }}); - } - - public void sendSms(SendSmsContext sms) { - sendSms(Collections.singletonList(sms)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java deleted file mode 100644 index b7c94b3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.entity.req.MeetingCalenderReq; -import com.ningdatech.pmapi.meeting.entity.req.MeetingListReq; -import com.ningdatech.pmapi.meeting.entity.vo.*; -import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertEvaluationService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.tuple.Pair; -import org.springframework.stereotype.Component; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * DashboardManage - *

- * - * @author WendyYang - * @since 23:04 2022/8/24 - */ -@Component -@AllArgsConstructor -public class DashboardManage { - - private final MeetingManage meetingManage; - private final IMeetingService meetingService; - private final IMeetingExpertService meetingExpertService; - private final MeetingManageHelper meetingManageHelper; - private final IMeetingExpertEvaluationService meetingExpertEvaluationService; - private final DictionaryCache dictionaryCache; - - public static final int MEETING_CALENDER_MONTHS = 2; - - public List meetingCalender(MeetingCalenderReq po) { - if (po.getStartDate().plusMonths(MEETING_CALENDER_MONTHS).isBefore(po.getEndDate())) { - throw new BizException("最多可查询两个月数据"); - } - MeetingListReq meetingListPo = new MeetingListReq(); - meetingListPo.setPageSize(500); - meetingListPo.setStartTime(po.getStartDate().atStartOfDay()); - meetingListPo.setEndTime(po.getEndDate().atTime(LocalTime.MAX)); - PageVo meetingPage = meetingManage.meetingListForExpert(meetingListPo); - Map> meetingByDate = meetingPage.getRecords().stream().map(w -> { - List> pairs = new ArrayList<>(); - LocalDateTime tempTime = w.getStartTime(); - while (tempTime.isBefore(w.getEndTime())) { - pairs.add(Pair.of(tempTime.toLocalDate(), w)); - tempTime = tempTime.plusDays(1); - } - return pairs; - }).flatMap(Collection::stream) - .collect(Collectors.groupingBy(Pair::getLeft, - Collectors.collectingAndThen(Collectors.mapping(Pair::getRight, Collectors.toList()), - w -> { - w.sort(Comparator.comparing(MeetingByManagerVO::getStartTime)); - return w; - }))); - LocalDate tempDate = po.getStartDate(); - List result = new ArrayList<>(); - while (!tempDate.isAfter(po.getEndDate())) { - MeetingCalenderItemVO item = new MeetingCalenderItemVO(); - List meetings = meetingByDate.get(tempDate); - item.setHasMeeting(meetings != null); - if (item.getHasMeeting()) { - item.setMeetings(meetings); - } - item.setToday(tempDate); - result.add(item); - tempDate = tempDate.plusDays(1); - } - return result; - } - - public PageVo expertEvaluationToDo(PagePo po) { - PageVo result = PageVo.of(new ArrayList<>(), 0L); - // 查询所有未完成的项目 - LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) - .select(Meeting::getId) - .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) - .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()); - List meetings = meetingService.list(query); - if (meetings.isEmpty()) { - return PageVo.empty(); - } - List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); - Page page = meetingExpertEvaluationService.pageExpertEvaluationTodo(meetingIds, po); - if (page.getTotal() > 0) { - List expertIds = new ArrayList<>(); - List meetingIdsByPage = new ArrayList<>(); - page.getRecords().forEach(w -> { - meetingIdsByPage.add(w.getMeetingId()); - expertIds.add(w.getExpertId()); - }); - Map meetingMap = CollUtils.listToMap(meetingService.listByIds(meetingIdsByPage), Meeting::getId); - Map basicInfoVoMap = meetingManageHelper.getExpertBasicInfo(expertIds); - page.getRecords().forEach(w -> { - ExpertBasicInfoVO expertInfo = basicInfoVoMap.get(w.getExpertId()); - Meeting meeting = meetingMap.get(w.getMeetingId()); - ExpertEvaluationToDoListItemVO item = BeanUtil.copyProperties(expertInfo, ExpertEvaluationToDoListItemVO.class); - item.setMeetingName(meeting.getName()); - item.setMeetingId(w.getMeetingId()); - item.setExpertMeetingId(w.getId()); - item.setStartTime(meeting.getStartTime()); - item.setEndTime(meeting.getEndTime()); - result.getRecords().add(item); - }); - result.setTotal(page.getTotal()); - } - return result; - } - - public PageVo expertConfirmToDo(PagePo po) { - // 查询所有未完成的项目 - LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) - .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()) - .orderByDesc(Meeting::getStartTime); - List meetings = meetingService.list(query); - if (meetings.isEmpty()) { - return PageVo.empty(); - } - List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); - Map confirmedMap = meetingExpertService.countConfirmedByMeetingIds(meetingIds); - confirmedMap.entrySet().removeIf(w -> { - CountConfirmByMeetingIdDTO confirm = w.getValue(); - return confirm.getConfirmed().equals(confirm.getTotal()); - }); - if (confirmedMap.size() == 0) { - return PageVo.empty(); - } - meetings.removeIf(w -> !confirmedMap.containsKey(w.getId())); - List dataList = meetings.stream() - .skip((long) (po.getPageNumber() - 1) * po.getPageSize()) - .limit(po.getPageSize()).map(w -> { - MeetingConfirmToDoListItemVO item = new MeetingConfirmToDoListItemVO(); - CountConfirmByMeetingIdDTO confirm = confirmedMap.get(w.getId()); - if (confirm == null) { - item.setTotalExpert(0); - item.setConfirmedExpert(0); - } else { - item.setTotalExpert(confirm.getTotal()); - item.setConfirmedExpert(confirm.getConfirmed()); - } - item.setMeetingId(w.getId()); - item.setEndTime(w.getEndTime()); - item.setStartTime(w.getStartTime()); - item.setStatus(w.getStatus()); - item.setType(dictionaryCache.getByCode(w.getType()).getName()); - item.setMeetingName(w.getName()); - return item; - }).collect(Collectors.toList()); - return PageVo.of(dataList, meetings.size()); - } - - public PageVo expertReplaceTodoList(PagePo po) { - // 查询所有未完成的项目 - LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) - .eq(Meeting::getCreateBy, LoginUserUtil.getUserId()) - .orderByDesc(Meeting::getStartTime); - List meetings = meetingService.list(query); - if (meetings.isEmpty()) { - return PageVo.empty(); - } - List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); - Page page = meetingExpertService.pageExpertByStatusAndMeetingIds(po.page(), meetingIds, null); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - Map meetingMap = CollUtils.listToMap(meetings, Meeting::getId); - List expertIds = CollUtils.fieldList(page.getRecords(), MeetingExpert::getExpertId); - Map basicInfoVoMap = meetingManageHelper.getExpertBasicInfo(expertIds); - List dataList = page.getRecords().stream().map(w -> { - ExpertBasicInfoVO basicInfoVo = basicInfoVoMap.get(w.getExpertId()); - ExpertReplaceTodoListItemVO item = BeanUtil.copyProperties(basicInfoVo, ExpertReplaceTodoListItemVO.class); - item.setMeetingId(w.getMeetingId()); - item.setExpertMeetingId(w.getId()); - Meeting meeting = meetingMap.get(w.getMeetingId()); - item.setMeetingName(meeting.getName()); - item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName()); - item.setStatus(w.getStatus()); - item.setStartTime(meeting.getStartTime()); - item.setEndTime(meeting.getEndTime()); - return item; - }).collect(Collectors.toList()); - return PageVo.of(dataList, page.getTotal()); - } - - public MeetingCountSummaryVO meetingCountSummary() { - Map meetingCountSummary = meetingService.meetingCountSummary(LoginUserUtil.getUserId()); - return MeetingCountSummaryVO.builder() - .canceled(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.CANCELED, 0)) - .completed(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.COMPLETED, 0)) - .toBeHeld(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.TO_BE_HELD, 0)) - .held(meetingCountSummary.getOrDefault(MeetingStatusByDashboard.HELD, 0)) - .build(); - } - - public MeetingCountByExpertVO meetingCountByExpert() { - List attendStatusList = meetingExpertService.listByExpertIdAndStatus(LoginUserUtil.getUserId(), null, null); - MeetingCountByExpertVO result = MeetingCountByExpertVO.init(); - attendStatusList.forEach(w -> { - if (w.getAttended() != null && w.getAttended()) { - result.incrAttended(); - } else { - result.incrToBeAttended(); - } - }); - return result; - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertExportManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertExportManage.java deleted file mode 100644 index f331fd7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertExportManage.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -import cn.hutool.core.lang.Assert; -import cn.hutool.core.lang.UUID; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.model.FreemarkerBatchExportDTO; -import com.ningdatech.pmapi.common.util.FreemarkerWordUtil; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.manage.ExpertReviewManage; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; -import com.ningdatech.pmapi.meeting.entity.dto.*; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService; -import com.ningdatech.pmapi.meeting.service.IMeetingOuterProjectService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sms.utils.DateUtil; -import freemarker.template.TemplateException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; - -/** - *

- * ExpertExportManage - *

- * - * @author WendyYang - * @since 2023/7/24 - **/ -@Slf4j -@Component -@RequiredArgsConstructor -public class ExpertExportManage { - - private final IMeetingService meetingService; - private final IMeetingExpertService meetingExpertService; - private final IMeetingInnerProjectService meetingInnerProjectService; - private final IMeetingOuterProjectService meetingOuterProjectService; - private final IExpertUserFullInfoService expertUserInfoService; - private final IProjectService projectService; - private final ExpertReviewManage expertReviewManage; - - //================================================================================================================== - - private static final String EXPERT_REVIEW = "meeting/专家评审单.ftl"; - - private static final String EXPERT_FEE = "meeting/专家费.ftl"; - - private static final String LABOR_FEE = "meeting/劳务费发放.ftl"; - - private static final String EXPERT_INVITE = "meeting/专家抽取表.ftl"; - - //================================================================================================================== - static Function meetingUsageTime = (type) -> { - if (1 == type) { - return "半天"; - } - if (2 == type) { - return "一天"; - } - return StrUtil.EMPTY; - }; - - static Supplier wordName = () -> UUID.randomUUID().toString(true) + ".doc"; - - private List listExpertsByAgreeOrLeave(Long meetingId) { - Page page = Page.of(1, 20); - meetingExpertService.pageExpertByStatusAndMeetingId(page, meetingId, null, null); - if (page.getTotal() == 0) { - return Collections.emptyList(); - } - page.getRecords().removeIf(w -> !(ExpertAttendStatusEnum.AGREED.eq(w.getStatus()) || ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus()))); - return page.getRecords(); - } - - //================================================================================================================== - - public void exportFeeForExpert(Long meetingId, HttpServletResponse response) { - try { - Meeting meeting = meetingService.getById(meetingId); - ExpertFeeExportDTO data = new ExpertFeeExportDTO(); - data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); - data.setMeetingAddress(meeting.getMeetingAddress()); - List projectNames = new ArrayList<>(); - if (meeting.getIsInnerProject()) { - List inners = meetingInnerProjectService.listByMeetingId(meetingId); - List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); - List projects = projectService.listByIds(projectIds); - projects.forEach(w -> projectNames.add(w.getProjectName())); - } else { - List inners = meetingOuterProjectService.listByMeetingId(meetingId); - inners.forEach(w -> projectNames.add(w.getProjectName())); - } - data.setProjectName(StrUtil.join("、", projectNames)); - data.setExperts(new ArrayList<>()); - // 设置专家信息 - List experts = meetingExpertService.listAgreedExperts(meetingId); - List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); - List expertInfos = expertUserInfoService.listByUserId(expertIds); - Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); - AtomicInteger integer = new AtomicInteger(0); - experts.forEach(w -> { - ExpertInfoDTO expert = new ExpertInfoDTO(); - expert.setNo(integer.incrementAndGet()); - expert.setFee(BigDecimal.valueOf(500)); - expert.setName(w.getExpertName()); - expert.setMobile(w.getMobile()); - ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); - if (expertUser != null) { - expert.setIdcard(expertUser.getIdCard()); - expert.setBankNo(expertUser.getBankNo()); - expert.setBank(expertUser.getBank()); - expert.setCompany(expertUser.getCompany()); - expert.setSex(expertUser.getGender()); - } - data.getExperts().add(expert); - }); - FreemarkerWordUtil.export(wordName.get(), data, response, EXPERT_FEE); - } catch (TemplateException | IOException e) { - log.error("专家费用单导出异常:{}", meetingId, e); - throw BizException.wrap("专家费用单导出失败"); - } - } - - public void expertReviewTable(Long meetingId, HttpServletResponse response) { - try { - Meeting meeting = meetingService.getById(meetingId); - String startTime = DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy年M月d日"); - List fbeList; - if (meeting.getIsInnerProject()) { - List inners = meetingInnerProjectService.listByMeetingId(meetingId); - Map reviewResultMap = expertReviewManage.buildExpertReviewToStr(meetingId); - List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); - List projects = projectService.listByIds(projectIds); - fbeList = projects.stream().map(w -> { - FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO(); - ExpertReviewTableDTO currData = new ExpertReviewTableDTO(); - currData.setHoldOrg(meeting.getHoldOrg()); - currData.setMeetingTime(startTime); - currData.setMeetingAddress(meeting.getMeetingAddress()); - currData.setProjectName(w.getProjectName()); - currData.setReviewResult(reviewResultMap.get(w.getId())); - fbe.setData(currData); - fbe.setTemplate(EXPERT_REVIEW); - fbe.setFileName(w.getProjectName() + ".doc"); - return fbe; - }).collect(Collectors.toList()); - } else { - List inners = meetingOuterProjectService.listByMeetingId(meetingId); - fbeList = inners.stream().map(w -> { - FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO(); - ExpertReviewTableDTO currData = new ExpertReviewTableDTO(); - currData.setHoldOrg(meeting.getHoldOrg()); - currData.setMeetingTime(startTime); - currData.setMeetingAddress(meeting.getMeetingAddress()); - currData.setProjectName(w.getProjectName()); - fbe.setData(currData); - fbe.setTemplate(EXPERT_REVIEW); - fbe.setFileName(w.getProjectName() + ".doc"); - return fbe; - }).collect(Collectors.toList()); - } - String exportFileName = meeting.getName() + "专家评审表.zip"; - FreemarkerWordUtil.exportBatch(response, fbeList, exportFileName); - } catch (TemplateException | IOException e) { - log.error("专家评审单导出异常:{}", meetingId, e); - throw BizException.wrap("专家评审单导出失败"); - } - } - - public void laborFeeAuditTable(Long meetingId, HttpServletResponse response) { - try { - Meeting meeting = meetingService.getById(meetingId); - LaborFeeAuditTableDTO data = new LaborFeeAuditTableDTO(); - data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); - data.setMeetingUsageTime(meetingUsageTime.apply(meeting.getMeetingUsageTime())); - List projectNames = new ArrayList<>(); - if (meeting.getIsInnerProject()) { - List inners = meetingInnerProjectService.listByMeetingId(meetingId); - List projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId); - List projects = projectService.listByIds(projectIds); - projects.forEach(w -> projectNames.add(w.getProjectName())); - } else { - List inners = meetingOuterProjectService.listByMeetingId(meetingId); - inners.forEach(w -> projectNames.add(w.getProjectName())); - } - data.setProjectName(StrUtil.join("、", projectNames)); - data.setExperts(new ArrayList<>()); - // 设置专家信息 - List experts = listExpertsByAgreeOrLeave(meetingId); - List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); - List expertInfos = expertUserInfoService.listByUserId(expertIds); - Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); - experts.forEach(w -> { - ExpertInfoDTO expert = new ExpertInfoDTO(); - if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) { - expert.setName(w.getExpertName() + "(请假)"); - } else { - expert.setName(w.getExpertName()); - } - ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); - if (expertUser != null) { - expert.setCompany(expertUser.getCompany()); - expert.setJob(expertUser.getAdministrativeDuties()); - } else { - expert.setCompany(StrUtil.EMPTY); - expert.setJob(StrUtil.EMPTY); - } - data.getExperts().add(expert); - }); - data.setExpertCount(experts.size()); - FreemarkerWordUtil.export(wordName.get(), data, response, LABOR_FEE); - } catch (TemplateException | IOException e) { - log.error("劳务费发放审批单导出异常:{}", meetingId, e); - throw BizException.wrap("劳务费发放审批单导出失败"); - } - } - - public void expertInviteTable(Long meetingId, HttpServletResponse response) { - try { - Meeting meeting = meetingService.getById(meetingId); - ExpertInviteTableDTO data = new ExpertInviteTableDTO(); - data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy-MM-dd HH:mm")); - data.setMeetingUsageTime(meetingUsageTime.apply(meeting.getMeetingUsageTime())); - data.setMeetingCreateBy(meeting.getCreator()); - data.setMeetingAddress(meeting.getMeetingAddress()); - if (meeting.getIsInnerProject()) { - List inners = meetingInnerProjectService.listByMeetingId(meetingId); - Assert.isTrue(inners.size() == 1, "专家抽取表导出失败"); - Project project = projectService.getById(inners.get(0).getProjectId()); - data.setProjectCode(project.getProjectCode()); - data.setProjectName(project.getProjectName()); - data.setBuildOrg(project.getBuildOrgName()); - } else { - List inners = meetingOuterProjectService.listByMeetingId(meetingId); - Assert.isTrue(inners.size() == 1, "专家抽取表导出失败"); - data.setProjectName(inners.get(0).getProjectName()); - data.setProjectCode(StrUtil.EMPTY); - data.setBuildOrg(StrUtil.EMPTY); - } - data.setExperts(new ArrayList<>()); - // 设置专家信息 - List experts = listExpertsByAgreeOrLeave(meetingId); - List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); - List expertInfos = expertUserInfoService.listByUserId(expertIds); - Map expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId); - AtomicInteger integer = new AtomicInteger(0); - experts.forEach(w -> { - ExpertInfoDTO expert = new ExpertInfoDTO(); - expert.setNo(integer.incrementAndGet()); - if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) { - expert.setName(w.getExpertName() + "(请假)"); - } else { - expert.setName(w.getExpertName()); - } - expert.setMobile(w.getMobile()); - ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId()); - if (expertUser != null) { - expert.setCompany(expertUser.getCompany()); - } - data.getExperts().add(expert); - }); - FreemarkerWordUtil.export(wordName.get(), data, response, EXPERT_INVITE); - } catch (Exception e) { - log.error("专家抽取表导出异常:{}", meetingId, e); - throw BizException.wrap("专家抽取表导出失败"); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java deleted file mode 100644 index 0452455..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java +++ /dev/null @@ -1,586 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; -import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; -import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService; -import com.ningdatech.pmapi.expert.service.IExpertGovBusinessStripService; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.*; -import com.ningdatech.pmapi.meeting.entity.enumeration.AvoidTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; -import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; -import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.Predicate; -import org.apache.commons.lang3.ObjectUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; -import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule; -import static com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm.*; - -/** - *

- * 专家邀请管理 - *

- * - * @author WendyYang - * @since 18:05 2022/8/8 - */ -@Component -@RequiredArgsConstructor -public class ExpertInviteManage { - - private final IExpertDictionaryService expertDictionaryService; - private final TagCache tagCache; - private final IExpertTagService expertTagService; - private final IExpertIntentionWorkRegionService workRegionService; - private final IExpertInviteRuleService inviteRuleService; - private final IMeetingExpertService meetingExpertService; - private final ExpertInviteHelper expertInviteHelper; - private final IExpertUserFullInfoService expertUserFullInfoService; - private final IMeetingService meetingService; - private final IExpertAvoidCompanyService expertAvoidCompanyService; - private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; - private final IExpertGovBusinessStripService expertGovBusinessStripService; - - @Value("#{randomInviteProperties.recentMeetingCount}") - private Integer recentMeetingCount; - - @Value("#{randomInviteProperties.recentDays}") - private Integer recentDays; - - private static final Predicate> COLL_EMPTY = (coll) -> coll != null && coll.isEmpty(); - - private LambdaQueryWrapper buildBaseExpertQuery() { - return Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .select(ExpertUserFullInfo::getUserId, - ExpertUserFullInfo::getId, - ExpertUserFullInfo::getCompany, - ExpertUserFullInfo::getExpertName, - ExpertUserFullInfo::getCompanyUniqCode, - ExpertUserFullInfo::getPhoneNo) - .eq(ExpertUserFullInfo::getExpertAccountStatus, ExpertAccountStatusEnum.AVAILABLE.getKey()); - } - - private void buildAvoidCompanyAndBusinessStrip(LambdaQueryWrapper query, List units, List strips) { - if (CollUtil.isNotEmpty(units)) { - String unitStr = BizUtils.inSqlJoin(units); - query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" + - " and company_uniq_code in " + unitStr); - } - if (CollUtil.isNotEmpty(strips)) { - String orgStr = BizUtils.inSqlJoin(strips); - query.notExists("select 1 from expert_gov_business_strip egbs where egbs.expert_user_id = nd_expert_user_full_info.user_id" + - " and business_strip_code in " + orgStr); - } - } - - /** - * 获取一周内被抽中并同意参会的专家ID - * - * @param agreeCnt 一周内被抽中并同意参会次数 - * @param sTime 会议开始时间 - * @param days 天数 - * @return java.util.List - * @author WendyYang - **/ - private List listAgreedUserIdByRecentMeetings(int agreeCnt, int days, LocalDateTime sTime) { - if (agreeCnt == 0 || days == 0) { - return Collections.emptyList(); - } - LocalDateTime beginLimit = sTime.minusDays(days); - return meetingExpertService.listAgreeExpertIdByRecentDaysAndAgreeCount(agreeCnt, beginLimit, sTime); - } - - /** - * 增加专家层级限制 - * - * @param query 查询 - * @param rule 随机邀请规则 - */ - private static void addRegionLimit(LambdaQueryWrapper query, RandomInviteRuleDTO rule) { - if (CollUtil.isNotEmpty(rule.getExpertRegionList())) { - String inSqlParam = rule.getExpertRegionList().stream() - .map(w -> "('" + w.getRegionCode() + "'," + w.getRegionLevel() + ")") - .collect(Collectors.joining(",", "(", ")")); - query.apply("(region_code, region_level) in " + inSqlParam); - } - } - - /** - * 获取满足履职意向地的专家ID - * null -> 表示无需过滤 - * - * @param rule 抽取规则 - * @return java.util.List - * @author WendyYang - **/ - private List expertIdsByRegion(RandomInviteRuleDTO rule) { - if (rule.getIntentionRegionCode() == null || rule.getIntentionRegionLevel() == null) { - return null; - } - return workRegionService.userIdsMatchIntentionRegion(rule.getIntentionRegionCode(), rule.getIntentionRegionLevel()); - } - - - /** - * 如果抽取回避单位和专家回避单位一致,同样需要回避该专家 - * - * @param unitCodeList / - * @return / - */ - private List avoidCompanyExpertIds(List unitCodeList) { - if (CollUtil.isEmpty(unitCodeList)) { - return new ArrayList<>(); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertAvoidCompany.class) - .select(ExpertAvoidCompany::getUserId) - .in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList); - List expertAvoidCompanyList = expertAvoidCompanyService.list(query); - return CollUtils.fieldList(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); - } - - private MergeExpertIdDTO mergeExpertIdsByCondition(RandomInviteRuleDTO rule, AvoidRuleDTO avoidInfo) { - // 处理履职意向地 - List expertIdsByIntentionRegion = expertIdsByRegion(rule); - if (COLL_EMPTY.evaluate(expertIdsByIntentionRegion)) { - return MergeExpertIdDTO.noExpert(); - } - // 处理专家标签 - List expertIdsByTag = expertIdsByTag(rule); - if (COLL_EMPTY.evaluate(expertIdsByTag)) { - return MergeExpertIdDTO.noExpert(); - } - // 处理专家字典 - List expertIdsByDict = expertIdsByDict(rule); - if (COLL_EMPTY.evaluate(expertIdsByDict)) { - return MergeExpertIdDTO.noExpert(); - } - // 处理专家回避单位 与 抽取回避单位是否相同 - List avoidExpertIdsByUnit = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList()); - - MergeExpertIdDTO merge = new MergeExpertIdDTO(); - // 聚合用户ID - List expertIdsIn = new ArrayList<>(); - if (ObjectUtils.anyNotNull(expertIdsByDict, expertIdsByTag, expertIdsByIntentionRegion)) { - Optional.ofNullable(expertIdsByDict).ifPresent(expertIdsIn::addAll); - Optional.ofNullable(expertIdsByTag).ifPresent(item -> { - if (expertIdsIn.isEmpty()) { - expertIdsIn.addAll(expertIdsByTag); - } else { - expertIdsIn.removeIf(w -> !expertIdsByTag.contains(w)); - } - }); - Optional.ofNullable(expertIdsByIntentionRegion).ifPresent(item -> { - if (expertIdsIn.isEmpty()) { - expertIdsIn.addAll(expertIdsByIntentionRegion); - } else { - expertIdsIn.removeIf(w -> !expertIdsByIntentionRegion.contains(w)); - } - }); - if (expertIdsIn.isEmpty()) { - return MergeExpertIdDTO.noExpert(); - } - merge.setExpertIdsIn(expertIdsIn); - } - if (CollUtil.isNotEmpty(avoidExpertIdsByUnit)) { - if (expertIdsIn.isEmpty()) { - merge.setExpertIdsNotIn(avoidExpertIdsByUnit); - } else { - expertIdsIn.removeIf(avoidExpertIdsByUnit::contains); - if (expertIdsIn.isEmpty()) { - return MergeExpertIdDTO.noExpert(); - } - } - } - merge.setSkip(Boolean.FALSE); - return merge; - } - - /** - * 根据专家标签获取满足的专家ID - * - * @param rule 抽取规则 - * @return java.util.List - * @author WendyYang - **/ - private List expertIdsByTag(RandomInviteRuleDTO rule) { - if (CollectionUtils.isEmpty(rule.getExpertTags())) { - return null; - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertTag.class) - .select(ExpertTag::getUserId, ExpertTag::getExpertInfoField); - rule.getExpertTags().forEach(tag -> { - List codes = tag.getTagCodes().stream() - .map(tagCache::listChildrenCodes) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - query.or(wrapper -> wrapper.eq(ExpertTag::getExpertInfoField, tag.getExpertTag()) - .in(ExpertTag::getTagCode, codes)); - }); - List expertTagList = expertTagService.list(query); - return expertTagList.stream() - .collect(Collectors.groupingBy(ExpertTag::getUserId, Collectors.collectingAndThen(Collectors.toList(), - tags -> CollUtils.fieldList(tags, ExpertTag::getExpertInfoField).size()))) - .entrySet().stream().filter(w -> w.getValue() == rule.getExpertTags().size()) - .map(Map.Entry::getKey).collect(Collectors.toList()); - } - - /** - * 根据专家字典获取满足的专家ID - * null -> 表示无需过虑 - * 空集合 -> 未查到 - * - * @param rule 抽取规则 - * @return java.util.List - * @author WendyYang - **/ - private List expertIdsByDict(RandomInviteRuleDTO rule) { - if (CollectionUtils.isEmpty(rule.getExpertDicts())) { - return null; - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) - .select(ExpertDictionary::getUserId, ExpertDictionary::getExpertInfoField); - for (ExpertDictChooseDTO dict : rule.getExpertDicts()) { - query.or(wrapper -> wrapper.eq(ExpertDictionary::getExpertInfoField, dict.getExpertDict()) - .in(ExpertDictionary::getDictionaryCode, dict.getDictCodes())); - } - List expertDictionaryList = expertDictionaryService.list(query); - return expertDictionaryList.stream() - .collect(Collectors.groupingBy(ExpertDictionary::getUserId, - Collectors.collectingAndThen(Collectors.toList(), - dicts -> CollUtils.fieldList(dicts, ExpertDictionary::getExpertInfoField).size()))) - .entrySet().stream().filter(w -> w.getValue() == rule.getExpertDicts().size()) - .map(Map.Entry::getKey).collect(Collectors.toList()); - } - - - /** - * 专家抽取(随机) - * - * @param avoidRule 回避信息 - * @param randomRule 抽取规则 - * @param invitedExpertIds 指定抽取专家ID - * @param meetingCreateOn 会议创建时间 - * @return 满足抽取条件的专家 - * @author WendyYang - **/ - public ExpertChooseDTO expertInviteByRandomRule(AvoidRuleDTO avoidRule, - RandomInviteRuleDTO randomRule, - List invitedExpertIds, - LocalDateTime sTime, - LocalDateTime eTime, - LocalDateTime meetingCreateOn) { - ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); - MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); - if (merge.getSkip()) { - return result; - } - boolean avoidExpert = CollUtil.isNotEmpty(avoidRule.getExpertIds()); - boolean avoidCompany = CollUtil.isNotEmpty(avoidRule.getAvoidUnitIdList()); - Set avoidCompanyUniqCodes = new HashSet<>(); - if (avoidCompany) { - avoidCompanyUniqCodes.addAll(avoidRule.getAvoidUnitIdList()); - } - if (CollUtil.isNotEmpty(invitedExpertIds)) { - List tmpCompanyUniqCodes = expertUserFullInfoService.listCompanyUniqCodeByUserIds(invitedExpertIds); - avoidCompanyUniqCodes.addAll(tmpCompanyUniqCodes); - } - // 回避信息 - LambdaQueryWrapper query = buildBaseExpertQuery(); - query.notIn(!avoidCompanyUniqCodes.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, avoidCompanyUniqCodes); - // 处理回避单位与回避条线 - buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); - Set expertIdsIn = new HashSet<>(); - Set expertIdsNotIn = new HashSet<>(); - if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { - expertIdsIn.addAll(merge.getExpertIdsIn()); - } else if (CollUtil.isNotEmpty(merge.getExpertIdsNotIn())) { - expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); - } - // 处理回避专家次数 - if (avoidRule.getWeekInviteCount() != null) { - Integer weekInviteCount = avoidRule.getWeekInviteCount(); - List tmpExpertIdsNotIn = listAgreedUserIdByRecentMeetings(weekInviteCount, recentDays, meetingCreateOn); - expertIdsNotIn.addAll(tmpExpertIdsNotIn); - } - // 处理专家层级 - addRegionLimit(query, randomRule); - if (!expertIdsIn.isEmpty()) { - if (avoidExpert) { - expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); - if (expertIdsIn.isEmpty()) { - // 字典、标签、履职意向地 筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的 - return result; - } - } - if (CollUtil.isNotEmpty(invitedExpertIds)) { - expertIdsIn.removeIf(invitedExpertIds::contains); - if (expertIdsIn.isEmpty()) { - return result; - } - } - // 过滤掉已参加会议的专家 - List expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(sTime, eTime); - expertIdsIn.removeIf(expertIdsLockByMeeting::contains); - if (expertIdsIn.isEmpty()) { - return result; - } - } else if (avoidExpert || CollUtil.isNotEmpty(invitedExpertIds)) { - Set tmpExpert = expertInviteHelper.getAvoidExpert(invitedExpertIds, avoidRule, sTime, eTime); - expertIdsNotIn.addAll(tmpExpert); - } else { - Set tmpNotInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime); - expertIdsNotIn.addAll(tmpNotInUserIds); - } - if (!expertIdsIn.isEmpty()) { - query.in(ExpertUserFullInfo::getUserId, expertIdsIn); - } else if (!expertIdsNotIn.isEmpty()) { - query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); - } - List userInfoList = expertUserFullInfoService.list(query); - if (userInfoList.isEmpty()) { - return result; - } - AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType()); - switch (avoidType) { - case NONE: - result.setExperts(inviteWithoutCompany(userInfoList, expertsByRecentMeeting(), randomRule.getCount())); - result.setTotal(userInfoList.size()); - break; - case CURR_UNIT: - Map> unitGroup = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode); - result.setExperts(inviteGroupByUnit(unitGroup, expertsByRecentMeeting(), randomRule.getCount())); - result.setTotal(unitGroup.size()); - break; - case CURR_STRIP: - List userIds = CollUtils.fieldList(userInfoList, ExpertUserFullInfo::getUserId); - List expertStrips = expertGovBusinessStripService.listByUserIds(userIds); - if (!expertStrips.isEmpty()) { - Map> stripGroup = CollUtils.group(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode); - result.setExperts(inviteGroupByStrip(stripGroup, userInfoList, expertsByRecentMeeting(), randomRule.getCount())); - result.setTotal(stripGroup.size()); - } else { - result.setTotal(0); - } - break; - } - return result; - } - - /** - * 专家替换、补充 - * - * @param avoidRule 回避信息 - * @param randomRule 随机抽取 - * @param invitedExperts 已抽取人员 - * @param count 抽取数量 - * @param msTime 会议开始时间 - * @param meTime 会议结束时间 - * @param reInvite 邀请已拒绝 - * @return {@link ExpertChooseDTO} - * @author WendyYang - **/ - public ExpertChooseDTO expertReplaceByRandomRule(AvoidRuleDTO avoidRule, - RandomInviteRuleDTO randomRule, - Collection invitedExperts, - Integer count, - LocalDateTime msTime, - LocalDateTime meTime, - LocalDateTime tsTime, - boolean reInvite) { - ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); - // 合并标签、字典 - MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); - if (merge.getSkip()) { - return result; - } - Set expertIdsIn = new HashSet<>(); - Set expertIdsNotIn = new HashSet<>(); - if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { - expertIdsIn.addAll(merge.getExpertIdsIn()); - } else if (CollUtil.isNotEmpty(merge.getExpertIdsNotIn())) { - expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); - } - LambdaQueryWrapper query = buildBaseExpertQuery(); - // 设置回避单位 - Set notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList()); - // 处理回避单位与回避条线 - buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); - // 处理回避专家次数 - if (avoidRule.getWeekInviteCount() != null) { - Integer weekInviteCount = avoidRule.getWeekInviteCount(); - List tmpExpertIdsNotIn = listAgreedUserIdByRecentMeetings(weekInviteCount, recentDays, msTime); - expertIdsNotIn.addAll(tmpExpertIdsNotIn); - } - // 处理专家层级 - addRegionLimit(query, randomRule); - - if (expertIdsIn.size() > 0) { - if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) { - expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); - if (expertIdsIn.isEmpty()) { - // 字典、标签、履职意向地筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的 - return result; - } - } - List lockExpertIds = expertInviteHelper.listInvitedExpertByTime(msTime, meTime); - expertIdsIn.removeIf(lockExpertIds::contains); - if (expertIdsIn.isEmpty()) { - return result; - } - } else if (CollUtil.isNotEmpty(avoidRule.getExpertIds())) { - Set notInExpertIds = expertInviteHelper.getAvoidExpert(avoidRule.getExpertIds(), null, msTime, meTime); - expertIdsNotIn.addAll(notInExpertIds); - } else { - Set notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(msTime, meTime); - expertIdsNotIn.addAll(notInUserIds); - } - Map> expertGroupByStatus = invitedExperts.stream() - .collect(Collectors.groupingBy(w -> ExpertAttendStatusEnum.getByCode(w.getStatus()))); - // 回避同单位其他专家 - List agreeOrNoticing = new ArrayList<>(); - BizUtils.notEmpty(expertGroupByStatus.get(AGREED), agreeOrNoticing::addAll); - BizUtils.notEmpty(expertGroupByStatus.get(NOTICING), agreeOrNoticing::addAll); - List agreeOrNoticingExpertIds = CollUtils.fieldList(agreeOrNoticing, MeetingExpert::getExpertId); - if (agreeOrNoticingExpertIds.size() > 0) { - expertIdsNotIn.addAll(agreeOrNoticingExpertIds); - List agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds); - List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); - notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); - } - // 已请假的专家不再抽取 - List expertsOnLeave = expertGroupByStatus.get(ON_LEAVE); - if (CollUtil.isNotEmpty(expertsOnLeave)) { - expertIdsNotIn.addAll(CollUtils.fieldList(expertsOnLeave, MeetingExpert::getExpertId)); - } - // 处理已拒绝专家与重复抽取 - BizUtils.notEmpty(expertGroupByStatus.get(REFUSED), refuseExperts -> { - List tmpExpertIdsNotIn; - if (reInvite) { - tmpExpertIdsNotIn = refuseExperts.stream() - .filter(w -> w.getCreateOn().isAfter(tsTime)) - .map(MeetingExpert::getExpertId) - .collect(Collectors.toList()); - } else { - tmpExpertIdsNotIn = CollUtils.fieldList(refuseExperts, MeetingExpert::getExpertId); - } - expertIdsNotIn.addAll(tmpExpertIdsNotIn); - }); - - boolean hasExpertIdIn = !expertIdsIn.isEmpty(); - boolean hasExpertIdNotIn = !expertIdsNotIn.isEmpty(); - if (hasExpertIdIn && hasExpertIdNotIn) { - expertIdsIn.removeAll(expertIdsNotIn); - if (expertIdsIn.isEmpty()) { - return result; - } - query.in(ExpertUserFullInfo::getUserId, expertIdsIn); - } else if (hasExpertIdIn) { - query.in(ExpertUserFullInfo::getUserId, expertIdsIn); - } else if (hasExpertIdNotIn) { - query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); - } - query.notIn(notInCompanyUniqCodeList.size() > 0, ExpertUserFullInfo::getCompanyUniqCode, notInCompanyUniqCodeList); - List userFullInfos = expertUserFullInfoService.list(query); - if (userFullInfos.size() == 0) { - return result; - } - Map> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode); - result.setTotal(userGroupByUnit.size()); - result.setExperts(inviteGroupByUnit(userGroupByUnit, expertsByRecentMeeting(), count)); - return result; - } - - private List> expertsByRecentMeeting() { - LambdaQueryWrapper query = Wrappers.lambdaQuery(Meeting.class) - .select(Meeting::getId) - .eq(Meeting::getInviteStatus, Boolean.TRUE) - .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) - .orderByDesc(Meeting::getCreateOn) - .last("limit " + recentMeetingCount); - List meetingIds = CollUtils.fieldList(meetingService.list(query), Meeting::getId); - if (meetingIds.isEmpty()) { - return Collections.emptyList(); - } - Map> groupByMeetingId = meetingExpertService.listByMeetingIds(meetingIds) - .stream().collect(Collectors.groupingBy(MeetingExpert::getMeetingId)); - return groupByMeetingId.entrySet().stream() - .sorted(Map.Entry.comparingByKey(Comparator.reverseOrder())) - .map(Map.Entry::getValue) - .collect(Collectors.toList()); - } - - /** - * 专家抽取(会议创建时抽取) - * - * @param randomRules 随机抽取规则 - * @param avoidRule 回避信息 - * @param meeting 会议信息 - * @author WendyYang - **/ - public void expertInviteByMeetingCreate(Meeting meeting, - List randomRules, - AvoidRuleDTO avoidRule) { - List expertInserts = new ArrayList<>(); - // 处理随机抽取规则 - if (CollUtil.isNotEmpty(randomRules)) { - List randoms = new ArrayList<>(); - List expertsByRandom = new ArrayList<>(); - List chooseExpertIds = new ArrayList<>(); - LocalDateTime sTime = meeting.getStartTime(); - LocalDateTime eTime = meeting.getEndTime(); - LocalDateTime createOn = meeting.getCreateOn(); - randomRules.forEach(rule -> { - ExpertChooseDTO tmpExperts = expertInviteByRandomRule(avoidRule, rule, chooseExpertIds, sTime, eTime, createOn); - if (tmpExperts.getTotal() < rule.getCount()) { - throw BizException.wrap("可抽取专家数量不足"); - } - expertsByRandom.add(tmpExperts); - chooseExpertIds.addAll(CollUtils.fieldList(tmpExperts.getExperts(), ExpertUserFullInfo::getUserId)); - randoms.add(getExpertInviteRule(rule, meeting.getId())); - }); - inviteRuleService.saveBatch(randoms); - for (int i = 0; i < expertsByRandom.size(); i++) { - Long ruleId = randoms.get(i).getId(); - expertsByRandom.get(i).getExperts().forEach(w -> { - MeetingExpert expert = ExpertInviteBuilder.getExpertByRandom(meeting.getId(), w, ruleId); - expert.setStatus(NOTICING.getCode()); - expertInserts.add(expert); - }); - } - meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertInserts); - } - meetingExpertService.saveBatch(expertInserts); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java deleted file mode 100644 index f16ff12..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.ValidUtil; -import com.ningdatech.cache.lock.DistributedLock; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; -import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Attend; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Map; - -/** - *

- * MeetingExpertJudgeManage - *

- * - * @author WendyYang - * @since 2023/7/31 - **/ -@Component -@AllArgsConstructor -public class MeetingExpertJudgeManage { - - private final IMeetingExpertJudgeService expertJudgeService; - private final IMeetingExpertService meetingExpertService; - private final IMeetingService meetingService; - private final DistributedLock distributedLock; - - private MeetingExpertJudge getMeetingExpertJudge(Long meetingExpertId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) - .eq(MeetingExpertJudge::getMeetingExpertId, meetingExpertId); - return expertJudgeService.getOne(query); - } - - public void saveExpertJudge(MeetingExpertJudgeReq req) { - String key = "lock_expert_judge:" + req.getMeetingExpertId(); - if (!distributedLock.lock(key, 3)) { - throw BizException.wrap("履职评价失败,请重试"); - } - try { - if (!ExpertJudgeEnum.AttendStatus.ABSENT.eq(req.getAttended())) { - Map validMap = ValidUtil.valid(req, Attend.class); - if (!validMap.isEmpty()) { - String errMsg = CollUtils.joinByComma(validMap.values()); - throw BizException.wrap(errMsg); - } - } - // 会议状态校验 - Meeting meeting = meetingService.getById(req.getMeetingId()); - if (meeting == null || MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("会议不存在或已取消"); - } - // 专家抽取状态校验 - MeetingExpert expert = meetingExpertService.getById(req.getMeetingExpertId()); - if (expert == null || (ExpertAttendStatusEnum.AGREED.eq(expert.getStatus()) - && ExpertAttendStatusEnum.ON_LEAVE.eq(expert.getStatus()))) { - throw BizException.wrap("未被抽中专家无法进行履职评价"); - } - // 智能履职评价一次 - MeetingExpertJudge judge = getMeetingExpertJudge(req.getMeetingExpertId()); - if (judge != null) { - throw BizException.wrap("履职评价已提交"); - } - MeetingExpertJudge entity = BeanUtil.copyProperties(req, MeetingExpertJudge.class); - entity.setExpertId(expert.getExpertId()); - expertJudgeService.save(entity); - } finally { - distributedLock.releaseLock(key); - } - } - - public MeetingExpertJudgeReq expertJudgeDetail(Long meetingExpertId) { - MeetingExpertJudge judge = getMeetingExpertJudge(meetingExpertId); - if (judge == null) { - throw BizException.wrap("履职评价未提交"); - } - return BeanUtil.copyProperties(judge, MeetingExpertJudgeReq.class); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertManage.java deleted file mode 100644 index b297101..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertManage.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertEvaluationService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -/** - *

- * MeetingExpertManage - *

- * - * @author WendyYang - * @since 10:04 2022/8/24 - */ -@Component -@AllArgsConstructor -public class MeetingExpertManage { - - private final IMeetingExpertService meetingExpertService; - private final IMeetingExpertEvaluationService meetingExpertEvaluationService; - private final MeetingManageHelper meetingManageHelper; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java deleted file mode 100644 index a21fbd2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ /dev/null @@ -1,937 +0,0 @@ -package com.ningdatech.pmapi.meeting.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.crypto.SecureUtil; -import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.basic.util.ValidUtil; -import com.ningdatech.cache.lock.DistributedLock; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.entity.ViewRegionDTO; -import com.ningdatech.pmapi.expert.constant.ReviewResultEnum; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.gov.service.IBelongOrgService; -import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder; -import com.ningdatech.pmapi.meeting.entity.domain.*; -import com.ningdatech.pmapi.meeting.entity.dto.*; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingReviewTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; -import com.ningdatech.pmapi.meeting.entity.req.*; -import com.ningdatech.pmapi.meeting.entity.vo.*; -import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; -import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; -import com.ningdatech.pmapi.meeting.helper.MeetingDataScopeHelper; -import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper; -import com.ningdatech.pmapi.meeting.service.*; -import com.ningdatech.pmapi.meeting.task.ExpertRandomInviteTask; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.Assert; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.function.BiFunction; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; -import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum.APPOINT; -import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule; - -/** - *

- * MeetingManage - *

- * - * @author WendyYang - * @since 13:35 2022/7/26 - */ -@Component -@RequiredArgsConstructor -public class MeetingManage { - - private final RegionCacheHelper regionCache; - private final IMeetingService meetingService; - private final IExpertInviteAvoidRuleService inviteAvoidRuleService; - private final IExpertInviteRuleService inviteRuleService; - private final IExpertUserFullInfoService expertUserFullInfoService; - private final TagCache tagCache; - private final DictionaryCache dictionaryCache; - private final IMeetingExpertService meetingExpertService; - private final ExpertInviteManage expertInviteManage; - private final ExpertRandomInviteTask expertRandomInviteTask; - private final MeetingManageHelper meetingManageHelper; - private final DistributedLock distributedLock; - private final IProjectService projectService; - private final IMeetingInnerProjectService meetingInnerProjectService; - private final IMeetingOuterProjectService meetingOuterProjectService; - private final IBelongOrgService belongOrgService; - private final IDingOrganizationService dingOrganizationService; - private final IExpertReviewService expertReviewService; - private final ExpertInviteHelper expertInviteHelper; - private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; - private final MeetingDataScopeHelper meetingDataScopeHelper; - private final IMeetingExpertJudgeService expertJudgeService; - private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; - - private static final String MEETING_CREATE_KEY = "MEETING_CREATE:"; - - private String getDictName(String dictType) { - return Optional.ofNullable(dictionaryCache.getByCode(dictType)) - .flatMap(w -> Optional.of(w.getName())) - .orElse(StrPool.EMPTY); - } - - /** - * 锁定时间10 * 60秒 - */ - public static final int RETRY_TIMES = 3; - - @Transactional(rollbackFor = Exception.class) - public IdVo meetingCreateAndInviteExpert(MeetingCreateReq req) { - MeetingBasicDTO meetingBasic = req.getMeetingBasicInfo(); - meetingManageHelper.checkReviewProject(meetingBasic); - String md5ByParam = SecureUtil.md5(meetingBasic.toString()); - String key = MEETING_CREATE_KEY + md5ByParam; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("会议正在创建中"); - } - try { - ExpertInviteReq inviteRule = req.getExpertInviteRule(); - // 保存会议基本信息 - Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class); - meeting.setStatus(MeetingStatusEnum.NORMAL.getCode()); - UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - meeting.setHoldOrg(userDetail.getOrganizationName()); - meeting.setHoldOrgCode(userDetail.getOrganizationCode()); - meeting.setRegionCode(userDetail.getRegionCode()); - meeting.setRegionLevel(userDetail.getRegionLevel()); - meeting.setCreator(userDetail.getUsername()); - meeting.setInviteStatus(Boolean.FALSE); - meeting.setConfirmedRoster(Boolean.FALSE); - meeting.setInviteType(inviteRule.getInviteType()); - meetingService.save(meeting); - if (meetingBasic.getIsInnerProject()) { - List projects = meetingBasic.getInnerProjects().stream().map(w -> { - MeetingInnerProject project = BeanUtil.copyProperties(w, MeetingInnerProject.class); - project.setMeetingId(meeting.getId()); - return project; - }).collect(Collectors.toList()); - meetingInnerProjectService.saveBatch(projects); - } else { - List projects = meetingBasic.getProjects().stream().map(w -> { - MeetingOuterProject project = BeanUtil.copyProperties(w, MeetingOuterProject.class); - project.setMeetingId(meeting.getId()); - return project; - }).collect(Collectors.toList()); - meetingOuterProjectService.saveBatch(projects); - } - // 抽取专家 - req.getExpertInviteRule().setMeetingId(meeting.getId()); - expertInviteByCreate(inviteRule); - return IdVo.of(meeting.getId()); - } finally { - distributedLock.releaseLock(key); - } - } - - @Transactional(rollbackFor = Exception.class) - public void continueInvite(Long meetingId) { - String key = "CONTINUE_INVITE:" + meetingId; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("已进行续抽,请勿重复点击"); - } - try { - Meeting meeting = meetingService.getById(meetingId); - if (!meeting.getInviteStatus()) { - throw BizException.wrap("该会议正在抽取专家,暂无法续抽"); - } - if (meeting.getStartTime().isBefore(LocalDateTime.now())) { - throw BizException.wrap("会议已开始,不允许续抽"); - } - if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { - throw BizException.wrap("续抽失败,请刷新后重试"); - } - boolean invitedContinue = meetingManageHelper.checkCouldBeInvitedContinue(meetingId); - if (!invitedContinue) { - throw BizException.wrap("抽取人员数量已满足抽取规则"); - } - expertRandomInviteTask.notifyInviteTask(meetingId); - } finally { - distributedLock.releaseLock(key); - } - } - - @Transactional(rollbackFor = Exception.class) - public void convertToAppoint(Long meetingId) { - String key = "CONVERT_TO_APPOINT:" + meetingId; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("已进行转换,请勿重复点击"); - } - try { - Meeting meeting = meetingService.getById(meetingId); - if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { - throw BizException.wrap("转换失败,请刷新后重试"); - } - expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); - LambdaUpdateWrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getInviteType, APPOINT.getCode()) - .eq(Meeting::getId, meetingId); - meetingService.update(meetingUpdate); - saveAppointRuleByConvertFromRandomRule(meetingId); - } finally { - distributedLock.releaseLock(key); - } - } - - private void saveAppointRuleByConvertFromRandomRule(Long meetingId) { - AppointInviteRuleDTO rule = new AppointInviteRuleDTO(); - rule.setInviteDesc("转为指定抽取"); - rule.setExpertIdList(Collections.emptyList()); - rule.setInviteType(APPOINT.getCode()); - rule.setCount(0); - ExpertInviteRule inviteRule = new ExpertInviteRule(); - inviteRule.setMeetingId(meetingId); - inviteRule.setInviteType(rule.getInviteType()); - inviteRule.setInviteCount(0); - inviteRule.setInviteRule(JSONUtil.toJsonStr(rule)); - inviteRuleService.save(inviteRule); - } - - @Transactional(rollbackFor = Exception.class) - public void expertInviteByCreate(ExpertInviteReq req) { - String key = INVITED_RULE_CREATE + req.getMeetingId(); - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("不可重复进行专家抽取"); - } - try { - Meeting meeting = meetingService.getById(req.getMeetingId()); - if (ExpertInviteTypeEnum.RANDOM.eq(req.getInviteType())) { - List randomRules = req.getRandomRules(); - Assert.notEmpty(randomRules, "随机抽取规则不能为空"); - AvoidRuleDTO avoidInfo = req.getAvoidRule(); - Assert.notNull(avoidInfo, "回避信息不能为空"); - // 随机抽取的话则需进行抽取数量校验 - LocalDateTime now = LocalDateTime.now(); - expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); - expertRandomInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now); - LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getInviteStatus, false) - .eq(Meeting::getId, meeting.getId()); - meetingService.update(mUpdate); - // 回避规则 - ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule(); - avoidRule.setMeetingId(meeting.getId()); - // 未传值时设置为0 表示不限制周参与次数 - avoidRule.setWeekInviteCount(ObjectUtil.defaultIfNull(avoidInfo.getWeekInviteCount(), 0)); - avoidRule.setAvoidOrgIds(CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList())); - avoidRule.setAvoidUnitIds(CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList())); - avoidRule.setAvoidExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds())); - avoidRule.setAvoidType(avoidInfo.getAvoidType()); - inviteAvoidRuleService.save(avoidRule); - } else { - // 指定邀请 - AppointInviteRuleDTO appointRule = req.getAppointRule(); - Assert.notNull(appointRule, "指定邀请规则不能为空"); - Map usersMap = expertInviteHelper.checkAppointExpert(appointRule); - // 处理指定抽取规则 - ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId()); - inviteRuleService.save(appoint); - Long ruleId = appoint.getId(); - List experts = appointRule.getExpertIdList().stream().map(w -> { - ExpertUserFullInfo info = usersMap.get(w); - MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId); - expert.setStatus(NOTICING.getCode()); - return expert; - }).collect(Collectors.toList()); - meetingExpertService.saveBatch(experts); - } - } finally { - distributedLock.releaseLock(key); - } - } - - /** - * 抽取数量校验 - * - * @param req 抽取参数 - * @return {@link ExpertCountOnChangeVO} - * @author WendyYang - **/ - public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteReq req) { - // 未传递指定邀请专家直接忽略 - expertInviteHelper.checkAppointExpert(req.getAppointRule()); - Meeting meeting = meetingService.getById(req.getMeetingId()); - ExpertCountOnChangeVO resultCount = new ExpertCountOnChangeVO(); - resultCount.setStatus(true); - resultCount.setCountList(new ArrayList<>()); - // 参数校验 - String errMsg = ValidUtil.validFast(req, AbstractInviteRule.CountCheck.class); - if (errMsg != null) { - resultCount.setStatus(false); - resultCount.setMessage(errMsg); - return resultCount; - } - List expertIdsChoose = new ArrayList<>(); - for (int i = 0; i < req.getRandomRules().size(); i++) { - RandomInviteRuleDTO randomRule = req.getRandomRules().get(i); - ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(), - randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime(), meeting.getCreateOn()); - if (i < req.getRandomRules().size() - 1 && chooseExpert.getTotal() > 0) { - List tempUserIds = CollUtils.fieldList(chooseExpert.getExperts(), ExpertUserFullInfo::getUserId); - expertIdsChoose.addAll(tempUserIds); - } - resultCount.addCountList(chooseExpert.getTotal()); - } - return resultCount; - } - - /** - * 专家会议列表 - * - * @param req 查询参数 - * @return 会议列表 - * @author WendyYang - **/ - public PageVo meetingListForExpert(MeetingListReq req) { - Long expertId = req.getExpertId() != null ? req.getExpertId() : LoginUserUtil.getUserId(); - List meetings = meetingExpertService.listByExpertIdAndStatus(expertId, null, null); - if (meetings.isEmpty()) { - return PageVo.empty(); - } - Map mapByMeetingId = new HashMap<>(16); - List meetingExpertIds = new ArrayList<>(); - meetings.forEach(w -> { - mapByMeetingId.put(w.getMeetingId(), w); - meetingExpertIds.add(w.getMeetingExpertId()); - }); - LambdaQueryWrapper query = new LambdaQueryWrapper() - .orderByDesc(Meeting::getCreateOn) - .in(Meeting::getId, mapByMeetingId.keySet()) - .eq(Meeting::getConfirmedRoster, Boolean.TRUE) - .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()); - if (req.getExpertId() == null) { - meetingManageHelper.buildMeetingQuery(query, req); - } - Page page = meetingService.page(req.page(), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List existsMeIds = expertJudgeService.listExistsMeetingExpertIds(meetingExpertIds); - PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); - page.getRecords().forEach(meeting -> { - MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); - MeetingAndAttendStatusDTO info = mapByMeetingId.get(meeting.getId()); - item.setMeetingExpertId(info.getMeetingExpertId()); - item.setExpertStatus(info.getStatus()); - item.setHasJudge(existsMeIds.contains(info.getMeetingExpertId())); - result.getRecords().add(item); - }); - return result; - } - - public PageVo meetingListForLeave(MeetingLeaveListReq req) { - Long expertId = ObjectUtil.defaultIfNull(req.getExpertId(), LoginUserUtil.getUserId()); - LambdaQueryWrapper meQuery = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getExpertId, expertId) - .in(MeetingExpert::getStatus, AGREED.getCode(), ON_LEAVE.getCode()); - List meetings = meetingExpertService.list(meQuery); - if (meetings.isEmpty()) { - return PageVo.empty(); - } - Map meetingMap = new HashMap<>(16); - meetings.forEach(w -> meetingMap.put(w.getMeetingId(), w)); - LambdaQueryWrapper query = new LambdaQueryWrapper() - .orderByAsc(Meeting::getStartTime) - .in(Meeting::getId, meetingMap.keySet()) - .eq(Meeting::getConfirmedRoster, Boolean.TRUE) - .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()); - Page page = meetingService.page(req.page(), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); - page.getRecords().forEach(meeting -> { - MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); - MeetingExpert info = meetingMap.get(meeting.getId()); - item.setExpertStatus(info.getStatus()); - result.getRecords().add(item); - }); - return result; - } - - - /** - * 管理员会议列表 - * - * @param req 查询参数 - * @return 会议列表 - * @author WendyYang - */ - public PageVo meetingListForManager(MeetingListReq req) { - ViewRegionDTO viewRegions = meetingDataScopeHelper.meetingListViewRegions(); - Collection regions; - if ((regions = viewRegions.getRegions()) != null && regions.isEmpty()) { - return PageVo.empty(); - } - LambdaQueryWrapper query = new LambdaQueryWrapper() - .orderByDesc(Meeting::getCreateOn); - // 补充逻辑 如果拥有超级管理员权限可以看到所有事务 - if (regions != null) { - query.in(Meeting::getRegionCode, regions); - query.ge(Meeting::getRegionLevel, viewRegions.getRegionLevel()); - } - query.eq(req.getStatus() != null, Meeting::getStatus, req.getStatus()); - meetingManageHelper.buildMeetingQuery(query, req); - Page page = meetingService.page(req.page(), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); - page.getRecords().forEach(meeting -> { - MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); - result.getRecords().add(item); - }); - return result; - } - - public MeetingDetailBasicVO getMeetingDetail(Long meetingId) { - Meeting meeting = meetingService.getById(meetingId); - Assert.notNull(meeting, "会议不存在"); - MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() - .meetingId(meeting.getId()) - .regionCode(meeting.getRegionCode()) - .meetingName(meeting.getName()) - .meetingType(meeting.getType()) - .meetingAddress(meeting.getMeetingAddress()) - .typeName(getDictName(meeting.getType())) - .startTime(meeting.getStartTime()) - .endTime(meeting.getEndTime()) - .judgesAttendanceTime(meeting.getJudgesAttendanceTime()) - .meetingUsageTime(meeting.getMeetingUsageTime()) - .contact(meeting.getContact()) - .connecter(meeting.getConnecter()) - .status(meeting.getStatus()) - .holdOrg(meeting.getHoldOrg()) - .createOn(meeting.getCreateOn()) - .creator(meeting.getCreator()) - .createBy(meeting.getCreator()) - .inviteType(meeting.getInviteType()) - .confirmedRoster(meeting.getConfirmedRoster()) - .invitedStopped(meeting.getInviteStatus()) - .build(); - if (meeting.getIsInnerProject()) { - List innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); - List projects = projectService.listByIds(CollUtils.fieldList(innerProjects, MeetingInnerProject::getProjectId)); - Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); - List convert = CollUtils.convert(projects, w -> { - MeetingReviewProjectDTO mrp = new MeetingReviewProjectDTO(); - mrp.setProjectId(w.getId()); - mrp.setBuildOrg(w.getBuildOrgName()); - mrp.setProjectName(w.getProjectName()); - mrp.setProjectType(w.getProjectType().toString()); - mrp.setProjectYear(w.getProjectYear()); - mrp.setDeclareAmount(w.getDeclareAmount()); - mrp.setProjectCode(w.getProjectCode()); - ExpertReview review = reviewMap.get(w.getId()); - if (review != null) { - mrp.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); - } - return mrp; - }); - detail.setProjects(convert); - } else { - List outerProjects = meetingOuterProjectService.listByMeetingId(meetingId); - detail.setProjects(BeanUtil.copyToList(outerProjects, MeetingReviewProjectDTO.class)); - } - detail.setInviteRule(inviteRuleDetail(meetingId)); - return detail; - } - - public ExpertInviteDetailVO inviteExpertList(Long meetingId) { - Meeting meeting = meetingService.getById(meetingId); - if (meeting == null) { - throw BizException.wrap("该会议信息不存在"); - } - ExpertInviteDetailVO result = new ExpertInviteDetailVO(); - result.setInvitedStopped(meeting.getInviteStatus()); - result.setConfirmedRoster(meeting.getConfirmedRoster()); - List experts = meetingExpertService.listByMeetingId(meetingId); - if (experts.isEmpty()) { - return result; - } - List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); - Map expertMap = meetingManageHelper.getExpertBasicInfo(expertIds); - BiFunction, InviteExpertListItemVO> mapping = (me, ruleMap) -> { - ExpertBasicInfoVO expert = expertMap.get(me.getExpertId()); - InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class); - item.setExpertMeetingId(me.getId()); - item.setMeetingId(me.getMeetingId()); - item.setStatus(me.getStatus()); - item.setMobile(me.getMobile()); - item.setNoticeTime(me.getCreateOn()); - item.setRuleId(me.getRuleId()); - item.setIsHeadman(me.getIsHeadman()); - ExpertInviteRule rule = ruleMap.get(me.getRuleId()); - item.setInviteType(rule == null ? APPOINT.getCode() : rule.getInviteType()); - if (NOTICING.eq(me.getStatus())) { - item.setNoticeStatus("通知中"); - } else { - item.setNoticeStatus("已通知"); - } - return item; - }; - List inviteRules = inviteRuleService.listByMeetingId(meetingId); - Map ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId); - boolean isRandom = ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType()); - if (isRandom) { - result.setInviteStatistics(new ArrayList<>()); - Map> groupByRule = CollUtils.group(experts, MeetingExpert::getRuleId); - ruleMap.forEach((k, v) -> { - InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(k); - statistics.setInviteCnt(v.getInviteCount()); - List expertList = groupByRule.get(k); - if (expertList != null) { - expertList.forEach((expert) -> { - if (AGREED.eq(expert.getStatus())) { - statistics.incrAgreeCnt(); - } - statistics.incrNoticedCnt(); - }); - } - result.getInviteStatistics().add(statistics); - }); - } - List converts = CollUtils.convert(experts, me -> mapping.apply(me, ruleMap)); - result.setInviteExpertList(converts); - // 确定参加列表 - return result; - } - - /** - * 会议基本信息修改 - * - * @param po 修改参数 - **/ - public void meetingBasicInfoModify(MeetingBasicInfoModifyReq po) { - Meeting meeting = new Meeting(); - BeanUtil.copyProperties(po, meeting); - LocalDateTime now = LocalDateTime.now(); - Meeting old = meetingService.getById(po.getId()); - List meList = meetingExpertService.listAgreedExperts(Collections.singletonList(po.getId())); - if (!meList.isEmpty() && old.getStartTime().isAfter(now)) { - // TODO - /*String meetingType = dictionaryCache.getByCode(old.getType()).getName(); - List contexts = YxtSmsContextBuilder.smsToExpertByMeetingChange(old, meeting, meList, meetingType); - yxtCallOrSmsHelper.sendSms(contexts);*/ - } - meetingService.updateById(meeting); - } - - /** - * 抽取规则详情 - * - * @param meetingId 会议ID - * @return {@link InviteRuleDetailVO} - * @author WendyYang - **/ - public InviteRuleDetailVO inviteRuleDetail(Long meetingId) { - InviteRuleDetailVO result = new InviteRuleDetailVO(); - List inviteRules = inviteRuleService.listByMeetingId(meetingId); - result.setRandomRules(new ArrayList<>()); - Map> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType())); - List randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM); - if (CollUtil.isNotEmpty(randoms)) { - randoms.forEach(random -> { - RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class); - randomRule.setId(random.getId()); - if (randomRule.getExpertTags() != null) { - randomRule.getExpertTags().forEach(w -> { - List tagNames = CollUtils.convert(w.getTagCodes(), tagCode -> tagCache.getByTagCode(tagCode).getTagName()); - w.setTagCodes(tagNames); - }); - } - if (randomRule.getExpertDicts() != null) { - randomRule.getExpertDicts().forEach(w -> { - List dictNames = CollUtils.convert(w.getDictCodes(), dictCode -> dictionaryCache.getByCode(dictCode).getName()); - w.setDictCodes(dictNames); - }); - } - if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) { - List intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel()); - randomRule.setIntentionRegions(intentionRegions); - } - if (CollUtil.isNotEmpty(randomRule.getExpertRegionList())) { - List regions = CollUtils.convert(randomRule.getExpertRegionList(), - w -> regionCache.getByCodeAndLevel(w.getRegionCode(), w.getRegionLevel())); - randomRule.setExpertRegions(regions); - } - result.getRandomRules().add(randomRule); - }); - AvoidRuleDTO avoidInfo = inviteAvoidRuleService.getAvoidInfo(meetingId); - AvoidInfoVO vo = new AvoidInfoVO(); - vo.setAvoidType(avoidInfo.getAvoidType()); - vo.setWeekInviteCount(avoidInfo.getWeekInviteCount()); - vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList()); - vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList()); - if (CollUtil.isNotEmpty(vo.getAvoidOrgIds())) { - vo.setAvoidOrgs(belongOrgService.listNameByCodes(avoidInfo.getAvoidOrgIdList())); - } - if (CollUtil.isNotEmpty(vo.getAvoidUnitIds())) { - vo.setAvoidUnits(dingOrganizationService.listNameByCodes(avoidInfo.getAvoidUnitIdList())); - } - if (CollUtil.isNotEmpty(avoidInfo.getExpertIds())) { - vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values())); - } - result.setAvoidInfo(vo); - } else { - List appoints = groupByType.get(APPOINT); - ExpertInviteRule appoint = appoints.get(0); - AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); - appointRule.setId(appoint.getId()); - AppointRuleVO vo = new AppointRuleVO(); - vo.setInviteDesc(appointRule.getInviteDesc()); - vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values())); - result.setAppointRule(vo); - } - return result; - } - - public void batchAppointExperts(BatchAppointExpertsReq req) { - Long meetingId = req.getMeetingId(); - String key = "BATCH_APPOINT_EXPERT:" + meetingId; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("补充专家中,请勿重复点击"); - } - try { - Meeting meeting = meetingService.getById(meetingId); - if (!APPOINT.eq(meeting.getInviteType())) { - throw BizException.wrap("该会议不能指定邀请专家"); - } - if (meeting.getConfirmedRoster()) { - throw BizException.wrap("补充专家失败,已确认过专家名单"); - } - if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { - throw BizException.wrap("补充专家失败"); - } - AppointInviteRuleDTO rule = inviteRuleService.appointRuleByMeetingId(meetingId); - List userInfos = meetingManageHelper.appointExpertCheck(meetingId, meeting.getInviteType(), req.getExpertIdList()); - List expertList = CollUtils.convert(userInfos, w -> { - MeetingExpert me = ExpertInviteBuilder.getExpertByAppoint(meetingId, w, rule.getId()); - me.setStatus(NOTICING.getCode()); - return me; - }); - meetingExpertService.saveBatch(expertList); - } finally { - distributedLock.releaseLock(key); - } - } - - public void stopRandomInvite(Long meetingId) { - expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); - } - - @Transactional(rollbackFor = Exception.class) - public void cancelMeeting(MeetingCancelReq req) { - Long meetingId = req.getMeetingId(); - String key = "CANCEL_MEETING:" + meetingId; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("正在取消会议,请刷新后重试"); - } - try { - Meeting meeting = meetingService.getById(meetingId); - if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("会议已取消"); - } - if (meeting.getStartTime().isBefore(LocalDateTime.now())) { - throw BizException.wrap("会议已开始,暂时无法取消"); - } - LambdaUpdateWrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) - .eq(Meeting::getId, meetingId); - meetingService.update(meetingUpdate); - expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId); - // 发送通知给专家 - List experts = meetingExpertService.listAgreedExperts(meetingId); - if (!experts.isEmpty()) { - meetingCallOrMsgHelper.sendCancelMeetingMsg(experts, meeting); - } - } finally { - distributedLock.releaseLock(key); - } - } - - public ExpertInvitationDetailVO expertInvitationDetail(Long meetingId, Long expertId) { - Long userId = expertId == null ? LoginUserUtil.getUserId() : expertId; - MeetingExpert me = meetingExpertService.getByMeetingIdAndExpertId(meetingId, userId); - if (me == null) { - throw BizException.wrap("未被邀请参加此会议"); - } - if (AGREED.eq(me.getStatus())) { - throw BizException.wrap("未确认参加此会议"); - } - ExpertUserFullInfo userInfo = expertUserFullInfoService.getByUserId(userId); - Meeting meeting = meetingService.getById(meetingId); - return ExpertInvitationDetailVO.builder() - .expertName(userInfo.getExpertName()) - .holdOrg(meeting.getHoldOrg()) - .meetingName(meeting.getName()) - .startTime(meeting.getStartTime()) - .endTime(meeting.getEndTime()) - .inviteTime(me.getCreateOn()) - .connecter(meeting.getConnecter()) - .contact(meeting.getContact()) - .build(); - } - - public void confirmAttendByManager(ExpertConfirmReq req) { - String key = "CONFIRM_ATTEND:" + req.getExpertMeetingId(); - String msgPrefix = req.getAgreed() ? "确认参加" : "拒绝参加"; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("%s失败,请重试!", msgPrefix); - } - try { - MeetingExpert me = meetingExpertService.getById(req.getExpertMeetingId()); - if (!NOTICING.eq(me.getStatus())) { - throw BizException.wrap("%s失败,请重试!", msgPrefix); - } - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getStatus, (req.getAgreed() ? AGREED : REFUSED).getCode()) - .eq(MeetingExpert::getId, req.getExpertMeetingId()); - meetingExpertService.update(update); - } finally { - distributedLock.releaseLock(key); - } - } - - @Transactional(rollbackFor = Exception.class) - public void expertRemove(ExpertRemoveReq req) { - String key = "EXPERT_REMOVE:" + req.getExpertMeetingId(); - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("删除专家失败,请重试!"); - } - try { - Meeting meeting = meetingService.getById(req.getMeetingId()); - if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("会议已取消!"); - } - if (LocalDateTime.now().isAfter(meeting.getStartTime())) { - throw BizException.wrap("会议已开始,不允许移除专家!"); - } - MeetingExpert expert = meetingExpertService.getById(req.getExpertMeetingId()); - if (!APPOINT.eq(expert.getInviteType())) { - throw BizException.wrap("随机抽取的专家不允许移除!"); - } - if (!NOTICING.eq(expert.getStatus())) { - throw BizException.wrap("已确认过的专家不允许移除!"); - } - LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getConfirmedRoster, false) - .eq(Meeting::getId, req.getMeetingId()); - meetingService.update(mUpdate); - meetingExpertService.removeById(req.getExpertMeetingId()); - } finally { - distributedLock.releaseLock(key); - } - } - - public void releaseExperts(MeetingCancelReq req) { - String key = "EXPERT_RELEASE:" + req.getMeetingId(); - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("释放专家失败,请重试!"); - } - try { - Meeting meeting = meetingService.getById(req.getMeetingId()); - if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("会议已取消"); - } - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getStatus, RELEASED.getCode()) - .eq(MeetingExpert::getMeetingId, req.getMeetingId()); - meetingExpertService.update(update); - } finally { - distributedLock.releaseLock(key); - } - } - - @Transactional(rollbackFor = Exception.class) - public void setUpHeadman(ExpertConfirmReq req) { - String key = "SETUP_HEADMAN:" + req.getMeetingId(); - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("设置专家组长失败,请重试!"); - } - try { - Meeting meeting = meetingService.getById(req.getMeetingId()); - if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { - throw BizException.wrap("会议已取消"); - } - LambdaUpdateWrapper cancel = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getIsHeadman, Boolean.FALSE) - .eq(MeetingExpert::getIsHeadman, Boolean.TRUE) - .eq(MeetingExpert::getMeetingId, req.getMeetingId()); - meetingExpertService.update(cancel); - MeetingExpert headman = meetingExpertService.getById(req.getExpertMeetingId()); - if (!AGREED.eq(headman.getStatus())) { - ExpertAttendStatusEnum status = getByCode(headman.getStatus()); - throw BizException.wrap("该专家处于:%s状态,不能被设置为专家组长!", status.getValue()); - } - LambdaUpdateWrapper setup = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getIsHeadman, Boolean.TRUE) - .eq(MeetingExpert::getId, req.getExpertMeetingId()); - meetingExpertService.update(setup); - } finally { - distributedLock.releaseLock(key); - } - } - - public void confirmedRoster(ConfirmedRosterReq req) { - Long meetingId = req.getMeetingId(); - String key = "MEETING_RESEND_SMS:" + meetingId; - if (!distributedLock.lock(key, RETRY_TIMES)) { - throw BizException.wrap("请刷新后重试!"); - } - try { - Meeting meeting = meetingService.getById(meetingId); - if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { - throw BizException.wrap("请刷新后重试!"); - } - if (!meeting.getConfirmedRoster()) { - // 首次确认的 - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class); - update.set(Meeting::getConfirmedRoster, Boolean.TRUE); - update.eq(Meeting::getId, meetingId); - meetingService.update(update); - } - List experts = meetingExpertService.listAgreedExperts(meetingId); - List expertNoticing = experts.stream() - .filter(w -> meeting.getConfirmedRoster() || !w.getConfirmedRoster()) - .collect(Collectors.toList()); - if (expertNoticing.isEmpty()) { - return; - } - List currConfirmedMeIds = CollUtils.fieldList(expertNoticing, MeetingExpert::getId); - LambdaUpdateWrapper meUpdate = Wrappers.lambdaUpdate(MeetingExpert.class) - .in(MeetingExpert::getId, currConfirmedMeIds) - .set(MeetingExpert::getConfirmedRoster, Boolean.TRUE); - meetingExpertService.update(meUpdate); - meetingCallOrMsgHelper.sendConfirmedRosterMsg(expertNoticing, meeting); - } finally { - distributedLock.releaseLock(key); - } - } - - public PageVo pageReviewProject(ReviewProjectListReq req) { - Page page = meetingExpertService.pageReviewProjectList(req); - return PageVo.of(page.getRecords(), page.getTotal()); - } - - public PageVo optionProject(MeetingOptionProjectReq req) { - String meetingType = req.getMeetingType(); - LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE); - switch (MeetingReviewTypeEnum.getByCode(meetingType)) { - case PRELIMINARY_SCHEME_REVIEW: - buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.PRE_APPLYING); - break; - case CONSTRUCTION_SCHEME_REVIEW: - buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.SCHEME_UNDER_REVIEW); - break; - case ACCEPTANCE_SCHEME_REVIEW: - buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW); - break; - case DEPT_JOIN_REVIEW: - buildOptionProjectQuery(query, meetingType, ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW); - break; - case FAIRNESS_REVIEW: - break; - default: - return PageVo.empty(); - } - UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - Collection regionCodes = regionCache.listChildRegionCodeList(userDetail.getRegionCode(), userDetail.getRegionLevel()); - query.in(Project::getAreaCode, regionCodes); - Page page = projectService.page(req.page(), query); - PageVo result = PageVo.of(null, page.getTotal()); - if (result.getTotal() > 0) { - result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList)); - } - return result; - } - - public List projectsByMeetingId(Long meetingId) { - Meeting meeting = meetingService.getById(meetingId); - if (meeting.getIsInnerProject()) { - List projects = meetingInnerProjectService.listByMeetingId(meetingId); - List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); - List projectList = projectService.listByIds(projectIdList); - Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); - return CollUtils.convert(projectList, w -> { - MeetingReviewProjectVO vo = buildProjectList(w); - ExpertReview review = reviewMap.get(w.getId()); - if (review != null) { - vo.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); - } else { - vo.setReviewResult("--"); - } - return vo; - }); - } else { - List projects = meetingOuterProjectService.listByMeetingId(meetingId); - return BeanUtil.copyToList(projects, MeetingReviewProjectVO.class); - } - } - - private MeetingReviewProjectVO buildProjectList(Project project) { - return MeetingReviewProjectVO - .builder() - .id(project.getId()) - .projectCode(project.getProjectCode()) - .projectName(project.getProjectName()) - .declaredAmount(project.getDeclareAmount()) - .projectType(project.getProjectType()) - .projectYear(project.getProjectYear()) - .buildOrg(project.getBuildOrgName()) - .createOn(project.getCreateOn()) - .build(); - } - - private void buildOptionProjectQuery(LambdaQueryWrapper query, String meetingType, ProjectStatusEnum status) { - query.eq(Project::getStatus, status.getCode()); - String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" + - " m.is_inner_project = true and m.id = mip.meeting_id and nd_project.id = mip.project_id" + - " and m.type = %s and m.status != 3", meetingType); - String sql2 = String.format("select review_result in (2,3) from " + - " (select ner.review_result from meeting m inner join meeting_inner_project mip on" + - " m.is_inner_project = true and m.id = mip.meeting_id and nd_project.id = mip.project_id" + - " and m.type = %s and m.status != 3 left join nd_expert_review ner on ner.meeting_id = m.id " + - " and ner.project_id = mip.project_id and ner.is_final = true order by m.create_on desc limit 1) t", meetingType); - query.and(q1 -> q1.notExists(sql).or(q2 -> q2.apply(sql2))); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.java deleted file mode 100644 index 6fb3866..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface ExpertInviteAvoidRuleMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.xml deleted file mode 100644 index 791c86d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteAvoidRuleMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.java deleted file mode 100644 index 883a6b9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface ExpertInviteRuleMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.xml deleted file mode 100644 index 718fae3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/ExpertInviteRuleMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.java deleted file mode 100644 index 7c68292..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertEvaluation; -import org.apache.ibatis.annotations.Param; - -import java.util.Collection; - -/** - *

- * 专家评价表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-25 - */ -public interface MeetingExpertEvaluationMapper extends BaseMapper { - - Page> countExpertAttend(@Param("expertIds") Collection expertIds, @Param("isAttended") Boolean isAttended, Page> page); - - Page pageExpertEvaluationToDo(@Param("meetingIds") Collection meetingIds, Page po); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.xml deleted file mode 100644 index 3f30b52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertEvaluationMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java deleted file mode 100644 index d178d32..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-07-31 - */ -public interface MeetingExpertJudgeMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml deleted file mode 100644 index 25776c8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.java deleted file mode 100644 index d13b407..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ReviewProjectDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.req.ReviewProjectListReq; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.List; - -/** - *

- * 事务专家表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-27 - */ -public interface MeetingExpertMapper extends BaseMapper { - - /** - * 根据专家状态查询需要参加的会议信息 - * - * @param expertId 专家ID - * @param status 状态 - * @param meetingIds 会议ID - * @return 专家参会状态列表 - * @author WendyYang - **/ - List selectByExpertIdAndStatus(@Param("expertId") Long expertId, - @Param("status") Integer status, - @Param("meetingIds") List meetingIds); - - /** - * 分页查询专家列表 - * - * @param page 分页数据 - * @param status 状态{@link ExpertAttendStatusEnum} - * @param meetingId 会议ID - * @param inviteType 邀请类型 - * @return Page - * @author WendyYang - **/ - Page selectExpertByStatusAndMeetingId(Page page, @Param("status") Integer status, - @Param("meetingId") Long meetingId, - @Param("inviteType") Integer inviteType); - - /** - * 分页查询专家列表 - * - * @param page 分页数据 - * @param status 状态{@link ExpertAttendStatusEnum} - * @param meetingIds 会议ID - * @return Page - * @author WendyYang - **/ - Page selectExpertByStatusAndMeetingIds(Page page, @Param("status") Integer status, - @Param("meetingIds") Collection meetingIds); - - /** - * 查询时间窗口之内参与会议不超过{@code agreeCount}次的专家ID - * - * @param agreeCount 参与次数(包含) - * @param startTime 开始时间 - * @param endTime 结束时间 - * @return 专家ID集合 - * @author WendyYang - **/ - List listAgreeExpertIdByRecentDaysAndAgreeCount(@Param("agreeCount") Integer agreeCount, - @Param("startTime") LocalDateTime startTime, - @Param("endTime") LocalDateTime endTime); - - /** - * 根据会议ID与参与状态统计专家数量 - * - * @param status 会议状态 - * @param meetingId 会议ID - * @param inviteType 邀请类型 - * @return 数量 - */ - int countExpertByStatusAndMeetingId(@Param("status") Integer status, @Param("meetingId") Long meetingId, @Param("inviteType") Integer inviteType); - - /** - * 查询会议的所有被抽取人最后一条记录 - * - * @param meetingIds 会议ID - * @return 抽取记录 - * @author WendyYang - **/ - List listExpertLastByMeetingIds(@Param("meetingIds") Collection meetingIds); - - /** - * 查询专家待评审项目 - * - * @param page 分页 - * @param req 查询参数 - * @return 待评审项目分页数据 - * @author WendyYang - **/ - Page pageReviewProjectList(Page page, @Param("p") ReviewProjectListReq req); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml deleted file mode 100644 index 619829d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = - me.expert_id and is_final = true) - - - not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = - me.expert_id and is_final = true) - - - - - - exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = - me.expert_id) - - - not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = - me.expert_id) - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.java deleted file mode 100644 index 8a393df..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 会议评审内部项目表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -public interface MeetingInnerProjectMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.xml deleted file mode 100644 index 3d78af0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.java deleted file mode 100644 index aa37b01..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; - -import java.util.List; - -/** - *

- * 会议 Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface MeetingMapper extends BaseMapper { - - List> meetingCountSummary(Long createBy); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.xml deleted file mode 100644 index bc6b0d8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.java deleted file mode 100644 index b0e89f4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meeting.mapper; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 会议评审外部项目 Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -public interface MeetingOuterProjectMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.xml deleted file mode 100644 index 52d562d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteAvoidRuleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteAvoidRuleService.java deleted file mode 100644 index ab44e87..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteAvoidRuleService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; - -/** - *

- * IExpertInviteAvoidRuleService服务类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface IExpertInviteAvoidRuleService extends IService { - - ExpertInviteAvoidRule getByMeetingId(Long meetingId); - - /** - * 获取回避信息 - * - * @param meetingId 会议ID - * @return {@link AvoidRuleDTO} - * @author WendyYang - **/ - AvoidRuleDTO getAvoidInfo(Long meetingId); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteRuleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteRuleService.java deleted file mode 100644 index 75f6063..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteRuleService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; - -import java.util.List; -import java.util.Map; - -/** - *

- * 服务类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface IExpertInviteRuleService extends IService { - - /** - * 查询会议所有的邀请规则 - * - * @param meetingId 会议ID - * @return 抽取规则集合 - * @author WendyYang - **/ - List listByMeetingId(Long meetingId); - - /** - * 查询会议所有的随机邀请规则 - * - * @param meetingId 会议ID - * @return 随机邀请规则 - * @author WendyYang - **/ - Map randomRuleByMeetingId(Long meetingId); - - /** - * 查询会议的指定邀请规则 - * - * @param meetingId 会议ID - * @return 指定邀请规则 - * @author WendyYang - **/ - AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertEvaluationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertEvaluationService.java deleted file mode 100644 index d4fe30a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertEvaluationService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertEvaluation; - -import java.util.Collection; - -/** - *

- * 专家评价表 服务类 - *

- * - * @author WendyYang - * @since 2022-07-25 - */ -public interface IMeetingExpertEvaluationService extends IService { - - Page> listExpertAttendSummary(Collection expertIds, Boolean isAttended, Page> page); - - Page pageExpertEvaluationTodo(Collection meetingIds, PagePo po); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertJudgeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertJudgeService.java deleted file mode 100644 index 6de683c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertJudgeService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-07-31 - */ -public interface IMeetingExpertJudgeService extends IService { - - default List listExistsMeetingExpertIds(Collection meetingExpertIds) { - if (CollUtil.isEmpty(meetingExpertIds)) { - return Collections.emptyList(); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) - .select(MeetingExpertJudge::getMeetingExpertId) - .in(MeetingExpertJudge::getMeetingExpertId, meetingExpertIds); - return CollUtils.fieldList(list(query), MeetingExpertJudge::getMeetingExpertId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertService.java deleted file mode 100644 index dd6b295..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertService.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ReviewProjectDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.req.ReviewProjectListReq; - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - *

- * 事务专家表 服务类 - *

- * - * @author WendyYang - * @since 2022-07-27 - */ -public interface IMeetingExpertService extends IService { - - /** - * 查询专家的参与状态 - * - * @param expertId 专家ID - * @param status 状态 - * @param meetingIds 会议ID - * @return 会议参加状态统计 - * @author WendyYang - **/ - List listByExpertIdAndStatus(Long expertId, Integer status, List meetingIds); - - /** - * 查询每个会议的确认进度 - * - * @param meetingIds 事务ID - * @return 确认进度 - * @author WendyYang - **/ - Map countConfirmedByMeetingIds(List meetingIds); - - /** - * 根据事务ID查询所有邀请记录 - * - * @param meetingId 事务ID - * @return 邀请专家记录 - */ - List listByMeetingId(Long meetingId); - - /** - * 根据事务ID查询所有邀请记录 - * - * @param meetingIds 事务ID - * @return List - */ - List listByMeetingIds(List meetingIds); - - /** - * 获取专家参与事务的最新记录 - * - * @param meetingId 会议ID - * @param expertId 专家ID - * @return 专家参会记录 - * @author WendyYang - **/ - MeetingExpert getByMeetingIdAndExpertId(Long meetingId, Long expertId); - - /** - * 根据状态与会议ID分页查询专家列表 - * - * @param page 分页 - * @param meetingId 会议ID - * @param status 状态 - * @param inviteType 邀请类型 - * @return Page - * @author WendyYang - **/ - Page pageExpertByStatusAndMeetingId(Page page, Long meetingId, ExpertAttendStatusEnum status, Integer inviteType); - - /** - * 批量查询某个状态的专家邀请记录 - * - * @param page 分页参数 - * @param meetingIds 会议ID - * @param status 状态 - * @return 专家邀请记录 - * @author WendyYang - **/ - Page pageExpertByStatusAndMeetingIds(Page page, List meetingIds, ExpertAttendStatusEnum status); - - /** - * 根据邀请类型统计会议下某个状态的专家数量 - * - * @param status 状态 - * @param meetingId 会议ID - * @param inviteType 邀请类型 - * @return int - * @author WendyYang - **/ - int countExpertByStatusAndMeetingId(ExpertAttendStatusEnum status, Long meetingId, ExpertInviteTypeEnum inviteType); - - /** - * 查询所有同意参加的专家记录(批量会议) - * - * @param meetingIds 会议ID - * @return 同意参加的专家 - * @author WendyYang - **/ - List listAgreedExperts(Collection meetingIds); - - /** - * 查询所有同意参加的专家记录(单个会议) - * - * @param meetingId 会议ID - * @return 同意参加的专家 - * @author WendyYang - **/ - default List listAgreedExperts(Long meetingId) { - return listAgreedExperts(Collections.singletonList(meetingId)); - } - - /** - * 查询会议的所有被抽取人最后一条记录 - * - * @param meetingIds 会议ID - * @return 抽取记录 - * @author WendyYang - **/ - List listExpertLastByMeetingIds(Collection meetingIds); - - /** - * 查询会议的所有被抽取人最后一条记录 - * - * @param meetingId 会议ID - * @return 抽取记录 - * @author WendyYang - **/ - default List listExpertLastByMeetingId(Long meetingId) { - return listExpertLastByMeetingIds(Collections.singletonList(meetingId)); - } - - /** - * 查询专家待评审项目 - * - * @param req {@link ReviewProjectListReq} - * @return 待评审项目分页数据 - * @author WendyYang - **/ - Page pageReviewProjectList(ReviewProjectListReq req); - - List listAgreeExpertIdByRecentDaysAndAgreeCount(int agreeCount, LocalDateTime sTime, LocalDateTime eTime); - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java deleted file mode 100644 index fcfed22..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; - -/** - *

- * 会议评审内部项目表 服务类 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -public interface IMeetingInnerProjectService extends IService { - - /** - * 查询会议评审的内部项目 - * - * @param meetingId 会议ID - * @return 会议关联的系统内部项目 - * @author WendyYang - **/ - List listByMeetingId(Long meetingId); - - /** - * 查询项目关联的所有会议 - * - * @param projectId 会议ID - * @return 项目关联的会议ID - * @author WendyYang - **/ - List listMeetingIdByProjectId(Long projectId); - - /** - * 查询项目关联的所有会议 - * - * @param projectCode 项目编号 - * @return 项目关联的会议ID - * @author WendyYang - **/ - List listMeetingIdByProjectCode(String projectCode); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java deleted file mode 100644 index 6b9d823..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; - -/** - *

- * 会议评审外部项目 服务类 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -public interface IMeetingOuterProjectService extends IService { - - /** - * 查询会议评审的外部项目 - * - * @param meetingId 会议ID - * @return 评审的外部项目 - * @author WendyYang - **/ - List listByMeetingId(Long meetingId); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingService.java deleted file mode 100644 index 002ed9a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.meeting.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard; - -import java.util.Map; - -/** - *

- * 会议 服务类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -public interface IMeetingService extends IService { - - /** - * 停止抽取 - * - * @param meetingId 会议ID - **/ - void stopRandomInvite(Long meetingId); - - /** - * 工作台会议状态统计 - * - * @param createBy 创建人 - * @return 各状态会议统计 - * @author WendyYang - **/ - Map meetingCountSummary(Long createBy); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java deleted file mode 100644 index fcaddec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; -import com.ningdatech.pmapi.meeting.mapper.ExpertInviteAvoidRuleMapper; -import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Service -public class ExpertInviteAvoidRuleServiceImpl extends ServiceImpl implements IExpertInviteAvoidRuleService { - - @Override - public ExpertInviteAvoidRule getByMeetingId(Long meetingId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertInviteAvoidRule.class) - .eq(ExpertInviteAvoidRule::getMeetingId, meetingId); - return getOne(query); - } - - @Override - public AvoidRuleDTO getAvoidInfo(Long meetingId) { - ExpertInviteAvoidRule avoidRule = getByMeetingId(meetingId); - if (avoidRule == null) { - return null; - } - AvoidRuleDTO avoidInfo = new AvoidRuleDTO(); - avoidInfo.setAvoidOrgIdList(StrUtils.split(avoidRule.getAvoidOrgIds())); - avoidInfo.setAvoidUnitIdList(StrUtils.split(avoidRule.getAvoidUnitIds())); - avoidInfo.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); - avoidInfo.setWeekInviteCount(avoidRule.getWeekInviteCount()); - avoidInfo.setAvoidType(avoidRule.getAvoidType()); - return avoidInfo; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java deleted file mode 100644 index dd33547..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import cn.hutool.json.JSONUtil; -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.service.impl.ServiceImpl; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.mapper.ExpertInviteRuleMapper; -import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Service -public class ExpertInviteRuleServiceImpl extends ServiceImpl implements IExpertInviteRuleService { - - public static LambdaQueryWrapper wrapperByMeetingId(Long meetingId) { - return Wrappers.lambdaQuery(ExpertInviteRule.class).eq(ExpertInviteRule::getMeetingId, meetingId); - } - - @Override - public List listByMeetingId(Long meetingId) { - return list(wrapperByMeetingId(meetingId)); - } - - @Override - public Map randomRuleByMeetingId(Long meetingId) { - LambdaQueryWrapper query = wrapperByMeetingId(meetingId) - .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()); - List inviteRules = baseMapper.selectList(query); - return inviteRules.stream().collect(Collectors.toMap(ExpertInviteRule::getId, - w -> JSONUtil.toBean(w.getInviteRule(), RandomInviteRuleDTO.class))); - } - - @Override - public AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId) { - LambdaQueryWrapper query = wrapperByMeetingId(meetingId) - .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode()); - ExpertInviteRule inviteRule = baseMapper.selectOne(query); - AppointInviteRuleDTO rule = JSONUtil.toBean(inviteRule.getInviteRule(), AppointInviteRuleDTO.class); - rule.setId(inviteRule.getId()); - return rule; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java deleted file mode 100644 index a668442..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertEvaluationServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertEvaluation; -import com.ningdatech.pmapi.meeting.mapper.MeetingExpertEvaluationMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertEvaluationService; -import org.springframework.stereotype.Service; - -import java.util.Collection; - -/** - *

- * 专家评价表 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-25 - */ -@Service -public class MeetingExpertEvaluationServiceImpl extends ServiceImpl implements IMeetingExpertEvaluationService { - - @Override - public Page> listExpertAttendSummary(Collection expertIds, Boolean isAttended, Page> page) { - return baseMapper.countExpertAttend(expertIds, isAttended, page); - } - - @Override - public Page pageExpertEvaluationTodo(Collection meetingIds, PagePo po) { - return baseMapper.pageExpertEvaluationToDo(meetingIds, new Page<>(po.getPageNumber(), po.getPageSize())); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertJudgeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertJudgeServiceImpl.java deleted file mode 100644 index a6302cb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertJudgeServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; -import com.ningdatech.pmapi.meeting.mapper.MeetingExpertJudgeMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-07-31 - */ -@Service -public class MeetingExpertJudgeServiceImpl extends ServiceImpl implements IMeetingExpertJudgeService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertServiceImpl.java deleted file mode 100644 index 4b49490..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertServiceImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -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.util.CollUtils; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO; -import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ReviewProjectDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.req.ReviewProjectListReq; -import com.ningdatech.pmapi.meeting.mapper.ExpertInviteRuleMapper; -import com.ningdatech.pmapi.meeting.mapper.MeetingExpertMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - *

- * 事务专家表 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-27 - */ -@Service -@RequiredArgsConstructor -public class MeetingExpertServiceImpl extends ServiceImpl implements IMeetingExpertService { - - private final ExpertInviteRuleMapper inviteRuleMapper; - - @Override - public List listByExpertIdAndStatus(Long expertId, Integer status, List meetingIds) { - return baseMapper.selectByExpertIdAndStatus(expertId, status, meetingIds); - } - - @Override - public Map countConfirmedByMeetingIds(List meetingIds) { - List inviteRules = inviteRuleMapper.selectList(Wrappers.lambdaQuery(ExpertInviteRule.class) - .eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()) - .in(ExpertInviteRule::getMeetingId, meetingIds)); - Map countByRandom = CollUtils.groupSumInt(inviteRules, ExpertInviteRule::getMeetingId, ExpertInviteRule::getInviteCount); - Page page = pageExpertByStatusAndMeetingIds(new Page<>(0, 500), meetingIds, null); - return page.getRecords().stream().collect(Collectors.groupingBy(MeetingExpert::getMeetingId, - Collectors.collectingAndThen(Collectors.toList(), - w -> { - Long meetingId = w.get(0).getMeetingId(); - CountConfirmByMeetingIdDTO confirm = CountConfirmByMeetingIdDTO.builder() - .confirmed(0) - .total(countByRandom.getOrDefault(meetingId, 0)) - .meetingId(meetingId) - .build(); - w.forEach(item -> { - ExpertAttendStatusEnum attendStatus = ExpertAttendStatusEnum.getByCode(item.getStatus()); - if (ExpertInviteTypeEnum.APPOINT.eq(item.getInviteType())) { - confirm.setTotal(confirm.getTotal() + 1); - } - // 除通知中的均为已确认 - if (attendStatus.equals(ExpertAttendStatusEnum.AGREED)) { - confirm.setConfirmed(confirm.getConfirmed() + 1); - } - }); - return confirm; - }))); - } - - @Override - public List listByMeetingId(Long meetingId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getMeetingId, meetingId) - .orderByDesc(MeetingExpert::getUpdateOn); - return list(query); - } - - @Override - public List listByMeetingIds(List meetingIds) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) - .in(MeetingExpert::getMeetingId, meetingIds) - .orderByDesc(MeetingExpert::getUpdateOn); - return list(query); - } - - @Override - public MeetingExpert getByMeetingIdAndExpertId(Long meetingId, Long expertId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getExpertId, expertId) - .eq(MeetingExpert::getMeetingId, meetingId) - .orderByDesc(MeetingExpert::getUpdateOn) - .last("limit 1"); - return getOne(query); - } - - @Override - public Page pageExpertByStatusAndMeetingId(Page page, Long meetingId, ExpertAttendStatusEnum status, Integer inviteType) { - Integer statusCode = Optional.ofNullable(status).flatMap(w -> Optional.of(w.getCode())).orElse(null); - return baseMapper.selectExpertByStatusAndMeetingId(page, statusCode, meetingId, inviteType); - } - - @Override - public Page pageExpertByStatusAndMeetingIds(Page page, List meetingIds, ExpertAttendStatusEnum status) { - return baseMapper.selectExpertByStatusAndMeetingIds(page, status == null ? null : status.getCode(), meetingIds); - } - - @Override - public int countExpertByStatusAndMeetingId(ExpertAttendStatusEnum status, Long meetingId, ExpertInviteTypeEnum inviteType) { - Integer tempStatus = status == null ? null : status.getCode(); - Integer tempInviteType = inviteType == null ? null : inviteType.getCode(); - return baseMapper.countExpertByStatusAndMeetingId(tempStatus, meetingId, tempInviteType); - } - - @Override - public List listAgreedExperts(Collection meetingIds) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode()) - .in(MeetingExpert::getMeetingId, meetingIds); - return baseMapper.selectList(query); - } - - @Override - public List listExpertLastByMeetingIds(Collection meetingIds) { - return baseMapper.listExpertLastByMeetingIds(meetingIds); - } - - @Override - public Page pageReviewProjectList(ReviewProjectListReq req) { - return baseMapper.pageReviewProjectList(req.page(), req); - } - - @Override - public List listAgreeExpertIdByRecentDaysAndAgreeCount(int agreeCount, LocalDateTime sTime, LocalDateTime eTime) { - return baseMapper.listAgreeExpertIdByRecentDaysAndAgreeCount(agreeCount, sTime, eTime); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingInnerProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingInnerProjectServiceImpl.java deleted file mode 100644 index 0d219f0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingInnerProjectServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject; -import com.ningdatech.pmapi.meeting.mapper.MeetingInnerProjectMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - *

- * 会议评审内部项目表 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -@Service -public class MeetingInnerProjectServiceImpl extends ServiceImpl implements IMeetingInnerProjectService { - - @Override - public List listByMeetingId(Long meetingId) { - return list(Wrappers.lambdaQuery(MeetingInnerProject.class) - .eq(MeetingInnerProject::getMeetingId, meetingId)); - } - - @Override - public List listMeetingIdByProjectId(Long projectId) { - LambdaQueryWrapper query = Wrappers - .lambdaQuery(MeetingInnerProject.class) - .eq(MeetingInnerProject::getProjectId, projectId); - return CollUtils.fieldList(list(query), MeetingInnerProject::getMeetingId); - } - - @Override - public List listMeetingIdByProjectCode(String projectCode) { - LambdaQueryWrapper query = Wrappers - .lambdaQuery(MeetingInnerProject.class) - .eq(MeetingInnerProject::getProjectCode, projectCode); - return CollUtils.fieldList(list(query), MeetingInnerProject::getMeetingId); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java deleted file mode 100644 index 0ec1250..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; -import com.ningdatech.pmapi.meeting.mapper.MeetingOuterProjectMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingOuterProjectService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - *

- * 会议评审外部项目 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-28 - */ -@Service -public class MeetingOuterProjectServiceImpl extends ServiceImpl implements IMeetingOuterProjectService { - - @Override - public List listByMeetingId(Long meetingId) { - return list(Wrappers.lambdaQuery(MeetingOuterProject.class) - .eq(MeetingOuterProject::getMeetingId, meetingId)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingServiceImpl.java deleted file mode 100644 index 116e429..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meeting.service.impl; - -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard; -import com.ningdatech.pmapi.meeting.mapper.MeetingMapper; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -/** - *

- * 会议 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-26 - */ -@Service -public class MeetingServiceImpl extends ServiceImpl implements IMeetingService { - - @Override - public void stopRandomInvite(Long meetingId) { - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class) - .eq(Meeting::getId, meetingId) - .set(Meeting::getInviteStatus, Boolean.TRUE); - update(update); - } - - @Override - public Map meetingCountSummary(Long createBy) { - List> meetingCountSummary = baseMapper.meetingCountSummary(createBy); - return CollUtils.listToMap(meetingCountSummary, w -> MeetingStatusByDashboard.valueOf(w.getGroupKey()), - CountGroupByDTO::getTotal); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java deleted file mode 100644 index 73d6394..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.ningdatech.pmapi.meeting.task; - -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.YxtCallBackDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.yxt.entity.SysMsgRecordDetail; -import com.ningdatech.yxt.service.ISysMsgRecordDetailService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.time.Duration; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.util.*; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; - -/** - *

- * ExpertCallResultRewriteTask - *
- * 专家电话结果回填 - *

- * - * @author WendyYang - * @since 14:15 2022/8/18 - */ -@Slf4j -@Component -@AllArgsConstructor -public class ExpertCallResultRewriteTask { - - private final RandomInviteProperties randomInviteProperties; - - private final ThreadPoolTaskScheduler scheduler; - private final IMeetingExpertService meetingExpertService; - private final IExpertInviteRuleService inviteRuleService; - private final ISysMsgRecordDetailService msgRecordDetailService; - private final static int MINUTES_CALL_RESULT_FEEDBACK = 15; - - private static final String AGREE_KEY = "1"; - - @PostConstruct - public void initTask() { - if (!randomInviteProperties.getEnable()) { - log.warn("随机邀请已关闭……"); - return; - } - Instant startTime = Instant.now().plus(randomInviteProperties.getResultRewriteFixedRate(), ChronoUnit.MINUTES); - // 处理电话结果回填 - Duration fixedRate = Duration.ofMinutes(randomInviteProperties.getResultRewriteFixedRate()); - scheduler.scheduleAtFixedRate(this::rewritePhoneCallResult, startTime, fixedRate); - } - - - public void rewritePhoneCallResult() { - log.info("开始执行电话结果回填任务:{}", Thread.currentThread().getName()); - // 查询所有邀请的专家信息 状态为通话中的 - LambdaQueryWrapper meQuery = Wrappers.lambdaQuery(MeetingExpert.class) - .eq(MeetingExpert::getStatus, NOTICING.getCode()) - .eq(MeetingExpert::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode()); - List experts = meetingExpertService.list(meQuery); - if (experts.isEmpty()) { - log.info("暂无电话结果回填任务执行"); - return; - } - // 所有随机邀请的规则ID - Map submitKeys = new HashMap<>(experts.size()); - Set randomRuleIds = experts.stream().peek(w -> submitKeys.put(w.getId(), w.getSubmitKey())) - .map(MeetingExpert::getRuleId).collect(Collectors.toSet()); - // 查询随机邀请回调等待时间 - Map callbackMinutes = new HashMap<>(randomRuleIds.size()); - if (!randomRuleIds.isEmpty()) { - List inviteRules = inviteRuleService.listByIds(randomRuleIds); - inviteRules.forEach(w -> { - RandomInviteRuleDTO rule = JSONObject.parseObject(w.getInviteRule(), RandomInviteRuleDTO.class); - callbackMinutes.put(w.getId(), rule.getWaitForCallbackMinutes()); - }); - } - LambdaQueryWrapper msgRecordDetailQuery = Wrappers.lambdaQuery(SysMsgRecordDetail.class) - .in(SysMsgRecordDetail::getSubmitKey, submitKeys.values()); - List recordDetailList = msgRecordDetailService.list(msgRecordDetailQuery); - if (recordDetailList.isEmpty()) { - return; - } - Map recordDetailMap = recordDetailList.stream() - .collect(Collectors.toMap(w -> w.getSubmitKey() + StrPool.UNDERSCORE + w.getReceiveNumber(), w -> w)); - List updates = new ArrayList<>(), agrees = new ArrayList<>(); - for (MeetingExpert expert : experts) { - String key = expert.getSubmitKey() + StrPool.UNDERSCORE + expert.getMobile(); - SysMsgRecordDetail msgRecordDetail = recordDetailMap.get(key); - if (msgRecordDetail == null) { - // 极端情况下获取不到submitKey异常情况 - continue; - } - Integer minutes = ObjectUtil.defaultIfNull(callbackMinutes.get(expert.getRuleId()), MINUTES_CALL_RESULT_FEEDBACK); - Optional status = getStatusByMsgRecordDetail(msgRecordDetail, minutes, expert.getCreateOn()); - if (status.isPresent()) { - MeetingExpert update = new MeetingExpert(); - update.setUpdateBy(0L); - update.setUpdateOn(LocalDateTime.now()); - update.setId(expert.getId()); - update.setStatus(status.get()); - if (AGREED.eq(update.getStatus())) { - // 发送专家确认参加的短信通知 - // sendAgreeNotice(expert); - agrees.add(expert); - } - updates.add(update); - } - } - meetingExpertService.updateBatchById(updates); - } - - private static Optional getStatusByMsgRecordDetail(SysMsgRecordDetail mrd, int minutes, LocalDateTime createOn) { - LocalDateTime limitTime = LocalDateTime.now().minusMinutes(minutes); - String callBackJson = mrd.getCallBackJson(); - boolean waiting = limitTime.isBefore(createOn); - boolean hasCallBack = StrUtils.isNotBlank(callBackJson); - if (!hasCallBack && waiting) { - return Optional.empty(); - } - ExpertAttendStatusEnum status; - if (hasCallBack) { - try { - YxtCallBackDTO callback = JSONObject.parseObject(callBackJson, YxtCallBackDTO.class); - LocalDateTime dialBeginTime = callback.getDialBeginTime(); - if (dialBeginTime == null) { - return Optional.empty(); - } - Integer resultCode = callback.getResultCode(); - if (resultCode != null && resultCode == 0) { - String pressKey = callback.getPressKey(); - if (pressKey != null) { - pressKey = pressKey.replaceAll("\\*", "").trim(); - } - if (StrUtils.isBlank(pressKey) && waiting) { - return Optional.empty(); - } - status = AGREE_KEY.equals(pressKey) ? AGREED : REFUSED; - } else { - if (waiting) { - return Optional.empty(); - } - status = REFUSED; - } - } catch (Exception e) { - log.error("获取电话回调结果异常{}", mrd, e); - status = UNANSWERED; - } - } else { - // 超时未回复设置为拒绝参加 - status = REFUSED; - } - return Optional.of(status.getCode()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteExecutorConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteExecutorConfig.java deleted file mode 100644 index 8e2d3f5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteExecutorConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.meeting.task; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; - -/** - *

- * ExpertInviteExecutorConfig - *

- * - * @author WendyYang - * @since 16:21 2022/8/16 - */ -@Configuration -public class ExpertInviteExecutorConfig { - - @Bean(name = "expertInviteScheduler") - public ThreadPoolTaskScheduler threadPoolTaskScheduler() { - ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); - scheduler.setPoolSize(3); - scheduler.setThreadGroupName("expert-invite"); - scheduler.setThreadNamePrefix("invite-executor-"); - scheduler.setAwaitTerminationSeconds(60); - scheduler.setWaitForTasksToCompleteOnShutdown(true); - return scheduler; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java deleted file mode 100644 index dde344d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java +++ /dev/null @@ -1,354 +0,0 @@ -package com.ningdatech.pmapi.meeting.task; - -import cn.hutool.core.util.ArrayUtil; -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.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.SpringUtils; -import com.ningdatech.cache.model.cache.CacheHashKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.common.util.SpringContextHolder; -import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder; -import com.ningdatech.pmapi.meeting.entity.domain.Meeting; -import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; -import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; -import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO; -import com.ningdatech.pmapi.meeting.entity.dto.InviteCacheDTO; -import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; -import com.ningdatech.pmapi.meeting.entity.req.ConfirmedRosterReq; -import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; -import com.ningdatech.pmapi.meeting.manage.ExpertInviteManage; -import com.ningdatech.pmapi.meeting.manage.MeetingManage; -import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService; -import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; -import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; -import com.ningdatech.pmapi.meeting.service.IMeetingService; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; -import org.springframework.aop.framework.AopContext; -import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.Assert; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import java.time.Duration; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.atomic.AtomicInteger; - - -/** - *

- * 专家随机邀请任务 - *

- * - * @author WendyYang - * @since 21:25 2022/8/15 - */ -@Slf4j -@Component -@AllArgsConstructor -public class ExpertRandomInviteTask { - - private final RandomInviteProperties properties; - private static final String MEETING_ID_INVITE_RANDOM = "MEETING_ID_INVITE_RANDOM"; - - private static final Duration EXPIRE_TIME = Duration.ofDays(60); - - private final CachePlusOps cachePlusOps; - @Resource(name = "expertInviteScheduler") - private ThreadPoolTaskScheduler scheduler; - private final IMeetingExpertService meetingExpertService; - private final IExpertInviteRuleService inviteRuleService; - private final IMeetingService meetingService; - private final ExpertInviteManage expertInviteManage; - private final IExpertInviteAvoidRuleService inviteAvoidRuleService; - private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; - - /** - * 用来存入线程执行句柄, 停止定时任务时使用 - */ - private static final ConcurrentMap> INVITE_TASK_MAP = new ConcurrentHashMap<>(); - - private ExpertRandomInviteTask currProxy() { - return (ExpertRandomInviteTask) AopContext.currentProxy(); - } - - private CacheHashKey getCacheKey(Long meetingId) { - String field = meetingId == null ? null : meetingId.toString(); - return new CacheHashKey(MEETING_ID_INVITE_RANDOM, field, EXPIRE_TIME); - } - - @PostConstruct - public void initTask() { - if (!properties.getEnable()) { - log.warn("随机邀请已关闭……"); - return; - } - initInviteTaskAfterStarted(); - } - - /** - * 项目重启之后重新初始化邀请任务 - */ - private void initInviteTaskAfterStarted() { - Map caches = cachePlusOps.hGetAll(getCacheKey(null)); - if (MapUtils.isEmpty(caches)) { - log.info("暂无需要初始化的抽取会议信息"); - return; - } - Integer inviteDelay = properties.getInviteDelay(); - for (InviteCacheDTO cache : caches.values()) { - Boolean reInvite = cache.getReInvite(); - LocalDateTime tsTime = cache.getTaskStartTime(); - boolean added = addInviteTask(cache.getMeetingId(), true, inviteDelay, reInvite, tsTime); - if (!added) { - cachePlusOps.hDel(getCacheKey(cache.getMeetingId())); - } - } - } - - /** - * 专家抽取校验(抽取数量是否不足) - * - * @param meetingId 会议ID - * @return boolean - * @author WendyYang - **/ - private boolean inviteCountCheck(Long meetingId) { - Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); - if (ruleMap.isEmpty()) { - return Boolean.FALSE; - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpert.class) - .select(MeetingExpert::getRuleId, MeetingExpert::getStatus) - .in(MeetingExpert::getRuleId, ruleMap.keySet()) - .eq(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode()); - List experts = meetingExpertService.list(query); - if (experts.isEmpty()) { - return Boolean.TRUE; - } - Map cntMap = CollUtils.groupCount(experts, MeetingExpert::getRuleId); - for (Map.Entry entry : ruleMap.entrySet()) { - Long agreeCnt = cntMap.getOrDefault(entry.getKey(), 0L); - if (agreeCnt < entry.getValue().getCount()) { - return Boolean.TRUE; - } - } - return Boolean.FALSE; - } - - /** - * 唤醒某个会议的抽取任务 - * - * @param meetingId 会议ID - * @param reInvite 是否可邀请已拒绝的专家 - * @author WendyYang - **/ - public void notifyInviteTask(Long meetingId, boolean... reInvite) { - boolean tmpReInvite = ArrayUtil.isEmpty(reInvite) || reInvite[0]; - if (!INVITE_TASK_MAP.containsKey(meetingId)) { - if (addInviteTask(meetingId, false, properties.getInviteDelay(), tmpReInvite, LocalDateTime.now())) { - log.info("重置会议的随机抽取状态:{}", meetingId); - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class); - update.set(Meeting::getInviteStatus, false); - update.eq(Meeting::getId, meetingId); - meetingService.update(update); - InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, tmpReInvite, LocalDateTime.now()); - cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); - } - } - } - - /** - * 添加专家抽取校验任务 - * - * @param meetingId 会议ID - * @param checked 是否前置校验 - * @param delayTime 延迟执行时间 - * @param reInvite 是否可以邀请被拒绝的专家 - * @param tsTime 任务启动时间 - * @return 是否添加任务成功 - * @author WendyYang - **/ - private boolean addInviteTask(Long meetingId, boolean checked, int delayTime, boolean reInvite, LocalDateTime tsTime) { - if (checked && !inviteCountCheck(meetingId)) { - // 如果抽取数量满足直接返回 - return Boolean.FALSE; - } - Instant startTime = LocalDateTime.now().plusMinutes(delayTime).atZone(ZoneId.systemDefault()).toInstant(); - ScheduledFuture future = scheduler.scheduleAtFixedRate(() -> { - ExpertRandomInviteTask bean = SpringContextHolder.getBean(ExpertRandomInviteTask.class); - try { - bean.invite(meetingId, reInvite, tsTime); - } catch (Exception e) { - log.error("执行专家邀请任务异常:{}", meetingId, e); - } - }, startTime, Duration.ofMinutes(properties.getInviteFixedRate())); - INVITE_TASK_MAP.putIfAbsent(meetingId, future); - log.info("添加专家抽取后台任务:{}", meetingId); - return Boolean.TRUE; - } - - /** - * 创建会议时添加抽取任务 - * - * @param meetingId 会议ID - * @param tsTime 开始时间 - * @author WendyYang - **/ - public void addInviteTaskByMeetingCreate(Long meetingId, LocalDateTime tsTime) { - Assert.isTrue(properties.getEnable(), "随机邀请已关闭"); - addInviteTask(meetingId, false, properties.getInviteDelay(), false, tsTime); - InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false, tsTime); - cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); - } - - /** - * 抽取过程 - * - * @param meetingId 会议ID - * @param reInvite 是否可以邀请已拒绝的专家 - * @param tsTime 任务开启时间 - */ - @Transactional(rollbackFor = Exception.class) - public void invite(Long meetingId, Boolean reInvite, LocalDateTime tsTime) { - log.info("开始进行专家后台抽取:{}", meetingId); - Meeting meeting = meetingService.getById(meetingId); - if (meeting.getInviteStatus() || meeting.getStartTime().isBefore(LocalDateTime.now())) { - log.info("会议已开始停止抽取:{}", meeting); - killTaskAndDelCacheMeetingId(meetingId); - return; - } - // 随机邀请规则 - Map ruleMap = inviteRuleService.randomRuleByMeetingId(meetingId); - // 回避规则 - AvoidRuleDTO avoidRule = inviteAvoidRuleService.getAvoidInfo(meetingId); - // 还需要抽取的规则数量 - AtomicInteger notIgnoreCnt = new AtomicInteger(ruleMap.size()); - AtomicInteger notSupportCnt = new AtomicInteger(0); - LocalDateTime msTime = meeting.getStartTime(); - LocalDateTime meTime = meeting.getStartTime(); - ruleMap.forEach((ruleId, value) -> { - List tmpExperts = meetingExpertService.listExpertLastByMeetingId(meetingId); - Map expertMap = CollUtils.listToMap(tmpExperts, MeetingExpert::getExpertId); - // 统计通知中与同意参加专家数量 - Map countMap = countByAttendStatus(expertMap); - ExpertCntBO cnt = countMap.getOrDefault(ruleId, ExpertCntBO.zeroInit()); - int wouldAttendCnt = cnt.getAgreeCnt() + cnt.getNoticeCnt(); - if (wouldAttendCnt == value.getCount()) { - if (cnt.getAgreeCnt().equals(value.getCount())) { - notIgnoreCnt.decrementAndGet(); - } - return; - } - int needInviteCnt = value.getCount() - wouldAttendCnt; - ExpertChooseDTO expertChoose = expertInviteManage.expertReplaceByRandomRule(avoidRule, value, - tmpExperts, needInviteCnt, msTime, meTime, tsTime, reInvite); - - if (expertChoose.getTotal() > 0) { - List expertMeetings = CollUtils.convert(expertChoose.getExperts(), w -> { - MeetingExpert expert = ExpertInviteBuilder.getExpertByRandom(meetingId, w, ruleId); - expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode()); - return expert; - }); - meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertMeetings); - log.info("会议:{} 后台抽取专家:{}名", meetingId, expertMeetings.size()); - meetingExpertService.saveBatch(expertMeetings); - } else { - // 抽取人数不够 - notSupportCnt.incrementAndGet(); - } - }); - if (notIgnoreCnt.get() == 0 || notIgnoreCnt.get() == notSupportCnt.get()) { - log.info("停止会议随机邀请:{} 未完成抽取规则数量 {} 无可抽取专家规则数量 {}", meetingId, notIgnoreCnt, notSupportCnt); - meetingService.stopRandomInvite(meetingId); - if (notIgnoreCnt.get() == notSupportCnt.get() && notIgnoreCnt.get() > 0) { - // 当未完成抽取且无专家可抽取时 - meetingCallOrMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName()); - } - } - // 所有抽取规则抽取人数满足 自动召开会议 - if (notIgnoreCnt.get() == 0 && notSupportCnt.get() == 0) { - MeetingManage meetingManage = SpringUtils.getBean(MeetingManage.class); - ConfirmedRosterReq req = new ConfirmedRosterReq(); - req.setReconfirmed(false); - req.setMeetingId(meetingId); - meetingManage.confirmedRoster(req); - } - } - - private void killTaskAndDelCacheMeetingId(Long meetingId) { - cachePlusOps.hDel(getCacheKey(meetingId)); - ScheduledFuture future = INVITE_TASK_MAP.get(meetingId); - if (future != null) { - INVITE_TASK_MAP.remove(meetingId); - if (!future.isCancelled()) { - future.cancel(true); - } - } - } - - @Transactional(rollbackFor = Exception.class) - public void cancelByMeetingIdAndKillTask(Long meetingId) { - log.info("终止专家抽取:{}", meetingId); - meetingService.stopRandomInvite(meetingId); - killTaskAndDelCacheMeetingId(meetingId); - } - - //================================================================================================================== - - private Map countByAttendStatus(Map expertMap) { - Map cntMap = new HashMap<>(8); - expertMap.values().forEach(w -> { - Long ruleId = w.getRuleId(); - ExpertCntBO cnt = cntMap.computeIfAbsent(ruleId, k -> ExpertCntBO.zeroInit()); - if (ExpertAttendStatusEnum.AGREED.eq(w.getStatus())) { - cnt.incrAgreeCnt(); - } else if (ExpertAttendStatusEnum.NOTICING.eq(w.getStatus())) { - cnt.incrNoticeCnt(); - } - }); - return cntMap; - } - - @Data - public static class ExpertCntBO { - - private Integer agreeCnt; - - private Integer noticeCnt; - - public ExpertCntBO(Integer agreeCnt, Integer noticeCnt) { - this.agreeCnt = agreeCnt; - this.noticeCnt = noticeCnt; - } - - public void incrAgreeCnt() { - agreeCnt++; - } - - public void incrNoticeCnt() { - noticeCnt++; - } - - public static ExpertCntBO zeroInit() { - return new ExpertCntBO(0, 0); - } - - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/RandomInviteProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/RandomInviteProperties.java deleted file mode 100644 index fa3a182..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/RandomInviteProperties.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.meeting.task; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - *

- * TelInviteTaskProperties - *

- * - * @author WendyYang - * @since 17:25 2022/9/9 - */ -@Data -@Component -@ConfigurationProperties(prefix = "random-invite") -public class RandomInviteProperties { - - /** - * 是否开启随机抽取 - */ - private Boolean enable = true; - /** - * 电话结果回填执行频率(分钟) - */ - private Integer resultRewriteFixedRate = 2; - /** - * 随机邀请延迟执行(分钟) - */ - private Integer inviteDelay = 2; - /** - * 随机邀请执行频率(分钟) - */ - private Integer inviteFixedRate = 3; - /** - * 会议抽取完成通知 管理员下发会议通知 - */ - private Integer meetingInviteCompleteNoticeRate = 1; - - /** - * 近期会议数量(以此来降低专家抽中间隔) - */ - private Integer recentMeetingCount = 5; - - /** - * 参会次数限制天数 - */ - private Integer recentDays = 7; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java deleted file mode 100644 index 109d695..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meta.assembler; - - -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.vo.ResDictionaryVO; - -/** - * @author liuxinxin - * @date 2022/7/22 上午10:53 - */ - -public class MetaDictionaryAssembler { - - public static DictionaryDTO toDictionaryDTO(MetaDictionary dictionaryManage) { - DictionaryDTO dictionaryDTO = new DictionaryDTO(); - dictionaryDTO.setDescribe(dictionaryManage.getDictionaryDescribe()); - dictionaryDTO.setDictionaryCode(dictionaryManage.getDictionaryCode()); - dictionaryDTO.setDictionaryType(dictionaryManage.getDictionaryType()); - dictionaryDTO.setName(dictionaryManage.getDictionaryName()); - dictionaryDTO.setReadonly(dictionaryManage.getReadonly()); - dictionaryDTO.setSortValue(dictionaryManage.getSortValue()); - return dictionaryDTO; - } - - public static ResDictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { - ResDictionaryVO resDictionaryVO = new ResDictionaryVO(); - resDictionaryVO.setDescribe(dictionaryDTO.getDescribe()); - resDictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); - resDictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); - resDictionaryVO.setName(dictionaryDTO.getName()); - resDictionaryVO.setReadonly(dictionaryDTO.getReadonly()); - resDictionaryVO.setSortValue(dictionaryDTO.getSortValue()); - return resDictionaryVO; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java deleted file mode 100644 index 44f850d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.meta.assembler; - -import com.ningdatech.pmapi.meta.model.entity.MetaTag; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; -import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:57 - */ - -public class MetaTagAssembler { - - public static TagDTO toTagDTO(MetaTag metaTagManage) { - TagDTO tagDTO = new TagDTO(); - tagDTO.setParentCode(metaTagManage.getParentCode()); - tagDTO.setTagCode(metaTagManage.getTagCode()); - tagDTO.setTagLevel(metaTagManage.getTagLevel()); - tagDTO.setTagName(metaTagManage.getTagName()); - return tagDTO; - } - - public static List toTagTreeDTOList(List tagDTOList) { - if (CollectionUtils.isEmpty(tagDTOList)) { - return new ArrayList<>(); - } - return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); - - } - - public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { - TagTreeDTO tagTreeDTO = new TagTreeDTO(); - tagTreeDTO.setParentCode(tagDTO.getParentCode()); - tagTreeDTO.setTagCode(tagDTO.getTagCode()); - tagTreeDTO.setTagLevel(tagDTO.getTagLevel()); - tagTreeDTO.setTagName(tagDTO.getTagName()); - return tagTreeDTO; - } - - public static List toTagTreeVOList(List tagTreeDTOList) { - List resTagTreeVOList = new ArrayList<>(); - for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { - ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); - resTagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); - resTagTreeVO.setTagName(tagTreeDTO.getTagName()); - resTagTreeVO.setParentCode(tagTreeDTO.getParentCode()); - resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); - resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); - if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { - resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); - } - resTagTreeVOList.add(resTagTreeVO); - } - return resTagTreeVOList; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java deleted file mode 100644 index 25d6310..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.meta.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:08 - */ -@AllArgsConstructor -@Getter -public enum DictAllTypeEnum { - - // 政治面貌 - POLITICAL("political"), - // 专家来源 - EXPERT_SOURCE("expert_source"), - // 学历 - EDU("edu"), - // 学位 - DEGREE("degree"), - // 在职状态 - JOB_STATUS("job_status"), - // 行政职级 - ADMINISTRATIVE_RANK("administrative_rank"), - // 内外围(专家类型) - EXPERT_TYPE("expert_type"), - // 单位类型 - COMPANY_ATTRIBUTE("company_attribute"), - // 职称级别 - TITLE_LEVEL("title_level"), - // 通知类型 - NOTICE_TYPE("notice_type"), - // 会议类型 - MEETING_TYPE("meeting_type"); - - private final String key; - - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { - if (typeEnum.key.equals(key)) { - return true; - } - } - return false; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java deleted file mode 100644 index d8b1962..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.meta.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:08 - */ -@AllArgsConstructor -@Getter -public enum DictExpertInfoTypeEnum { - - // 政治面貌 - POLITICAL("political"), - // 学历 - EDU("edu"), - // 学位 - DEGREE("degree"), - // 在职状态 - JOB_STATUS("job_status"), - // 行政职级 - ADMINISTRATIVE_RANK("administrative_rank"), - // 内外围(专家类型) - EXPERT_TYPE("expert_type"), - // 单位类型 - COMPANY_ATTRIBUTE("company_attribute"), - // 职称级别 - TITLE_LEVEL("title_level"), - // 推荐方式 - RECOMMENDED_WAY("recommended_way"); - - - private final String key; - - public static List getAll() { - List dictionaryList = new ArrayList<>(); - DictExpertInfoTypeEnum[] values = DictExpertInfoTypeEnum.values(); - for (DictExpertInfoTypeEnum typeEnum : values) { - dictionaryList.add(typeEnum.key); - } - return dictionaryList; - } - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (DictExpertInfoTypeEnum typeEnum : DictExpertInfoTypeEnum.values()) { - if (typeEnum.key.equals(key)) { - return true; - } - } - return false; - } - - public static DictExpertInfoTypeEnum of(String key) { - for (DictExpertInfoTypeEnum statusEnum : DictExpertInfoTypeEnum.values()) { - if (statusEnum.key.equals(key)) { - return statusEnum; - } - } - throw new IllegalArgumentException(String.format("Illegal DictionaryExpertInfoTypeEnum = %s", key)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java deleted file mode 100644 index 79ca540..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.meta.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 上午11:13 - */ -@AllArgsConstructor -@Getter -public enum ExpertTagEnum { - - // 专家来源 - EXPERT_SOURCE("expert_source"), - // 擅长方向 - GOOD_AT("good_at"), - // 技术专长 - TECHNICAL_EXPERTISE("technical_expertise"), - // 行业领域 - INDUSTRY_SECTOR("industry_sector"), - // 其他 - OTHER("other"); - - private final String key; - - public static List getAll() { - List tagList = new ArrayList<>(); - ExpertTagEnum[] values = ExpertTagEnum.values(); - for (ExpertTagEnum fieldEnum : values) { - tagList.add(fieldEnum.key); - } - return tagList; - } - - public static boolean contains(String key) { - if (StringUtils.isBlank(key)) { - return false; - } - for (ExpertTagEnum fieldEnum : ExpertTagEnum.values()) { - if (fieldEnum.key.equals(key)) { - return true; - } - } - return false; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java deleted file mode 100644 index fd0cc27..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meta.constant; - -/** - * @author liuxinxin - * @date 2022/8/27 下午1:49 - */ - -public class TagConst { - - private TagConst() { - } - - /** - * 标签类型顶级时 parent_code 为 -1 - */ - public static final String TAG_ROOT_PARENT_CODE = "-1"; - - public static final Long TAG_ROOT_LEVEL = 1L; - - public static final String TAG_CREATOR = "管理员"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java deleted file mode 100644 index f1d4afe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.meta.manage.MetaManage; -import com.ningdatech.pmapi.meta.model.po.ReqAddDictionaryPO; -import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; -import com.ningdatech.pmapi.meta.model.vo.ResDictionaryListVO; -import com.ningdatech.pmapi.meta.validate.DictionaryRequestValidator; -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.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author liuxinxin - * @since 2022-07-21 - */ -@RestController -@Validated -@RequiredArgsConstructor -@RequestMapping("/api/v1/meta/dictionary") -@Api(tags = "基础数据接口") -public class MetaDictionaryManageController { - - // private final IMetaDictionaryManageService metaDictionaryManageService; - private final MetaManage metaManage; - - @PostMapping("/list") - @ApiOperation("字典筛选数据返回") - public List expertDictList(@RequestBody ReqDictionaryListPO request) { - DictionaryRequestValidator.dictionaryRequestValidator(request); - return metaManage.getDictionaryList(request); - } - - @PostMapping("/common/list") - @ApiOperation("通用字典筛选数据返回") - public List commonDictList(@RequestBody ReqDictionaryListPO request) { - DictionaryRequestValidator.dictionaryRequestValidator(request); - return metaManage.commonDictList(request); - } - - @PostMapping("/add/dictionary") - @ApiOperation("添加字典值") - @WebLog("添加字典值") - public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO reqAddDictionaryPO) { - metaManage.addDictionary(reqAddDictionaryPO); - } - - @PostMapping("/remove/dictionary/{dictionaryCode}") - @ApiOperation("删除字典值") - @WebLog("删除字典值") - public void removeDictionary(@PathVariable String dictionaryCode) { - metaManage.removeDictionary(dictionaryCode); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java deleted file mode 100644 index ee43763..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.meta.manage.MetaManage; -import com.ningdatech.pmapi.meta.model.po.ReqAddTagTypePO; -import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; -import com.ningdatech.pmapi.meta.model.po.ReqTagQueryPO; -import com.ningdatech.pmapi.meta.model.vo.ResTagListVO; -import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; -import com.ningdatech.pmapi.meta.model.vo.ResTagTypeVO; -import com.ningdatech.pmapi.meta.validate.TagListRequestValidator; -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.*; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author liuxinxin - * @since 2022-07-21 - */ -@RestController -@Validated -@RequiredArgsConstructor -@RequestMapping("/api/v1/meta") -@Api(value = "MetaController", tags = "基础数据接口") -public class MetaTagManageController { - - /** - * 专家标签的缓存时间设置为5分钟,单位秒 - */ - private static final Long MAX_AGE = 5 * 60L; - /** - * max-age=86400 - */ - private static final String MAX_AGE_STR = "max-age=" + MAX_AGE; - private final MetaManage metaManage; - - @PostMapping("/tag") - @ApiOperation("获取专家标签的树状结构") - public List getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { - response.setHeader("Cache-Control", MAX_AGE_STR); - TagListRequestValidator.tagListRequestValidator(request); - return metaManage.getTagTree(request); - } - - @PostMapping("/tag/query") - @ApiOperation("标签查询接口") - public List tagQuery(@Valid @RequestBody ReqTagQueryPO reqTagQueryPO) { - return metaManage.tagQuery(reqTagQueryPO); - } - - @PostMapping("/tag-tyoe/list") - @ApiOperation("获取标签分类列表") - public List tagTypeList() { - return metaManage.tagTypeList(); - } - - @PostMapping("/add/tag-type") - @ApiOperation("新增标签分类") - @WebLog("新增标签分类") - public void addTagType(@Valid @RequestBody ReqAddTagTypePO request) { - metaManage.addTagType(request); - } - - @PostMapping("/remove/tag/{tagCode}") - @ApiOperation("删除标签") - @WebLog("删除标签") - public void removeTagName(@PathVariable String tagCode) { - metaManage.removeTagName(tagCode); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java deleted file mode 100644 index 35c251c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.meta.helper; - - - -import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/12/22 上午11:03 - */ - -public interface DictionaryCache { - - /** - * 根据字典类型枚举 获取 字典列表 - * - * @param dictionaryType - * @return - */ - List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType); - - /** - * 根据字典类型 获取 字典列表 - * - * @param dictionaryType - * @return - */ - List getDictionaryListByDictionaryType(String dictionaryType); - - /** - * 根据字典类型、字典编码 获取 字典实体 - * - * @param dictionaryType - * @param code - * @return - */ - DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code); - - /** - * 根据字典编码 获取 字典实体 - * - * @param dictionaryCode - * @return - */ - DictionaryDTO getByCode(String dictionaryCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java deleted file mode 100644 index 75d0798..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meta.helper; - -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; - -/** - * @author liuxinxin - * @date 2023/3/2 上午11:02 - */ - -public interface ExpertUserInfoHelper { - - ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId); - - ExpertRegionInfo getExpertRegionInfo(Long expertUserId); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java deleted file mode 100644 index fa16617..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.meta.helper; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - * @author liuxinxin - * @date 2022/8/30 下午2:17 - * 公共专家相关信息工具类 用于获取专家的一些基础信息 - */ -@Component -@RequiredArgsConstructor -public class ExpertUserInfoHelperImpl implements ExpertUserInfoHelper { - - private final IExpertUserFullInfoService iExpertUserFullInfoService; - - /** - * 获取专家 - * - * @param expertUserId - * @return - */ - @Override - public ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId) { - return iExpertUserFullInfoService - .getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class).eq(ExpertUserFullInfo::getUserId, expertUserId)); - } - - /** - * 获取专家层级 - * - * @param expertUserId - * @return - */ - @Override - public ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { - ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); - - Integer regionLevel = one.getRegionLevel(); - String regionCode = one.getRegionCode(); - ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); - expertRegionInfo.setRegionCode(regionCode); - expertRegionInfo.setRegionLevel(regionLevel); - return expertRegionInfo; - } - -// /** -// * 专家是否已经出库 -// */ -// public Boolean isDelivery(Long expertUserId) { -// ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); -// if (Objects.isNull(one)) { -// return true; -// } -// return ExpertAccountStatusEnum.DELIVERY.getKey().equals(one.getExpertAccountStatus()); -// } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java deleted file mode 100644 index 70cc7a5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.meta.helper; - - -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; - -import java.util.List; -import java.util.Map; - -/** - * @author liuxinxin - * @date 2022/12/22 上午11:56 - */ - -public interface TagCache { - - /** - * @param level 最多几级标签 - * @param rootTagCode 根标签类型及对应的字段类型 - * @return - */ - TagTreeDTO getTagTreeDTO(int level, String rootTagCode); - - /** - * 根据标签编码获取 实体类 - * - * @param tagCode - * @return - */ - TagDTO getByTagCode(String tagCode); - - /** - * 导入原专家库数据使用 - * - * @return - */ - Map getNameTagDtoMap(); - - /** - * 获取所有子节点包含当前节点 - * - * @param code 标签编码 - * @return - */ - List listChildren(String code); - - /** - * 获取所有子节点包含当前节点的编码 - * - * @param code 标签编码 - * @return - */ - List listChildrenCodes(String code); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java deleted file mode 100644 index 77bb4a5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.meta.helper.basic; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/12/22 上午11:03 - */ -public abstract class AbstractDictionaryCache implements InitializingBean, DictionaryCache { - - @Autowired - private IMetaDictionaryService iMetaDictionaryService; - - protected Map dictionaryMap = new ConcurrentHashMap<>(); - protected LoadingCache> dictionaryCacheHelper; - - @Override - public void afterPropertiesSet() { - dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) - .refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { - List dictionaryDTOList = iMetaDictionaryService.queryAll(); - dictionaryMap = buildCateMap(dictionaryDTOList); - Map> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); - return dictionaryTypeListMap.get(key); - }); - warmUp(); - } - - private Map buildCateMap(List dictionaryDTOList) { - Map dictionaryDtoMap = new ConcurrentHashMap<>(128); - dictionaryDTOList.forEach(dictionaryDTO -> dictionaryDtoMap.put(dictionaryDTO.getDictionaryCode(), dictionaryDTO)); - return dictionaryDtoMap; - } - - private void warmUp() { - for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { - dictionaryCacheHelper.get(typeEnum.getKey()); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java deleted file mode 100644 index 413e410..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.meta.helper.basic; - -import cn.hutool.core.lang.Assert; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; -import com.ningdatech.pmapi.meta.service.IMetaTagService; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/12/22 上午11:56 - */ -public abstract class AbstractTagsCache implements InitializingBean, TagCache { - - protected static final int MAX_LEVEL = 4; - - @Autowired - private IMetaTagService iMetaTagService; - - protected LoadingCache> tagsCache; - - protected Map tagDtoMap; - - @Override - public void afterPropertiesSet() { - tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) - .refreshAfterWrite(5, TimeUnit.MINUTES) - .build(key -> { - // 查询全部 - List tagDTOList = iMetaTagService.queryAll(); - Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); - tagDtoMap = buildCateMap(tagDTOList); - List tagInLevel = tagDTOList.stream().filter(tagDto -> { - // 只过滤出小于等于level的tag - if (Objects.isNull(tagDto.getTagLevel())) { - return false; - } - return Integer.parseInt(key) >= tagDto.getTagLevel(); - }).collect(Collectors.toList()); - List treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); - return toTreeStructure(treeDtos); - }); - warmUp(); - } - - private Map buildCateMap(List tagDTOList) { - Map tagDtoMapTemp = new ConcurrentHashMap<>(1024); - tagDTOList.forEach(tagDTO -> tagDtoMapTemp.put(tagDTO.getTagCode(), tagDTO)); - return tagDtoMapTemp; - } - - private List toTreeStructure(List rootList) { - List nodeList = new ArrayList<>(); - for (TagTreeDTO tagTreeDTO : rootList) { - if ("-1".equals(tagTreeDTO.getParentCode()) || Objects.isNull(tagTreeDTO.getParentCode())) { - nodeList.add(tagTreeDTO); - } - tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), rootList)); - } - return nodeList; - } - - public void warmUp() { - for (int level = 1; level <= MAX_LEVEL; level++) { - tagsCache.get(level + ""); - } - } - - protected List getChildren(String tagCode, List list) { - List childList = new ArrayList<>(); - for (TagTreeDTO tagTreeDTO : list) { - if (tagCode.equals(tagTreeDTO.getParentCode())) { - childList.add(tagTreeDTO); - } - } - for (TagTreeDTO tagTreeDTO : childList) { - tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), list)); - } - if (CollectionUtils.isEmpty(childList)) { - return Collections.emptyList(); - } - return childList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java deleted file mode 100644 index 944fa1d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.meta.helper.impl; - -import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; -import com.ningdatech.pmapi.meta.helper.basic.AbstractDictionaryCache; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/7/22 上午10:47 - */ -@Component -public class DictionaryCacheImpl extends AbstractDictionaryCache { - - @Override - public List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { - return dictionaryCacheHelper.get(dictionaryType.getKey()); - } - - @Override - public List getDictionaryListByDictionaryType(String dictionaryType) { - return dictionaryCacheHelper.get(dictionaryType); - } - - @Override - public DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code) { - return Objects.requireNonNull(dictionaryCacheHelper.get(dictionaryType.getKey())) - .stream().filter(w -> w.getDictionaryCode().equals(code)) - .findFirst().orElse(null); - } - - @Override - public DictionaryDTO getByCode(String dictionaryCode) { - return dictionaryMap.get(dictionaryCode); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java deleted file mode 100644 index e6929e6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.ningdatech.pmapi.meta.helper.impl; - -import cn.hutool.core.bean.BeanUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.meta.helper.basic.AbstractTagsCache; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; -import io.micrometer.core.instrument.util.StringUtils; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:51 - * 标签树 - */ -@Slf4j -@Component -public class TagsCacheImpl extends AbstractTagsCache { - - @Override - public TagTreeDTO getTagTreeDTO(int level, String rootTagCode) { - List tagTreeDtos = tagsCache.get(level + ""); - for (TagTreeDTO tagTreeDTO : tagTreeDtos) { - if (tagTreeDTO.getTagCode().equals(rootTagCode)) { - return tagTreeDTO; - } - } - throw new BizException("rootTagCode not exist"); - } - - @Override - public TagDTO getByTagCode(String tagCode) { - if (StringUtils.isBlank(tagCode)) { - return null; - } - return tagDtoMap.get(tagCode); - } - - /** - * 导入原专家库数据使用 - * - * @return - */ - @Override - public Map getNameTagDtoMap() { - Map nameTagDtoMap = new HashMap<>(1024); - for (String key : tagDtoMap.keySet()) { - nameTagDtoMap.put(tagDtoMap.get(key).getTagName(), tagDtoMap.get(key)); - } - return nameTagDtoMap; - } - - - /** - * 获取所有子节点包含当前节点 - * - * @param code 标签编码 - * @return java.util.List - * @author WendyYang - **/ - @Override - public List listChildren(String code) { - List allTree = tagsCache.get(String.valueOf(MAX_LEVEL)); - assert allTree != null; - List children = getChildren(code, allTree); - TagDTO tagDTO = tagDtoMap.get(code); - TagTreeDTO rootNode = BeanUtil.copyProperties(tagDTO, TagTreeDTO.class); - rootNode.setChildren(children); - return treeToList(rootNode); - } - - /** - * 获取所有子节点包含当前节点的编码 - * - * @param code 标签编码 - * @return java.util.List - * @author WendyYang - **/ - @Override - public List listChildrenCodes(String code) { - return CollUtils.fieldList(listChildren(code), TagTreeDTO::getTagCode); - } - - /** - * tree -> list - * - * @param tagTreeDTO 树节点 - * @return java.util.List - * @author WendyYang - **/ - private List treeToList(TagTreeDTO tagTreeDTO) { - List result = new ArrayList<>(); - result.add(tagTreeDTO); - if (tagTreeDTO.getChildren() != null && !tagTreeDTO.getChildren().isEmpty()) { - tagTreeDTO.getChildren().forEach(node -> { - result.addAll(treeToList(node)); - }); - } - return result; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java deleted file mode 100644 index b6cf02a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.ningdatech.pmapi.meta.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; -import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.constant.TagConst; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; -import com.ningdatech.pmapi.meta.model.entity.MetaTag; -import com.ningdatech.pmapi.meta.model.po.*; -import com.ningdatech.pmapi.meta.model.vo.*; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; -import com.ningdatech.pmapi.meta.service.IMetaTagService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/22 下午2:34 - */ -@Component -@RequiredArgsConstructor -public class MetaManage { - - private final DictionaryCache dictionaryCache; - private final TagCache tagCache; - private final IMetaDictionaryService metaDictionaryManageService; - private final IExpertDictionaryService iExpertDictionaryService; - private final IMetaTagService iMetaTagManageService; - private final IExpertTagService iExpertTagService; - - public List getDictionaryList(ReqDictionaryListPO request) { - List dictionaryTypeList = request.getDictionaryTypeList(); - if (CollectionUtils.isEmpty(dictionaryTypeList)) { - dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); - } - - List resDictionaryListVos = new ArrayList<>(); - for (String dictionaryType : dictionaryTypeList) { - ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); - resDictionaryListVO.setDictionaryName(dictionaryType); - List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); - List resDictionaryVOList = dictionaryList.stream() - .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); - resDictionaryListVO.setDictionaryList(resDictionaryVOList); - resDictionaryListVos.add(resDictionaryListVO); - } - return resDictionaryListVos; - } - - public List commonDictList(ReqDictionaryListPO request) { - List result = new ArrayList<>(); - if (request.getAllDict()) { - Map> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); - groupByType.forEach((k, v) -> { - ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); - resDictionaryListVO.setDictionaryName(k); - List resDictionaryVOList = v.stream() - .map(w -> { - ResDictionaryVO vo = new ResDictionaryVO(); - vo.setDescribe(w.getDictionaryDescribe()); - vo.setDictionaryCode(w.getDictionaryCode()); - vo.setDictionaryType(w.getDictionaryType()); - vo.setName(w.getDictionaryName()); - vo.setReadonly(w.getReadonly()); - vo.setSortValue(w.getSortValue()); - return vo; - }).collect(Collectors.toList()); - resDictionaryListVO.setDictionaryList(resDictionaryVOList); - result.add(resDictionaryListVO); - }); - } else { - List dictionaryTypeList = request.getDictionaryTypeList(); - for (String dictionaryType : dictionaryTypeList) { - ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); - resDictionaryListVO.setDictionaryName(dictionaryType); - List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); - List resDictionaryVOList = dictionaryList.stream() - .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); - resDictionaryListVO.setDictionaryList(resDictionaryVOList); - result.add(resDictionaryListVO); - } - } - return result; - } - - public List getTagTree(ReqTagListPO request) { - List rootTagCodeList = request.getRootTagCodeList(); - if (CollectionUtils.isEmpty(rootTagCodeList)) { - rootTagCodeList = ExpertTagEnum.getAll(); - } - List tagTreeDTOList = new ArrayList<>(); - for (String rootTagCode : rootTagCodeList) { - TagTreeDTO tagTreeDTO = tagCache.getTagTreeDTO(4, rootTagCode); - if (Objects.nonNull(tagTreeDTO)) { - tagTreeDTOList.add(tagTreeDTO); - } - } - return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); - } - - - /** - * 专家管理员才能调用 - * - * @param reqAddDictionaryPO - */ - @Transactional(rollbackFor = Exception.class) - public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { - String dictionaryType = reqAddDictionaryPO.getDictionaryType(); - boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); - if (!contains) { - throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); - } - String name = reqAddDictionaryPO.getName(); - Integer sortValue = reqAddDictionaryPO.getSortValue(); - LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); - List dictionaryManageList = metaDictionaryManageService.list(eq); - - MetaDictionary saveRecord = new MetaDictionary(); - saveRecord.setCreateOn(LocalDateTime.now()); - saveRecord.setDictionaryName(name); - saveRecord.setUpdateOn(LocalDateTime.now()); - saveRecord.setDictionaryCode(BizUtils.uuid32()); - saveRecord.setDictionaryType(dictionaryType); - saveRecord.setReadonly(BoolDisplayEnum.N.name()); - saveRecord.setSortValue(sortValue); - - List saveRecordList = new ArrayList<>(); - saveRecordList.add(saveRecord); - for (MetaDictionary metaDictionary : dictionaryManageList) { - if (metaDictionary.getSortValue() >= sortValue) { - metaDictionary.setSortValue(metaDictionary.getSortValue() + 1); - } - saveRecordList.add(metaDictionary); - } - boolean remove = metaDictionaryManageService - .remove(Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType)); - if (remove) { - metaDictionaryManageService.saveBatch(saveRecordList); - } - } - - public void removeDictionary(String dictionaryCode) { - LambdaUpdateWrapper eq = Wrappers.lambdaUpdate(MetaDictionary.class) - .eq(MetaDictionary::getDictionaryCode, dictionaryCode); - MetaDictionary one = metaDictionaryManageService.getOne(eq); - if (Objects.isNull(one)) { - throw BizException.wrap("字典值不存在"); - } - if (BoolDisplayEnum.judgeBoolean(one.getReadonly())) { - throw BizException.wrap("内置字典值无法删除"); - } - List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getDictionaryCode, dictionaryCode)); - if (CollUtil.isNotEmpty(expertDictionaryList)) { - throw BizException.wrap("该字典值已被使用无法删除"); - } - metaDictionaryManageService.removeById(one); - } - - public void addTagType(ReqAddTagTypePO request) { - String tagName = request.getTagName(); - LambdaQueryWrapper in = Wrappers.lambdaQuery(MetaTag.class) - .in(MetaTag::getTagName, tagName) - .in(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); - List list = iMetaTagManageService.list(in); - if (CollectionUtils.isNotEmpty(list)) { - throw BizException.wrap("该标签类型已存在"); - } - MetaTag saveRecord = new MetaTag(); - saveRecord.setCreateOn(LocalDateTime.now()); - saveRecord.setUpdateOn(LocalDateTime.now()); - saveRecord.setParentCode(TagConst.TAG_ROOT_PARENT_CODE); - saveRecord.setTagCode(BizUtils.uuid32()); - saveRecord.setTagName(tagName); - saveRecord.setTagLevel(TagConst.TAG_ROOT_LEVEL); - iMetaTagManageService.save(saveRecord); - } - - public void removeTagName(String tagCode) { - LambdaQueryWrapper eq = Wrappers.lambdaQuery(ExpertTag.class) - .eq(ExpertTag::getTagCode, tagCode); - List expertTagList = iExpertTagService.list(eq); - if (CollectionUtils.isNotEmpty(expertTagList)) { - throw BizException.wrap("该标签正在使用无法删除"); - } - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, tagCode); - List list = iMetaTagManageService.list(queryWrapper); - if (CollectionUtils.isNotEmpty(list)) { - throw BizException.wrap("该标签存在子标签无法删除"); - } - LambdaQueryWrapper metaTagManageLambdaQueryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getTagCode, tagCode); - MetaTag one = iMetaTagManageService.getOne(metaTagManageLambdaQueryWrapper); - if (Objects.nonNull(one)) { - iMetaTagManageService.removeById(one); - } - } - - public List tagTypeList() { - LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); - List list = iMetaTagManageService.list(eq); - return list.stream().map(r -> { - ResTagTypeVO resTagTypeVO = new ResTagTypeVO(); - resTagTypeVO.setTagCode(r.getTagCode()); - resTagTypeVO.setTagLevel(r.getTagLevel()); - resTagTypeVO.setTagName(r.getTagName()); - resTagTypeVO.setTagName(r.getTagName()); - return resTagTypeVO; - }).collect(Collectors.toList()); - } - - public List tagQuery(ReqTagQueryPO reqTagQueryPO) { - String parentCode = reqTagQueryPO.getParentCode(); - if (StringUtils.isBlank(parentCode)) { - parentCode = TagConst.TAG_ROOT_PARENT_CODE; - } - LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class) - .eq(MetaTag::getParentCode, parentCode); - List list = iMetaTagManageService.list(eq); - - List tagCodeList = CollUtils.fieldList(list, MetaTag::getTagCode); - Map> hasChildrenMap = new HashMap<>(16); - Map> useFrequencyMap = new HashMap<>(16); - if (CollectionUtils.isNotEmpty(tagCodeList)) { - List childrenMetaTagList = iMetaTagManageService.list(Wrappers.lambdaQuery(MetaTag.class) - .in(MetaTag::getParentCode, tagCodeList)); - hasChildrenMap = CollUtils.group(childrenMetaTagList, MetaTag::getParentCode); - - List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) - .in(ExpertTag::getTagCode, tagCodeList)); - useFrequencyMap = CollUtils.group(expertTagList, ExpertTag::getTagCode); - } - - Map> finalHasChildrenMap = hasChildrenMap; - Map> finalUseFrequencyMap = useFrequencyMap; - return list.stream().map(r -> { - ResTagListVO resTagListVO = new ResTagListVO(); - resTagListVO.setCreateTime(r.getCreateOn()); - resTagListVO.setCreator(TagConst.TAG_CREATOR); - resTagListVO.setTagLevel(r.getTagLevel()); - resTagListVO.setTagCode(r.getTagCode()); - resTagListVO.setTagName(r.getTagName()); - List metaTagManages = finalHasChildrenMap.get(r.getTagCode()); - if (CollUtil.isNotEmpty(metaTagManages)) { - resTagListVO.setIsLeaf(false); - resTagListVO.setHasChildren(true); - } else { - resTagListVO.setIsLeaf(true); - resTagListVO.setHasChildren(false); - } - long useFrequency = 0; - List expertTagList = finalUseFrequencyMap.get(r.getTagCode()); - if (CollUtil.isNotEmpty(expertTagList)) { - useFrequency = expertTagList.size(); - } - resTagListVO.setUseFrequency(useFrequency); - return resTagListVO; - }).collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java deleted file mode 100644 index b15fc12..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meta.mapper; - -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface ExpertDictionaryMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml deleted file mode 100644 index 5bbce65..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java deleted file mode 100644 index ae93928..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meta.mapper; - -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface ExpertTagMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml deleted file mode 100644 index 017d58f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java deleted file mode 100644 index 0307169..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meta.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface MetaDictionaryMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml deleted file mode 100644 index 516061f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java deleted file mode 100644 index fcb8fc5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.meta.mapper; - -import com.ningdatech.pmapi.meta.model.entity.MetaTag; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface MetaTagMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml deleted file mode 100644 index 0476da7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java deleted file mode 100644 index 37c17ed..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meta.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/7/25 下午2:43 - */ -@Data -@ApiModel("专家区域信息") -public class ExpertRegionInfo { - - /** - * 区域编码 - */ - @NotBlank - @ApiModelProperty("区域编码") - private String regionCode; - - /** - * 区域级别 - */ - @NotBlank - @ApiModelProperty("区域级别") - private Integer regionLevel; - - /** - * 区域名称 - */ - @ApiModelProperty("区域名称") - private String regionName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java deleted file mode 100644 index a07aee7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.meta.model.bo; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/26 下午4:48 - */ -@Data -public class RegionContainsBO { - - /** - * 最高级节点级别 - */ - private Integer parentRegionTreeLevel; - - /** - * 所有区域码列表 - */ - private List containsRegionCodeList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java deleted file mode 100644 index 7030775..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.meta.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 上午10:49 - */ -@Data -public class DictionaryDTO { - - private String dictionaryType; - - /** - * 编码 随机数处理 - */ - private String dictionaryCode; - - /** - * 名称 - */ - private String name; - - /** - * 描述 - */ - private String describe; - - /** - * 排序 - */ - private Integer sortValue; - - /** - * 是否内置,内置不可删除 - */ - private String readonly; - -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java deleted file mode 100644 index 1cbc019..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.meta.model.dto; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:53 - */ -@Data -public class TagDTO { - - /** - * 标签 编码 - * 根标签
擅长方向 good_at - * 技术专长 technical_expertise - * 行业领域 industry_sector - * 其他 other - */ - private String tagCode; - - /** - * 标签名称 - */ - private String tagName; - - /** - * 标签级别 - */ - private Long tagLevel; - - /** - * 标签父级id - * 当parent_tag_code 为 -1 时为顶级标签 - */ - private String parentCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java deleted file mode 100644 index 6aa437a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.meta.model.dto; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:53 - */ -@Data -public class TagTreeDTO { - - - /** - * 标签 编码 - * 根标签
擅长方向 good_at - * 技术专长 technical_expertise - * 行业领域 industry_sector - * 其他 other - */ - private String tagCode; - - /** - * 标签名称 - */ - private String tagName; - - /** - * 标签级别 - */ - private Long tagLevel; - - /** - * 标签父级id - * 当parent_tag_code 为 -1 时为顶级标签 - */ - private String parentCode; - - - private List children; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java deleted file mode 100644 index a6d5b42..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meta.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("expert_dictionary") -@ApiModel(value = "ExpertDictionary对象", description = "") -public class ExpertDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String dictionaryCode; - - private String expertInfoField; - - private Long userId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java deleted file mode 100644 index e9abc27..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.meta.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@TableName("expert_tag") -@Data -@ApiModel(value = "ExpertTag对象", description = "") -public class ExpertTag implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String tagCode; - - private String expertInfoField; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java deleted file mode 100644 index ed67e4b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.meta.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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("meta_dictionary") -@ApiModel(value = "MetaDictionary对象", description = "") -public class MetaDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String dictionaryType; - - private String dictionaryCode; - - private String dictionaryName; - - private String dictionaryDescribe; - - private Integer sortValue; - - private Long createBy; - - private String readonly; - - private Long updateBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java deleted file mode 100644 index c3d770e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.meta.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("meta_tag") -@ApiModel(value = "MetaTag对象", description = "") -public class MetaTag implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String tagName; - - private Long tagLevel; - - private String parentCode; - - private String tagType; - - private String tagCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java deleted file mode 100644 index 5825080..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - * @author liuxinxin - * @date 2022/8/25 上午11:10 - */ -@Data -@ApiModel("新增字典值") -public class ReqAddDictionaryPO { - - @ApiModelProperty(value = "字典类型") - @NotBlank - private String dictionaryType; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotBlank - private String name; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - @NotNull - private Integer sortValue; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java deleted file mode 100644 index d41d1cb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/8/27 上午10:17 - */ -@ApiModel(description = "新增标签分类") -@Data -public class ReqAddTagTypePO { - - @ApiModelProperty("标签分类名") - @NotBlank - private String tagName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java deleted file mode 100644 index 245bfb6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:05 - */ -@Data -public class ReqDictionaryListPO { - - private List dictionaryTypeList; - - private Boolean allDict = false; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java deleted file mode 100644 index 178756f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午2:43 - */ -@Data -public class ReqTagListPO { - private List rootTagCodeList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java deleted file mode 100644 index 31527c4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:30 - */ -@Data -@ApiModel(description = "标签查询request") -public class ReqTagQueryPO { -// -// @ApiModelProperty("标签类型") -// private Long tagType; -// -// @ApiModelProperty("标签名") -// private String tagName; - - @ApiModelProperty("父级标签编码") - private String parentCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java deleted file mode 100644 index e1661c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:13 - */ -@Data -@ToString(callSuper = true) -@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") -public class ResDictionaryListVO { - - @ApiModelProperty(value = "字典名称") - private String dictionaryName; - - @ApiModelProperty(value = "字典选项名称") - private List dictionaryList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java deleted file mode 100644 index 040b235..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 上午11:26 - */ -@Data -@ApiModel(value = "DictionaryListVO", description = "字典结构VO") -public class ResDictionaryVO { - - - @ApiModelProperty(value = "字典类型") - private String dictionaryType; - - /** - * 编码 随机数处理 - */ - @ApiModelProperty(value = "编码") - private String dictionaryCode; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String describe; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sortValue; - - /** - * 是否内置,内置不可删除 - */ - @ApiModelProperty(value = "是否内置,内置不可删除") - private String readonly; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java deleted file mode 100644 index 91f9782..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:35 - */ -@Data -@ApiModel(description = "标签列表展示") -public class ResTagListVO { - - @ApiModelProperty(value = "标签 编码") - private String tagCode; - - @ApiModelProperty(value = "标签名称") - private String tagName; - - @ApiModelProperty(value = "标签级别") - private Long tagLevel; - - @ApiModelProperty(value = "使用频次") - private Long useFrequency; - - @ApiModelProperty(value = "创建时间") - private LocalDateTime createTime; - - @ApiModelProperty(value = "创建人") - private String creator; - - @ApiModelProperty(value = "是否为叶子节点") - private Boolean isLeaf; - - @ApiModelProperty(value = "是否有子集") - private Boolean hasChildren; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java deleted file mode 100644 index ee1f6bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午2:27 - */ -@Data -@ToString(callSuper = true) -@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") -public class ResTagTreeVO { - - /** - * 标签 编码 - * 根标签
擅长方向 good_at - * 技术专长 technical_expertise - * 行业领域 industry_sector - * 其他 other - */ - @ApiModelProperty(value = " * 标签 编码\n" + - " * 根标签\u2028擅长方向 good_at\n" + - " * 技术专长 technical_expertise\n" + - " * 行业领域 industry_sector\n" + - " * 其他 other") - private String tagCode; - - /** - * 标签名称 - */ - @ApiModelProperty(value = "标签名称") - private String tagName; - - /** - * 标签级别 - */ - @ApiModelProperty(value = "标签级别") - private Long tagLevel; - - /** - * 标签父级id - * 当parent_tag_code 为 -1 时为顶级标签 - */ - @ApiModelProperty(value = " * 标签父级id\n" + - " * 当parent_tag_code 为 -1 时为顶级标签") - private String parentCode; - - @ApiModelProperty(value = "子节点标签") - private List children; - - @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") - private String unionCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java deleted file mode 100644 index e097f16..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:20 - */ -@Data -@ApiModel(description = "标签类型VO") -public class ResTagTypeVO { - - @ApiModelProperty(value = "标签编码") - private String tagCode; - - @ApiModelProperty(value = "标签名称") - private String tagName; - - @ApiModelProperty(value = "标签级别") - private Long tagLevel; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java deleted file mode 100644 index 18e2de6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.meta.service; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertDictionaryService extends IService { - - - /** - * 根据专家ID批量查询专家字典信息 - * - * @param userIds 专家ID - * @param dictType 专家字典类型 - * @return / - * @author WendyYang - **/ - List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType); - - default void removeByUserId(Long userId) { - this.remove(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java deleted file mode 100644 index bd91a77..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meta.service; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertTagService extends IService { - - default void removeByUserId(Long userId) { - remove(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java deleted file mode 100644 index 4745147..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.meta.service; - -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IMetaDictionaryService extends IService { - - List queryAll(); - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java deleted file mode 100644 index 862fe70..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.meta.service; - -import com.ningdatech.pmapi.meta.model.entity.MetaTag; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IMetaTagService extends IService { - - List queryAll(); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java deleted file mode 100644 index 43ccffa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.meta.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.mapper.ExpertDictionaryMapper; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { - - @Override - public List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType) { - // 获取专家职称 - LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) - .in(ExpertDictionary::getUserId, userIds) - .eq(ExpertDictionary::getExpertInfoField, dictType.getKey()); - return list(query); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java deleted file mode 100644 index 891089f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.service.impl; - -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.mapper.ExpertTagMapper; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertTagServiceImpl extends ServiceImpl implements IExpertTagService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java deleted file mode 100644 index e55df9e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.meta.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; -import com.ningdatech.pmapi.meta.mapper.MetaDictionaryMapper; -import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; -import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; -import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { - - @Override - public List queryAll() { - List dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list(); - List dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); - return dictionaryDTOList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java deleted file mode 100644 index c60de04..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.meta.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; -import com.ningdatech.pmapi.meta.model.entity.MetaTag; -import com.ningdatech.pmapi.meta.mapper.MetaTagMapper; -import com.ningdatech.pmapi.meta.model.dto.TagDTO; -import com.ningdatech.pmapi.meta.service.IMetaTagService; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class MetaTagServiceImpl extends ServiceImpl implements IMetaTagService { - - - @Override - public List queryAll() { - List allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); - List allTagDTOList = allTags.stream().map(MetaTagAssembler::toTagDTO).collect(Collectors.toList()); - return allTagDTOList; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java deleted file mode 100644 index 293cdc2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.meta.validate; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; -import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:15 - */ - -public class DictionaryRequestValidator { - - public static void dictionaryRequestValidator(ReqDictionaryListPO reqDictionaryListPO) { - List dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList(); - if (CollectionUtils.isNotEmpty(dictionaryTypeList)) { - for (String dictionaryType : dictionaryTypeList) { - if (!DictExpertInfoTypeEnum.contains(dictionaryType)) { - throw new BizException("Illegal dictionaryType: " + dictionaryType); - } - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java deleted file mode 100644 index 836c3c6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.meta.validate; - - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; -import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午2:44 - */ - -public class TagListRequestValidator { - - private TagListRequestValidator() { - } - - public static void tagListRequestValidator(ReqTagListPO request) { - List rootTagCodeList = request.getRootTagCodeList(); - if (CollectionUtils.isNotEmpty(rootTagCodeList)) { - for (String rootTagCode : rootTagCodeList) { - if (!ExpertTagEnum.contains(rootTagCode)) { - throw new BizException("Illegal rootTagCode:" + rootTagCode); - } - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java deleted file mode 100644 index 8372439..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ningdatech.pmapi.organization.constants; - -/** - * @Classname ProcDefContant - * @Description - * @Date 2023/7/11 9:35 - * @Author PoffyZhang - */ -public interface ProcDefContant { - - public final static String MODELS_ID_PREFIX = "pd"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java deleted file mode 100644 index 9b65eb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.organization.manage.OrganizationManage; -import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; -import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; -import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO; -import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; -import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; -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 javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author Lierbao - * @since 2023-02-09 - */ - -@Slf4j -@Validated -@RestController -@RequiredArgsConstructor -@Api(value = "DingOrganizationController", tags = "单位管理") -@RequestMapping("/api/v1/organization") -public class DingOrganizationController { - - private final OrganizationManage organizationManage; - - @ApiOperation("单位列表筛选") - @PostMapping("/list") - public PageVo organizationList(@Valid @RequestBody ReqOrganizationListPO reqOrganizationListPO) { - return organizationManage.organizationList(reqOrganizationListPO); - } - - @PostMapping("/get-child-list") - @ApiOperation("获取组织架构的树状结构(单位筛选列表)") - public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode, @RequestParam(value = "orgName", required = false) String orgName) { - return organizationManage.getChildOrganizationList(parentCode, orgName, false); - } - - @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") - @PostMapping("/tree-list") - public List treeVOList(@Valid @RequestBody ReqSynthesizePO request) { - return organizationManage.treeRubbishVOList(request); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/GovBusinessStripController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/GovBusinessStripController.java deleted file mode 100644 index a5fa7b4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/GovBusinessStripController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.organization.manage.GovBusinessStripManage; -import com.ningdatech.pmapi.organization.model.vo.GovBusinessStripTreeVO; -import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Controller; -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.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -@Controller -@Slf4j -@Validated -@RestController -@RequiredArgsConstructor -@Api(value = "GovBusinessStripController", tags = "条线管理") -@RequestMapping("/api/v1/gov-business-strip") -public class GovBusinessStripController { - - private final GovBusinessStripManage govBusinessStripManage; - - @GetMapping("/get-child-list") - @ApiOperation("获取条线标签的的树状结构") - public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) { - return govBusinessStripManage.getChildOrganizationList(parentCode); - } - - - @GetMapping("/list") - @ApiOperation("获取省局条线列表") - public List getProvincialGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) { - return govBusinessStripManage.getProvincialGovBusinessStripList(businessStripName); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/MetaOrganizationLineTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/MetaOrganizationLineTagController.java deleted file mode 100644 index 21771d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/MetaOrganizationLineTagController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -@Controller -@RequestMapping("/pmapi.organization/meta-organization-line-tag") -public class MetaOrganizationLineTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationMainManageTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationMainManageTagController.java deleted file mode 100644 index 582b106..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationMainManageTagController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@Controller -@RequestMapping("/pmapi.organization/organization-main-manage-tag") -public class OrganizationMainManageTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationTagController.java deleted file mode 100644 index dd13531..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationTagController.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - - -import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-03-06 - */ -@RestController -@Api(tags = "组织标签(条线标签)") -@RequestMapping("/api/v1/organization-tag") -public class OrganizationTagController { - -// @PostMapping("条线单位") -// private - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java deleted file mode 100644 index 3944977..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ningdatech.pmapi.organization.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.organization.manage.ProcDefManage; -import com.wflow.bean.dto.WflowOrgProcdefDto; -import com.wflow.bean.vo.OrgProcdefVo; -import com.wflow.service.OrgProcdefService; -import com.wflow.workflow.service.OrgProcessModelService; -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.*; - -/** - * @Classname OrganizationProcessController - * @Description - * @Date 2023/1/13 11:13 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/organization/procdef") -@Api(value = "OrganizationProcdef", tags = "单位配置-流程配置") -@RequiredArgsConstructor -public class ProcDefController { - - private final OrgProcdefService orgProcdefService; - - private final OrgProcessModelService orgProcessModelService; - - private final ProcDefManage procDefManage; - - @ApiOperation(value = "单位流程配置列表", notes = "单位流程配置列表") - @GetMapping("/list") - public PageVo list(@RequestParam String orgCode, @RequestParam(defaultValue = "1") Integer pageNumber, - @RequestParam(defaultValue = "10") Integer pageSize) { - return orgProcdefService.getOrgProcessByOrgCode(orgCode, pageNumber, pageSize); - } - - @ApiOperation(value = "单位流程配置详情", notes = "单位流程配置详情") - @GetMapping("/detail/{processDefId}") - public OrgProcdefVo detail(@PathVariable String processDefId) { - return orgProcessModelService.getProcess(processDefId); - } - - @ApiOperation(value = "单位流程配置保存", notes = "单位流程配置保存") - @PostMapping("/save") - @WebLog("单位流程配置保存") - public String save(@Validated @RequestBody WflowOrgProcdefDto wflowOrgProcdefDto) { - return orgProcessModelService.saveProcessLs(wflowOrgProcdefDto); - } - - @ApiOperation(value = "单位流程配置启用", notes = "单位流程配置启用") - @PutMapping("/enable/{processDefId}") - @WebLog("单位流程配置启用") - public String enableProcess(@PathVariable String processDefId) { - orgProcessModelService.enableProcess(processDefId, Boolean.FALSE); - return "启用成功"; - } - - @ApiOperation(value = "单位流程配置禁用", notes = "单位流程配置禁用") - @PutMapping("/disable/{processDefId}") - @WebLog("单位流程配置禁用") - public String disableProcess(@PathVariable String processDefId) { - orgProcessModelService.enableProcess(processDefId, Boolean.TRUE); - return "禁用成功"; - } - - @ApiOperation(value = "单位流程配置部署", notes = "单位流程配置部署") - @PostMapping("/deploy/{processDefId}") - @WebLog("单位流程配置部署") - public String deploy(@Validated @PathVariable String processDefId) { - return orgProcessModelService.deployProcessLs(processDefId, null); - } - - @ApiOperation(value = "单位流程配置删除", notes = "单位流程配置删除") - @PostMapping("/delete/{processDefId}") - @WebLog("单位流程配置删除") - public Boolean delete(@PathVariable String processDefId) { - return orgProcessModelService.delProcess(processDefId); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/GovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/GovBusinessStrip.java deleted file mode 100644 index 60ff77d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/GovBusinessStrip.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.organization.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -@TableName("gov_business_strip") -@Data -@ApiModel(value = "GovBusinessStrip对象", description = "") -public class GovBusinessStrip implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - /** - * 条线code - */ - private String businessStripCode; - - /** - * 条线名称 - */ - private String businessStripName; - - /** - * 父级条线code - */ - private String parentCode; - - /** - * 父级条线名称 - */ - private String parentName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/OrganizationMainManageTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/OrganizationMainManageTag.java deleted file mode 100644 index 9aab1d6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/OrganizationMainManageTag.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.pmapi.organization.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@TableName("organization_main_manage_tag") -@ApiModel(value = "OrganizationMainManageTag对象", description = "") -public class OrganizationMainManageTag implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long createBy; - - private Long updateBy; - - private String organizationCode; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public LocalDateTime getCreateOn() { - return createOn; - } - - public void setCreateOn(LocalDateTime createOn) { - this.createOn = createOn; - } - public LocalDateTime getUpdateOn() { - return updateOn; - } - - public void setUpdateOn(LocalDateTime updateOn) { - this.updateOn = updateOn; - } - public Long getCreateBy() { - return createBy; - } - - public void setCreateBy(Long createBy) { - this.createBy = createBy; - } - public Long getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(Long updateBy) { - this.updateBy = updateBy; - } - public String getOrganizationCode() { - return organizationCode; - } - - public void setOrganizationCode(String organizationCode) { - this.organizationCode = organizationCode; - } - - @Override - public String toString() { - return "OrganizationMainManageTag{" + - "id=" + id + - ", createOn=" + createOn + - ", updateOn=" + updateOn + - ", createBy=" + createBy + - ", updateBy=" + updateBy + - ", organizationCode=" + organizationCode + - "}"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/GovBusinessStripHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/GovBusinessStripHelper.java deleted file mode 100644 index 6f82002..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/GovBusinessStripHelper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.organization.helper; - -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/3/8 下午3:23 - */ - -public interface GovBusinessStripHelper { - - /** - * 获取上级条线单位 - * - * @param organizationCode - * @return - */ - List getSupGovBusinessStrip(String organizationCode); - - - /** - * 获取上级主管单位 - * - * @param organizationCode - * @return - */ - DingOrganization getSupMainManageOrganization(String organizationCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/impl/GovBusinessStripHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/impl/GovBusinessStripHelperImpl.java deleted file mode 100644 index 24e4366..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/helper/impl/GovBusinessStripHelperImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.organization.helper.impl; - -import com.ningdatech.pmapi.organization.helper.GovBusinessStripHelper; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/3/8 下午3:34 - */ - -@Component -@RequiredArgsConstructor -public class GovBusinessStripHelperImpl implements GovBusinessStripHelper { - - private final IDingOrganizationService organizationService; - - @Override - public List getSupGovBusinessStrip(String organizationCode) { - List supGovBusinessStripList = new ArrayList<>(); - - DingOrganization dingOrganization = organizationService.getByOrgCode(organizationCode); - if (Objects.isNull(dingOrganization)) { - return null; - } - String businessStripCodes = dingOrganization.getBusinessStripCodes(); - if (StringUtils.isNotBlank(businessStripCodes)) { - String[] businessStripCodeList = businessStripCodes.split("|"); - for (String businessStripCode : businessStripCodeList) { - DingOrganization supGovBusinessStrip = getSupGovBusinessStrip(dingOrganization.getOrganizationCode(), businessStripCode); - if (Objects.nonNull(supGovBusinessStrip)) { - supGovBusinessStripList.add(supGovBusinessStrip); - } - } - } - return supGovBusinessStripList; - } - - private DingOrganization getSupGovBusinessStrip(String organizationCode, String businessStripCode) { - String tempParentOrgCode = organizationCode; - - HashSet tempParentOrgCodeSet = new HashSet<>(); - while (true) { - if (StringUtils.isBlank(tempParentOrgCode)) { - return null; - } - // 防止脏数据导致死循环 - if (!tempParentOrgCodeSet.add(tempParentOrgCode)) { - return null; - } - DingOrganization parentOrganization = organizationService.getParentOrganization(tempParentOrgCode); - if (Objects.isNull(parentOrganization)) { - return null; - } - String businessStripCodes = parentOrganization.getBusinessStripCodes(); - if (StringUtils.isNotBlank(businessStripCode) && businessStripCodes.contains(businessStripCode)) { - return parentOrganization; - } - tempParentOrgCode = parentOrganization.getParentCode(); - } - } - - @Override - public DingOrganization getSupMainManageOrganization(String organizationCode) { - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java deleted file mode 100644 index be0d63e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.organization.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; -import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip; -import com.ningdatech.pmapi.organization.model.vo.GovBusinessStripTreeVO; -import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO; -import com.ningdatech.pmapi.organization.service.IGovBusinessStripService; -import com.ningdatech.pmapi.organization.service.IProvincialGovBusinessStripService; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/3/14 下午4:48 - */ - -@Component -@RequiredArgsConstructor -public class GovBusinessStripManage { - - private final IGovBusinessStripService iGovBusinessStripService; - - private final IProvincialGovBusinessStripService provincialGovBusinessStripService; - - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - @Value("${irs.province-gov.can-search}") - private Boolean canSearch; - - public List getChildOrganizationList(String parentCode) { - if (Objects.isNull(parentCode)) { - parentCode = "-1"; - } - List govBusinessStripList = iGovBusinessStripService.list(Wrappers.lambdaQuery(GovBusinessStrip.class) - .eq(GovBusinessStrip::getParentCode, parentCode)); - - return govBusinessStripList.stream().map(r -> { - GovBusinessStripTreeVO govBusinessStripTreeVO = new GovBusinessStripTreeVO(); - govBusinessStripTreeVO.setBusinessStripCode(r.getBusinessStripCode()); - govBusinessStripTreeVO.setBusinessStripName(r.getBusinessStripName()); - govBusinessStripTreeVO.setParentCode(r.getParentCode()); - govBusinessStripTreeVO.setParentName(r.getParentName()); - return govBusinessStripTreeVO; - }).collect(Collectors.toList()); - } - - public List getProvincialGovBusinessStripList(String businessStripName) { - List strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class) - .like(StringUtils.isNotBlank(businessStripName),ProvincialGovBusinessStrip::getBusinessStripName,businessStripName) - .orderByAsc(ProvincialGovBusinessStrip::getBusinessStripName)); - - if(CollUtil.isEmpty(strips)){ - return Collections.emptyList(); - } - - return strips.stream() - .map(p -> BeanUtil.copyProperties(p,ProvincialGovBusinessStripVO.class)) - .collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java deleted file mode 100644 index dde0d77..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.ningdatech.pmapi.organization.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -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.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.config.DingOrganizationProperties; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; -import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; -import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO; -import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; -import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/1/13 下午2:55 - */ -@Component -@RequiredArgsConstructor -public class OrganizationManage { - - private final IDingOrganizationService iDingOrganizationService; - - private final DingOrganizationProperties dingOrganizationProperties; - - private final IDingEmployeeInfoService iDingEmployeeInfoService; - - private final RegionCacheHelper regionCacheHelper; - - private final ICompanyFiscalCodeService iCompanyFiscalCodeService; - - public PageVo organizationList(ReqOrganizationListPO reqOrganizationListPO) { - String orgName = reqOrganizationListPO.getOrgName(); - Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit(); - String regionId = reqOrganizationListPO.getRegionId(); - - Page page = iDingOrganizationService - .page(new Page<>(reqOrganizationListPO.getPageNumber(), reqOrganizationListPO.getPageSize()) - , Wrappers.lambdaQuery(DingOrganization.class) - .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) - .eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId) - .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") - .orderByAsc(DingOrganization::getId) - ); - - long total = page.getTotal(); - List records = page.getRecords(); - List resVOList = new ArrayList<>(); - if (CollUtil.isNotEmpty(records)) { - List organizationCodeList = records.stream().map(DingOrganization::getOrganizationCode) - .distinct().collect(Collectors.toList()); - Map orgFiscalCodeMap = iCompanyFiscalCodeService.getByOrgFiscalCodeMap(organizationCodeList); - - resVOList = records.stream().map(r -> { - ResOrganizationListVO resOrganizationListVO = new ResOrganizationListVO(); - resOrganizationListVO.setOrgCode(r.getOrganizationCode()); - resOrganizationListVO.setOrgName(r.getOrganizationName()); - String divisionCode = r.getDivisionCode(); - if (StringUtils.isNotBlank(divisionCode)) { - RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(divisionCode, 3); - resOrganizationListVO.setRegionId(regionDTO.getRegionCode()); - resOrganizationListVO.setRegionName(regionDTO.getRegionName()); - } - String fiscalCode = orgFiscalCodeMap.get(r.getOrganizationCode()); - resOrganizationListVO.setFiscalCode(fiscalCode); - return resOrganizationListVO; - }).collect(Collectors.toList()); - } - - PageVo pageVo = new PageVo<>(); - pageVo.setTotal(total); - pageVo.setRecords(resVOList); - return pageVo; - } - - public List getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { - List parentCodeList = new ArrayList<>(); - List dingOrganizationList = new ArrayList<>(); - if (StrUtils.isBlank(parentCode)) { - parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); - dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) - .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") - .in(DingOrganization::getOrganizationCode, parentCodeList)); - } else { - parentCodeList = CollectionUtil.toList(parentCode); - dingOrganizationList = iDingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class) - .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) - .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") - .in(DingOrganization::getParentCode, parentCodeList)); - } - - if (CollectionUtils.isEmpty(dingOrganizationList)) { - return new ArrayList<>(); - } - - dingOrganizationList.sort(Comparator.comparing(DingOrganization::getDisplayOrder)); - return dingOrganizationList.stream().map(r -> { - OrganizationTreeVO treeVO = new OrganizationTreeVO(); - treeVO.setId(r.getId()); - treeVO.setName(r.getOrganizationName()); -// Boolean enabled = "1".equals(r.get()); -// treeVO.setEnabled(enabled); - treeVO.setOrganizationCode(r.getOrganizationCode()); - treeVO.setParentCode(r.getParentCode()); -// treeVO.setSubCount(r.get()); -// Boolean isLeaf = true; -// Long subCount = r.getSubCount(); -// if (Objects.nonNull(subCount) && subCount > 0) { -// isLeaf = false; -// } -// treeVO.setIsLeaf(isLeaf); -// treeVO.setDeptSort(r.getDeptSort()); -// treeVO.setUnionCode(r.getName() + "##" + r.getOrganizationCode()); - return treeVO; - }).collect(Collectors.toList()); - } - - public List treeRubbishVOList(ReqSynthesizePO request) { - String organizationCode = request.getOrganizationCode(); - String organizationName = request.getOrganizationName(); - String employeeName = request.getEmployeeName(); - Boolean onlyUnit = request.getOnlyUnit(); - - // 用户搜索为特殊逻辑 - if (StringUtils.isNotBlank(employeeName)) { - return treeEmployeeQuery(employeeName, organizationCode); - } - - List dingOrganizationList = new ArrayList<>(); - List organizationCodeList = new ArrayList<>(); - if (StringUtils.isNotBlank(organizationName)) { - dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .like(DingOrganization::getOrganizationName, organizationName) - .in(onlyUnit, DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE, - DingOrganizationContant.HOLLOW))); - if (dingOrganizationList.size() == 0) { - return new ArrayList<>(); - } - } else if (StrUtils.isBlank(organizationCode)) { - organizationCodeList = dingOrganizationProperties.getDeptVisibleScopes(); - } else { - organizationCodeList = CollectionUtil.toList(organizationCode); - } - - if (CollectionUtil.isEmpty(dingOrganizationList)) { - dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getOrganizationCode, organizationCodeList) - .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")); - } - - List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { - KeyTreeVO keyTreeVO = new KeyTreeVO(); - keyTreeVO.setTitle(r.getOrganizationName()); - keyTreeVO.setKey(r.getOrganizationCode()); - keyTreeVO.setType("ORGANIZATION"); - return keyTreeVO; - }).collect(Collectors.toList()); - treeVOList(request.getNeedMember(), orgKeyTreeVOList, onlyUnit); - return orgKeyTreeVOList; - } - - public List treeEmployeeQuery(String employeeName, String organizationCode) { - List parentCodeList = CollUtil.toList(organizationCode).stream() - .filter(StringUtils::isNotBlank) - .collect(Collectors.toList()); - - // 获取所有的组织列表 - List organizationCodeList = new ArrayList<>(); - getChildList(organizationCodeList, parentCodeList); - organizationCodeList = organizationCodeList.stream().distinct().collect(Collectors.toList()); - - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .like(DingEmployeeInfo::getEmployeeName, employeeName) - .eq(DingEmployeeInfo::getMainJob, "true") - .in(CollUtil.isNotEmpty(organizationCodeList), DingEmployeeInfo::getOrganizationCode, organizationCodeList) - ); - List resultOrganizationCodeList = dingEmployeeInfoList.stream() - .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) - .map(DingEmployeeInfo::getOrganizationCode) - .distinct().collect(Collectors.toList()); - - if (CollectionUtil.isEmpty(resultOrganizationCodeList)) { - return new ArrayList<>(); - } - - List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getOrganizationCode, resultOrganizationCodeList)); - - List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { - KeyTreeVO keyTreeVO = new KeyTreeVO(); - keyTreeVO.setTitle(r.getOrganizationName()); - keyTreeVO.setKey(r.getOrganizationCode()); - keyTreeVO.setType("ORGANIZATION"); - return keyTreeVO; - }).collect(Collectors.toList()); - - employeeNameSearcheTreeVOList(orgKeyTreeVOList, dingEmployeeInfoList); - return orgKeyTreeVOList; - } - - private void getChildList(List orgCodeList, List parentCodeList) { - if (CollUtil.isEmpty(parentCodeList)) { - return; - } - orgCodeList.addAll(parentCodeList); -// orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); - - for (String parentCode : parentCodeList) { - List childOrgList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getParentCode, parentCode)); - List newParentCodeList = childOrgList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); - getChildList(orgCodeList, newParentCodeList); - } - } - - private void employeeNameSearcheTreeVOList(List basicOrgKeyTreeVOList, List allDingEmployeeInfoList) { - Map> orgCodeEmployeeMap = allDingEmployeeInfoList.stream() - .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) - .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); - - for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { - String parentCode = basicOrgKeyTreeVO.getKey(); - - List dingEmployeeInfoList = orgCodeEmployeeMap.get(parentCode); - List memberChildren = dingEmployeeInfoList.stream().map(r -> { - KeyTreeVO child = new KeyTreeVO(); - child.setKey(r.getEmployeeCode()); - child.setTitle(r.getEmployeeName()); - child.setType("MEMBER"); - return child; - }).collect(Collectors.toList()); - basicOrgKeyTreeVO.setChildren(memberChildren); - } - } - - - public void treeVOList(Boolean needMember, List basicOrgKeyTreeVOList, Boolean onlyUnit) { - for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { - String parentCode = basicOrgKeyTreeVO.getKey(); - List childOrganizationList = getChildOrganizationList(parentCode, null, onlyUnit); - - List orgKeyTreeVOList = childOrganizationList.stream().map(r -> { - KeyTreeVO keyTreeVO = new KeyTreeVO(); - keyTreeVO.setTitle(r.getName()); - keyTreeVO.setKey(r.getOrganizationCode()); - keyTreeVO.setType("ORGANIZATION"); - return keyTreeVO; - }).collect(Collectors.toList()); - - if (StringUtils.isNotBlank(parentCode) && needMember) { - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); - - List memberChildren = dingEmployeeInfoList.stream().map(r -> { - KeyTreeVO child = new KeyTreeVO(); - child.setKey(r.getEmployeeCode()); - child.setTitle(r.getEmployeeName()); - child.setType("MEMBER"); - return child; - }).collect(Collectors.toList()); - - if (CollUtil.isNotEmpty(memberChildren)) { - orgKeyTreeVOList.addAll(memberChildren); - } - } - basicOrgKeyTreeVO.setChildren(orgKeyTreeVOList); - } - } - - -} 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 deleted file mode 100644 index 6d5ca27..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ningdatech.pmapi.organization.manage; - -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; -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; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Classname ProcDefManage - * @Description - * @Date 2023/7/10 17:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class ProcDefManage { - private final IDingOrganizationService organizationService; - - private final OrgProcdefService orgProcdefService; - - private final OrgProcdefHistoryService orgProcdefHistoryService; - - private final ZwddClient zwddClient; - - /** - * 初始化 单位配置 - * @return - */ - public String init() { - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList( - DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY - ))); - - log.info("需要处理初始化单位配置的企业 数量为{}",orgs.size()); - - for(DingOrganization org : orgs){ - log.info("当前是 {}",org.getOrganizationName()); - String orgCode = org.getOrganizationCode(); - - List models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) - .eq(WflowOrgModels::getOrgCode, orgCode)); - - log.info("已经有的单位流程 {}", JSON.toJSONString(models)); - - List types = models.stream().map(WflowOrgModels::getType).collect(Collectors.toList()); - //默认流程 - if(!types.contains(ProcessDefTypeEnum.DEFAULT.name())){ - saveDef(org,ProcessDefTypeEnum.DEFAULT); - } - //盖章流程 - if(!types.contains(ProcessDefTypeEnum.SEAL.name())){ - saveDef(org,ProcessDefTypeEnum.SEAL); - } - //联审流程 - if(!types.contains(ProcessDefTypeEnum.JOINT_REVIEW.name())){ - saveDef(org,ProcessDefTypeEnum.JOINT_REVIEW); - } - } - - return "初始化成功"; - } - - private void saveDef(DingOrganization org,ProcessDefTypeEnum defTypeEnum){ - String procDefId = ProcDefContant.MODELS_ID_PREFIX + IdUtil.objectId(); - WflowOrgModels defaultModel = new WflowOrgModels(); - defaultModel.setProcessDefId(procDefId); - defaultModel.setIsStop(Boolean.FALSE); - defaultModel.setProcess(StrPool.BRACE); - defaultModel.setCreated(LocalDateTime.now()); - defaultModel.setIsDelete(Boolean.FALSE); - defaultModel.setOrgCode(org.getOrganizationCode()); - defaultModel.setOrgName(org.getOrganizationName()); - defaultModel.setProcessDefName(defTypeEnum.getDesc()); - defaultModel.setType(defTypeEnum.name()); - defaultModel.setSort(1); - defaultModel.setVersion(1); - orgProcdefService.save(defaultModel); - - WflowOrgModelHistorys defaultHistory = new WflowOrgModelHistorys(); - defaultHistory.setProcessDefId(procDefId); - defaultHistory.setProcess(StrPool.BRACE); - defaultHistory.setCreated(LocalDateTime.now()); - defaultHistory.setOrgCode(org.getOrganizationCode()); - defaultHistory.setOrgName(org.getOrganizationName()); - defaultHistory.setProcessDefName(defTypeEnum.getDesc()); - defaultHistory.setType(defTypeEnum.name()); - defaultHistory.setVersion(0); - orgProcdefHistoryService.save(defaultHistory); - } - - public String initByArea(String areaCode) { - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList( - DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY - )) - .eq(DingOrganization::getDivisionCode,areaCode)); - - log.info("{}地区 需要处理初始化单位配置的企业 数量为{}",areaCode,orgs.size()); - - for(DingOrganization org : orgs){ - log.info("当前是 {}",org.getOrganizationName()); - String orgCode = org.getOrganizationCode(); - - List models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) - .eq(WflowOrgModels::getOrgCode, orgCode)); - - log.info("已经有的单位流程 {}", JSON.toJSONString(models)); - - List types = models.stream().map(WflowOrgModels::getType).collect(Collectors.toList()); - //默认流程 - if(!types.contains(ProcessDefTypeEnum.DEFAULT.name())){ - saveDef(org,ProcessDefTypeEnum.DEFAULT); - } - //盖章流程 - if(!types.contains(ProcessDefTypeEnum.SEAL.name())){ - saveDef(org,ProcessDefTypeEnum.SEAL); - } - //联审流程 - if(!types.contains(ProcessDefTypeEnum.JOINT_REVIEW.name())){ - saveDef(org,ProcessDefTypeEnum.JOINT_REVIEW); - } - } - - 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/organization/mapper/DingEmployeeInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.java deleted file mode 100644 index 0a900bc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.mapper; - -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-11 - */ -public interface DingEmployeeInfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml deleted file mode 100644 index 138e8ff..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.java deleted file mode 100644 index 86cf9ab..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.mapper; - -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-09 - */ -public interface DingOrganizationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.xml deleted file mode 100644 index e3e5708..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingOrganizationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.java deleted file mode 100644 index b767324..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.mapper; - -import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -public interface GovBusinessStripMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.xml deleted file mode 100644 index 381441f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/GovBusinessStripMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.java deleted file mode 100644 index e636198..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.mapper; - -import com.ningdatech.pmapi.organization.entity.OrganizationMainManageTag; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -public interface OrganizationMainManageTagMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.xml deleted file mode 100644 index 2551432..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/OrganizationMainManageTagMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java deleted file mode 100644 index 8d05229..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ningdatech.pmapi.organization.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip; - -/** - *

- * Mapper 接口 - *

- * @author zpf - * @since 2023-06-25 - */ -public interface ProvincialGovBusinessStripMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml deleted file mode 100644 index 482a0ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java deleted file mode 100644 index 50fbde8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ningdatech.pmapi.organization.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 Lierbao - * @since 2023-02-11 - */ -@TableName("ding_employee_info") -@Data -@ApiModel(value = "DingEmployeeInfo对象", description = "") -public class DingEmployeeInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long createBy; - - private Long updateBy; - - private String employeeName; - - private String gmtCreate; - - private String empGender; - - private String empPoliticalStatusCode; - - private String empJobLevelCode; - - private String empBudgetedPostCode; - - private String status; - - private String posJobRankCode; - - private String orderInOrganization; - - private String mainJob; - - private String empPosUnitCode; - - private String empPosEmployeeRoleCode; - - private String empPosInnerInstitutionCode; - - private String employeeCode; - - private String jobAttributesCode; - - private String organizationCode; - - private String empPosVirtualOrganizationCode; - - private String empStatus; - - private Long accountId; - - /** - * 绑定系统用户手机号 - */ - private String bindUserMobile; - - @ApiModelProperty("头像") - private String avatar; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java deleted file mode 100644 index 3f58820..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.organization.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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-09 - */ -@TableName("ding_organization") -@ApiModel(value = "DingOrganization对象", description = "") -@Data -public class DingOrganization implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private String institutionLevelCode; - - private String address; - - private String organizationName; - - private Long displayOrder; - - private String typeName; - - private Integer leaf; - - private LocalDateTime gmtCreate; - - private String typeCode; - - private String divisionCode; - - private String parentName; - - private String parentCode; - - private String organizationCode; - - private String businessStripCodes; - - private String status; - - private String unifiedSocialCreditCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java deleted file mode 100644 index 696c0ef..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.organization.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; - -/** - * @author Liuxinxin - * @since 2023-03-08 - */ -@TableName("nd_provincial_gov_business_strip") -@Data -@ApiModel(value = "省级条线实体", description = "省级条线实体") -public class ProvincialGovBusinessStrip { - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("条线code") - private String businessStripCode; - - @ApiModelProperty("条线名称") - private String businessStripName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java deleted file mode 100644 index ba58783..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.organization.model.po; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/2/16 上午11:50 - */ -@Data -@ApiModel("组织列表 请求PO") -public class ReqOrganizationListPO extends PagePo { - - @ApiModelProperty("单位名称") - private String orgName; - - @ApiModelProperty("浙政钉编码") - private String orgCode; - - @ApiModelProperty("所属区域id") - private String regionId; - - @ApiModelProperty("是否为主管单位") - private Boolean isCompetentUnit; - - @ApiModelProperty("是否为上级条线主管单位") - private Boolean isSuperiorLineCompetentUnit; - - @ApiModelProperty("是否只筛选单位") - private Boolean onlyUnit = false; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java deleted file mode 100644 index f9c32fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.organization.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/3/28 上午10:11 - */ - -@Data -@ApiModel("单位列表综合筛选请求") -public class ReqSynthesizePO { - - @ApiModelProperty("组织code") - private String organizationCode; - - @ApiModelProperty("是否需要组织成员列表") - private Boolean needMember = false; - - @ApiModelProperty("单位名称") - private String organizationName; - - @ApiModelProperty("筛选人员姓名") - private String employeeName; - - @ApiModelProperty("是否只筛选单位") - private Boolean onlyUnit = false; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/GovBusinessStripTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/GovBusinessStripTreeVO.java deleted file mode 100644 index c3e50bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/GovBusinessStripTreeVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author Liuxinxin - * @since 2023-03-08 - */ -@Data -@ApiModel(value = "条线树形 responseVO", description = "") -public class GovBusinessStripTreeVO { - - private Long id; - - @ApiModelProperty("条线code") - private String businessStripCode; - - @ApiModelProperty("条线名称") - private String businessStripName; - - @ApiModelProperty("父级条线code") - private String parentCode; - - @ApiModelProperty("父级条线名称") - private String parentName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/KeyTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/KeyTreeVO.java deleted file mode 100644 index b8265f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/KeyTreeVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/3/29 下午2:38 - */ - -@Data -@ApiModel("树形定制化接口") -public class KeyTreeVO { - - @ApiModelProperty("编码") - private String key; - - @ApiModelProperty("名称") - private String title; - - @ApiModelProperty("类型 ORGANIZATION/MEMBER") - private String type; - - @ApiModelProperty("子集") - private List children; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java deleted file mode 100644 index 35ccd63..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/3/28 上午10:40 - */ - -@Data -@ApiModel("组织列表") -public class OrganizationSynthesizeTreeVO { - - @ApiModelProperty("上级部门") - private String parentCode; - - @ApiModelProperty("浙政钉组织编号") - private String organizationCode; - - @ApiModelProperty("名称") - private String name; - -// @ApiModelProperty("自己组织列表") -// private List childOrganizationList; - - @ApiModelProperty("组织下成员列表") - private List memberList; - - - @ApiModel - @Data - public static class OrganizationMemberInfo { - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @ApiModelProperty("姓名") - private String name; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java deleted file mode 100644 index b3457a0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/17 下午2:01 - */ -@Data -public class OrganizationTreeVO { - - private Long id; - - @ApiModelProperty("上级部门") - private String parentCode; - - @ApiModelProperty("浙政钉组织编号") - private String organizationCode; - - // @ApiModelProperty("子部门数目") -// private Long subCount; -// -// @ApiModelProperty("排序") -// private Long deptSort; -// -// @ApiModelProperty("状态(禁用,启用)") - private Boolean enabled; - - @ApiModelProperty("名称") - private String name; - -// @ApiModelProperty(value = "子节点") -// private List children; -// -// @ApiModelProperty(value = "是否为叶子节点") -// private Boolean isLeaf; -// - @ApiModelProperty(value = "社会同一信用代码") - private String unifiedSocialCreditCode;; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ProvincialGovBusinessStripVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ProvincialGovBusinessStripVO.java deleted file mode 100644 index 65fd25c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ProvincialGovBusinessStripVO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author Liuxinxin - * @since 2023-03-08 - */ -@Data -@ApiModel(value = "条线 responseVO", description = "") -public class ProvincialGovBusinessStripVO { - - @ApiModelProperty("条线code") - private String businessStripCode; - - @ApiModelProperty("条线名称") - private String businessStripName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java deleted file mode 100644 index 1ae838e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.organization.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/2/16 上午11:50 - */ -@Data -@ApiModel("组织列表VO") -public class ResOrganizationListVO { - - public String id; - - @ApiModelProperty("单位名称") - private String orgName; - - @ApiModelProperty("浙政钉编码") - private String orgCode; - - @ApiModelProperty("财政编码") - private String fiscalCode; - - @ApiModelProperty("所属区域id") - private String regionId; - - @ApiModelProperty("所属区域") - private String regionName; - - @ApiModelProperty("是否为主管单位") - private Boolean isCompetentUnit; - - @ApiModelProperty("是否为上级条线主管单位") - private Boolean isSuperiorLineCompetentUnit; - - @ApiModelProperty("社会统一信用代码") - private String unifiedSocialCreditCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java deleted file mode 100644 index 236b51a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.organization.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-11 - */ -public interface IDingEmployeeInfoService extends IService { - - /** - * 根据专家 专有钉codeList 获取专家组织codeList - * - * @param employeeCodeList - * @return - */ - List getEmployeesOrgCodeList(List employeeCodeList); - - List getEmployeeList(List employeeCodeList); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingOrganizationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingOrganizationService.java deleted file mode 100644 index c129a95..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingOrganizationService.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.organization.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-09 - */ -public interface IDingOrganizationService extends IService { - - /** - * 根据组织code查询组织信息 - * - * @param orgCode - * @return - */ - DingOrganization getByOrgCode(String orgCode); - - /** - * 根据组织code查询父组织信息 - * - * @param orgCode - * @return - */ - DingOrganization getParentOrganization(String orgCode); - - /** - * 批量查询单位信息 - * - * @param codes 单位编码 - * @return 单位信息 - * @author WendyYang - **/ - List listByCodes(Collection codes); - - /** - * 批量查询单位名称 - * - * @param codes 单位编码 - * @return 单位信息 - * @author WendyYang - **/ - List listNameByCodes(Collection codes); - - - /** - * 根据orgCodeList 获取 code 和 名称 Map - * - * @param orgCodeList - * @return - */ - Map getOrgCodeAndNameMap(List orgCodeList); - - Map getOrgMap(List orgCodeList); - - /** - * 获取 key:专家code value:组织信息 (所属单位组织信息) - * @param employeeInfoList - * @return - */ - Map getEmpCodeOrgMap(List employeeInfoList); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IGovBusinessStripService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IGovBusinessStripService.java deleted file mode 100644 index ae614d0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IGovBusinessStripService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.organization.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -public interface IGovBusinessStripService extends IService { - - /** - * 根据code查询名称 - * - * @param codes 条线编码 - * @return 条线名称 - * @author WendyYang - **/ - default List listNameByCodes(Collection codes) { - return CollUtils.fieldList(listByCodes(codes), GovBusinessStrip::getBusinessStripName); - } - - /** - * 根据code查询条线 - * - * @param codes 条线编码 - * @return 条线名称 - * @author WendyYang - **/ - default List listByCodes(Collection codes) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(GovBusinessStrip.class) - .in(GovBusinessStrip::getBusinessStripCode, codes); - return list(query); - } - - /** - * 根据code查询名称 - * - * @param code 条线编码 - * @return 条线名称 - * @author WendyYang - **/ - default String getNameByCode(String code) { - return Optional.ofNullable(getByCode(code)) - .flatMap(w -> Optional.of(w.getBusinessStripName())) - .orElse(StrPool.EMPTY); - } - - /** - * 根据code查询名称 - * - * @param code 条线编码 - * @return 条线名称 - * @author WendyYang - **/ - default GovBusinessStrip getByCode(String code) { - List strips = listByCodes(Collections.singletonList(code)); - return strips.isEmpty() ? null : strips.get(0); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IOrganizationMainManageTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IOrganizationMainManageTagService.java deleted file mode 100644 index f899be6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IOrganizationMainManageTagService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.service; - -import com.ningdatech.pmapi.organization.entity.OrganizationMainManageTag; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -public interface IOrganizationMainManageTagService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java deleted file mode 100644 index f48f69b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.organization.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-03-08 - */ -public interface IProvincialGovBusinessStripService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java deleted file mode 100644 index 24fe316..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.organization.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.organization.mapper.DingEmployeeInfoMapper; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-11 - */ -@Service -public class DingEmployeeInfoServiceImpl extends ServiceImpl implements IDingEmployeeInfoService { - - @Override - public List getEmployeesOrgCodeList(List employeeCodeList) { - if (CollUtil.isEmpty(employeeCodeList)) { - return new ArrayList<>(); - } - List dingEmployeeInfoList = this.list(Wrappers.lambdaQuery(DingEmployeeInfo.class).in(DingEmployeeInfo::getEmployeeCode, employeeCodeList)); - List orgCodeList = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).distinct().collect(Collectors.toList()); - return orgCodeList; - } - - @Override - public List getEmployeeList(List employeeCodeList) { - if (CollUtil.isEmpty(employeeCodeList)) { - return new ArrayList<>(); - } - List dingEmployeeInfoList = this.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .in(DingEmployeeInfo::getEmployeeCode, employeeCodeList)); - return dingEmployeeInfoList; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingOrganizationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingOrganizationServiceImpl.java deleted file mode 100644 index 38619b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingOrganizationServiceImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ningdatech.pmapi.organization.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -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.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.organization.mapper.DingOrganizationMapper; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-09 - */ -@Service -public class DingOrganizationServiceImpl extends ServiceImpl implements IDingOrganizationService { - - @Override - public DingOrganization getByOrgCode(String orgCode) { - if (StringUtils.isBlank(orgCode)) { - return null; - } - return this.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, orgCode)); - } - - @Override - public DingOrganization getParentOrganization(String orgCode) { - DingOrganization dingOrganization = getByOrgCode(orgCode); - if (dingOrganization == null) { - return null; - } - String parentCode = dingOrganization.getParentCode(); - return getByOrgCode(parentCode); - } - - @Override - public List listByCodes(Collection codes) { - if (CollectionUtil.isEmpty(codes)) { - return new ArrayList<>(); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getOrganizationCode, codes); - return list(query); - } - - @Override - public List listNameByCodes(Collection codes) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(DingOrganization.class) - .select(DingOrganization::getOrganizationName) - .in(DingOrganization::getOrganizationCode, codes); - return CollUtils.fieldList(list(query), DingOrganization::getOrganizationName); - } - - @Override - public Map getOrgCodeAndNameMap(List orgCodeList) { - orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); - List dingOrganizationList = listByCodes(orgCodeList); - return dingOrganizationList.stream() - .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode()) && StringUtils.isNotBlank(r.getOrganizationName())) - .collect(Collectors.toMap(DingOrganization::getOrganizationCode, DingOrganization::getOrganizationName)); - } - - @Override - public Map getOrgMap(List orgCodeList) { - orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); - if (CollectionUtil.isEmpty(orgCodeList)) { - return new HashMap<>(); - } - List dingOrganizationList = listByCodes(orgCodeList); - return dingOrganizationList.stream() - .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) - .collect(Collectors.toMap(DingOrganization::getOrganizationCode, r -> r)); - } - - @Override - public Map getEmpCodeOrgMap(List employeeInfoList) { - List orgCodeList = employeeInfoList.stream() - .map(DingEmployeeInfo::getEmpPosUnitCode) - .distinct().collect(Collectors.toList()); - - Map orgMap = this.getOrgMap(orgCodeList); - - Map empCodeOrgMap = new HashMap(); - for(DingEmployeeInfo dingEmployeeInfo:employeeInfoList){ - DingOrganization dingOrganization = orgMap.get(dingEmployeeInfo.getEmpPosUnitCode()); - if (Objects.nonNull(dingOrganization)){ - empCodeOrgMap.put(dingEmployeeInfo.getEmployeeCode(),dingOrganization); - } - } - return empCodeOrgMap; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/GovBusinessStripServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/GovBusinessStripServiceImpl.java deleted file mode 100644 index d2b799b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/GovBusinessStripServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.organization.service.impl; - -import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; -import com.ningdatech.pmapi.organization.mapper.GovBusinessStripMapper; -import com.ningdatech.pmapi.organization.service.IGovBusinessStripService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-03-08 - */ -@Service -public class GovBusinessStripServiceImpl extends ServiceImpl implements IGovBusinessStripService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/OrganizationMainManageTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/OrganizationMainManageTagServiceImpl.java deleted file mode 100644 index 7b19125..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/OrganizationMainManageTagServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.organization.service.impl; - -import com.ningdatech.pmapi.organization.entity.OrganizationMainManageTag; -import com.ningdatech.pmapi.organization.mapper.OrganizationMainManageTagMapper; -import com.ningdatech.pmapi.organization.service.IOrganizationMainManageTagService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-03-09 - */ -@Service -public class OrganizationMainManageTagServiceImpl extends ServiceImpl implements IOrganizationMainManageTagService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java deleted file mode 100644 index 6978215..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.organization.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.organization.mapper.ProvincialGovBusinessStripMapper; -import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip; -import com.ningdatech.pmapi.organization.service.IProvincialGovBusinessStripService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-03-08 - */ -@Service -public class ProvincialGovBusinessStripServiceImpl extends ServiceImpl - implements IProvincialGovBusinessStripService { - -} 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 deleted file mode 100644 index 6903600..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java +++ /dev/null @@ -1,70 +0,0 @@ -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 = "复评员"; - - String FIRST_INDEX_NAME = "firstIndexName"; - String FIRST_INDEX_TITLE = "一级指标"; - String SECOND_INDEX_NAME = "secondIndexName"; - String SECOND_INDEX_TITLE = "二级指标"; - String THIRD_INDEX_NAME = "thirdIndexName"; - String THIRD_INDEX_TITLE = "三级指标"; - String INDEX_SCORE = "indexScore"; - String INDEX_SCORE_TITLE = "指标分值"; - String INDEX_DETAIL = "indexDetail"; - String INDEX_DETAIL_TITLE = "指标细则"; - String GRADE_DETAIL = "gradeDetail"; - String GRADE_DETAIL_TITLE = "评分细则"; - String SUPPORT_MATERIAL = "supportMaterial"; - String SUPPORT_MATERIAL_TITLE = "佐证材料"; - String SELF_APPRAISAL_BASIS = "selfAppraisalBasis"; - String SELF_APPRAISAL_BASIS_TITLE = "自评依据"; - String SELF_APPRAISAL_SCORE = "selfAppraisalScore"; - String SELF_APPRAISAL_SCORE_TITLE = "自评得分"; - String RE_APPRAISAL_BASIS = "refAppraisalBasis"; - String RE_APPRAISAL_BASIS_TITLE = "复评依据"; - String RE_APPRAISAL_SCORE = "reAppraisalScore"; - String RE_APPRAISAL_SCORE_TITLE = "复评得分"; - - String VERIFY_BASIS = "verifyBasis"; - String VERIFY_BASIS_TITLE = "核查依据"; - String VERIFY_SCORE = "verifyScore"; - String VERIFY_SCORE_TITLE = "核查得分"; - String IS_ADDITIONAL = "isAdditional"; - String IS_ADDITIONAL_TITLE = "是否附加指标"; - String RE_APPRAISAL = "(复评)"; - String VERIFY = "(核查)"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java deleted file mode 100644 index 3a2f660..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.performance.manage.AppAppraisalManage; -import com.ningdatech.pmapi.performance.model.vo.*; -import org.springframework.web.bind.annotation.*; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.performance.manage.ReAppraisalManage; -import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; - -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/app-appraisal") -public class AppAppraisalController { - - private final AppAppraisalManage appAppraisalManage; - - @GetMapping("/list") - @ApiOperation("当前复评用户的应用绩效评价计划列表") - public PageVo list(PerformanceAppraisalListReq req) { - return appAppraisalManage.list(req); - } - - @GetMapping("/unEvaluate-list/{planId}") - @ApiOperation("当前绩效评价应用待评价列表") - public PageVo unEvaluateList(@PathVariable Long planId, PerformanceAppraisalListReq req) { - return appAppraisalManage.unEvaluateList(planId,req); - } - - @GetMapping("/evaluated-list/{planId}") - @ApiOperation("当前绩效评价应用已评价列表") - public PageVo evaluatedList(@PathVariable Long planId, PerformanceAppraisalListReq req) { - return appAppraisalManage.evaluatedList(planId,req); - } - - @GetMapping("/detail/{planId}/{appId}") - @ApiOperation("获取详情") - public AppAppraisalIndexDetailVO detail(@PathVariable Long planId,@PathVariable Long appId){ - return appAppraisalManage.detail(planId,appId); - } - - @PostMapping("/save") - @ApiOperation("保存分数") - @WebLog(value = "保存分数",modular = "绩效评价-应用评价") - public String saveAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ - return appAppraisalManage.saveAppraisal(param); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java deleted file mode 100644 index 0c392c6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/IndicatorConfigController.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.performance.manage.IndicatorConfigManage; -import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; -import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; -import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -import com.ningdatech.pmapi.performance.model.vo.AppIndexVO; -import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; -import com.ningdatech.pmapi.performance.model.vo.ProjectIndexVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - * 绩效评价-指标配置 - * @return - * @author CMM - * @since 2023/07/26 16:29 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价-指标配置") -@RequestMapping("/api/v1/indicator-config") -public class IndicatorConfigController { - - private final IndicatorConfigManage indicatorConfigManage; - - @GetMapping("/project/index/template/list") - @ApiOperation("项目指标模板列表") - public PageVo projectIndexTemplateList(PerformanceAppraisalListReq req) { - return indicatorConfigManage.projectIndexTemplateList(req); - } - - @GetMapping("/project/index/template/detail/{id}") - @ApiOperation("项目指标配置模板详情") - public ProjectIndexTemplateVO projectDetail(@PathVariable Long id) { - return indicatorConfigManage.projectDetail(id); - } - - @ApiOperation(value = "项目指标模版启用(禁用)", notes = "项目指标模版启用(禁用)") - @PutMapping("/project/index/{templateId}/active/{state}") - public String enOrDisProjectIndexTemplate(@PathVariable Long templateId, - @PathVariable Boolean state) { - Boolean result = indicatorConfigManage.enOrDisProjectIndexTemplate(templateId, state); - return Boolean.TRUE.equals(result) ? "操作成功":"操作失败"; - } - - @PostMapping("/project/index/template/save") - @ApiOperation("项目指标配置模板保存") - @WebLog("项目指标配置模板保存") - public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { - return indicatorConfigManage.projectTemplateSave(dto); - } - - @PostMapping("/project/index/template/copy/{id}") - @ApiOperation("项目指标配置模板复制") - @WebLog("项目指标配置模板复制") - public String projectTemplateCopy(@PathVariable Long id) { - return indicatorConfigManage.projectTemplateCopy(id); - } - - @PostMapping("/project/index/template/delete/{id}") - @ApiOperation("项目指标配置模板删除") - @WebLog("项目指标配置模板删除") - public String projectTemplateDelete(@PathVariable Long id) { - return indicatorConfigManage.projectTemplateDelete(id); - } - - @GetMapping("/project/index/list") - @ApiOperation("项目指标库列表") - public PageVo projectIndexList(PerformanceAppraisalListReq req) { - return indicatorConfigManage.projectIndexList(req); - } - - @PostMapping("/project/index/save") - @ApiOperation("项目指标库新增指标保存") - @WebLog("项目指标库新增指标保存") - public String projectIndexSave(@Valid @RequestBody PerformanceIndicatorProjectIndexSaveDTO dto) { - return indicatorConfigManage.projectIndexSave(dto); - } - - @PostMapping("/project/index/delete/{id}") - @ApiOperation("项目指标库指标删除") - @WebLog("项目指标库指标删除") - public String projectIndexDelete(@PathVariable Long id) { - return indicatorConfigManage.projectIndexDelete(id); - } - - @PostMapping("/project/index/detail/{id}") - @ApiOperation("项目指标库项目指标详情") - public ProjectIndexVO projectIndexDetail(@PathVariable Long id) { - return indicatorConfigManage.projectIndexDetail(id); - } - - @GetMapping("/app/index/list") - @ApiOperation("应用指标库列表") - public PageVo appIndexList(PerformanceAppraisalListReq req) { - return indicatorConfigManage.appIndexList(req); - } - - @PostMapping("/app/index/save") - @ApiOperation("应用指标库新增指标保存") - @WebLog("应用指标库新增指标保存") - public String appIndexSave(@Valid @RequestBody PerformanceIndicatorAppIndexSaveDTO dto) { - return indicatorConfigManage.appIndexSave(dto); - } - - @PostMapping("/app/index/delete/{id}") - @ApiOperation("应用指标库指标删除") - @WebLog("应用指标库指标删除") - public String appIndexDelete(@PathVariable Long id) { - return indicatorConfigManage.appIndexDelete(id); - } - - @PostMapping("/app/index/detail/{id}") - @ApiOperation("应用指标库应用指标详情") - public AppIndexVO appIndexDetail(@PathVariable Long id) { - return indicatorConfigManage.appIndexDetail(id); - } - - @ApiOperation(value = "应用指标启用(禁用)", notes = "应用指标启用(禁用)") - @PutMapping("/app/index/{appId}/active/{state}") - @WebLog("应用指标库指标启用(禁用)") - public String enOrDisAppIndex(@PathVariable Long appId, - @PathVariable Boolean state) { - Boolean result = indicatorConfigManage.enOrDisAppIndex(appId, state); - return Boolean.TRUE.equals(result) ? "操作成功":"操作失败"; - } -} 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 deleted file mode 100644 index 6e933b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; -import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq; -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.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -/** - * @Classname OrgSelfAppraisalController - * @Description - * @Date 2023/6/25 14:16 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价-单位自评") -@RequestMapping("/api/v1/self-appraisal") -public class OrgSelfAppraisalController { - - private final OrgSelfAppraisalManage selfAppraisalManage; - - @GetMapping("/list") - @ApiOperation("当前用户的绩效评价计划列表") - public PageVo list(PerformanceAppraisalListReq req) { - return selfAppraisalManage.list(req); - } - - @GetMapping("/pending-list/{planId}") - @ApiOperation("当前绩效评价待自评列表") - public PageVo pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { - return selfAppraisalManage.pendingList(planId,req); - } - - @GetMapping("/appraisaled-list/{planId}") - @ApiOperation("当前绩效评价已自评列表") - public PageVo appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { - 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("提交自评") - @WebLog(value = "提交自评",modular = "绩效评价-单位自评") - public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ - return selfAppraisalManage.submitSelfAppraisal(param); - } - - @GetMapping("/score/export") - @ApiOperation("自评打分导出") - @WebLog(value = "自评打分导出",modular = "绩效评价-单位自评") - public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ - ExcelDownUtil.downXls(response, param, selfAppraisalManage::exportScore); - } -} 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 deleted file mode 100644 index d204c5f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java +++ /dev/null @@ -1,136 +0,0 @@ -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 com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 PerformanceAppraisalController - * @Description - * @Date 2023/6/19 14:16 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价-评价计划") -@RequestMapping("/api/v1/performance-appraisal/plan") -public class PerformanceAppraisalPlanController { - - private final PerformanceAppraisalPlanManage performanceAppraisalPlanManage; - - @GetMapping("/list") - @ApiOperation("评价计划列表") - public PageVo list(PerformanceAppraisalListReq req) { - return performanceAppraisalPlanManage.list(req); - } - - @GetMapping("/detail/{id}") - @ApiOperation("评价计划详情") - public PerformanceAppraisalVO detail(@PathVariable Long id) { - return performanceAppraisalPlanManage.detail(id); - } - - @PostMapping("/create") - @ApiOperation("绩效评价创建") - @WebLog("绩效评价创建") - public String create(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) { - return performanceAppraisalPlanManage.create(createDTO); - } - - @GetMapping("/final-project-list") - @ApiOperation("评价计划-终验项目列表") - public PageVo finalProjectList(PerformanceAppraisalListReq req) { - return performanceAppraisalPlanManage.finalProjectList(req); - } - - @GetMapping("/final-application-list") - @ApiOperation("评价计划-终验应用列表") - public PageVo finalApplicationList(PerformanceAppraisalListReq req) { - return performanceAppraisalPlanManage.finalApplicationList(req); - } - - @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("编辑绩效评价") - public String edit(@Valid @RequestBody PerformanceAppraisalEditDTO editDTO) { - return performanceAppraisalPlanManage.edit(editDTO); - } - - @PostMapping("/delete/{id}") - @ApiOperation("绩效评价删除") - @WebLog("绩效评价删除") - public String delete(@PathVariable Long id) { - 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, - @RequestParam(required = false) String name) { - return performanceAppraisalPlanManage.groupList(appraisalId,name); - } - - @GetMapping("/group/detail/{id}") - @ApiOperation("绩效评价分组详情") - public PerformanceAppraisalProjectGroupVO groupDetail(@PathVariable Long id) { - return performanceAppraisalPlanManage.groupDetail(id); - } - - @PostMapping("/group/save") - @ApiOperation("绩效评价分组保存") - @WebLog("绩效评价分组保存") - public String groupSave(@Valid @RequestBody PerformanceAppraisalProjectGroupSaveDTO dto) { - return performanceAppraisalPlanManage.groupSave(dto); - } - - @PostMapping("/group/delete/{id}") - @ApiOperation("绩效评价分组删除") - @WebLog("绩效评价分组删除") - public String groupDelete(@PathVariable Long id) { - return performanceAppraisalPlanManage.groupDelete(id); - } -} 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 deleted file mode 100644 index 0e93a2e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/ReAppraisalController.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.performance.manage.ReAppraisalManage; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq; -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("提交复评") - @WebLog(value = "提交复评",modular = "绩效评价-人工复评") - public String submitReAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ - return reAppraisalManage.submitReAppraisal(param); - } - - @GetMapping("/score/export") - @ApiOperation("复评打分导出") - @WebLog(value = "复评打分导出",modular = "绩效评价-人工复评") - public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ - ExcelDownUtil.downXls(response, param, reAppraisalManage::exportScore); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java deleted file mode 100644 index f294ea4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.performance.manage.RectifyAuditManage; -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; - -/** - * RectifyController - * @return - * @author CMM - * @since 2023/08/12 15:45 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价-项目整改核查") -@RequestMapping("/api/v1/rectify-audit") -public class RectifyAuditController { - - private final RectifyAuditManage rectifyAuditManage; - - @GetMapping("/list") - @ApiOperation("当前用户的绩效评价整改审核计划列表") - public PageVo list(PerformanceAppraisalListReq req) { - return rectifyAuditManage.list(req); - } - - @GetMapping("/unAudit-list/{planId}") - @ApiOperation("当前绩效评价待整改审核列表") - public PageVo unAuditList(@PathVariable Long planId, PerformanceAppraisalListReq req) { - return rectifyAuditManage.unAuditList(planId,req); - } - - @GetMapping("/audited-list/{planId}") - @ApiOperation("当前绩效评价已整改审核列表") - public PageVo auditedList(@PathVariable Long planId,PerformanceAppraisalListReq req) { - return rectifyAuditManage.auditedList(planId,req); - } - - @PostMapping("/submit") - @ApiOperation("提交整改审核结果") - @WebLog(value = "提交整改审核结果",modular = "绩效评价-项目整改核查") - public String submit(@Valid @RequestBody ProjectAppraisalDTO param){ - return rectifyAuditManage.submit(param); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java deleted file mode 100644 index 4dc1f1c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import org.springframework.web.bind.annotation.*; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.performance.manage.RectifyManage; -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.RectifyDetailVO; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; - -/** - * RectifyController - * - * @return - * @author CMM - * @since 2023/08/12 15:45 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价-项目整改") -@RequestMapping("/api/v1/rectify") -public class RectifyController { - - private final RectifyManage rectifyManage; - - @GetMapping("/list") - @ApiOperation("当前用户的绩效评价整改计划列表") - public PageVo list(PerformanceAppraisalListReq req) { - return rectifyManage.list(req); - } - - @GetMapping("/unRectify-list/{planId}") - @ApiOperation("当前绩效评价待整改列表") - public PageVo unRectifyList(@PathVariable Long planId, - PerformanceAppraisalListReq req) { - return rectifyManage.unRectifyList(planId, req); - } - - @GetMapping("/rectified-list/{planId}") - @ApiOperation("当前绩效评价已整改列表") - public PageVo rectifiedList(@PathVariable Long planId, - PerformanceAppraisalListReq req) { - return rectifyManage.rectifiedList(planId, req); - } - - @GetMapping("/get-rectify-detail/{planId}/{projectCode}") - @ApiOperation("查看整改详情") - public RectifyDetailVO getRectifyDetail(@PathVariable Long planId, @PathVariable String projectCode) { - return rectifyManage.getRectifyDetail(planId, projectCode); - } - - @PostMapping("/fill-out-result") - @ApiOperation("填写整改情况") - @WebLog(value = "填写整改情况",modular = "绩效评价-项目整改") - public String fillOutResult(@Valid @RequestBody ProjectAppraisalDTO param) { - return rectifyManage.fillOutResult(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 deleted file mode 100644 index c6f257e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.performance.manage.VerifyManage; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq; -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("提交核查") - @WebLog(value = "提交核查",modular = "绩效评价-专家核查") - public String submitVerify(@Valid @RequestBody ProjectAppraisalDTO param){ - return verifyManage.submitVerify(param); - } - - @GetMapping("/score/export") - @ApiOperation("核查打分导出") - @WebLog(value = "核查打分导出",modular = "绩效评价-专家核查") - public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){ - ExcelDownUtil.downXls(response, param, verifyManage::exportScore); - } - -} 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 deleted file mode 100644 index a5beb6d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.ningdatech.pmapi.performance.convert; - -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 com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -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; -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 cn.hutool.core.collection.CollUtil; - -/** - * @Classname PerformanceAppraisalConverer - * @Description - * @Date 2023/6/19 15:31 - * @Author PoffyZhang - */ -public class PerformanceAppraisalConveter { - - public static List convertProjects( - List projects, Map map) { - if(CollUtil.isNotEmpty(projects) && CollUtil.isNotEmpty(map)){ - return projects.stream().map(p -> { - PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); - vo.setIsReAppraisal(p.getIsReAppraisal()); - vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); - vo.setProjectId(p.getProjectId()); - if(map.containsKey(p.getProjectCode())){ - Project project = map.get(p.getProjectCode()); - vo.setProjectCode(project.getProjectCode()); - vo.setProjectName(project.getProjectName()); - vo.setProjectType(project.getProjectType()); - vo.setProjectTypeName(getProjectTypeName(project.getProjectType())); - vo.setBuildOrgName(project.getBuildOrgName()); - vo.setDeclareAmount(project.getDeclareAmount()); - vo.setProjectYear(project.getProjectYear()); - } - return vo; - }).collect(Collectors.toList()); - } - return Collections.emptyList(); - } - - public static List convertApplications( - List applications, Map map) { - if(CollUtil.isNotEmpty(applications) && CollUtil.isNotEmpty(map)){ - return applications.stream().map(a -> { - PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); - vo.setAppId(a.getApplicationId()); - if(map.containsKey(a.getApplicationId())){ - ProjectApplication application = map.get(a.getApplicationId()); - vo.setApplicationName(StringUtils.isNotBlank(application.getRelatedExistsApplication())? - application.getRelatedExistsApplication() : application.getApplicationName()); - vo.setApplicationType(application.getApplicationType()); - vo.setBizDomain(application.getBizDomain()); - vo.setBuildOrgName(application.getBuildOrgName()); - vo.setPublishSide(application.getPublishSide()); - } - return vo; - }).collect(Collectors.toList()); - } - return Collections.emptyList(); - } - - public static String getProjectTypeName(String projectType) { - if (Objects.nonNull(projectType)) { - return ProjectTypeNewEnum.getDesc(projectType); - } - 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/AppIndexTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java deleted file mode 100644 index b61ace2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java +++ /dev/null @@ -1,42 +0,0 @@ -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; - -/** - * AppIndexTypeEnum - * @return - * @author CMM - * @since 2023/07/26 16:44 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum AppIndexTypeEnum { - /** - * 应用指标类型 - */ - COMMON(1, "通用指标"), - AUX(2, "辅助指标"), - BUSINESS(3,"业务指标"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (AppIndexTypeEnum t : AppIndexTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} 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 deleted file mode 100644 index 232c040..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -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, "专家核查"), - EXPERT_RECTIFY_AUDIT(4, "专家整改审核"), - APPLICATION_APPRAISAL(5, "应用评价"); - - 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/ConstructTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java deleted file mode 100644 index bd5c9ce..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/ConstructTypeEnum.java +++ /dev/null @@ -1,42 +0,0 @@ -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; - -/** - * ConstructTypeEnum - * @return - * @author CMM - * @since 2023/07/26 16:44 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ConstructTypeEnum { - /** - * 建设类型 - */ - SOFT(1, "软件"), - HARDWARE(2, "硬件"), - SOFT_HARD(3, "软硬件"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ConstructTypeEnum t : ConstructTypeEnum.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 deleted file mode 100644 index 8cbd684..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java +++ /dev/null @@ -1,42 +0,0 @@ -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/PerformanceTemplateStageNameEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java deleted file mode 100644 index e5958f8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.performance.enumration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - *

- * PerformanceTemplateStageNameEnum - *

- * - * @author Poffy - * @since 16:56 2023/6/27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum PerformanceTemplateStageNameEnum { - /** - * 模板阶段名称枚举 - */ - STAGE_1(1, "立项阶段"), - STAGE_2(2, "建设阶段"), - STAGE_3(3, "运行阶段"), - STAGE_4(4, "附加阶段"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (PerformanceTemplateStageNameEnum t : PerformanceTemplateStageNameEnum.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 deleted file mode 100644 index 82e03fb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.performance.enumration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - *

- * PerformanceTemplateTypeEnum - *

- * - * @author Poffy - * @since 16:56 2023/6/27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum PerformanceTemplateTypeEnum { - /** - * 模板类型 - */ - FIRST_INDEX(1, "第一指标"), - SECOND_INDEX(2, "第二指标"), - THIRD_INDEX(3, "第三指标"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (PerformanceTemplateTypeEnum t : PerformanceTemplateTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java deleted file mode 100644 index 4528116..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java +++ /dev/null @@ -1,41 +0,0 @@ -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; - -/** - * RectifyAuditEnum - * @return - * @author CMM - * @since 2023/07/26 16:44 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum RectifyAuditEnum { - /** - * 评价类型 - */ - APPROVED(1, "通过"), - NOT_APPROVED(2, "不通过"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (RectifyAuditEnum t : RectifyAuditEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java deleted file mode 100644 index c40d67c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -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; - -/** - * RectifyStatusEnum - * @return - * @author CMM - * @since 2023/07/26 16:44 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum RectifyStatusEnum { - /** - * 整改状态 - */ - TO_BE_SUBMITTED(1, "整改情况待提交"), - NOT_APPROVED(2, "整改核查不通过"), - TO_BE_REVIEWED(3, "整改待审核"), - APPROVED(4,"整改审核通过"); - - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (RectifyStatusEnum t : RectifyStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} 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 deleted file mode 100644 index 18c941e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -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 - * @param projectCode - * @param vo - * @return - */ - List buildTemplateDetail(List templateDetails, String projectCode, 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 deleted file mode 100644 index 143aefd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -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.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, String projectCode, 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::getAppraisalProjectCode,projectCode) - .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::getAppraisalProjectCode,projectCode) - .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.setReAppraisalTotalScore(sum); - } - } - // 按照核查人员分组 获取核查分数信息 - List verifyScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) - .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); - } - } - // 获取整改审核分数信息 - List rectifyAuditScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode())); - if (CollUtil.isNotEmpty(rectifyAuditScoreInfo)) { - detailThirdVo.setRectifyAuditScoreInfo(rectifyAuditScoreInfo); - BigDecimal score = rectifyAuditScoreInfo.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - if (Objects.nonNull(vo)) { - vo.setRectifyAuditTotalScore(score); - } - } - 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/AppAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java deleted file mode 100644 index 5bda1a6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java +++ /dev/null @@ -1,429 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.map.MapUtil; -import com.ningdatech.pmapi.performance.enumration.AppIndexTypeEnum; -import com.ningdatech.pmapi.performance.model.dto.AppAppraisalInfoDTO; -import com.ningdatech.pmapi.performance.model.vo.*; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -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.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.performance.constant.BizConst; -import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; -import com.ningdatech.pmapi.performance.model.entity.*; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -import com.ningdatech.pmapi.performance.service.*; -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; - -/** - * AppAppraisalManage - * @return - * @author CMM - * @since 2023/08/10 8:55 - */ -@Component -@Slf4j -@AllArgsConstructor -public class AppAppraisalManage { - private final IPerformanceAppraisalService performanceAppraisalService; - private final IRoleService roleService; - private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService; - private final IPerformanceAppraisalProjectGroupService groupService; - private final IProjectApplicationService projectApplicationService; - private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; - private final IPerformanceAppraisalAppIndicatorService performanceAppraisalAppIndicatorService; - private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; - /** - * 应用评价-评价计划列表 - * @param req - * @return - */ - public PageVo list(PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - // 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 - 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 paas = performanceAppraisalApplicationService.list(); - // 没有包含应用的评价计划 - if (CollUtil.isEmpty(paas)){ - return PageVo.empty(); - } - Set paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .in(PerformanceAppraisal::getId,paIds) - .orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page,wrapper); - List res = page.getRecords().stream() - .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) - .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); - } - - - public PageVo unEvaluateList(Long planId, PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); - - PerformanceAppraisal plan = performanceAppraisalService.getById(planId); - VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); - - // 获取分组所在评价计划添加的未完成评价的应用信息 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, planId) - .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); - // 没有当前用户待评价的应用信息 - if (CollUtil.isEmpty(paas)){ - return PageVo.empty(); - } - List ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 - List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - List appIds; - if (CollUtil.isNotEmpty(appraisalScoreInfos)) { - // 筛选出当前登录用户已进行打分的应用信息 - List scoredAppIds = appraisalScoreInfos.stream() - .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); - ids.removeAll(scoredAppIds); - } - appIds = ids; - // 没有当前用户待评价的应用信息 - if(CollUtil.isEmpty(appIds)){ - return PageVo.empty(); - } - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, appIds) - .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); - projectApplicationService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(p -> { - PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); - vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); - vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); - vo.setAppraisalId(planId); - return vo; - }) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - public PageVo evaluatedList(Long planId, PerformanceAppraisalListReq req) { - - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); - - PerformanceAppraisal plan = performanceAppraisalService.getById(planId); - VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); - - // 获取评价计划添加的已完成评价的应用信息 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, planId) - .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); - if (CollUtil.isEmpty(paas)){ - return PageVo.empty(); - } - // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 - List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - List appIds = Lists.newArrayList(); - if (CollUtil.isNotEmpty(appraisalScoreInfos)) { - // 筛选出当前登录用户已进行打分的应用信息 - List scoredAppIds = appraisalScoreInfos.stream() - .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); - appIds = scoredAppIds; - } - - // 没有当前用户已评价的应用信息 - if(CollUtil.isEmpty(appIds)){ - return PageVo.empty(); - } - - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, appIds) - .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); - projectApplicationService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(p -> { - PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); - vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); - vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); - vo.setAppraisalId(planId); - return vo; - }) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 是否可以评价 - * - * @param employeeCode - * @param appId - * @param appraisalId - * @return - */ - private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { - // 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 - // 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 - List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId,appId) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,appraisalId) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); - if (CollUtil.isEmpty(scoreInfos)){ - return true; - } - return Boolean.FALSE; - } - - - public AppAppraisalIndexDetailVO detail(Long planId, Long appId) { - - ProjectApplication projectApplication = projectApplicationService.getById(appId); - VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在!"); - - AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); - if (StringUtils.isNotBlank(projectApplication.getApplicationName())) { - resVo.setApplicationName(projectApplication.getApplicationName()); - }else { - resVo.setApplicationName(projectApplication.getRelatedExistsApplication()); - } - if (Objects.nonNull(projectApplication)){ - resVo.setBuildOrgName(projectApplication.getBuildOrgName()); - // todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 - resVo.setApplicationStatus("已验收"); - } - // 获取指标配置的应用指标信息 - // 通用指标 - List commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode()) - .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); - // 获取当前应用通用指标的的打分信息 - Map commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) - .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.COMMON.getCode())) - .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); - if (CollUtil.isNotEmpty(commonIndexList)) { - List commonIndexDetails = commonIndexList.stream().map(i -> { - AppIndexDetailVO vo = new AppIndexDetailVO(); - BeanUtils.copyProperties(i, vo); - PerformanceAppraisalAppScoreInfo scoreInfo = commonScoreInfoMap.get(i.getId()); - if (Objects.nonNull(scoreInfo)) { - vo.setAppraisalScore(scoreInfo.getAppraisalScore()); - } - return vo; - }).collect(Collectors.toList()); - resVo.setCommonIndexDetails(commonIndexDetails); - } - - // 辅助指标 - List auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode()) - .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); - // 获取当前应用辅助指标的的打分信息 - Map auxScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) - .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.AUX.getCode())) - .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); - if (CollUtil.isNotEmpty(auxIndexList)) { - List auxIndexDetails = auxIndexList.stream().map(i -> { - AppIndexDetailVO vo = new AppIndexDetailVO(); - BeanUtils.copyProperties(i, vo); - PerformanceAppraisalAppScoreInfo scoreInfo = auxScoreInfoMap.get(i.getId()); - if (Objects.nonNull(scoreInfo)) { - vo.setAppraisalScore(scoreInfo.getAppraisalScore()); - } - return vo; - }).collect(Collectors.toList()); - resVo.setAuxIndexDetails(auxIndexDetails); - } - // 获取应用的核心业务指标 - List coreBusinessIndicators = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) - .eq(ProjectCoreBusinessIndicators::getApplicationId, appId)); - // 获取当前应用业务指标的的打分信息 - Map businessScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) - .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.BUSINESS.getCode())) - .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); - if (CollUtil.isNotEmpty(coreBusinessIndicators)) { - List businessIndexDetails = coreBusinessIndicators.stream().map(c -> { - AppBusinessIndexDetailVO appBusinessIndexDetailVo = new AppBusinessIndexDetailVO(); - BeanUtils.copyProperties(c, appBusinessIndexDetailVo); - PerformanceAppraisalAppScoreInfo scoreInfo = businessScoreInfoMap.get(c.getId()); - if (Objects.nonNull(scoreInfo)) { - appBusinessIndexDetailVo.setAppraisalScore(scoreInfo.getAppraisalScore()); - } - return appBusinessIndexDetailVo; - }).collect(Collectors.toList()); - resVo.setBusinessIndexDetails(businessIndexDetails); - } - return resVo; - } - - public String saveAppraisal(ProjectAppraisalDTO param) { - UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); - String username = userDetail.getUsername(); - - Long applicationId = param.getApplicationId(); - Long appraisalId = param.getAppraisalId(); - List appAppraisalInfoList = param.getAppAppraisalInfoList(); - - // 获取评价应用 - PerformanceAppraisalApplication appraisalApplication = performanceAppraisalApplicationService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalApplication::getApplicationId, applicationId)); - - List indexIds = appAppraisalInfoList.stream().filter(a -> AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || - AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) - .map(AppAppraisalInfoDTO::getIndexId) - .collect(Collectors.toList()); - List businessIndexIds = appAppraisalInfoList.stream() - .filter(a -> AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) - .map(AppAppraisalInfoDTO::getIndexId) - .collect(Collectors.toList()); - // 查出通用、辅助应用指标分数信息 - Map indexMap = MapUtil.newHashMap(); - if (CollUtil.isNotEmpty(indexIds)) { - List indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .in(PerformanceAppraisalAppIndicator::getId, indexIds)); - if (CollUtil.isEmpty(indexList)) { - throw new BizException("通用/辅助评价指标不存在!"); - } - indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); - } - - // 查出应用业务指标分数信息 - Map businessIndexMap = MapUtil.newHashMap(); - if (CollUtil.isNotEmpty(businessIndexIds)) { - List businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) - .in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); - if (CollUtil.isEmpty(businessIndexList)) { - throw new BizException("核心业务评价指标不存在!"); - } - businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); - } - - Map finalIndexMap = indexMap; - Map finalBusinessIndexMap = businessIndexMap; - List scoreInfos = appAppraisalInfoList.stream().map(a -> { - if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || - AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())){ - PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.get(a.getIndexId()); - BigDecimal score = a.getScore(); - BigDecimal indexScore = appIndicator.getIndexScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ - throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); - } - } else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { - ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); - BigDecimal score = a.getScore(); - BigDecimal indexScore = coreBusinessIndicators.getScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ - throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); - } - } - // 保存评价分数信息 - PerformanceAppraisalAppScoreInfo scoreInfo = new PerformanceAppraisalAppScoreInfo(); - scoreInfo.setAppraisalScore(a.getScore()); - scoreInfo.setAppraisalId(appraisalId); - scoreInfo.setAppraisalEmployeeCode(employeeCode); - scoreInfo.setAppraisalEmployeeName(username); - scoreInfo.setApplicationId(applicationId); - scoreInfo.setIndexId(a.getIndexId()); - scoreInfo.setIndexType(a.getIndexType()); - scoreInfo.setCreateOn(LocalDateTime.now()); - scoreInfo.setCreateBy(username); - scoreInfo.setUpdateOn(LocalDateTime.now()); - scoreInfo.setUpdateBy(username); - return scoreInfo; - }).collect(Collectors.toList()); - if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)){ - // 计算评价总分并保存 - BigDecimal appraisalTotalScore = appAppraisalInfoList.stream() - .map(AppAppraisalInfoDTO::getScore) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - appraisalApplication.setAppraisalTotalScore(appraisalTotalScore); - appraisalApplication.setAppraisalScoreTime(LocalDateTime.now()); - // 一个复评员打完分就认为完成了打分 - appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); - appraisalApplication.setUpdateBy(username); - performanceAppraisalApplicationService.updateById(appraisalApplication); - return "提交成功"; - } - return "提交失败"; - } - private void judgeCompleteAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalApplication appraisalApplication) { - // 获取该评价应用的复评打分信息 - List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, group.getAppraisalId()) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appraisalApplication.getApplicationId())); - String reAppraisalUsers = group.getReAppraisalUsers(); - List users = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(users)){ - String join = String.join(StrPool.COMMA, users); - if (join.equals(reAppraisalUsers)) { - appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); - } - } - } -} 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 deleted file mode 100644 index 71395a9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java +++ /dev/null @@ -1,566 +0,0 @@ -package com.ningdatech.pmapi.performance.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.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.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -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; -import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppIndicator; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectIndicator; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -import com.ningdatech.pmapi.performance.model.vo.AppIndexVO; -import com.ningdatech.pmapi.performance.model.vo.ProjectIndexTemplateVO; -import com.ningdatech.pmapi.performance.model.vo.ProjectIndexVO; -import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalAppIndicatorService; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectIndicatorService; -import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; -import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; -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.beans.BeanUtils; -import org.springframework.stereotype.Component; -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.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname IndicatorTemplateManage - * @Description - * @Date 2023/6/26 14:15 - * @Author PoffyZhang - */ -@Slf4j -@Component -@AllArgsConstructor -public class IndicatorConfigManage { - private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; - private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; - private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; - private final IPerformanceAppraisalAppIndicatorService appIndicatorService; - private final TemplateDetailBuildHelper templateDetailBuildHelper; - - /** - * 模板列表 - * @param req - * @return - */ - public PageVo projectIndexTemplateList(PerformanceAppraisalListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()) - .orderByDesc(PerformanceIndicatorProjectTemplate::getCreateOn); - indicatorProjectTemplateService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 查询项目模板详情 - * @param id - * @return - */ - public ProjectIndexTemplateVO projectDetail(Long id) { - PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); - if(Objects.isNull(template)){ - return null; - } - 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::getIsAdditional,Boolean.FALSE)); - // 获取模版附加绩效指标详情 - List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - if(CollUtil.isNotEmpty(templateDetails)){ - List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, null, null); - vo.setTemplateDetails(templateDetailVos); - } - - if (CollUtil.isNotEmpty(additionalTemplateDetails)){ - List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, null, null); - vo.setAdditionalIndexDetails(additionalTemplateDetailVos); - } - return vo; - } - - /** - * 项目指标 模板保存 - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - 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("该模板不存在!"); - template.setId(old.getId()); - }else{ - template.setId(null); - template.setCreateOn(LocalDateTime.now()); - template.setCreateBy(user.getUsername()); - } - template.setUpdateOn(LocalDateTime.now()); - template.setUpdateBy(user.getUsername()); - if(indicatorProjectTemplateService.saveOrUpdate(template)){ - //保存 模板指标的详情 - if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ - //先删除 - indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .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() - .map(PerformanceIndicatorProjectTemplateDetail::getIndexScore) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - boolean score = (BigDecimal.valueOf(100)).equals(sum); - VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!"); - } - } - // 保存 模版附加指标详情 - if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ - indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId()); - } - return BizConst.SAVE_SUCCESS; - } - throw new BizException(BizConst.SAVE_FAIL); - } - - /** - * 解析 项目考核指标 - * @param templateDetails - * @return - */ - public void analysisTemplateDetails( - List templateDetails,Long templateId) { - if(CollUtil.isEmpty(templateDetails)){ - return; - } - analysisTemplateDetailsInner(templateDetails,templateId,null); - } - - /** - * 解析 项目附加考核指标 - * @param additionalTemplateDetails - * @return - */ - public void analysisAdditionalTemplateDetails( - List additionalTemplateDetails,Long templateId) { - if(CollUtil.isEmpty(additionalTemplateDetails)){ - return; - } - analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); - } - - public void analysisTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId) { - if(CollUtil.isEmpty(templateDetails)){ - return; - } - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - for(ProjectTemplateDetailDTO detail : templateDetails){ - //计算阶段的 - PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); - templateDetail.setCreateBy(user.getUsername()); - templateDetail.setCreateOn(LocalDateTime.now()); - templateDetail.setUpdateBy(user.getUsername()); - templateDetail.setUpdateOn(LocalDateTime.now()); - templateDetail.setTemplateId(templateId); - // 一级指标的父ID为null - templateDetail.setParentId(parentId); - templateDetail.setIsAdditional(Boolean.FALSE); - - indicatorProjectTemplateDetailService.save(templateDetail); - - if(CollUtil.isNotEmpty(detail.getChildren())){ - analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); - } - } - } - - public void analysisAdditionalTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId) { - if(CollUtil.isEmpty(templateDetails)){ - return; - } - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - for(ProjectTemplateDetailDTO detail : templateDetails){ - //计算阶段的 - PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); - templateDetail.setCreateBy(user.getUsername()); - templateDetail.setCreateOn(LocalDateTime.now()); - templateDetail.setUpdateBy(user.getUsername()); - templateDetail.setUpdateOn(LocalDateTime.now()); - templateDetail.setTemplateId(templateId); - // 标记为附加指标 - templateDetail.setIsAdditional(Boolean.TRUE); - // 一级指标的父ID为null - templateDetail.setParentId(parentId); - - indicatorProjectTemplateDetailService.save(templateDetail); - - if(CollUtil.isNotEmpty(detail.getChildren())){ - analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); - } - } - } - - /** - * 装配 模板详情 - * @param templateDetails - * @return - */ - private List buildTemplateDetail(List templateDetails) { - 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 thirdList = Lists.newArrayList(); - for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) { - if (Objects.nonNull(templateDetailFour.getParentId()) && - templateDetailFour.getParentId().equals(templateDetailThird.getId())) { - ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class); - thirdList.add(detailFourVo); - } - } - detailThirdVo.setChildren(thirdList); - secondList.add(detailThirdVo); - } - } - detailSecondVo.setChildren(secondList); - firstList.add(detailSecondVo); - } - } - detailFirstVo.setChildren(firstList); - res.add(detailFirstVo); - - } - } - return res; - } - - - /** - * 删除项目模板 - * - * @param id - * @return - */ - public String projectTemplateDelete(Long id) { - PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id); - VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!"); - - if (CommonEnum.YES.getCode().equals(projectTemplate.getStatus())) { - throw new BizException("操作失败 该模板 是启用状态!"); - } - - if (indicatorProjectTemplateService.removeById(id)) { - indicatorProjectTemplateDetailService - .remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); - return "删除成功"; - } - return "操作失败"; - } - - 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()); - } - return indicatorProjectTemplateService.updateById(projectTemplate); - } - - @Transactional(rollbackFor = Exception.class) - public String projectTemplateCopy(Long templateId) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); - PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate(); - BeanUtils.copyProperties(projectTemplate,newTemplate); - // 复制后,项目模版名称变更为xxx副本,状态为禁用 - newTemplate.setName(projectTemplate.getName() + CommonConst.COPY); - newTemplate.setStatus(CommonEnum.NO.getCode()); - newTemplate.setCreateOn(LocalDateTime.now()); - newTemplate.setCreateBy(user.getUsername()); - newTemplate.setUpdateOn(LocalDateTime.now()); - newTemplate.setUpdateBy(user.getUsername()); - // 副本ID要置空 - newTemplate.setId(null); - if (indicatorProjectTemplateService.save(newTemplate)) { - // 新增指标详情 - List projectTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateId)); - Map detailMap = projectTemplateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, p -> p)); - // 按层级逐个新增并保存各指标 - // 从三级指标开始 - List thirdList = projectTemplateDetails.stream() - .filter(p -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(p.getType())) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(thirdList)){ - throw new BizException("当前模板未配置三级指!"); - } - List templateDetails = Lists.newArrayList(); - for (PerformanceIndicatorProjectTemplateDetail templateDetail : thirdList) { - PerformanceIndicatorProjectTemplateDetail newThirdTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); - BeanUtils.copyProperties(templateDetail, newThirdTemplateDetail); - newThirdTemplateDetail.setTemplateId(newTemplate.getId()); - newThirdTemplateDetail.setCreateOn(LocalDateTime.now()); - newThirdTemplateDetail.setCreateBy(user.getUsername()); - newThirdTemplateDetail.setUpdateOn(LocalDateTime.now()); - newThirdTemplateDetail.setUpdateBy(user.getUsername()); - // 新的指标ID、parentId要置空 - newThirdTemplateDetail.setId(null); - newThirdTemplateDetail.setParentId(null); - indicatorProjectTemplateDetailService.save(newThirdTemplateDetail); - // 再保存关联的二级指标 - Long thirdParentId = templateDetail.getParentId(); - PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = detailMap.get(thirdParentId); - if (Objects.isNull(secondTemplateDetail)){ - throw new BizException("三级指标:" + templateDetail.getName() + "对应的二级指标不存在"); - } - PerformanceIndicatorProjectTemplateDetail newSecondTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); - BeanUtils.copyProperties(secondTemplateDetail, newSecondTemplateDetail); - newSecondTemplateDetail.setTemplateId(newTemplate.getId()); - newSecondTemplateDetail.setCreateOn(LocalDateTime.now()); - newSecondTemplateDetail.setCreateBy(user.getUsername()); - newSecondTemplateDetail.setUpdateOn(LocalDateTime.now()); - newSecondTemplateDetail.setUpdateBy(user.getUsername()); - // 新的指标Id、parentId要置空 - newSecondTemplateDetail.setId(null); - newSecondTemplateDetail.setParentId(null); - indicatorProjectTemplateDetailService.save(newSecondTemplateDetail); - // 关联三级指标 - newThirdTemplateDetail.setParentId(newSecondTemplateDetail.getId()); - templateDetails.add(newThirdTemplateDetail); - // 再保存关联的一级指标 - Long secondParentId = secondTemplateDetail.getParentId(); - PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = detailMap.get(secondParentId); - if (Objects.isNull(firstTemplateDetail)){ - throw new BizException("二级指标:" + secondTemplateDetail.getName() + "对应的一级指标不存在"); - } - PerformanceIndicatorProjectTemplateDetail newFirstTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); - BeanUtils.copyProperties(firstTemplateDetail, newFirstTemplateDetail); - newFirstTemplateDetail.setTemplateId(newTemplate.getId()); - newFirstTemplateDetail.setCreateOn(LocalDateTime.now()); - newFirstTemplateDetail.setCreateBy(user.getUsername()); - newFirstTemplateDetail.setUpdateOn(LocalDateTime.now()); - newFirstTemplateDetail.setUpdateBy(user.getUsername()); - // 新的指标ID、parentId要置空 - newFirstTemplateDetail.setId(null); - newFirstTemplateDetail.setParentId(null); - indicatorProjectTemplateDetailService.save(newFirstTemplateDetail); - // 关联二级指标 - newSecondTemplateDetail.setParentId(newFirstTemplateDetail.getId()); - templateDetails.add(newSecondTemplateDetail); - } - // 批量更新 - if (indicatorProjectTemplateDetailService.updateBatchById(templateDetails)) { - return "模版复制成功"; - } - } - return "模版复制失败"; - } - - public PageVo projectIndexList(PerformanceAppraisalListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisalProjectIndicator.class) - .like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalProjectIndicator::getIndexName, req.getIndexName()) - .eq(Objects.nonNull(req.getIndexLevel()), PerformanceAppraisalProjectIndicator::getIndexLevel, req.getIndexLevel()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceAppraisalProjectIndicator::getRegionCode, req.getRegionCode()) - .orderByDesc(PerformanceAppraisalProjectIndicator::getCreateOn); - projectIndicatorService.page(page,wrapper); - - if (CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - List result = page.getRecords().stream() - .map(i -> BeanUtil.copyProperties(i, ProjectIndexVO.class)) - .collect(Collectors.toList()); - return PageVo.of(result,page.getTotal()); - } - - public String projectIndexSave(PerformanceIndicatorProjectIndexSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceAppraisalProjectIndicator projectIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectIndicator.class); - if(Objects.nonNull(dto.getId())){ - PerformanceAppraisalProjectIndicator old = projectIndicatorService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); - projectIndicator.setId(old.getId()); - }else{ - projectIndicator.setId(null); - projectIndicator.setCreateOn(LocalDateTime.now()); - projectIndicator.setCreateBy(user.getUsername()); - } - projectIndicator.setUpdateOn(LocalDateTime.now()); - projectIndicator.setUpdateBy(user.getUsername()); - if(projectIndicatorService.saveOrUpdate(projectIndicator)){ - return "指标新增成功"; - } - return "指标新增失败"; - } - - public String projectIndexDelete(Long id) { - PerformanceAppraisalProjectIndicator projectIndicator = projectIndicatorService.getById(id); - VUtils.isTrue(Objects.isNull(projectIndicator)).throwMessage("该项目指标不存在!"); - if (projectIndicatorService.removeById(id)) { - return "删除成功"; - } - return "操作失败"; - } - - public ProjectIndexVO projectIndexDetail(Long id) { - PerformanceAppraisalProjectIndicator projectIndex = projectIndicatorService.getById(id); - if(Objects.isNull(projectIndex)){ - return null; - } - return BeanUtil.copyProperties(projectIndex, ProjectIndexVO.class); - } - - public PageVo appIndexList(PerformanceAppraisalListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalAppIndicator::getIndexName, req.getIndexName()) - .orderBy(Boolean.FALSE,Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort); - appIndicatorService.page(page,wrapper); - - if (CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - List result = page.getRecords().stream() - .map(i -> BeanUtil.copyProperties(i, AppIndexVO.class)) - .collect(Collectors.toList()); - return PageVo.of(result,page.getTotal()); - } - - public String appIndexSave(PerformanceIndicatorAppIndexSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceAppraisalAppIndicator appIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalAppIndicator.class); - if(Objects.nonNull(dto.getId())){ - PerformanceAppraisalAppIndicator old = appIndicatorService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); - appIndicator.setId(old.getId()); - }else{ - appIndicator.setId(null); - appIndicator.setCreateOn(LocalDateTime.now()); - appIndicator.setCreateBy(user.getUsername()); - } - appIndicator.setUpdateOn(LocalDateTime.now()); - appIndicator.setUpdateBy(user.getUsername()); - if(appIndicatorService.saveOrUpdate(appIndicator)){ - return "指标新增成功"; - } - return "指标新增失败"; - } - - public String appIndexDelete(Long id) { - PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(id); - VUtils.isTrue(Objects.isNull(appIndicator)).throwMessage("该应用指标不存在!"); - if (appIndicatorService.removeById(id)) { - return "删除成功"; - } - return "操作失败"; - } - - public AppIndexVO appIndexDetail(Long id) { - PerformanceAppraisalAppIndicator appIndex = appIndicatorService.getById(id); - if(Objects.isNull(appIndex)){ - return null; - } - return BeanUtil.copyProperties(appIndex, AppIndexVO.class); - } - - public Boolean enOrDisAppIndex(Long appId, Boolean state) { - PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(appId); - if (Boolean.TRUE.equals(state)){ - appIndicator.setIsDisplay(Boolean.TRUE); - }else { - appIndicator.setIsDisplay(Boolean.FALSE); - } - return appIndicatorService.updateById(appIndicator); - } -} 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 deleted file mode 100644 index 808a5cf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java +++ /dev/null @@ -1,510 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.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.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.common.util.ExcelExportStyle; -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.SelfAppraisalScoreExportDTO; -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.PerformanceAppraisalExportReq; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -import com.ningdatech.pmapi.performance.model.vo.*; -import com.ningdatech.pmapi.performance.service.*; -import com.ningdatech.pmapi.performance.util.ExcelFillCellMergeStrategy; -import com.ningdatech.pmapi.performance.util.MultiColumnMergeStrategy; -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.enumeration.ProjectTypeNewEnum; -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.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 javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname OrgSelfAppraisalManage - * @Description - * @Date 2023/6/19 14:18 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class OrgSelfAppraisalManage { - - 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; - /** - * 绩效列表 - * @param req - * @return - */ - public PageVo list(PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - //当前登录用户 单位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); - performanceAppraisalService.page(page,wrapper); - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) - .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); - } - - public PageVo pendingList(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.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 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(CollUtil.isEmpty(page.getRecords())){ - 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); - vo.setAppraisalId(planId); - return vo; - }) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 已经自评表 - * - * @param planId - * @param req - * @return - */ - 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(); - } - - // 获取本单位在当前评价计划内的项目 - 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(CollUtil.isEmpty(page.getRecords())){ - 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); - vo.setAppraisalId(planId); - return vo; - }) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 是否可以自评 - * @param appraisalProject - * @return - */ - 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("项目不存在!"); - // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 - String 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) - .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) - .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); - List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ - throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); - } - PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); - // 装配项目指标详情及分数信息 - // 获取模版绩效指标详情 - List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); - // 获取模版附加绩效指标详情 - List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,projectCode,vo); - List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,projectCode,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 "提交失败"; - } - - public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - String projectCode = param.getProjectCode(); - Long appraisalId = param.getAppraisalId(); - - // 根据项目编码获取最新版本的项目信息 - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); - // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 - String 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) - .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) - .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); - List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ - throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); - } - PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); - // 装配项目指标详情及分数信息 - // 获取模版绩效指标详情 - List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); - Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); - - List exportDataList = Lists.newArrayList(); - List exportAdditionalDataList = Lists.newArrayList(); - // 构建指标和打分详情 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) - .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); - Map scoreInfoMap = scoreInfoList.stream() - .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); - - // 筛选出所有打分的三级指标模板详情ID - for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { - SelfAppraisalScoreExportDTO thirdDto = new SelfAppraisalScoreExportDTO(); - Long detailId = scoreInfo.getTemplateDetailId(); - PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); - thirdDto.setThirdIndexName(thirdTemplateDetail.getName()); - thirdDto.setIndexDetail(thirdTemplateDetail.getIndexDetail()); - thirdDto.setGradeDetail(thirdTemplateDetail.getGradeDetail()); - thirdDto.setSupportMaterial(thirdTemplateDetail.getSupportMaterial()); - thirdDto.setIndexScore(thirdTemplateDetail.getIndexScore()); - if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { - thirdDto.setIsAdditional(CommonEnum.YES.getDesc()); - } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - thirdDto.setIsAdditional(CommonEnum.NO.getDesc()); - } - PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); - if (Objects.nonNull(appraisalScoreInfo)) { - thirdDto.setAppraisalBasis(appraisalScoreInfo.getAppraisalBasis()); - thirdDto.setAppraisalScore(appraisalScoreInfo.getAppraisalScore()); - } - // 二级指标名称 - Long secondId = thirdTemplateDetail.getParentId(); - if (Objects.nonNull(secondId)) { - PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); - if (Objects.nonNull(secondTemplateDetail)) { - thirdDto.setSecondIndexName(secondTemplateDetail.getName()); - // 一级指标名称 - Long firstId = secondTemplateDetail.getParentId(); - if (Objects.nonNull(firstId)){ - PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); - if (Objects.nonNull(firstTemplateDetail)) { - thirdDto.setFirstIndexName(firstTemplateDetail.getName()); - } - } - } - } - if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - exportDataList.add(thirdDto); - }else { - exportAdditionalDataList.add(thirdDto); - } - } - exportDataList.addAll(exportAdditionalDataList); - - String fileName = "绩效评价_单位自评_评分明细表"; - ExcelDownUtil.setFileName(fileName, response); - int[] mergeColumnIndex = {0}; - // 需要从第几行开始合并 - int mergeRowIndex = 1; - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), SelfAppraisalScoreExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)) - .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(exportDataList); - } catch (IOException e) { - throw new RuntimeException(e); - } - - } -} 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 deleted file mode 100644 index 30b074d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ /dev/null @@ -1,1187 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import com.ningdatech.pmapi.performance.model.entity.*; -import com.ningdatech.pmapi.performance.service.*; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.wflow.workflow.bean.vo.ProcessTaskVo; -import org.checkerframework.checker.nullness.qual.Nullable; -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.enumration.EvalObjectEnum; -import com.ningdatech.pmapi.performance.model.dto.*; -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 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; - -/** - * @Classname PerformanceAppraisalManage - * @Description - * @Date 2023/6/19 14:18 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -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; - private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; - private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService; - private final ProjectLibManage projectLibManage; - private final IProjectApplicationService projectApplicationService; - - /** - * 绩效列表 - * @param req - * @return - */ - public PageVo list(PerformanceAppraisalListReq req) { - Page page = req.page(); - String regionCode = req.getRegionCode(); - 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()) - .eq(StringUtils.isNotBlank(regionCode), PerformanceAppraisal::getRegionCode,regionCode) - .orderByDesc(PerformanceAppraisal::getUpdateOn); - // 如果登录用户是区域管理员,能看到本区域的评价计划 - performanceAppraisalService.page(page,wrapper); - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); - List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getAppraisalId, paIds)); - - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); - } - } - - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); - } - } - - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - List res = page.getRecords().stream().map(p -> { - PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); - if(finalPapsGroupMap.containsKey(p.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap)); - } - if(finalPaasGroupMap.containsKey(p.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap)); - } - return vo; - }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); - } - - public PerformanceAppraisalVO detail(Long id) { - - PerformanceAppraisal pa = performanceAppraisalService.getById(id); - VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); - - PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); - //绩效关联的项目 - List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, id)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); - } - } - - //绩效关联的应用 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); - } - } - - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - if(finalPapsGroupMap.containsKey(vo.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); - } - 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; - } - - /** - * 新建计划 - * @param createDTO - * @return - */ - @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(EvalObjectEnum.PROJECT.getCode())){ - saveProjects(createDTO,pa.getId(),user); - } - - if(CollUtil.isNotEmpty(createDTO.getApplicationIds()) - && StringUtils.isNotBlank(createDTO.getTarget()) - && createDTO.getTarget().contains(EvalObjectEnum.APP.getCode())){ - saveApplications(createDTO,pa.getId(),user); - } - - return "新建成功"; - } - - - /** - * 编辑计划 - * @param editDTO - * @return - */ - @Transactional - public String edit(PerformanceAppraisalEditDTO editDTO) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - deduplicationName(editDTO); - - PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO,PerformanceAppraisal.class); - - pa.setUpdateOn(LocalDateTime.now()); - pa.setUpdateBy(user.getUsername()); - performanceAppraisalService.updateById(pa); - String target = editDTO.getTarget(); - // 如果新编辑的评价计划不包含项目,删除原计划添加的评价项目信息 - if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.PROJECT.getCode())){ - performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); - } - - // 如果新编辑的评价计划不包含应用,删除原计划添加的评价应用信息 - if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.APP.getCode())){ - performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); - } - - if(StringUtils.isNotBlank(target) && - target.contains(EvalObjectEnum.PROJECT.getCode()) && - CollUtil.isNotEmpty(editDTO.getProjects())){ - saveProjects(editDTO,user); - } - - if(StringUtils.isNotBlank(target) && - target.contains(EvalObjectEnum.APP.getCode()) && - CollUtil.isNotEmpty(editDTO.getApplicationIds())){ - saveApplications(editDTO,user); - } - - return "编辑成功"; - } - - /** - * 名称去重 - * @param dto - */ - private void deduplicationName(PerformanceAppraisalCreateDTO dto) { - long count = performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) - .eq(PerformanceAppraisal::getName, dto.getName())); - VUtils.isTrue(count > 0).throwMessage("名称已经存在"); - } - - private void deduplicationName(PerformanceAppraisalEditDTO dto) { - if(StringUtils.isNotBlank(dto.getName())){ - long count =performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) - .eq(PerformanceAppraisal::getName,dto.getName()) - .ne(Objects.nonNull(dto.getId()),PerformanceAppraisal::getId,dto.getId())); - VUtils.isTrue(count > 0).throwMessage("名称已经存在"); - } - } - - @Transactional - public void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { - if(CollUtil.isEmpty(createDTO.getProjects())){ - return; - } - Integer startSelfDays = createDTO.getStartSelfDays(); - Integer completeSelfDays = createDTO.getCompleteSelfDays(); - List projects = createDTO.getProjects(); - - List proIdList = performanceAppraisalProjectService.list().stream() - .map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList()); - - List projectIdList = projects.stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); - // 判断提交时,项目是否已经被添加到其他评价计划中 - if (Boolean.TRUE.equals(haveIntersection(projectIdList, proIdList))){ - // 得到交集 - List intersection = Lists.newArrayList(projectIdList); - intersection.retainAll(proIdList); - // 获取重复添加的项目名称 - 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); - } - - 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()); - pap.setProjectCode(newProject.getProjectCode()); - pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); - pap.setCreateBy(user.getUsername()); - 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())){ - return; - } - - List applicationIdList = createDTO.getApplicationIds(); - // 获取已经创建的评价计划中添加的评价应用ID - List applicationIds = performanceAppraisalApplicationService.list().stream() - .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - - // 如果有交集,说明选择的应用中,有已经在其他评价计划中的应用 - 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); - } - - Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIdList)).stream() - .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); - for(Long applicationId : applicationIdList){ - PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); - paa.setAppraisalId(id); - paa.setApplicationId(applicationId); - ProjectApplication projectApplication = applicationMap.get(applicationId); - if (Objects.nonNull(projectApplication)){ - paa.setAppraisalProjectId(projectApplication.getProjectId()); - paa.setAppraisalProjectCode(projectApplication.getProjectCode()); - } - paa.setCreateBy(user.getUsername()); - paa.setCreateOn(LocalDateTime.now()); - paa.setUpdateBy(user.getUsername()); - paa.setUpdateOn(LocalDateTime.now()); - performanceAppraisalApplicationService.save(paa); - } - } - - @Transactional - public void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(Objects.isNull(editDTO.getProjects())){ - return; - } - - // 删除计划内的项目 - performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); - // 删除项目的打分信息 - List projectIds = editDTO.getProjects().stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectIds)){ - throw new BizException("请选择至少一个评价项目!"); - } - List projectCodes = projectService.listByIds(projectIds).stream().map(Project::getProjectCode).collect(Collectors.toList()); - // 删除项目的打分信息 - performanceAppraisalScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId,editDTO.getId()) - .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCodes)); - - 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()); - pap.setProjectCode(newProject.getProjectCode()); - pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); - pap.setCreateBy(user.getUsername()); - 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); - } - } - - @Transactional - public void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(Objects.isNull(editDTO.getApplicationIds())){ - return; - } - // 删除计划内的应用 - performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); - // 删除计划内应用的打分信息 - List applicationIdList = editDTO.getApplicationIds(); - if (CollUtil.isEmpty(applicationIdList)){ - throw new BizException("请选择至少一个应用!"); - } - // 删除应用的打分信息 - performanceAppraisalAppScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,editDTO.getId()) - .in(PerformanceAppraisalAppScoreInfo::getApplicationId,applicationIdList)); - - Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, applicationIdList)).stream() - .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); - for(Long applicationId : applicationIdList){ - PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); - paa.setAppraisalId(editDTO.getId()); - paa.setApplicationId(applicationId); - ProjectApplication projectApplication = applicationMap.get(applicationId); - if (Objects.nonNull(projectApplication)){ - paa.setAppraisalProjectId(projectApplication.getProjectId()); - paa.setAppraisalProjectCode(projectApplication.getProjectCode()); - } - paa.setCreateBy(user.getUsername()); - paa.setCreateOn(LocalDateTime.now()); - paa.setUpdateBy(user.getUsername()); - paa.setUpdateOn(LocalDateTime.now()); - performanceAppraisalApplicationService.save(paa); - } - } - - /** - * 删除绩效评价计划 - * 连带删除 其下所有 - * @param id - * @return - */ - public String delete(Long id) { - PerformanceAppraisal pa = performanceAppraisalService.getById(id); - VUtils.isTrue(Objects.isNull(pa)).throwMessage("绩效评价不存在 删除失败!"); - - // 获取评价计划内的待评价项目信息,并按自评开始时间排序 - List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, id) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalProject::getSelfAppraisalStart)); - // 获取计划内项目的自评开始时间 - Optional min = paps.stream().map(PerformanceAppraisalProject::getSelfAppraisalStart).min(LocalDateTime::compareTo); - if (min.isPresent()){ - // 比较当前时间与自评开始时间最小值 - if (LocalDateTime.now().isAfter(min.get())){ - throw new BizException("评价计划内已有项目到达自评时间,无法删除!"); - } - } - - if(performanceAppraisalService.removeById(id)){ - // 删除评价计划关联的项目 - //绩效关联的项目 - if (CollUtil.isNotEmpty(paps)) { - performanceAppraisalProjectService.removeBatchByIds(paps); - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - // 删除项目的打分信息 - List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId, id) - .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCodes)); - if (CollUtil.isNotEmpty(scoreInfos)) { - performanceAppraisalScoreInfoService.removeBatchByIds(scoreInfos); - } - - } - // 删除评价计划关联的应用 - //绩效关联的应用 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - if (CollUtil.isNotEmpty(paas)) { - performanceAppraisalApplicationService.removeBatchByIds(paas); - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - // 删除应用的打分信息 - List scoreInfos = performanceAppraisalAppScoreInfoService - .list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, id) - .in(PerformanceAppraisalAppScoreInfo::getApplicationId, applicationIds)); - if (CollUtil.isNotEmpty(scoreInfos)) { - performanceAppraisalAppScoreInfoService.removeBatchByIds(scoreInfos); - } - } - // 删除评级计划关联的分组信息 - groupService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId,id)); - return "删除成功"; - } - return "删除失败"; - } - - 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) - .orderByDesc(PerformanceAppraisalProjectGroup::getCreateOn)); - if(CollUtil.isEmpty(groups)){ - return Collections.emptyList(); - } - - Set allEmployeeCodes = Sets.newHashSet(); - Set projectCodes = Sets.newHashSet(); - Map userMap = Maps.newHashMap(); - Map projectMap = Maps.newHashMap(); - groups.stream().forEach(g -> { - allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); - allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); - projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes())); - }); - - if(CollUtil.isNotEmpty(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)); - } - } - - if(CollUtil.isNotEmpty(projectCodes)){ - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode,projectCodes) - .eq(Project::getNewest,Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); - } - } - - Map finalProjectMap = projectMap; - Map finalUserMap = userMap; - return groups.stream().map(g -> { - PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); - vo.setAppraisalId(g.getAppraisalId()); - vo.setName(g.getName()); - vo.setCreateOn(g.getCreateOn()); - vo.setCreateBy(g.getCreateBy()); - vo.setUpdateBy(g.getUpdateBy()); - vo.setUpdateOn(g.getUpdateOn()); - vo.setId(g.getId()); - 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()); - } - - /** - * 分组详情 - * @param id - * @return - */ - public PerformanceAppraisalProjectGroupVO groupDetail(Long id) { - PerformanceAppraisalProjectGroup group = groupService.getById(id); - - if(Objects.isNull(group)){ - return null; - } - - Map projectMap = Maps.newHashMap(); - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .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)); - } - - Map userMap = Maps.newHashMap(); - Set allEmployeeCodes = Sets.newHashSet(); - allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); - allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); - if(CollUtil.isNotEmpty(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)); - } - } - - PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); - vo.setAppraisalId(group.getAppraisalId()); - vo.setName(group.getName()); - vo.setCreateOn(group.getCreateOn()); - vo.setCreateBy(group.getCreateBy()); - vo.setUpdateBy(group.getUpdateBy()); - vo.setUpdateOn(group.getUpdateOn()); - vo.setId(group.getId()); - 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; - } - - /** - * 分组 保存 - * @param dto - * @return - */ - public String groupSave(PerformanceAppraisalProjectGroupSaveDTO dto) { - 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())){ - // 判断选择的项目是否已经在当前评价计划的其他分组内 - // 获取当前评价计划的其他分组的项目信息 - 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())){ - // 判断选择的复评人员是否已经在当前评价计划的其他分组内 - // 获取当前评价计划的其他分组的复评人员信息 - 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())){ - // 判断选择的核查人员是否已经在当前评价计划的其他分组内 - // 获取当前评价计划的其他分组的核查人员信息 - 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()); - groupService.saveOrUpdate(group); - 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 - * @return - */ - public String groupDelete(Long id) { - PerformanceAppraisalProjectGroup group = groupService.getById(id); - VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在"); - - //评价Id - Long appraisalId = group.getAppraisalId(); - - PerformanceAppraisal pa = performanceAppraisalService.getById(appraisalId); - VUtils.isTrue(Objects.isNull(pa)).throwMessage("评价不存在"); - - if(groupService.removeById(id)){ - return "删除成功"; - } - return "删除失败"; - } - - private List checkProject(String projectIds, Map projectMap) { - if(StringUtils.isBlank(projectIds)){ - return Collections.emptyList(); - } - return Arrays.stream(projectIds.split(StrPool.COMMA)).map(projectCode -> { - 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.setProjectId(project.getId()); - vo.setProjectCode(projectCode); - vo.setProjectYear(project.getProjectYear()); - vo.setDeclareAmount(project.getDeclareAmount()); - } - return vo; - }).collect(Collectors.toList()); - } - - private List checkUser(String users, Map userMap) { - if(StringUtils.isBlank(users)){ - return Collections.emptyList(); - } - 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(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - List res = page.getRecords().stream().map(r -> { - PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); - vo.setAppId(r.getId()); - vo.setAppraisalProjectId(r.getProjectId()); - vo.setAppraisalProjectCode(r.getProjectCode()); - vo.setApplicationName(Objects.nonNull(r.getRelatedExistsApplication()) ? r.getRelatedExistsApplication() : r.getApplicationName()); - 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()); - if (CollUtil.isEmpty(projectCodes)){ - return PageVo.empty(); - } - 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); - return appraisalProjectVo; - }).collect(Collectors.toList()); - return PageVo.of(voList,voList.size()); - } - - public PageVo finalProjectList(PerformanceAppraisalListReq req) { - - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - - Long appraisalId = req.getAppraisalId(); - String projectName = req.getProjectName(); - String buildOrgName = req.getBuildOrgName(); - String projectType = req.getProjectType(); - Integer projectYear = req.getProjectYear(); - // 从项目库获取本区域已验收的项目列表 - ProjectListReq param = new ProjectListReq(); - param.setProjectName(projectName); - param.setBuildOrgName(buildOrgName); - param.setProjectType(projectType); - param.setProjectYear(projectYear); - param.setRegionCode(user.getRegionCode()); - param.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - // 获取已添加到评价计划中的项目 - List projectCodes = performanceAppraisalProjectService.list().stream() - .map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - // 如果是编辑评价计划,获取当前评价计划已添加的项目,并保留当前计划已添加的项目 - if (Objects.nonNull(appraisalId)) { - List projects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); - if (CollUtil.isNotEmpty(projects)){ - List projectCodeList = projects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - projectCodes.removeAll(projectCodeList); - } - } - // 过滤掉已经添加到评价计划中的项目(如果是编辑评价计划,保留当前计划已添加的项目) - param.setProjectCodes(projectCodes); - return projectLibManage.projectLibListWithPermission(param, user); - } - - public PageVo finalApplicationList(PerformanceAppraisalListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String regionCode = user.getRegionCode(); - Long appraisalId = req.getAppraisalId(); - - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()); - - if (StringUtils.isNotBlank(req.getApplicationName())) { - wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName()) - .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName()))); - } - // 获取本区域已验收的项目关联的应用 - List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getAreaCode, regionCode) - .eq(Project::getNewest,Boolean.TRUE) - .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())); - if (CollUtil.isEmpty(projectList)){ - return PageVo.empty(); - } - List projectCodeList = projectList.stream().map(Project::getProjectCode).collect(Collectors.toList()); - List projectVersionList = projectList.stream().map(Project::getVersion).collect(Collectors.toList()); - wrapper.in(ProjectApplication::getProjectCode,projectCodeList); - wrapper.in(ProjectApplication::getProjectVersion,projectVersionList); - wrapper.orderByDesc(ProjectApplication::getUpdateOn); - List appList = projectApplicationService.list(wrapper); - if (CollUtil.isEmpty(appList)){ - return PageVo.empty(); - } - - List applicationList = Lists.newArrayList(); - - // 按项目编号+应用名称+IRS关联应用名称分组,获取最新版本的应用 - Map> appMap = appList.stream().collect(Collectors.groupingBy(p -> p.getProjectCode() + p.getRelatedExistsApplication() + p.getApplicationName())); - for (Map.Entry> entry : appMap.entrySet()) { - List applications = entry.getValue(); - Optional max = applications.stream().max(Comparator.comparingInt(ProjectApplication::getProjectVersion)); - if (max.isPresent()){ - ProjectApplication application = max.get(); - applicationList.add(application); - } - } - if (CollUtil.isEmpty(applicationList)){ - return PageVo.empty(); - } - // 获取已添加到评价计划中的应用 - List applicationIdList = performanceAppraisalApplicationService.list().stream() - .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - // 如果是编辑评价计划,保留当前计划已添加的应用 - if (Objects.nonNull(appraisalId)) { - List projectApplications = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId)); - if (CollUtil.isNotEmpty(projectApplications)){ - List appIdList = projectApplications.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - applicationIdList.removeAll(appIdList); - } - } - List resList = applicationList.stream().filter(a -> !applicationIdList.contains(a.getId())).collect(Collectors.toList()); - if (CollUtil.isEmpty(resList)){ - return PageVo.empty(); - } - //List relatedAppList = Lists.newArrayList(); - //// TODO 对IRS关联应用是否按照应用名称和应用code进行去重(在不同项目中,已经在IRS注册过的同一个应用只显示一个)? - //List relatedList = resList.stream().filter(r -> StringUtils.isNotBlank(r.getRelatedExistsApplication())).collect(Collectors.toList()); - //if (CollUtil.isNotEmpty(relatedList)) { - // resList.removeAll(relatedList); - // Map> relatedAppMap = relatedList.stream() - // .collect(Collectors.groupingBy(r -> r.getRelatedExistsApplication() + r.getRelatedExistsApplicationCode())); - // for (Map.Entry> entry : relatedAppMap.entrySet()) { - // List value = entry.getValue(); - // relatedAppList.add(value.get(0)); - // } - // resList.addAll(relatedAppList); - //} - //// TODO 对初次建设应用,是否根据建设方案申报时填写的应用名称、应用类型、发布端、应用简介、等保级别、密评级别 去重? - Integer pageNumber = req.getPageNumber(); - Integer pageSize = req.getPageSize(); - List resultList = resList.stream() - .skip((long) (pageNumber - 1) * pageSize) - .limit(pageSize) - .collect(Collectors.toList()); - - List res = resultList.stream() - .map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class)) - .collect(Collectors.toList()); - - return PageVo.of(res, resList.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 deleted file mode 100644 index c34025c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java +++ /dev/null @@ -1,494 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.CharsetUtil; -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.write.builder.ExcelWriterBuilder; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.performance.model.dto.*; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq; -import com.ningdatech.pmapi.performance.util.*; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.ss.formula.functions.T; -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.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; - -import javax.servlet.http.HttpServletResponse; - -/** - * 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; - private final IProjectTagService projectTagService; - private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; - /** - * 复评-评价计划列表 - * @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, 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 = Lists.newArrayList(); - if (reAppraisalUsers.contains(StrPool.COMMA)) { - empCodeList.addAll(Arrays.asList(reAppraisalUsers.split(StrPool.COMMA))); - }else { - empCodeList.add(reAppraisalUsers); - } - 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); - if (Objects.isNull(projectGroup)){ - throw new BizException("当前复评用户所在分组不存在!"); - } - 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(ProjectTypeNewEnum.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) { - // 获取该评价计划的该分组内的复评人员对该项目的的复评打分信息 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId, group.getAppraisalId()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, appraisalProject.getProjectCode()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); - // 判断打分人员是否为分组内的复评人员 - if (CollUtil.isNotEmpty(scoreInfoList)) { - Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); - if (CollUtil.isNotEmpty(users)) { - String reAppraisalUsers = group.getReAppraisalUsers(); - String join = String.join(StrPool.COMMA, users); - if (join.equals(reAppraisalUsers)) { - // 标记项目完成复评 - appraisalProject.setIsCompleteReAppraisal(Boolean.TRUE); - } - } - } - } - - public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - String projectCode = param.getProjectCode(); - Long appraisalId = param.getAppraisalId(); - - // 根据项目编码获取最新版本的项目信息 - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); - // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 - String 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) - .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) - .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); - List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ - throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); - } - PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); - // 装配项目指标详情及分数信息 - // 获取模版绩效指标详情 - List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); - Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); - - List> exportDataList = Lists.newArrayList(); - List> exportAdditionalDataList = Lists.newArrayList(); - // 构建指标和打分详情 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) - .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) - .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); - Map scoreInfoMap = scoreInfoList.stream() - .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); - - // 获取复评打分人员信息 - List reScoreInfoList = scoreInfoList.stream() - .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) - .collect(Collectors.toList()); - List reUserList = reScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) - .collect(Collectors.toList()); - - // 筛选出所有打分的三级指标模板详情ID - for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { - HashMap scoreMap = MapUtil.newHashMap(); - Long detailId = scoreInfo.getTemplateDetailId(); - PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); - - // 二级指标名称 - Long secondId = thirdTemplateDetail.getParentId(); - if (Objects.nonNull(secondId)) { - PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); - if (Objects.nonNull(secondTemplateDetail)) { - // 一级指标名称 - Long firstId = secondTemplateDetail.getParentId(); - if (Objects.nonNull(firstId)){ - PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); - if (Objects.nonNull(firstTemplateDetail)) { - scoreMap.put(BizConst.FIRST_INDEX_NAME,firstTemplateDetail.getName()); - scoreMap.put(BizConst.SECOND_INDEX_NAME,secondTemplateDetail.getName()); - } - } - } - } - scoreMap.put(BizConst.THIRD_INDEX_NAME,thirdTemplateDetail.getName()); - scoreMap.put(BizConst.INDEX_SCORE,thirdTemplateDetail.getIndexScore()); - scoreMap.put(BizConst.INDEX_DETAIL,thirdTemplateDetail.getIndexDetail()); - scoreMap.put(BizConst.GRADE_DETAIL,thirdTemplateDetail.getGradeDetail()); - scoreMap.put(BizConst.SUPPORT_MATERIAL,thirdTemplateDetail.getSupportMaterial()); - PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); - // 构建自评和复评打分信息 - if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())){ - scoreMap.put(BizConst.SELF_APPRAISAL_BASIS,appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(BizConst.SELF_APPRAISAL_SCORE,appraisalScoreInfo.getAppraisalScore()); - } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); - } - - if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.YES.getDesc()); - } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.NO.getDesc()); - } - if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - exportDataList.add(scoreMap); - }else { - exportAdditionalDataList.add(scoreMap); - } - } - exportDataList.addAll(exportAdditionalDataList); - String fileName = "绩效评价_人工复评_评分明细表"; - ExcelDownUtil.setFileName(fileName, response); - int[] mergeColumnIndex = {0}; - // 需要从第几行开始合并 - int mergeRowIndex = 2; - - List headList = Lists.newArrayList(); - headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME,BizConst.FIRST_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME,BizConst.SECOND_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME,BizConst.THIRD_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_SCORE,BizConst.INDEX_SCORE_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_DETAIL,BizConst.INDEX_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.GRADE_DETAIL,BizConst.GRADE_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL,BizConst.SUPPORT_MATERIAL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS,BizConst.SELF_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE,BizConst.SELF_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); - for (String reUser : reUserList) { - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS,BizConst.RE_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE,BizConst.RE_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); - } - headList.add(new ExcelHead(BizConst.IS_ADDITIONAL,BizConst.IS_ADDITIONAL_TITLE,StrPool.EMPTY)); - - // 数据导出处理函数 - try { - response.setCharacterEncoding(CharsetUtil.UTF_8); - response.setContentType(ContentTypeUtils.APPLICATION_EXCEL); - ExcelWriterBuilder writerBuilder = EasyExcel.write(); - writerBuilder.file(response.getOutputStream()); - writerBuilder.autoCloseStream(true); - writerBuilder.registerWriteHandler(new ExcelSheetVerticalCellStyleStrategy()); - writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)); - writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)); - writerBuilder.head(ExcelUtils.getHead(reUserList,Lists.newArrayList())) - .sheet(fileName) - .doWrite(ExcelUtils.convertData(headList, exportDataList)); - } catch (IOException e) { - throw new BizException(e.getMessage()); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java deleted file mode 100644 index 181d05d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java +++ /dev/null @@ -1,382 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.text.StrPool; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; -import com.ningdatech.pmapi.performance.enumration.RectifyAuditEnum; -import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; -import com.ningdatech.pmapi.performance.model.entity.*; -import com.ningdatech.pmapi.performance.service.*; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -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.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; -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.RectifyDetailVO; -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.entity.enumeration.RoleEnum; -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 cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * RectifyAuditManage - * - * @return - * @author CMM - * @since 2023/08/12 17:36 - */ -@Component -@Slf4j -@AllArgsConstructor -public class RectifyAuditManage { - - private final IPerformanceAppraisalService performanceAppraisalService; - private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; - private final IProjectService projectService; - private final IRoleService roleService; - private final UserInfoHelper userInfoHelper; - private final IPerformanceAppraisalProjectGroupService groupService; - private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; - private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; - /** - * 绩效列表 - * - * @param req - * @return - */ - public PageVo list(PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - // 当前登录用户 单位code - 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 verifyLeader = projectGroup.getVerifyLeader(); - if (Objects.nonNull(verifyLeader) && verifyLeader.equals(employeeCode)) { - groups.add(projectGroup); - } - } - // 当前登录专家没有绩效分组信息 - if (CollUtil.isEmpty(groups)) { - return PageVo.empty(); - } - - // 获取分组所在的评价计划ID - List appraisalIds = - groups.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); - - // 获取评价计划内的所有需整改核查项目信息(整改状态为整改待审核、整改审核不通过、整改审核通过) - List paps = performanceAppraisalProjectService.list(Wrappers - .lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getAppraisalId, appraisalIds) - .and(wp -> wp.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()) - .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()).or() - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode())) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); - // 评价计划内符合条件的项目数为空 - if (CollUtil.isEmpty(paps)) { - return PageVo.empty(); - } - - Set appraisalIdList = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); - - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .in(PerformanceAppraisal::getId, appraisalIdList).orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page, wrapper); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - // 按评价计划分组 - Map> papsMap = - paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List res = page.getRecords().stream().map(p -> { - PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); - // 统计评价计划待核查项目数量(整改状态为:整改待审核) - List projects = papsMap.get(p.getId()); - if (CollUtil.isNotEmpty(projects)) { - List unRectifyAuditProjects = - projects.stream().filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus())) - .collect(Collectors.toList()); - vo.setUnRectifyAuditNumber(unRectifyAuditProjects.size()); - // 统计评价计划已核查项目数量(整改状态为:整改核查不通过、整改审核通过) - List rectifiedAuditProjects = - paps.stream() - .filter(d -> RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus()) - || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) - .collect(Collectors.toList()); - vo.setRectifiedAuditNumber(rectifiedAuditProjects.size()); - } - return vo; - }).collect(Collectors.toList()); - return PageVo.of(res, page.getTotal()); - } - - public PageVo unAuditList(Long planId, PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); - - PerformanceAppraisal plan = performanceAppraisalService.getById(planId); - VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); - - // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 - PerformanceAppraisalProjectGroup projectGroup = - groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) - .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); - // 当前登录专家没有为核查组长的绩效分组信息 - if (Objects.isNull(projectGroup)) { - return PageVo.empty(); - } - - String groupProjectCodes = projectGroup.getProjectCodes(); - List codes = Lists.newArrayList(); - if (groupProjectCodes.contains(StrPool.COMMA)) { - codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); - } else { - codes.add(groupProjectCodes); - } - // 获取评价计划内已添加的核查组长为当前登录专家用户的待整改审核项目信息 - List paps = - performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) - .in(PerformanceAppraisalProject::getProjectCode, codes) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); - if (CollUtil.isEmpty(paps)) { - return PageVo.empty(); - } - Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - - // 获取本单位在当前评价计划内的项目 - 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) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) - .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 = papsMap.get(p.getId()); - BeanUtil.copyProperties(appraisalProject, vo); - vo.setProjectId(appraisalProject.getProjectId()); - vo.setProjectCode(appraisalProject.getProjectCode()); - vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setAppraisalId(planId); - vo.setRectifyStatus(appraisalProject.getRectifyStatus()); - vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); - vo.setGroupId(projectGroup.getId()); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res, page.getTotal()); - } - - public PageVo auditedList(Long planId, PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); - - PerformanceAppraisal plan = performanceAppraisalService.getById(planId); - VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); - - // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 - PerformanceAppraisalProjectGroup projectGroup = - groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) - .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); - // 当前登录专家没有为核查组长的绩效分组信息 - if (Objects.isNull(projectGroup)) { - return PageVo.empty(); - } - - String groupProjectCodes = projectGroup.getProjectCodes(); - List codes = Lists.newArrayList(); - if (groupProjectCodes.contains(StrPool.COMMA)) { - codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); - } else { - codes.add(groupProjectCodes); - } - // 获取评价计划内已添加的核查组长为当前登录专家用户的已整改审核项目信息 - List< - PerformanceAppraisalProject> paps = - performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) - .in(PerformanceAppraisalProject::getProjectCode, codes) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .and(wp -> wp - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) - .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); - if (CollUtil.isEmpty(paps)) { - return PageVo.empty(); - } - Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - - // 获取评价计划内的项目 - 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) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) - .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 = papsMap.get(p.getId()); - BeanUtil.copyProperties(appraisalProject, vo); - vo.setProjectId(appraisalProject.getProjectId()); - vo.setProjectCode(appraisalProject.getProjectCode()); - vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setAppraisalId(planId); - vo.setRectifyStatus(appraisalProject.getRectifyStatus()); - vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); - vo.setGroupId(projectGroup.getId()); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res, page.getTotal()); - } - - @Transactional(rollbackFor = Exception.class) - public String submit(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(); - Integer rectifyAuditResult = param.getRectifyAuditResult(); - String rectifyAuditOpinion = param.getRectifyAuditOpinion(); - String rectifyAuditAppendix = param.getRectifyAuditAppendix(); - 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_RECTIFY_AUDIT.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 rectifyTotalScore = appraisalInfoList.stream() - .map(ProjectAppraisalInfoDTO::getScore) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - // 保存整改审核相关信息 - appraisalProject.setRectifyTotalScore(rectifyTotalScore); - appraisalProject.setRectifyScoreTime(LocalDateTime.now()); - appraisalProject.setUpdateOn(LocalDateTime.now()); - appraisalProject.setUpdateBy(username); - appraisalProject.setRectifyAuditResult(rectifyAuditResult); - appraisalProject.setRectifyAuditOpinion(rectifyAuditOpinion); - appraisalProject.setRectifyAuditAppendix(rectifyAuditAppendix); - if (RectifyAuditEnum.APPROVED.getCode().equals(rectifyAuditResult)) { - appraisalProject.setRectifyStatus(RectifyStatusEnum.APPROVED.getCode()); - } else if (RectifyAuditEnum.NOT_APPROVED.getCode().equals(rectifyAuditResult)) { - appraisalProject.setRectifyStatus(RectifyStatusEnum.NOT_APPROVED.getCode()); - } - performanceAppraisalProjectService.updateById(appraisalProject); - return "提交成功"; - } - return "提交失败"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java deleted file mode 100644 index e7b5f4d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -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.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; -import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; -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.RectifyDetailVO; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.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.UserFullInfoDTO; -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; - -/** - * RectifyManage - * - * @return - * @author CMM - * @since 2023/08/12 17:36 - */ -@Component -@Slf4j -@AllArgsConstructor -public class RectifyManage { - - private final IPerformanceAppraisalService performanceAppraisalService; - private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; - private final IProjectService projectService; - private final IRoleService roleService; - private final UserInfoHelper userInfoHelper; - - /** - * 绩效列表 - * - * @param req - * @return - */ - public PageVo list(PerformanceAppraisalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - // 当前登录用户 单位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) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); - // 按评价计划分组 - Map> papsMap = - paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - 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); - performanceAppraisalService.page(page, wrapper); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - List res = page.getRecords().stream().map(p -> { - PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); - // 统计评价计划待整改项目数量(整改状态为:整改情况待提交、整改核查不通过) - List projects = papsMap.get(p.getId()); - List unRectifyProjects = projects.stream() - .filter(d -> RectifyStatusEnum.TO_BE_SUBMITTED.getCode().equals(d.getRectifyStatus()) - || RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus())) - .collect(Collectors.toList()); - vo.setUnRectifyNumber(unRectifyProjects.size()); - // 统计评价计划已整改项目数量(整改状态为:整改待审核、整改审核通过) - List rectifiedProjects = - paps.stream() - .filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus()) - || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) - .collect(Collectors.toList()); - vo.setRectifiedNumber(rectifiedProjects.size()); - return vo; - }).collect(Collectors.toList()); - return PageVo.of(res, page.getTotal()); - } - - public PageVo unRectifyList(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()) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .and(wp -> wp - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_SUBMITTED.getCode()).or() - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()))); - Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - - if (CollUtil.isEmpty(paps)) { - 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 (CollUtil.isEmpty(page.getRecords())) { - 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.setProjectCode(appraisalProject.getProjectCode()); - vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setAppraisalId(planId); - vo.setRectifyStatus(appraisalProject.getRectifyStatus()); - vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res, page.getTotal()); - } - - public PageVo rectifiedList(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()) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .and(wp -> wp - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()).or() - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); - Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - - if (CollUtil.isEmpty(paps)) { - 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 (CollUtil.isEmpty(page.getRecords())) { - 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.setProjectCode(appraisalProject.getProjectCode()); - vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setAppraisalId(planId); - vo.setRectifyStatus(appraisalProject.getRectifyStatus()); - vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res, page.getTotal()); - } - - public RectifyDetailVO getRectifyDetail(Long planId, String projectCode) { - RectifyDetailVO vo = new RectifyDetailVO(); - // 根据评价计划ID和项目编号获取评价项目信息 - PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers - .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, planId) - .eq(PerformanceAppraisalProject::getProjectCode, projectCode)); - VUtils.isTrue(Objects.isNull(appraisalProject)).throwMessage("该项目已被移除评价计划,请返回上一页或者刷新重试!!"); - BeanUtils.copyProperties(appraisalProject, vo); - String rectifySubmitEmployeeCode = appraisalProject.getRectifySubmitEmployeeCode(); - if (StringUtils.isNotBlank(rectifySubmitEmployeeCode)) { - UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifySubmitEmployeeCode); - vo.setRectifySubmitEmployee(userFullInfoDto); - } - String rectifyResSubEmpCode = appraisalProject.getRectifyResSubEmpCode(); - if (StringUtils.isNotBlank(rectifyResSubEmpCode)) { - UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifyResSubEmpCode); - vo.setRectifyResSubEmployee(userFullInfoDto); - } - vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); - return vo; - } - - @Transactional(rollbackFor = Exception.class) - public String fillOutResult(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(); - String rectifyResult = param.getRectifyResult(); - String rectifyResultAppendix = param.getRectifyResultAppendix(); - - // 判断该项目是否还存在于计划或分组中 - 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("该项目已被移除评价计划,请返回上一页或者刷新重试!"); - } - appraisalProject.setRectifyResult(rectifyResult); - appraisalProject.setRectifyResultAppendix(rectifyResultAppendix); - appraisalProject.setRectifyResSubEmpCode(employeeCode); - appraisalProject.setRectifyResSubTime(LocalDateTime.now()); - // 更新整改状态为整改待审核 - appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_REVIEWED.getCode()); - appraisalProject.setUpdateOn(LocalDateTime.now()); - appraisalProject.setUpdateBy(username); - if (performanceAppraisalProjectService.updateById(appraisalProject)) { - return "提交审核成功!"; - } - return "提交审核失败"; - } -} 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 deleted file mode 100644 index c082728..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java +++ /dev/null @@ -1,513 +0,0 @@ -package com.ningdatech.pmapi.performance.manage; - -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.CharsetUtil; -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.write.builder.ExcelWriterBuilder; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.performance.constant.BizConst; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq; -import com.ningdatech.pmapi.performance.util.*; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -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.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.performance.enumration.AppraisalTypeEnum; -import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; -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.entity.enumeration.RoleEnum; -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; - -import javax.servlet.http.HttpServletResponse; - -/** - * 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 IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; - private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; - private final IPerformanceAppraisalProjectGroupService groupService; - private final IProjectTagService projectTagService; - private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; - /** - * 核查-评价计划列表 - * @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.setVerifyGroupId(group.getId()); - vo.setVerifyGroupName(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); - if (Objects.isNull(projectGroup)){ - throw new BizException("当前核查用户所在分组不存在!"); - } - 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(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setCanVerify(checkCanVerify(employeeCode,appraisalProject.getProjectCode(),appraisalId)); - // 如果登录用户是核查组长,该项目可填写整改意见 - String verifyLeader = projectGroup.getVerifyLeader(); - if (employeeCode.equals(verifyLeader)){ - vo.setCanRectify(Boolean.TRUE); - } - vo.setGroupId(groupId); - 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.setVerifyTotalScore(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()); - appraisalProject.setRectifySubmitEmployeeCode(employeeCode); - appraisalProject.setRectifySubmitTime(LocalDateTime.now()); - appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_SUBMITTED.getCode()); - } - performanceAppraisalProjectService.updateById(appraisalProject); - return "提交成功"; - } - return "提交失败"; - } - - private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { - // 获取该评价计划当前分组对该项目的核查打分信息 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId,group.getAppraisalId()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,appraisalProject.getProjectCode()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); - - // 判断打分人员是否为分组内的核查人员 - if (CollUtil.isNotEmpty(scoreInfoList)) { - Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); - if (CollUtil.isNotEmpty(users)) { - String verificationUsers = group.getVerificationUsers(); - String join = String.join(StrPool.COMMA, users); - if (join.equals(verificationUsers)) { - // 标记项目完成核查 - appraisalProject.setIsCompleteVerify(Boolean.TRUE); - } - } - } - } - - public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - String projectCode = param.getProjectCode(); - Long appraisalId = param.getAppraisalId(); - - // 根据项目编码获取最新版本的项目信息 - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); - // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 - String 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) - .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) - .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); - List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ - throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); - } - PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); - // 装配项目指标详情及分数信息 - // 获取模版绩效指标详情 - List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); - Map templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t)); - - List> exportDataList = Lists.newArrayList(); - List> exportAdditionalDataList = Lists.newArrayList(); - // 构建指标和打分详情 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) - .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()).or() - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) - .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); - Map scoreInfoMap = scoreInfoList.stream() - .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); - - // 获取复评打分人员信息 - List reScoreInfoList = scoreInfoList.stream() - .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) - .collect(Collectors.toList()); - List reUserList = reScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) - .collect(Collectors.toList()); - - // 获取核查打分人员信息 - List verifyScoreInfoList = scoreInfoList.stream() - .filter(s -> AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(s.getAppraisalType())) - .collect(Collectors.toList()); - List verifyUserList = verifyScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) - .collect(Collectors.toList()); - - // 筛选出所有打分的三级指标模板详情ID - for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { - HashMap scoreMap = MapUtil.newHashMap(); - Long detailId = scoreInfo.getTemplateDetailId(); - PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); - - // 二级指标名称 - Long secondId = thirdTemplateDetail.getParentId(); - if (Objects.nonNull(secondId)) { - PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId); - if (Objects.nonNull(secondTemplateDetail)) { - // 一级指标名称 - Long firstId = secondTemplateDetail.getParentId(); - if (Objects.nonNull(firstId)){ - PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); - if (Objects.nonNull(firstTemplateDetail)) { - scoreMap.put(BizConst.FIRST_INDEX_NAME,firstTemplateDetail.getName()); - scoreMap.put(BizConst.SECOND_INDEX_NAME,secondTemplateDetail.getName()); - } - } - } - } - scoreMap.put(BizConst.THIRD_INDEX_NAME,thirdTemplateDetail.getName()); - scoreMap.put(BizConst.INDEX_SCORE,thirdTemplateDetail.getIndexScore()); - scoreMap.put(BizConst.INDEX_DETAIL,thirdTemplateDetail.getIndexDetail()); - scoreMap.put(BizConst.GRADE_DETAIL,thirdTemplateDetail.getGradeDetail()); - scoreMap.put(BizConst.SUPPORT_MATERIAL,thirdTemplateDetail.getSupportMaterial()); - - PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); - // 构建自评和复评打分信息 - if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())){ - scoreMap.put(BizConst.SELF_APPRAISAL_BASIS,appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(BizConst.SELF_APPRAISAL_SCORE,appraisalScoreInfo.getAppraisalScore()); - } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); - } else if (AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); - } - - if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.YES.getDesc()); - } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.NO.getDesc()); - } - if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - exportDataList.add(scoreMap); - }else { - exportAdditionalDataList.add(scoreMap); - } - } - exportDataList.addAll(exportAdditionalDataList); - String fileName = "绩效评价_专家核查_评分明细表"; - ExcelDownUtil.setFileName(fileName, response); - int[] mergeColumnIndex = {0}; - // 需要从第几行开始合并 - int mergeRowIndex = 2; - - List headList = Lists.newArrayList(); - headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME,BizConst.FIRST_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME,BizConst.SECOND_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME,BizConst.THIRD_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_SCORE,BizConst.INDEX_SCORE_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_DETAIL,BizConst.INDEX_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.GRADE_DETAIL,BizConst.GRADE_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL,BizConst.SUPPORT_MATERIAL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS,BizConst.SELF_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE,BizConst.SELF_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); - for (String reUser : reUserList) { - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS,BizConst.RE_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE,BizConst.RE_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); - } - - for (String verifyUser : verifyUserList) { - headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_BASIS,BizConst.VERIFY_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_SCORE,BizConst.VERIFY_SCORE_TITLE,StrPool.EMPTY)); - } - headList.add(new ExcelHead(BizConst.IS_ADDITIONAL,BizConst.IS_ADDITIONAL_TITLE,StrPool.EMPTY)); - - // 数据导出处理函数 - try { - response.setCharacterEncoding(CharsetUtil.UTF_8); - response.setContentType(ContentTypeUtils.APPLICATION_EXCEL); - ExcelWriterBuilder writerBuilder = EasyExcel.write(); - writerBuilder.file(response.getOutputStream()); - writerBuilder.autoCloseStream(true); - writerBuilder.registerWriteHandler(new ExcelSheetVerticalCellStyleStrategy()); - writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)); - writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)); - writerBuilder.head(ExcelUtils.getHead(reUserList,verifyUserList)) - .sheet(fileName) - .doWrite(ExcelUtils.convertData(headList, exportDataList)); - } catch (IOException e) { - throw new BizException(e.getMessage()); - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java deleted file mode 100644 index 3e60b91..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppIndicator; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-07-29 - */ -public interface PerformanceAppraisalAppIndicatorMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml deleted file mode 100644 index cb8a4d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppIndicatorMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java deleted file mode 100644 index 458f9fc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-14 - */ -public interface PerformanceAppraisalAppScoreInfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml deleted file mode 100644 index 483998c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java deleted file mode 100644 index 957f22f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceAppraisalApplicationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml deleted file mode 100644 index 7b75dce..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java deleted file mode 100644 index 1e9a37f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.projectlib.model.entity.Project; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceAppraisalMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml deleted file mode 100644 index c0801d4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java deleted file mode 100644 index 9fb9b82..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceAppraisalProjectGroupMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml deleted file mode 100644 index b017ca1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java deleted file mode 100644 index 03a900f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectIndicator; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-07-28 - */ -public interface PerformanceAppraisalProjectIndicatorMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml deleted file mode 100644 index 19e19bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectIndicatorMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java deleted file mode 100644 index 2a0e102..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceAppraisalProjectMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml deleted file mode 100644 index afcb05f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - 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 deleted file mode 100644 index e262a88..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index b5be0ac..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java deleted file mode 100644 index d0e9a73..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml deleted file mode 100644 index 16a746b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java deleted file mode 100644 index 5604e52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; - -/** - *

- * Mapper 接口 - *

- * - * @author Zpf - * @since 2023-06-03 - */ -public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml deleted file mode 100644 index eec7ce7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java deleted file mode 100644 index 26435b1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.mapper; - -import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-07-26 - */ -public interface ProjectCoreBusinessIndicatorsMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml deleted file mode 100644 index d200755..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/ProjectCoreBusinessIndicatorsMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - 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 deleted file mode 100644 index 2e5cac4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -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/AppAppraisalInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java deleted file mode 100644 index da63ddc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; - -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 AppAppraisalInfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用指标ID") - private Long indexId; - - @ApiModelProperty("评价得分") - @NotNull(message = "得分不能为空!") - private BigDecimal score; - - @ApiModelProperty("指标类型") - private Integer indexType; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java deleted file mode 100644 index 1e4eace..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotNull; - -/** - * @Classname AppraisalProjectDTO - * @Description - * @Date 2023/6/19 17:08 - * @Author PoffyZhang - */ -@Data -public class AppraisalProjectDTO { - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID 必填") - private Long id; - - @ApiModelProperty("是否复评") - private Boolean isReAppraisal = Boolean.FALSE; -} 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 deleted file mode 100644 index d5e744f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO; -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; - -/** - * @Classname PerformanceAppraisalCreateDTO - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价创建对象", description = "绩效评价创建对象") -public class PerformanceAppraisalCreateDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("计划名称") - @NotBlank(message = "请输入计划名称") - @Size(max = 50) - private String name; - - @ApiModelProperty("终验后 xx 天开始自评") - @NotNull(message = "开始自评时间不能为空") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") - private Integer startSelfDays; - - @ApiModelProperty("xx 天需完成自评") - @NotNull(message = "完成自评时间不能为空") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") - private Integer completeSelfDays; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") - @NotBlank(message = "评价目标不能为空") - private String target; - - @ApiModelProperty("评价项目 只有ID 和是否复评") - private List projects; - - @ApiModelProperty("评价应用ids") - private List applicationIds; -} 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 deleted file mode 100644 index 139cbf0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -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; -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname PerformanceAppraisalEditDTO - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价编辑对象", description = "绩效评价编辑对象") -public class PerformanceAppraisalEditDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - @NotNull(message = "编辑的时候 id必填") - private Long id; - - @ApiModelProperty("计划名称") - private String name; - - @ApiModelProperty("终验后 xx 天开始自评") - @NotNull(message = "开始自评时间不能为空") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") - private Integer startSelfDays; - - @ApiModelProperty("xx 天需完成自评") - @NotNull(message = "完成自评时间不能为空") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100") - private Integer completeSelfDays; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") - private String target; - - @ApiModelProperty("评价项目 只有ID 和是否复评") - private List projects; - - @ApiModelProperty("评价应用ids") - private List applicationIds; -} 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 deleted file mode 100644 index 4799285..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -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; -import java.util.List; - -/** - * @Classname PerformanceAppraisalProjectGroupSaveDTO - * @Description 绩效评价和项目分组 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") -public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("名称") - private String name; - - @ApiModelProperty("计划id") - private Long appraisalId; - - @ApiModelProperty("状态 0关闭 1开启") - private Integer status = 0; - - @ApiModelProperty("分组内的所有项目code") - private List projectCodes; - - @ApiModelProperty("复评人员") - private List reAppraisalUsers; - - @ApiModelProperty("核查人员") - private List verificationUsers; - - @ApiModelProperty("核查组长") - private String verifyLeader; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java deleted file mode 100644 index 0973517..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import javax.validation.constraints.Size; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.hibernate.validator.constraints.Range; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 绩效评级-应用指标库 新增指标保存 - * @return - * @author CMM - * @since 2023/07/29 10:04 - */ -@Data -@ApiModel(value = "绩效评价考核应用指标库", description = "绩效评价考核应用指标库") -public class PerformanceIndicatorAppIndexSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标所属模块") - private String indexOwningModule; - - @ApiModelProperty("指标展示顺序") - private Integer sort; - - @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") - private Integer displayForm; - - @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") - private Integer indexType; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("单位") - private String unit; - - @ApiModelProperty("指标定义") - private String indexDef; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java deleted file mode 100644 index f0dd3cb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Range; - -import javax.validation.constraints.Size; - -/** - * 绩效评级-项目指标库 新增指标保存 - * @return - * @author CMM - * @since 2023/07/28 15:44 - */ -@Data -@ApiModel(value = "绩效评价考核项目指标库", description = "绩效评价考核项目指标库") -public class PerformanceIndicatorProjectIndexSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("指标名称") - @Size(max = 50) - private String indexName; - - @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") - private Integer indexLevel; - - @ApiModelProperty("指标分值") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则") - @Size(max = 200) - private String indexDetail; - - @ApiModelProperty("评分细则") - @Size(max = 200) - private String gradeDetail; - - @ApiModelProperty("佐证材料") - @Size(max = 200) - private String supportMaterial; - - @ApiModelProperty("丽水 区域code") - private String regionCode; -} 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 deleted file mode 100644 index 31e646f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * @Classname PerformanceIndicatorProjectTemplateSaveDTO - * @Description 绩效评价考核模板 保存 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") -public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("模板名称") - private String name; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("项目年度") - private Integer projectYear; - - @ApiModelProperty("项目类型 ") - private Integer projectType; - - @ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") - private Integer constructType; - - @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") - private Integer amountRange; - - @ApiModelProperty("状态 0 1") - private Integer status; - - @ApiModelProperty("绩效指标详情") - private List templateDetails; - - @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 deleted file mode 100644 index 3df7ff0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java +++ /dev/null @@ -1,64 +0,0 @@ -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 applicationId; - - @ApiModelProperty("评价项目ID") - private Long appraisalProjectId; - - @ApiModelProperty("评价项目Code") - private String appraisalProjectCode; - - @ApiModelProperty("评价计划ID") - private Long appraisalId; - - @ApiModelProperty("项目模板指标详情评价信息集合") - private List appraisalInfoList; - - @ApiModelProperty("应用指标评价信息集合") - private List appAppraisalInfoList; - - @ApiModelProperty("项目是否需要整改") - private Boolean isRectify; - - @ApiModelProperty("整改意见") - private String rectifyOpinion; - - @ApiModelProperty("评价项目所在分组ID") - private Long groupId; - - @ApiModelProperty("整改结果说明") - private String rectifyResult; - - @ApiModelProperty("整改结果附件") - private String rectifyResultAppendix; - - @ApiModelProperty("整改审核结果 1 通过、2 不通过") - private Integer rectifyAuditResult; - - @ApiModelProperty("整改审核意见") - private String rectifyAuditOpinion; - - @ApiModelProperty("整改审核附件") - private String rectifyAuditAppendix; - -} 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 deleted file mode 100644 index f6a839b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -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/dto/ProjectCoreBusinessDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java deleted file mode 100644 index b0c6485..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectCoreBusinessDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Range; - -import javax.validation.constraints.Size; - -/** - * @author CMM - * @since 2023/07/26 15:05 - */ -@ApiModel(value = "ProjectCoreBusinessDTO对象", description = "") -@Data -public class ProjectCoreBusinessDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("核心业务ID") - private Long id; - - @ApiModelProperty("核心业务") - private String coreBusiness; - - @ApiModelProperty("业务指标分值") - @Range(min = 0, max = 10, message = "数值范围不正确,数值应大于0小于10") - private BigDecimal score; - - @ApiModelProperty("业务指标名称") - @Size(max = 100) - private String businessIndicatorName; - - @ApiModelProperty("业务指标描述") - @Size(max = 100) - private String businessIndicatorDescription; - - @ApiModelProperty("指标设计依据") - @Size(max = 100) - private String indexDesignBasis; - - @ApiModelProperty("指标计算方法") - @Size(max = 100) - private String indexCalculationMethod; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java deleted file mode 100644 index 516321f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Range; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** - * @Classname PerformanceIndicatorProjectTemplateDetail - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树") -public class ProjectTemplateDetailDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("关联模板ID") - private Long templateId; - - @ApiModelProperty("指标ID") - private Long indexId; - - @ApiModelProperty("指标名称") - private String name; - - @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") - private Integer type; - - @ApiModelProperty("父级指标id") - private Long parentId; - - @ApiModelProperty("指标分值 3级指标才有") - @Range(min = 0, max = 100, message = "数值范围不正确,数值应大于0小于100") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则 3级指标才有") - private String indexDetail; - - @ApiModelProperty("评分细则") - private String gradeDetail; - - @ApiModelProperty("佐证材料 描述") - private String supportMaterial; - - @ApiModelProperty("子指标") - private List children; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalInfoDTO.java deleted file mode 100644 index f45abea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalInfoDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 应用评价信息 - * @return - * @author CMM - * @since 2023/08/08 18:46 - */ -@Data -public class ReAppraisalInfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("复评依据") - private String reAppraisalBasis; - - @ApiModelProperty("复评得分") - private BigDecimal reAppraisalScore; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalScoreExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalScoreExportDTO.java deleted file mode 100644 index a9cf760..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ReAppraisalScoreExportDTO.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import com.alibaba.excel.annotation.ExcelProperty; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 绩效打分详情导出实体 - * - * @author CMM - * @since 2023/08/16 10:31 - */ -@Data -public class ReAppraisalScoreExportDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("一级指标名称") - @ExcelProperty(value = "一级指标",index = 0) - private String firstIndexName; - - @ApiModelProperty("二级指标名称") - @ExcelProperty(value = "二级指标",index = 1) - private String secondIndexName; - - @ApiModelProperty("三级指标名称") - @ExcelProperty(value = "三级指标",index = 2) - private String thirdIndexName; - - @ApiModelProperty("指标分值 3级指标才有") - @ExcelProperty(value = "指标分值",index = 3) - private BigDecimal indexScore; - - @ApiModelProperty("指标细则 3级指标才有") - @ExcelProperty(value = "指标细则",index = 4) - private String indexDetail; - - @ApiModelProperty("评分细则") - @ExcelProperty(value = "评分细则",index = 5) - private String gradeDetail; - - @ApiModelProperty("佐证材料描述") - @ExcelProperty(value = "佐证材料",index = 6) - private String supportMaterial; - - @ApiModelProperty("自评依据") - @ExcelProperty(value = "自评依据",index = 7) - private String selfAppraisalBasis; - - @ApiModelProperty("自评得分") - @ExcelProperty(value = "自评得分",index = 8) - private BigDecimal selfAppraisalScore; - - @ApiModelProperty("复评依据") - @ExcelProperty(value = "复评依据",index = 9) - private String refAppraisalBasis; - - @ApiModelProperty("复评得分") - @ExcelProperty(value = "复评得分",index = 10) - private BigDecimal reAppraisalScore; - - @ApiModelProperty("是否为附加指标") - @ExcelProperty(value = "是否附加指标",index = 11) - private String isAdditional; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/SelfAppraisalScoreExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/SelfAppraisalScoreExportDTO.java deleted file mode 100644 index 4e0cd75..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/SelfAppraisalScoreExportDTO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.performance.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; - -import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 绩效打分详情导出实体 - * - * @author CMM - * @since 2023/08/16 10:31 - */ -@Data -public class SelfAppraisalScoreExportDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("一级指标名称") - @ExcelProperty(value = "一级指标",index = 0) - private String firstIndexName; - - @ApiModelProperty("二级指标名称") - @ExcelProperty(value = "二级指标",index = 1) - private String secondIndexName; - - @ApiModelProperty("三级指标名称") - @ExcelProperty(value = "三级指标",index = 2) - private String thirdIndexName; - - @ApiModelProperty("指标分值 3级指标才有") - @ExcelProperty(value = "指标分值",index = 3) - private BigDecimal indexScore; - - @ApiModelProperty("指标细则 3级指标才有") - @ExcelProperty(value = "指标细则",index = 4) - private String indexDetail; - - @ApiModelProperty("评分细则") - @ExcelProperty(value = "评分细则",index = 5) - private String gradeDetail; - - @ApiModelProperty("佐证材料描述") - @ExcelProperty(value = "佐证材料",index = 6) - private String supportMaterial; - - @ApiModelProperty("自评依据") - @ExcelProperty(value = "自评依据",index = 7) - private String appraisalBasis; - - @ApiModelProperty("自评得分") - @ExcelProperty(value = "自评得分",index = 8) - private BigDecimal appraisalScore; - - @ApiModelProperty("是否为附加指标") - @ExcelProperty(value = "是否附加指标",index = 9) - private String isAdditional; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ExcelHead.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ExcelHead.java deleted file mode 100644 index 4b5171f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ExcelHead.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.performance.model.entity; - -/** - * @author CMM - * @since 2023/08/17 21:03 - */ - -import lombok.Data; - -/** - * Excel 导出类 - ExcelHead - */ -@Data -public class ExcelHead { - /** - * 内容里的字段名称 - */ - private String fieldName; - /** - * 显示值,一般为中文的 - */ - private String title; - /** - * 如果为 null 的值 - */ - private T nullValue; - public ExcelHead(String fieldName, String title) { - this.fieldName = fieldName; - this.title = title; - } - public ExcelHead(String fieldName, String title, T nullValue) { - this.fieldName = fieldName; - this.title = title; - this.nullValue = nullValue; - } -} 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 deleted file mode 100644 index 9a72064..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.performance.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; - -/** - * @Classname PerformanceAppraisal - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_appraisal") -@ApiModel(value = "绩效评价对象", description = "绩效评价对象") -public class PerformanceAppraisal implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("计划名称") - private String name; - - @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") - private String target; - - @ApiModelProperty("终验后 xx 天开始自评") - private Integer startSelfDays; - - @ApiModelProperty("xx 天需完成自评") - private Integer completeSelfDays; - - @ApiModelProperty("区域编码") - private String regionCode; - - @ApiModelProperty("备注") - private String remark; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java deleted file mode 100644 index 3a5a632..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.performance.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -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-07-29 - */ -@TableName("nd_performance_appraisal_app_indicator") -@ApiModel(value = "NdPerformanceAppraisalAppIndicator对象", description = "") -@Data -public class PerformanceAppraisalAppIndicator implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标所属模块") - private String indexOwningModule; - - @ApiModelProperty("指标展示顺序") - private Integer sort; - - @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") - private Integer displayForm; - - @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") - private Integer indexType; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("是否展示") - private Boolean isDisplay; - - @ApiModelProperty("单位") - private String unit; - - @ApiModelProperty("指标定义") - private String indexDef; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java deleted file mode 100644 index 40796f0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.performance.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -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-14 - */ -@Data -@TableName("nd_performance_appraisal_app_score_info") -@ApiModel(value = "NdPerformanceAppraisalAppScoreInfo对象", description = "") -public class PerformanceAppraisalAppScoreInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("更新人") - private String updateBy; - - @ApiModelProperty("评价指标ID") - private Long indexId; - - @ApiModelProperty("指标类型 1 通用指标、2 辅助指标、3 业务指标") - private Integer indexType; - - @ApiModelProperty("评价得分") - private BigDecimal appraisalScore; - - @ApiModelProperty("评价员工code") - private String appraisalEmployeeCode; - - @ApiModelProperty("评价员工姓名") - private String appraisalEmployeeName; - - @ApiModelProperty("评价应用ID") - private Long applicationId; - - @ApiModelProperty("评价计划ID") - private Long appraisalId; -} 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 deleted file mode 100644 index f6c0b3e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.performance.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PerformanceAppraisalApplication - * @Description 绩效评价和应用关联对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_appraisal_application") -@ApiModel(value = "绩效评价和应用关联对象", description = "绩效评价和应用关联对象") -public class PerformanceAppraisalApplication implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("计划id") - private Long appraisalId; - - @ApiModelProperty("应用ID") - private Long applicationId; - - @ApiModelProperty("应用关联的项目ID") - private Long appraisalProjectId; - - @ApiModelProperty("应用关联的项目code") - private String appraisalProjectCode; - - @ApiModelProperty("评价总分") - private BigDecimal appraisalTotalScore; - - @ApiModelProperty("打分时间") - private LocalDateTime appraisalScoreTime; - - @ApiModelProperty("是否完成评价") - private Boolean isCompleteAppraisal; -} 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 deleted file mode 100644 index 4ff21ef..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java +++ /dev/null @@ -1,123 +0,0 @@ -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; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PerformanceAppraisalProject - * @Description 绩效评价和项目关联对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_appraisal_project") -@ApiModel(value = "绩效评价和项目关联对象", description = "绩效评价和项目关联对象") -public class PerformanceAppraisalProject implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("计划id") - private Long appraisalId; - - @ApiModelProperty("项目id") - private Long projectId; - - @ApiModelProperty("项目编码") - private String projectCode; - - @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 BigDecimal rectifyTotalScore; - - @ApiModelProperty("整改审核打分时间") - private LocalDateTime rectifyScoreTime; - - @ApiModelProperty("项目是否需要整改") - private Boolean isRectify; - - @ApiModelProperty("整改意见") - private String rectifyOpinion; - - @ApiModelProperty("整改提交人员工code") - private String rectifySubmitEmployeeCode; - - @ApiModelProperty("整改提交时间") - private LocalDateTime rectifySubmitTime; - - @ApiModelProperty("是否完成自评") - private Boolean isCompleteSelfAppraisal; - - @ApiModelProperty("是否完成复评") - private Boolean isCompleteReAppraisal; - - @ApiModelProperty("是否完成核查") - private Boolean isCompleteVerify; - - @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") - private Integer rectifyStatus; - - @ApiModelProperty("整改结果说明") - private String rectifyResult; - - @ApiModelProperty("整改结果附件") - private String rectifyResultAppendix; - - @ApiModelProperty("整改结果提交人员工code") - private String rectifyResSubEmpCode; - - @ApiModelProperty("整改结果提交时间") - private LocalDateTime rectifyResSubTime; - - @ApiModelProperty("整改审核结果 1 通过、2 不通过") - private Integer rectifyAuditResult; - - @ApiModelProperty("整改审核意见") - private String rectifyAuditOpinion; - - @ApiModelProperty("整改审核附件") - private String rectifyAuditAppendix; -} 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 deleted file mode 100644 index 9027e46..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.performance.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; - -/** - * @Classname PerformanceAppraisalProjectGroup - * @Description 绩效评价和项目分组 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_appraisal_project_group") -@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") -public class PerformanceAppraisalProjectGroup implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("名称") - private String name; - - @ApiModelProperty("计划id") - private Long appraisalId; - - @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/PerformanceAppraisalProjectIndicator.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectIndicator.java deleted file mode 100644 index 8f58fe0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectIndicator.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.performance.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -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-07-28 - */ -@TableName("nd_performance_appraisal_project_indicator") -@ApiModel(value = "NdPerformanceAppraisalProjectIndicator对象", description = "") -@Data -public class PerformanceAppraisalProjectIndicator implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") - private Integer indexLevel; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则") - private String indexDetail; - - @ApiModelProperty("评分细则") - private String gradeDetail; - - @ApiModelProperty("佐证材料") - private String supportMaterial; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("更新人") - private String updateBy; - -} 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 deleted file mode 100644 index 4bead52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -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 专家核查、4 专家整改审核、5 应用评价") - 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 deleted file mode 100644 index 667f34f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.performance.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 liquibase.pro.packaged.I; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname PerformanceIndicatorTemplate - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_indicator_project_template") -@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板") -public class PerformanceIndicatorProjectTemplate implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("模板名称") - private String name; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("建设类型") - private Integer constructType; - - @ApiModelProperty("状态 0关闭 1开启") - private Integer status; - - @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/entity/PerformanceIndicatorProjectTemplateDetail.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java deleted file mode 100644 index 4eb23f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ningdatech.pmapi.performance.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PerformanceIndicatorProjectTemplateDetail - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@TableName("nd_performance_indicator_project_template_detail") -@ApiModel(value = "绩效评价考核项目指标模板详情", description = "绩效评价考核项目指标模板详情") -public class PerformanceIndicatorProjectTemplateDetail implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - - @ApiModelProperty("关联模板ID") - private Long templateId; - - @ApiModelProperty("指标ID") - private Long indexId; - - @ApiModelProperty("指标名称") - private String name; - - @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") - private Integer type; - - @ApiModelProperty("父级指标id") - private Long parentId; - - @ApiModelProperty("指标分值 3级指标才有") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则 3级指标才有") - private String indexDetail; - - @ApiModelProperty("评分细则") - private String gradeDetail; - - @ApiModelProperty("佐证材料描述") - private String supportMaterial; - - @ApiModelProperty("是否为附加指标") - private Boolean isAdditional; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java deleted file mode 100644 index 356d33c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/ProjectCoreBusinessIndicators.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.performance.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -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; -import org.hibernate.validator.constraints.Range; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Size; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-07-26 - */ -@TableName("nd_project_core_business_indicators") -@ApiModel(value = "NdProjectCoreBusinessIndicators对象", description = "") -@Data -public class ProjectCoreBusinessIndicators implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("核心业务") - private String coreBusiness; - - @ApiModelProperty("业务指标分值") - private BigDecimal score; - - @ApiModelProperty("业务指标名称") - private String businessIndicatorName; - - @ApiModelProperty("业务指标描述") - private String businessIndicatorDescription; - - @ApiModelProperty("指标设计依据") - private String indexDesignBasis; - - @ApiModelProperty("指标计算方法") - private String indexCalculationMethod; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("关联的应用ID") - private Long applicationId; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalExportReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalExportReq.java deleted file mode 100644 index 7cec022..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalExportReq.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.performance.model.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * PerformanceAppraisalExportReq - * @return - * @author CMM - * @since 2023/08/16 17:07 - */ -@Data -public class PerformanceAppraisalExportReq { - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("评价计划Id") - private Long appraisalId; - - -} 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 deleted file mode 100644 index 747e3bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.performance.model.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.time.LocalDateTime; - -/** - *

- * PerformanceAppraisalListReq - *

- * - * @author ZPF - * @since 09:32 2023/06/13 - */ -@Data -public class PerformanceAppraisalListReq extends PagePo { - - @ApiModelProperty("计划名称") - private String planName; - - @ApiModelProperty("开始时间") - private String start; - - @ApiModelProperty("结束时间") - private String end; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("模板名称") - private String templateName; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标级别 1一级指标 2二级指标 3三级指标") - private Integer indexLevel; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("申报单位") - private String buildOrgName; - - @ApiModelProperty("评价计划ID") - private Long appraisalId; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java deleted file mode 100644 index 7bd3b86..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; -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 AppAppraisalIndexDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("申报/建设单位") - private String buildOrgName; - - @ApiModelProperty("应用状态") - private String applicationStatus; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("通用指标详情") - private List commonIndexDetails; - - @ApiModelProperty("辅助指标详情") - private List auxIndexDetails; - - @ApiModelProperty("业务指标详情") - private List businessIndexDetails; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java deleted file mode 100644 index 80e73e0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - - -/** - * AppIndexDetailVO - * @return - * @author CMM - * @since 2023/08/14 8:55 - */ -@Data -public class AppBusinessIndexDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("核心业务") - private String coreBusiness; - - @ApiModelProperty("业务指标分值") - private BigDecimal score; - - @ApiModelProperty("业务指标名称") - private String businessIndicatorName; - - @ApiModelProperty("业务指标描述") - private String businessIndicatorDescription; - - @ApiModelProperty("指标设计依据") - private String indexDesignBasis; - - @ApiModelProperty("指标计算方法") - private String indexCalculationMethod; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("关联的应用ID") - private Long applicationId; - - @ApiModelProperty("评价得分") - private BigDecimal appraisalScore; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java deleted file mode 100644 index 5677204..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - - -/** - * AppIndexDetailVO - * @return - * @author CMM - * @since 2023/08/14 8:55 - */ -@Data -public class AppIndexDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标所属模块") - private String indexOwningModule; - - @ApiModelProperty("指标展示顺序") - private Integer sort; - - @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") - private Integer displayForm; - - @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") - private Integer indexType; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("是否展示") - private Boolean isDisplay; - - @ApiModelProperty("单位") - private String unit; - - @ApiModelProperty("指标定义") - private String indexDef; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人") - private String updateBy; - - @ApiModelProperty("评价得分") - private BigDecimal appraisalScore; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java deleted file mode 100644 index 27ef74c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 绩效评价-项目指标库 - * @return - * @author CMM - * @since 2023/07/28 14:45 - */ -@Data -@ApiModel(value = "绩效评价项目指标库", description = "绩效评价项目指标库") -public class AppIndexVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标所属模块") - private String indexOwningModule; - - @ApiModelProperty("指标展示顺序") - private Integer sort; - - @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") - private Integer displayForm; - - @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") - private Integer indexType; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("是否展示") - private Boolean isDisplay; - - @ApiModelProperty("单位") - private String unit; - - @ApiModelProperty("指标定义") - private String indexDef; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人") - private String updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java deleted file mode 100644 index 7f7387d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import com.alibaba.fastjson.annotation.JSONField; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * PerformanceAppraisalAppVO - * @return - * @author CMM - - */ -@Data -@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") -public class PerformanceAppraisalAppVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("删除时间") - private LocalDateTime deleteOn; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("是否数改系统 0:否 1:是") - private Integer isDigitalModification; - - @ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") - private String digitalModification; - - @ApiModelProperty("业务领域") - private String bizDomain; - - @ApiModelProperty("发布端") - private String publishSide; - - @ApiModelProperty("应用简介") - private String applicationSummary; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; - - @ApiModelProperty("申报单位名称") - private String buildOrgName; - - @ApiModelProperty("申报单位编码") - private String buildOrgCode; - - private Long createBy; - - private Long updateBy; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("项目版本") - private Integer projectVersion; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("应用核心业务") - private Boolean coreBusinessList; - - @ApiModelProperty("是否可以评价") - private Boolean canAppraisal; - - @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 deleted file mode 100644 index 28e5faf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @Classname PerformanceAppraisalApplicationVO - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") -public class PerformanceAppraisalApplicationVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - private Long appId; - - @ApiModelProperty("应用关联的项目ID") - private Long appraisalProjectId; - - @ApiModelProperty("应用关联的项目code") - private String appraisalProjectCode; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("申报单位") - private String buildOrgName; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("应用领域") - private String bizDomain; - - @ApiModelProperty("发布端") - private String publishSide; -} 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 deleted file mode 100644 index ad6cac2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -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; - -/** - * @Classname PerformanceAppraisalProjectGroupVO - * @Description 绩效评价和项目分组 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") -public class PerformanceAppraisalProjectGroupVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("名称") - private String name; - - @ApiModelProperty("计划id") - private Long appraisalId; - - @ApiModelProperty("分组内的所有项目") - private List projects; - - @ApiModelProperty("复评人员") - private List reAppraisalUsers; - - @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 deleted file mode 100644 index 4476e46..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PerformanceAppraisalProjectVO - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价项目对象", description = "绩效评价项目对象") -public class PerformanceAppraisalProjectVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrgName; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("项目类型名") - private String projectTypeName; - - @ApiModelProperty("是否复评") - private Boolean isReAppraisal; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @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("整改提交人") - private UserFullInfoDTO rectifySubmitEmployee; - - @ApiModelProperty("整改提交时间") - private LocalDateTime rectifySubmitTime; - - @ApiModelProperty("评价计划ID") - private Long appraisalId; - - @ApiModelProperty("所在分组ID") - private Long groupId; - - @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") - private Integer rectifyStatus; - - @ApiModelProperty("整改状态名称") - private String rectifyStatusName; - - @ApiModelProperty("整改结果说明") - private String rectifyResult; - - @ApiModelProperty("整改结果附件") - private String rectifyResultAppendix; - - @ApiModelProperty("整改结果提交人员工code") - private String rectifyResSubEmpCode; - - @ApiModelProperty("整改结果提交时间") - private LocalDateTime rectifyResSubTime; - - @ApiModelProperty("整改审核结果 1 通过、2 不通过") - private Integer rectifyAuditResult; - - @ApiModelProperty("整改审核意见") - private String rectifyAuditOpinion; - - @ApiModelProperty("整改审核附件") - private String rectifyAuditAppendix; - -} 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 deleted file mode 100644 index 25de516..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -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; - -/** - * @Classname PerformanceAppraisal - * @Description 绩效评价对象 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价对象", description = "绩效评价对象") -public class PerformanceAppraisalVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("计划名称") - private String name; - - @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") - private String target; - - @ApiModelProperty("评价项目列表") - private List projects; - - @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; - - @ApiModelProperty("待整改项目数") - private Integer unRectifyNumber; - - @ApiModelProperty("已整改项目数") - private Integer rectifiedNumber; - - @ApiModelProperty("待核查项目数") - private Integer unRectifyAuditNumber; - - @ApiModelProperty("已核查项目数") - private Integer rectifiedAuditNumber; -} 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 deleted file mode 100644 index 93200b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java +++ /dev/null @@ -1,55 +0,0 @@ -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; - - @ApiModelProperty("整改审核总得分") - private BigDecimal rectifyAuditTotalScore; -} 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 deleted file mode 100644 index fad699c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO; -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; - -/** - * @Classname PerformanceIndicatorProjectTemplateVO - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价项目指标模板", description = "绩效评价项目指标模板") -public class ProjectIndexTemplateVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("模板名称") - private String name; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("项目年度") - private Integer projectYear; - - @ApiModelProperty("建设类型 1 软件、2 硬件、3 软硬件") - private Integer constructType; - - @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") - private Integer amountRange; - - @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/ProjectIndexVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexVO.java deleted file mode 100644 index c1e0b2e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexVO.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 绩效评价-项目指标库 - * @return - * @author CMM - * @since 2023/07/28 14:45 - */ -@Data -@ApiModel(value = "绩效评价项目指标库", description = "绩效评价项目指标库") -public class ProjectIndexVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键ID") - private Long id; - - @ApiModelProperty("指标名称") - private String indexName; - - @ApiModelProperty("指标级别(1 一级、2 二级、3 三级)") - private Integer indexLevel; - - @ApiModelProperty("指标分值") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则") - private String indexDetail; - - @ApiModelProperty("评分细则") - private String gradeDetail; - - @ApiModelProperty("佐证材料") - private String supportMaterial; - - @ApiModelProperty("丽水 区域code") - private String regionCode; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("更新人") - private String updateBy; -} 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 deleted file mode 100644 index 95a4d9f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java +++ /dev/null @@ -1,79 +0,0 @@ -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; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - * @Classname PerformanceIndicatorProjectTemplateDetail - * @Description 绩效评价考核项目指标模板 - * @Date 2023/6/19 14:02 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树") -public class ProjectTemplateDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("关联模板ID") - private Long templateId; - - @ApiModelProperty("指标ID") - private Long indexId; - - @ApiModelProperty("指标名称") - private String name; - - @ApiModelProperty("指标类型 1一级指标 2二级指标 3三级指标") - private Integer type; - - @ApiModelProperty("父级指标id") - private Long parentId; - - @ApiModelProperty("指标分值 3级指标才有") - private BigDecimal indexScore; - - @ApiModelProperty("指标细则 3级指标才有") - private String indexDetail; - - @ApiModelProperty("评分细则") - private String gradeDetail; - - @ApiModelProperty("佐证材料描述") - private String supportMaterial; - - @ApiModelProperty("是否为附加指标") - private Boolean isAdditional; - - @ApiModelProperty("子指标") - private List children; - - @ApiModelProperty("自评分数信息") - private List selfAppraisalScoreInfo; - - @ApiModelProperty("复评分数信息") - private Map> reAppraisalScoreInfo; - - @ApiModelProperty("复评得分信息") - private Map reAppraisalTotalScoreInfo; - - @ApiModelProperty("核查分数信息") - private Map> verifyScoreInfo; - - @ApiModelProperty("核查得分信息") - private Map verifyTotalScoreInfo; - - @ApiModelProperty("自评分数信息") - private List rectifyAuditScoreInfo; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java deleted file mode 100644 index 59ce554..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.performance.model.vo; - -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 整改详情 - * - * @author CMM - * @since 2023/08/13 15:36 - */ -@Data -@ApiModel(value = "整改详情", description = "整改详情") -public class RectifyDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("整改意见") - private String rectifyOpinion; - - @ApiModelProperty("整改提交人") - private UserFullInfoDTO rectifySubmitEmployee; - - @ApiModelProperty("整改提交时间") - private LocalDateTime rectifySubmitTime; - - @ApiModelProperty("整改结果说明") - private String rectifyResult; - - @ApiModelProperty("整改结果附件") - private String rectifyResultAppendix; - - @ApiModelProperty("整改结果提交人") - private UserFullInfoDTO rectifyResSubEmployee; - - @ApiModelProperty("整改结果提交时间") - private LocalDateTime rectifyResSubTime; - - @ApiModelProperty("整改审核结果 1 通过、2 不通过") - private Integer rectifyAuditResult; - - @ApiModelProperty("整改审核意见") - private String rectifyAuditOpinion; - - @ApiModelProperty("整改审核附件") - private String rectifyAuditAppendix; - - @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") - private Integer rectifyStatus; - - @ApiModelProperty("整改状态名称") - private String rectifyStatusName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppIndicatorService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppIndicatorService.java deleted file mode 100644 index 940c0f6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppIndicatorService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppIndicator; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-07-29 - */ -public interface IPerformanceAppraisalAppIndicatorService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java deleted file mode 100644 index 86c48c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-08-14 - */ -public interface IPerformanceAppraisalAppScoreInfoService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java deleted file mode 100644 index 3fc9a0c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceAppraisalApplicationService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java deleted file mode 100644 index 4548554..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceAppraisalProjectGroupService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectIndicatorService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectIndicatorService.java deleted file mode 100644 index 7e5f08f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectIndicatorService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectIndicator; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-07-28 - */ -public interface IPerformanceAppraisalProjectIndicatorService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java deleted file mode 100644 index 5749b93..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceAppraisalProjectService extends IService { - -} 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 deleted file mode 100644 index d9e0ee6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -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/IPerformanceAppraisalService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java deleted file mode 100644 index 12b3c01..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceAppraisalService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java deleted file mode 100644 index ff9d7a1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceIndicatorProjectTemplateDetailService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java deleted file mode 100644 index 2c2b125..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2023-06-03 - */ -public interface IPerformanceIndicatorProjectTemplateService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java deleted file mode 100644 index 082db1b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IProjectCoreBusinessIndicatorsService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.performance.service; - -import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-07-26 - */ -public interface IProjectCoreBusinessIndicatorsService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java deleted file mode 100644 index 429d15a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppIndicatorServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppIndicator; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalAppIndicatorMapper; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalAppIndicatorService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-07-29 - */ -@Service -public class PerformanceAppraisalAppIndicatorServiceImpl extends ServiceImpl implements IPerformanceAppraisalAppIndicatorService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java deleted file mode 100644 index e25cc6d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalAppScoreInfoMapper; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalAppScoreInfoService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-08-14 - */ -@Service -public class PerformanceAppraisalAppScoreInfoServiceImpl extends ServiceImpl implements IPerformanceAppraisalAppScoreInfoService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java deleted file mode 100644 index 020d8bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalApplicationMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价和应用 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceAppraisalApplicationServiceImpl extends ServiceImpl implements IPerformanceAppraisalApplicationService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java deleted file mode 100644 index 4ac484e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectGroupMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectGroupService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价分组 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceAppraisalProjectGroupServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectGroupService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java deleted file mode 100644 index cdaece7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectIndicatorServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectIndicator; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectIndicatorMapper; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectIndicatorService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-07-28 - */ -@Service -public class PerformanceAppraisalProjectIndicatorServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectIndicatorService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java deleted file mode 100644 index d03db8f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价和项目 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceAppraisalProjectServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectService { - -} 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 deleted file mode 100644 index 5b6ad52..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -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/performance/service/impl/PerformanceAppraisalServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java deleted file mode 100644 index 0613978..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceAppraisalServiceImpl extends ServiceImpl implements IPerformanceAppraisalService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java deleted file mode 100644 index 660c459..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateDetailMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; -import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价详情 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl - implements IPerformanceIndicatorProjectTemplateDetailService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java deleted file mode 100644 index 551d24a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateMapper; -import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; -import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService; -import org.springframework.stereotype.Service; - -/** - *

- * 绩效评价 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-15 - */ -@Service -public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl - implements IPerformanceIndicatorProjectTemplateService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java deleted file mode 100644 index ab8fcae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/ProjectCoreBusinessIndicatorsServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.performance.service.impl; - -import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; -import com.ningdatech.pmapi.performance.mapper.ProjectCoreBusinessIndicatorsMapper; -import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-07-26 - */ -@Service -public class ProjectCoreBusinessIndicatorsServiceImpl extends ServiceImpl implements IProjectCoreBusinessIndicatorsService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ContentTypeUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ContentTypeUtils.java deleted file mode 100644 index b186cb0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ContentTypeUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.performance.util; - -/** - * @author CMM - * @since 2023/08/17 21:02 - */ - -import cn.hutool.core.util.CharsetUtil; -import com.ningdatech.basic.exception.BizException; -import com.wflow.config.ResponseCode; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -/** - * Content-type 工具类 - * @return - * @author CMM - * @since 2023/08/17 21:05 - */ -public final class ContentTypeUtils { - public static final String CONTENT_DISPOSITION; - public static final String APPLICATION_EXCEL; - static { - CONTENT_DISPOSITION = "Content-Disposition"; - APPLICATION_EXCEL = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - } - public static String encode(String fileName) { - - try { - return "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8) + ".xlsx"; - } catch (UnsupportedEncodingException e) { - throw new BizException(e.getMessage()); - } - } -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelFillCellMergeStrategy.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelFillCellMergeStrategy.java deleted file mode 100644 index 431cafa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelFillCellMergeStrategy.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.performance.util; - -import com.alibaba.excel.metadata.Head; -import com.alibaba.excel.metadata.data.WriteCellData; -import com.alibaba.excel.write.handler.CellWriteHandler; -import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; -import com.alibaba.excel.write.metadata.holder.WriteTableHolder; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.util.CellRangeAddress; - -import java.util.List; - -/** - * 单元格合并策略 - * - * @author CMM - * @since 2023/08/17 10:57 - */ - -public class ExcelFillCellMergeStrategy implements CellWriteHandler { - - private int[] mergeColumnIndex; - private int mergeRowIndex; - - public ExcelFillCellMergeStrategy() { - } - - public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndex) { - this.mergeRowIndex = mergeRowIndex; - this.mergeColumnIndex = mergeColumnIndex; - } - - - @Override - public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List> list, Cell cell, Head head, Integer integer, Boolean aBoolean) { - //当前行 - int curRowIndex = cell.getRowIndex(); - //当前列 - int curColIndex = cell.getColumnIndex(); - - if (curRowIndex > mergeRowIndex) { - for (int columnIndex : mergeColumnIndex) { - if (curColIndex == columnIndex) { - mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); - break; - } - } - } - } - - - - /** - * 当前单元格向上合并 - * - * @param cell 当前单元格 - * @param curRowIndex 当前行 - * @param curColIndex 当前列 - */ - private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) { - //获取当前行的当前列的数据和上一行的当前列列数据,通过上一行数据是否相同进行合并 - Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); - Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex); - Object preData = preCell.getCellType() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue(); - - // 比较当前行的第一列的单元格与上一行是否相同,相同合并当前单元格与上一行 - if (curData.equals(preData)) { - Sheet sheet = writeSheetHolder.getSheet(); - List mergeRegions = sheet.getMergedRegions(); - boolean isMerged = false; - for (int i = 0; i < mergeRegions.size() && !isMerged; i++) { - CellRangeAddress cellRangeAddr = mergeRegions.get(i); - // 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元 - if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) { - sheet.removeMergedRegion(i); - cellRangeAddr.setLastRow(curRowIndex); - sheet.addMergedRegion(cellRangeAddr); - isMerged = true; - } - } - // 若上一个单元格未被合并,则新增合并单元 - if (!isMerged) { - CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex); - sheet.addMergedRegion(cellRangeAddress); - } - } - } - - @Override - public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) { - - } - - @Override - public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) { - - } -} - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelSheetVerticalCellStyleStrategy.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelSheetVerticalCellStyleStrategy.java deleted file mode 100644 index 3af8e48..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelSheetVerticalCellStyleStrategy.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.performance.util; - -/** - * @author CMM - * @since 2023/08/17 21:01 - */ - -import com.alibaba.excel.metadata.Head; -import com.alibaba.excel.write.metadata.style.WriteCellStyle; -import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy; - -/** - * excel 样式设置 - * @return - * @author CMM - * @since 2023/08/17 21:07 - */ -public class ExcelSheetVerticalCellStyleStrategy extends AbstractVerticalCellStyleStrategy { - /** - * 头部样式 - * - * @return 样式 - */ - @Override - protected WriteCellStyle headCellStyle(Head head) { - return ExcelUtils.writeCellStyle(); - } - /** - * 内容样式 - * - * @return 样式 - */ - @Override - protected WriteCellStyle contentCellStyle(Head head) { - return ExcelUtils.writeCellStyle(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelUtils.java deleted file mode 100644 index 851aa79..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/ExcelUtils.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.ningdatech.pmapi.performance.util; - -/** - * @author CMM - * @since 2023/08/17 20:59 - */ - -import java.util.List; -import java.util.Map; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.performance.constant.BizConst; -import org.apache.poi.ss.formula.functions.T; -import org.apache.poi.ss.usermodel.BorderStyle; -import org.apache.poi.ss.usermodel.HorizontalAlignment; -import org.apache.poi.ss.usermodel.VerticalAlignment; - -import com.alibaba.excel.write.metadata.style.WriteCellStyle; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.performance.model.entity.ExcelHead; - -/** - * excel 工具类 - * @return - * @author CMM - * @since 2023/08/17 21:07 - */ -public class ExcelUtils { - /** - * 构造excel基础样式 - * - * @return 样式 - */ - public static WriteCellStyle writeCellStyle() { - WriteCellStyle writeCellStyle = new WriteCellStyle(); - writeCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); - writeCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); - writeCellStyle.setWrapped(true); - writeCellStyle.setBorderBottom(BorderStyle.THIN); - writeCellStyle.setBorderLeft(BorderStyle.THIN); - writeCellStyle.setBorderRight(BorderStyle.THIN); - writeCellStyle.setBorderTop(BorderStyle.THIN); - return writeCellStyle; - } - - /** - * 表内容数据转换 - * - * @param headList 表头数据 - * @param dataList 表内容数据转换 - * @return List> - */ - public static List> convertData(List headList, List> dataList) { - List> result = Lists.newArrayList(); - //对 dataList 转为 easyExcel 的数据格式 - for (Map data : dataList) { - List row = Lists.newArrayList(); - for (ExcelHead h : headList) { - Object o = data.get(h.getFieldName()); - //需要对null的处理,转换为空字符串 - row.add(handler(o, h.getNullValue())); - } - result.add(row); - } - return result; - } - /** - * null 值处理 - * @param nullValue 默认值 - * @return 默认值 - */ - private static Object handler(Object o, Object nullValue) { - return o != null ? o : nullValue; - } - - public static List> getHead(List reUserList,List verifyUserList) { - - List> list = Lists.newArrayList(); - list.add(Lists.newArrayList(BizConst.FIRST_INDEX_TITLE)); - list.add(Lists.newArrayList(BizConst.SECOND_INDEX_TITLE)); - list.add(Lists.newArrayList(BizConst.THIRD_INDEX_TITLE)); - list.add(Lists.newArrayList(BizConst.INDEX_SCORE_TITLE)); - list.add(Lists.newArrayList(BizConst.INDEX_DETAIL_TITLE)); - list.add(Lists.newArrayList(BizConst.GRADE_DETAIL_TITLE)); - list.add(Lists.newArrayList(BizConst.SUPPORT_MATERIAL_TITLE)); - list.add(Lists.newArrayList(BizConst.SELF_APPRAISAL_BASIS_TITLE)); - list.add(Lists.newArrayList(BizConst.SELF_APPRAISAL_SCORE_TITLE)); - if (CollUtil.isNotEmpty(reUserList)) { - List reUserHead = Lists.newArrayList(); - reUserHead.add(BizConst.RE_APPRAISAL_BASIS_TITLE); - reUserHead.add(BizConst.RE_APPRAISAL_SCORE_TITLE); - for (String reUser : reUserList) { - for (String h : reUserHead) { - List reUsers = Lists.newArrayList(); - reUsers.add(reUser + BizConst.RE_APPRAISAL); - reUsers.add(h); - list.add(reUsers); - } - } - } - - if (CollUtil.isNotEmpty(verifyUserList)) { - List verifyUserHead = Lists.newArrayList(); - verifyUserHead.add(BizConst.VERIFY_BASIS_TITLE); - verifyUserHead.add(BizConst.VERIFY_SCORE_TITLE); - for (String verifyUser : reUserList) { - for (String h : verifyUserHead) { - List reUsers = Lists.newArrayList(); - reUsers.add(verifyUser + BizConst.VERIFY); - reUsers.add(h); - list.add(reUsers); - } - } - } - list.add(Lists.newArrayList(BizConst.IS_ADDITIONAL_TITLE)); - return list; - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/MultiColumnMergeStrategy.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/MultiColumnMergeStrategy.java deleted file mode 100644 index 154ee6c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/util/MultiColumnMergeStrategy.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.ningdatech.pmapi.performance.util; - -import com.alibaba.excel.metadata.Head; -import com.alibaba.excel.write.merge.AbstractMergeStrategy; -import com.alibaba.fastjson.JSONObject; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.util.CellRangeAddress; - -import java.util.ArrayList; -import java.util.List; - -/** - * 指定列单元格合并策略 - * - * @author CMM - * @since 2023/08/17 11:26 - */ - -public class MultiColumnMergeStrategy extends AbstractMergeStrategy { - - // 合并的列编号,从0开始,指定的index或自己按字段顺序数 - private Integer startCellIndex = 0; - private Integer endCellIndex = 0; - - // 数据集大小,用于区别结束行位置 - private Integer maxRow = 0; - - // 禁止无参声明 - private MultiColumnMergeStrategy() { - } - - /** - * 每行每列都会进入,循环注意条件限制 - */ - @Override - protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { - int currentCellIndex = cell.getColumnIndex(); - int currentRowIndex = cell.getRowIndex(); - - // 判断该列是否需要合并 - if (currentCellIndex < startCellIndex || currentCellIndex > endCellIndex) { - return; - } - - Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); - String currentCellValue = curData.toString(); - - List rowList; - if (dataList.size() > currentRowIndex - 1) { - rowList = dataList.get(currentRowIndex - 1); - } else { - rowList = new ArrayList<>(); - dataList.add(rowList); - } - rowList.add(currentCellValue); - - // 结束的位置触发下最后一次没完成的合并 - if (relativeRowIndex == (maxRow - 1) && currentCellIndex == endCellIndex) { - System.out.println(JSONObject.toJSONString(dataList)); - List tempList = null; - Integer tempIndex = null; - for (int i = 0; i < dataList.size(); i++) { - if (tempList == null) { - tempList = dataList.get(i); - tempIndex = i; - continue; - } - List currList = dataList.get(i); - if (tempList.equals(currList)) { - if (i >= dataList.size() - 1) { - // 结束的位置触发下最后一次没完成的合并 - for (int j = 0; j < tempList.size(); j++) { - sheet.addMergedRegionUnsafe(new CellRangeAddress(tempIndex + 1, i + 1, startCellIndex + j, startCellIndex + j)); - } - } - continue; - } - - // 当前行数据和上一行数据不同且上面有多行相同数据时触发合并 - if (i - tempIndex > 1) { - for (int j = 0; j < tempList.size(); j++) { - sheet.addMergedRegionUnsafe(new CellRangeAddress(tempIndex + 1, i, startCellIndex + j, startCellIndex + j)); - } - } - - - tempIndex = i; - tempList = currList; - - - } - - } - } - - - public MultiColumnMergeStrategy(Integer maxRow, Integer startCellIndex, Integer endCellIndex) { - this.startCellIndex = startCellIndex; - this.endCellIndex = endCellIndex; - this.maxRow = maxRow; - } - - // 记录上一次合并的信息 - private final List> dataList = new ArrayList<>(); -} - - 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 deleted file mode 100644 index 0a46dce..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java +++ /dev/null @@ -1,64 +0,0 @@ -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 deleted file mode 100644 index 3525413..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java +++ /dev/null @@ -1,221 +0,0 @@ -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.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -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.sys.model.dto.RegionDTO; -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; - - private final IGovBizProjectBaseinfoService baseinfoService; - - private final RegionCacheHelper regionCacheHelper; - - /** - * 标签分页 - * @param areaCode - * @param req - * @return - */ - public PageVo list(String areaCode, TagPageReq req) { - RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY); - String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null; - LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) - .eq(Objects.nonNull(regionCode),Tag::getAreaCode, regionCode) - .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 BizConst.SAVE_SUCCESS; - } - - /** - * 标签名 去重 - * @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); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).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 BizConst.SAVE_SUCCESS; - } - - public String removeTagToProject(TagToProjectDTO dto) { - String projectCode = dto.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).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 deleted file mode 100644 index 7ee6898..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 78ed337..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 4cc5a2e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100644 index 7bdb8d8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index f399112..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index df641ae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index 85dfd3f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 3527f98..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index 0ecabf3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.portrait.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.model.entity.Tag; - -import java.util.List; - -/** - * @Classname ITagService - * @Description - * @Date 2023/8/2 10:47 - * @Author PoffyZhang - */ -public interface IProjectTagService extends IService { - /** - * 获取项目 标签 - * @param projectCode - * @return - */ - List getProjectTas(String projectCode); -} 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 deleted file mode 100644 index b635e07..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index a353175..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.portrait.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -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.model.entity.Tag; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.portrait.service.ITagService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- *

- * - * @author ZPF - * @since 2023-08-2 - */ -@Service -@RequiredArgsConstructor -public class ProjectTagServiceImpl extends ServiceImpl implements IProjectTagService { - - private final ITagService tagService; - - /** - * 获取项目标签 - * @param projectCode - * @return - */ - @Override - public List getProjectTas(String projectCode) { - List proTags = this.list(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode, projectCode)); - if(CollUtil.isEmpty(proTags)){ - return Collections.emptyList(); - } - List tagIds = proTags.stream().map(ProjectTag::getTagId).collect(Collectors.toList()); - return tagService.listByIds(tagIds); - } -} 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 deleted file mode 100644 index 142029a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -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/DeclaredProjectContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java deleted file mode 100644 index 53586ae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.contants; - -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.user.entity.UserInfo; - -import java.util.List; - -public interface DeclaredProjectContant { - - class ProcessDef { - public static final String PROJECT_STAGE_1 = "单位内部审批流程"; - - public static final String PROJECT_STAGE_2 = "项目预审审批流程"; - - public static final String PROJECT_STAGE_3 = "部门联合审批流程"; - - public static final String PROJECT_STAGE_4 = "建设方案审批流程"; - - public static final String PROJECT_STAGE_5 = "验收申报审批流程"; - } - - class Instance { - public static final String PROVINCE_INSTANCE_ID = "PROVINCE_AUDIT"; - } - - class Biz { - public static final String CORE_BIZ = "{\"msg\":\"操作成功\",\"code\":0,\"data\":[{\"id\":6366,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"947\",\"uuid\":\"5922bdbb-ae35-4f4d-b6e0-916cf01b9a6a\",\"sysName\":\"丽水市数据中心平台\"}],\"coreMaterials\":[{\"id\":11317,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划申报)\"},{\"id\":66025,\"comaterialName\":\"测试信息\"},{\"id\":70165,\"comaterialName\":\"演示系统信息\"},{\"id\":11318,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划申报)\"},{\"id\":60284,\"comaterialName\":\"测试需求信息\"},{\"id\":60285,\"comaterialName\":\"测试需求的信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6367,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划调整申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11319,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划调整申报)\"},{\"id\":11320,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划调整申报)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6368,\"matterOrg\":4,\"matterName\":\"信息化项目立项\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"2095\",\"uuid\":\"2b4a5100-708c-4716-b713-79be1860edf9\",\"sysName\":\"丽水市公共数据管理系统\"}],\"coreMaterials\":[{\"id\":69142,\"comaterialName\":\"演示项目信息\"},{\"id\":11321,\"comaterialName\":\"项目定密正式意见信息\"},{\"id\":11322,\"comaterialName\":\"项目数据资源承诺共享开放目录信息\"},{\"id\":11324,\"comaterialName\":\"项目申请立项正式函信息\"},{\"id\":11323,\"comaterialName\":\"项目建设方案信息(信息化项目立项)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6369,\"matterOrg\":4,\"matterName\":\"信息化项目验收\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"1020\",\"uuid\":\"103afdd3-5078-4e8e-9f3e-8890b42d9276\",\"sysName\":\"协同平台\"}],\"coreMaterials\":[{\"id\":11325,\"comaterialName\":\"项目验收申请函信息(电子公文正式件)\"},{\"id\":11329,\"comaterialName\":\"项目初验意见书信息\"},{\"id\":11328,\"comaterialName\":\"第三方测评报告信息(立项批复投资估算>500万)\"},{\"id\":11327,\"comaterialName\":\"项目监理报告信息(立项批复投资估算>200万)\"},{\"id\":11330,\"comaterialName\":\"项目验收完整归档资料信息\"},{\"id\":60411,\"comaterialName\":\"测试数据项数量信息\"},{\"id\":69141,\"comaterialName\":\"演示验收信息\"},{\"id\":11326,\"comaterialName\":\"项目竣工报告信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6370,\"matterOrg\":4,\"matterName\":\"办公助手人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11331,\"comaterialName\":\"办公助手人员变更表单信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6371,\"matterOrg\":4,\"matterName\":\"办公助手单位新增申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11332,\"comaterialName\":\"办公助手单位新增申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6372,\"matterOrg\":4,\"matterName\":\"办公助手短信数量申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":17570,\"comaterialName\":\"办公助手短信数量申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6373,\"matterOrg\":4,\"matterName\":\"办公助手通知公告发布申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11335,\"comaterialName\":\"通知公告发布申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6374,\"matterOrg\":4,\"matterName\":\"丽水市党政机关公文交换系统单位新增\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11336,\"comaterialName\":\"公文交换系统单位新增信息\"},{\"id\":17572,\"comaterialName\":\"公章替换说明函信息\"},{\"id\":17571,\"comaterialName\":\"机关代字(红头文号)模板信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6375,\"matterOrg\":4,\"matterName\":\"丽水市党政机关协同办公系统人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11337,\"comaterialName\":\"协同办公系统人员变更信息\"}],\"page\":null,\"limit\":null,\"startRow\":null}],\"total\":10}"; - } - - class Project{ - public static final Integer YEAR_THREE = 2; - public static final Integer YEAR_FOUR = 4; - - public static final Integer YEAR_DRAW_SURPLUS = 100; - - public static final String FIXED_NUMBER = "0130"; - public static final Long MAX_PROJECT_ID = 999L; - - public static final Long MIN_PROJECT_ID = 1L; - } - - class ReviewChecklist { - public static final List REVIEW_HUMANS_ZZD = Lists.newArrayList("GE_dce116d65ffe48a3aee6c14c1c5a3031", - "GE_573158a366554bdbb483f8f93d594bf7","GE_fe1cd568b453456ead00f471ecddf6a2","GE_fc1e28e29b5a4cf39c7b7c83278db6f4", - "GE_16580afcdf7d4d379fd3690ba47f3b58","GE_9c901c85eaeb42abbb485b7aa4d4358f","GE_a4c2c56ed3204600805e0f7b7dca9044"); - - public static final List REVIEW_HUMANS_ZYD = Lists.newArrayList("GE_6dc0e5a3513d41f684b6b01aeb94d887", - "GE_39be254f6cb84ad0b30c9bd5bda657d7","GE_051f5e34c0c4467b873cde517a21669b","GE_e68c7af513474eaa959b7ce7141a4d9f", - "GE_c3e4d8e8067b4fce91b28b570cffc67a","GE_809a061236b941d281446df6f14dc8f0","GE_6168943503de45919c42d46e05b24fa1"); - public static final Integer INIT_NUM = 0; - } -} 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 deleted file mode 100644 index 098f8ba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java +++ /dev/null @@ -1,17 +0,0 @@ -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"; - String SHUZI_4 = "%04d"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java deleted file mode 100644 index bddfb55..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -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.ConstructionManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.ContractSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PaymentPlanSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PaymentPlanSupplementDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PreInsSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectContractListVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * @Classname ConstructionController - * @Description 申报项目-建设中 - * @Date 2023/5/29 09:29 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared/construction") -@Api(value = "ConstructionController", tags = "申报管理-建设中") -@RequiredArgsConstructor -public class ConstructionController { - private final ConstructionManage constructionManage; - - @ApiOperation(value = "待合同备案的项目列表", notes = "合同备案的项目列表") - @GetMapping("/contract/project-list") - public PageVo projectlist(@ModelAttribute ProjectListReq req) { - return constructionManage.projectLibList(req); - } - - @ApiOperation(value = "已经完善合同信息的项目列表", notes = "已经完善合同信息的项目列表") - @GetMapping("/contract/project-list-perfect") - public PageVo projectlistPerfect(@ModelAttribute ProjectListReq req) { - return constructionManage.projectlistPerfect(req); - } - - @GetMapping("/contract/export") - @ApiOperation("待合同备案的项目列表导出") - @WebLog("待合同备案的项目列表导出") - public void exportList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,constructionManage::exportList); - } - - @ApiOperation(value = "合同备案的详情-通过项目ID", notes = "合同备案的详情-通过项目ID") - @GetMapping("/contract/detail/{projectId}") - public ContractVO detailContractByProjectId(@PathVariable Long projectId) { - return constructionManage.detailContractByProjectId(projectId); - } - - @ApiOperation(value = "填写合同信息", notes = "填写合同信息") - @WebLog("填写合同信息") - @PostMapping("/submit-contract") - public String submitContract(@Validated @RequestBody ContractSaveDTO dto) { - return constructionManage.submitContract(dto); - } - - @ApiOperation(value = "补充实际支付金额", notes = "补充实际支付金额") - @WebLog("补充实际支付金额") - @PostMapping("/supplement") - public String supplement(@Validated @RequestBody List plans) { - return constructionManage.supplement(plans); - } - - @ApiOperation(value = "待初验备案的项目列表", notes = "待初验备案的项目列表") - @GetMapping("/pre-ins/project-list") - public PageVo preProjectList(@ModelAttribute ProjectListReq req) { - return constructionManage.preProjectlist(req); - } - - @GetMapping("/pre-ins/export") - @ApiOperation("待初验备案的项目列表导出") - @WebLog("待初验备案的项目列表导出") - public void exportPreList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,constructionManage::exportPreList); - } - - @ApiOperation(value = "初验备案的详情-通过项目ID", notes = "初验备案的详情-通过项目ID") - @GetMapping("/pre-ins/detail/{projectId}") - public PreInsVO detailPreInsByProjectId(@PathVariable Long projectId) { - return constructionManage.detailPreInsByProjectId(projectId); - } - - @ApiOperation(value = "填写初验信息", notes = "填写初验信息") - @WebLog("填写初验信息") - @PostMapping("/submit-pre-ins") - public String submitPreIns(@Validated @RequestBody PreInsSaveDTO dto) { - return constructionManage.submitPreIns(dto); - } -} 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 deleted file mode 100644 index d2f6085..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -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.ConstructionPlanManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.ContructionSuggestionsDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; - -/** - * @Classname ConstructionPlanController - * @Description 建设方案申报 - * @Date 2023/2/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/construction") -@Api(value = "ConstructionPlan", tags = "申报管理-建设方案申报") -@RequiredArgsConstructor -public class ConstructionPlanController { - - private final ConstructionPlanManage constructionPlanManage; - - @ApiOperation(value = "可申报建设方案项目列表", notes = "可申报建设方案项目列表") - @GetMapping("/list") - public PageVo list(@Validated @ModelAttribute ConstrctionPlanListReq planReq) { - return constructionPlanManage.projectLibList(planReq); - } - - @ApiOperation(value = "建设方案申报", notes = "建设方案申报") - @WebLog("建设方案申报") - @PostMapping("/start") - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - String instanceId = constructionPlanManage.startTheProcess(dto); - return "建设方案申报 【" + instanceId + "】 成功"; - } - - @GetMapping("/export") - @ApiOperation("可申报建设方案项目列表导出") - @WebLog("可申报建设方案项目列表导出") - public void exportList(ConstrctionPlanListReq planReq, HttpServletResponse response) { - ExcelDownUtil.downXls(response, planReq, constructionPlanManage::exportList); - } - - @ApiOperation(value = "建设方案专家建议", notes = "建设方案专家建议") - @WebLog("建设方案专家建议") - @PostMapping("/construction-suggestions") - public String constructionSuggestions(@Validated @RequestBody ContructionSuggestionsDTO dto) { - constructionPlanManage.constructionSuggestions(dto); - return "专家建设方案建议保存成功"; - } -} 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 deleted file mode 100644 index 06a654c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -import javax.servlet.http.HttpServletResponse; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; -import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * @Classname DeclaredProjectController - * @Description 申报项目 - * @Date 2023/1/31 11:29 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared") -@Api(value = "DeclaredProject", tags = "申报管理-申报项目") -@RequiredArgsConstructor -public class DeclaredProjectController { - private final DeclaredProjectManage declaredProjectManage; - - private final ProjectAdjustmentManage projectAdjustmentManage; - - private final GovProjectCollectionManage collectionManage; - - @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") - @GetMapping("/list") - public PageVo list(@ModelAttribute ProjectListReq req) { - return declaredProjectManage.projectLibList(req); - } - - @ApiOperation(value = "核心业务列表", notes = "核心业务列表") - @GetMapping("/core-biz") - public JSONObject bizList(@RequestParam(required = false) String businessName, - @RequestParam(required = false) Integer pageSize, - @RequestParam(required = false) Integer pageNumber, - @RequestParam(required = false) String orgCode) { - return declaredProjectManage.bizList(businessName,pageSize,pageNumber,orgCode); - } - - @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") - @GetMapping("/draft") - public PageVo draft(@ModelAttribute DeclaredProjectListParamDTO params) { - return declaredProjectManage.pageDraft(params); - } - - @ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情") - @GetMapping("/draft/{id}") - public ProjectDraftVO draft(@PathVariable(value = "id") Long id) { - return declaredProjectManage.draftDatail(id); - } - - @ApiOperation(value = "申报项目保存至草稿箱", notes = "申报项目保存至草稿箱") - @WebLog("申报项目保存至草稿箱") - @PostMapping("/save-to-draft") - public Object saveToDraft(@Validated @RequestBody ProjectDraftSaveDTO dto) { - return declaredProjectManage.saveToDraft(dto); - } - - @ApiOperation(value = "申报项目", notes = "申报项目") - @WebLog("申报项目") - @PostMapping("/start") - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - String instanceId = declaredProjectManage.startTheProcess(dto); - return "启动流程实例 【" + instanceId + "】 成功"; - } - - @ApiOperation(value = "重新申报项目", notes = "重新申报项目") - @WebLog("重新申报项目") - @PostMapping("/restart") - public String reStartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - return projectAdjustmentManage.adjustment(dto); - } - - @GetMapping("/export") - @ApiOperation("申报项目列表导出") - @WebLog("申报项目列表导出") - public void exportList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,declaredProjectManage::exportList); - } - - @PostMapping("/remove/{projectCode}") - @ApiOperation("申报项目删除-预审失败") - @WebLog("申报项目删除-预审失败") - public String remove(@PathVariable String projectCode){ - return declaredProjectManage.removeProject(projectCode); - } -} 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 deleted file mode 100644 index a5a2702..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -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.DelayedApplyDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.DelayedApplyVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * @Classname DelayedProjectController - * @Description - * @Date 2023/6/7 18:50 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared/delayed") -@Api(value = "DelayedProjectController", tags = "申报管理-延期项目") -@RequiredArgsConstructor -public class DelayedApplyController { - - private final DelayedApplyManage delayedApplyManage; - - @ApiOperation(value = "过期的项目列表", notes = "过期的项目列表") - @GetMapping("/project-list") - public PageVo projectlist(@ModelAttribute ProjectListReq req) { - 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) { - return delayedApplyManage.detailByProjectId(projectId); - } - - @GetMapping("/export") - @ApiOperation("过期的项目列表导出") - @WebLog("过期的项目列表导出") - public void exportList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,delayedApplyManage::exportList); - } - - @ApiOperation(value = "延期申报", notes = "延期申报") - @WebLog("延期申报") - @PostMapping("/apply") - public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) { - String instanceId = delayedApplyManage.startDelayedApplyProcess(dto); - return "启动延期申请流程实例 【" + instanceId + "】 成功"; - } -} 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 deleted file mode 100644 index 388e2f0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/FinalAcceptanceController.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -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.FinalAcceptanceManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; - - -/** - * @Classname FinalAcceptanceController - * @Description 申报项目-终验 - * @Date 2023/6/2 09:29 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared/final-acc") -@Api(value = "FinalAcceptanceController", tags = "申报管理-终验") -@RequiredArgsConstructor -public class FinalAcceptanceController { - private final FinalAcceptanceManage finalAcceptanceManage; - - @ApiOperation(value = "待终验申报的项目列表", notes = "待终验申报的项目列表") - @GetMapping("/project-list") - public PageVo projectlist(@ModelAttribute ProjectListReq req) { - return finalAcceptanceManage.projectLibList(req); - } - - @GetMapping("/export") - @ApiOperation("待终验申报的项目导出") - @WebLog("待终验申报的项目导出") - public void exportList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,finalAcceptanceManage::exportList); - } - - @ApiOperation(value = "待终验申报的项目列表", notes = "待终验申报的项目列表") - @GetMapping("/detail/{projectId}") - public FinalAcceptanceVO detailByProjectId(@PathVariable Long projectId) { - return finalAcceptanceManage.detailByProjectId(projectId); - } - - @ApiOperation(value = "终验申报", notes = "终验申报") - @WebLog("终验申报") - @PostMapping("/start-process") - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - 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/controller/OperationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java deleted file mode 100644 index 0ca7f11..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.projectdeclared.manage.OperationManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.OperationDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO; -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.*; - -/** - * @Classname OperationController - * @Description 申报项目-实施 - * @Date 2023/7/31 09:29 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared/operation") -@Api(value = "OperationController", tags = "申报管理-实施") -@RequiredArgsConstructor -public class OperationController { - private final OperationManage operationManage; - - @ApiOperation(value = "实施详情", notes = "实施详情") - @GetMapping("/detail/{projectId}") - public OperationVO detail(@PathVariable Long projectId) { - return operationManage.detail(projectId); - } - - @PostMapping("/push-operation") - @ApiOperation("填写实施计划") - @WebLog("填写实施计划") - public String pushOperation(@RequestBody OperationDTO operation) { - return operationManage.pushOperation(operation); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java deleted file mode 100644 index 2d7298c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -import javax.servlet.http.HttpServletResponse; - -import com.ningdatech.log.annotation.WebLog; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * @Classname PrequalificationDeclaredController - * @Description 预审申报 - * @Date 2023/2/12 9:03 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/prequalification") -@Api(value = "Prequalification", tags = "申报管理-预审申报") -@RequiredArgsConstructor -public class PrequalificationDeclaredController { - - private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; - - @ApiOperation(value = "可预审申报项目列表", notes = "可预审申报项目列表") - @GetMapping("/list") - public PageVo list(@Validated @ModelAttribute PrequalificationDeclaredListReq preReq) { - return prequalificationDeclaredProjectManage.pageInfo(preReq); - } - - @ApiOperation(value = "申报预审", notes = "申报预审") - @WebLog("申报预审") - @PostMapping("/start") - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - return prequalificationDeclaredProjectManage.startTheProcess(dto); - } - - @GetMapping("/export") - @ApiOperation("可预审申报项目列表导出") - @WebLog("可预审申报项目列表导出") - public void exportList(PrequalificationDeclaredListReq preReq, HttpServletResponse response){ - ExcelDownUtil.downXls(response,preReq,prequalificationDeclaredProjectManage::exportList); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java deleted file mode 100644 index e1b0671..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq; -import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; -import java.util.Arrays; - -/** - * @Classname ConstructionPlanController - * @Description 建设方案申报 - * @Date 2023/2/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/project/adjustment") -@Api(value = "ProjectAdjustment", tags = "申报管理-项目内容调整") -@RequiredArgsConstructor -public class ProjectAdjustmentController { - - private final ProjectAdjustmentManage projectAdjustmentManage; - - @ApiOperation(value = "可做项目内容调整的列表", notes = "可做项目内容调整的列表") - @GetMapping("/list") - public PageVo list(@Validated @ModelAttribute AdjustmentListReq preReq) { - return projectAdjustmentManage.projectLibList(preReq); - } - - @ApiOperation(value = "项目内容调整", notes = "项目内容调整") - @WebLog("项目内容调整") - @PostMapping - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - String instanceId = projectAdjustmentManage.adjustment(dto); - return "项目内容调整并且重新申报 【" + instanceId + "】 成功"; - } - - @GetMapping("/export") - @ApiOperation("项目内容调整列表导出") - @WebLog("项目内容调整列表导出") - public void exportList(AdjustmentListReq preReq, HttpServletResponse response){ - ExcelDownUtil.downXls(response,preReq,projectAdjustmentManage::exportList); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java deleted file mode 100644 index ac52265..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -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.ProjectAdjustmentManage; -import com.ningdatech.pmapi.projectdeclared.manage.PurchaseManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -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 javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * @Classname PurchaseController - * @Description 申报项目-采购结果备案 - * @Date 2023/5/29 09:29 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/declared/purchase") -@Api(value = "PurchaseController", tags = "申报管理-采购结果备案") -@RequiredArgsConstructor -public class PurchaseController { - private final PurchaseManage purchaseManage; - - private final ProjectAdjustmentManage projectAdjustmentManage; - - @ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") - @GetMapping("/project-list") - public PageVo projectlist(@ModelAttribute ProjectListReq req) { - return purchaseManage.projectLibList(req); - } - - @ApiOperation(value = "采购结果备案详情", notes = "采购结果备案详情") - @GetMapping("/detail/{projectId}") - public List detailByProjectId(@PathVariable Long projectId) { - return purchaseManage.detailByProjectId(projectId); - } - - @GetMapping("/export") - @ApiOperation("待采购结果备案列表导出") - @WebLog("待采购结果备案列表导出") - public void exportList(ProjectListReq req, HttpServletResponse response) { - ExcelDownUtil.downXls(response, req, purchaseManage::exportList); - } - - @ApiOperation(value = "填写采购结果", notes = "填写采购结果") - @WebLog("填写采购结果") - @PostMapping("/submit-result") - public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) { - return purchaseManage.submitResult(dto); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java deleted file mode 100644 index c04684a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.projectdeclared.manage.ReviewChecklistManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.ReviewChecklistApproveDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ReviewCheckInfoVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.ReviewChecklistApproveVO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectReviewCheckListItemVO; -import com.wflow.bean.dto.FormsReviewChecklistDto; -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 ReviewChecklistController - * @Description - * @Date 2023/11/7 17:00 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/review-checklist") -@Api(value = "Review-Checklist", tags = "审查清单") -@RequiredArgsConstructor -public class ReviewChecklistController { - - private final ReviewChecklistManage reviewChecklistManage; - - @ApiOperation(value = "建设方案后审查清单", notes = "建设方案后审查清单") - @GetMapping("/list") - public PageVo list(@ModelAttribute ProjectListReq req) { - return reviewChecklistManage.projectLibList(req); - } - - @ApiOperation(value = "审查清单审核", notes = "审查清单审核") - @PostMapping("/approve") - @WebLog("审查清单审核") - public String approve(@RequestBody List dtos) { - return reviewChecklistManage.approve(dtos); - } - - @ApiOperation(value = "查看某个项目的意见汇总", notes = "查看某个项目的意见汇总") - @GetMapping("/summary-list/{projectCode}") - public List summaryList(@PathVariable String projectCode) { - return reviewChecklistManage.summaryList(projectCode); - } - - @ApiOperation(value = "意见汇总提交", notes = "意见汇总提交") - @PostMapping("/summary/{projectCode}") - @WebLog("意见汇总提交") - public String summary(@PathVariable String projectCode) { - return reviewChecklistManage.summary(projectCode); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java deleted file mode 100644 index d47468f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.converter; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.provincial.model.dto.FileDTO; -import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; -import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; - -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname ApplicationConverter - * @Description - * @Date 2023/3/13 17:38 - * @Author PoffyZhang - */ -@Slf4j -public class ApplicationConverter { - - public static ProvincialProjectDTO convertProject(Project projectInfo, List applications, - FileService fileService, String active) { - return ProvincialProjectDTO.builder() - //暂时先写死 - .operationManageUnit(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? - "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getHigherSuperOrgCode()) - .digitalReform(String.valueOf(projectInfo.getBizDomain())) - .regionCode(projectInfo.getAreaCode()) - .regionName(projectInfo.getArea()) - .projectName(projectInfo.getProjectName()) - .projectId(projectInfo.getProjectCode()) - .projectType(convertProjectType(projectInfo.getProjectType())) - .totalMoney(projectInfo.getDeclareAmount()) - .yearBudget(projectInfo.getAnnualPlanAmount()) - .budgetFrom(checkAddBudget(projectInfo.getDeclareHaveAmount() - , projectInfo.getDeclareGovOwnFinanceAmount(), - projectInfo.getDeclareGovSuperiorFinanceAmount(), - projectInfo.getDeclareBankLendingAmount(), - projectInfo.getDeclareOtherAmount())) - .year(String.valueOf(projectInfo.getProjectYear())) - .financialCode(projectInfo.getFinancialCode()) - .developCode(projectInfo.getDevelopCode()) - .beginTime(projectInfo.getBeginTime()) - .endTime(projectInfo.getEndTime()) - .buildBasis("立项依据") - .buildBasisFile(convertBasicFile(projectInfo.getBuildBasis(), fileService)) - .projectSummary(projectInfo.getProjectIntroduction()) - .responsibleMan(projectInfo.getResponsibleMan()) - .responsibleManPhone(projectInfo.getResponsibleManMobile()) - .contactName(projectInfo.getContactName()) - .contactPhone(projectInfo.getContactPhone()) - .buildUnit(projectInfo.getBuildOrgName()) - .buildUnitCode(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? - "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getBuildOrgCode()) - .superUnit(projectInfo.getSuperOrg()) - .superUnitCode(StringUtils.isBlank(active) || BizConst.DEV.equals(active) ? - "GO_a1479720291640b4982158fe3035a2d0" : projectInfo.getSuperOrgCode()) - .projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(), fileService)) - .unitThreePlan(convertFile(projectInfo.getMainResponsibilitiesApplicantFile(), fileService)) - .otherFile(convertFile(projectInfo.getPreliminaryPlanFile(), fileService)) - .projectRemark(projectInfo.getProjectRemarks()) - .includeApplication(projectInfo.getIncludeApplication()) - .isEffective(1) - .projectApplyFile(convertFile(projectInfo.getProjectApplicationForm(), fileService)) - .researchReport(convertFile(projectInfo.getPreliminaryPlanFile(), fileService)) - .applicationInfo(convertApplications(applications, fileService)) - .build(); - } - - private static Integer convertProjectType(String projectType) { - if(StringUtils.isBlank(projectType)){ - return null; - } - - if(Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), - ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode()).contains(projectType)){ - return ProjectTypeEnum.BUILD.getCode(); - }else if(Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), - ProjectTypeNewEnum.XU_OPERA.getCode()).contains(projectType)){ - return ProjectTypeEnum.DEV_OPS.getCode(); - } - return null; - } - - private static String checkAddBudget(BigDecimal declareHaveAmount, BigDecimal declareGovOwnFinanceAmount, - BigDecimal declareGovSuperiorFinanceAmount, BigDecimal declareBankLendingAmount, - BigDecimal otherAmount) { - StringBuilder sb = new StringBuilder(); - - if (Objects.nonNull(declareHaveAmount) && declareHaveAmount.compareTo(BigDecimal.ZERO) > 0) { - sb.append("自有资金,"); - } - if (Objects.nonNull(declareGovOwnFinanceAmount) && declareGovOwnFinanceAmount.compareTo(BigDecimal.ZERO) > 0) { - sb.append("政府投资-本级财政资金,"); - } - if (Objects.nonNull(declareGovSuperiorFinanceAmount) && declareGovSuperiorFinanceAmount.compareTo(BigDecimal.ZERO) > 0) { - sb.append("政府投资-上级财政资金,"); - } - if (Objects.nonNull(declareBankLendingAmount) && declareBankLendingAmount.compareTo(BigDecimal.ZERO) > 0) { - sb.append("银行贷款,"); - } - if (Objects.nonNull(otherAmount) && otherAmount.compareTo(BigDecimal.ZERO) > 0) { - sb.append("其他资金"); - } - return sb.toString(); - } - - //放入项目 app - private static List convertApplications(List applications, - FileService fileService) { - if (CollUtil.isEmpty(applications)) { - return Collections.emptyList(); - } - return applications.stream().map(app -> convertApp(app, fileService)).collect(Collectors.toList()); - } - - private static ProvincialApplicationDTO convertApp(ProjectApplication projectApplication, FileService fileService) { - return ProvincialApplicationDTO.builder() - .clouds(convertCloud(projectApplication)) - .isFirst(projectApplication.getIsFirst()) - .applicationName((projectApplication.getApplicationName())) - .applicationCode(StringUtils.isNotBlank(projectApplication.getAppCode()) ? - projectApplication.getAppCode() : projectApplication.getRelatedExistsApplicationCode()) - .relatedExistsApplication(projectApplication.getRelatedExistsApplication()) - .applicationType(2) - .buildLevel(projectApplication.getBuildLevel()) - .isUniteBuild(projectApplication.getIsUniteBuild()) - .unionBuildKind(projectApplication.getUnionBuildKind()) - .applicationSummary(projectApplication.getApplicationSummary()) - .applicationRemark(projectApplication.getApplicationRemark()) - .isFiveDomain(projectApplication.getIsDigitalModification()) - .fiveDomain(projectApplication.getDigitalModification()) - .bizDomain(projectApplication.getBizDomain()) - .isBizCooperate(projectApplication.getIsBizCooperate()) - .userRange(projectApplication.getUsesRangeRemark()) - .useGovCloud(projectApplication.getUseGovCloud()) - .nationalITSpec(projectApplication.getNationalItSpec()) - .netEnv(String.valueOf(projectApplication.getNetEnv())) - .secrecyGrade(projectApplication.getSecrecyGrade()) - .passwordGrade(projectApplication.getPasswordGrade()) - .accountAppName(projectApplication.getAccountAppName()) - .brainAccountAppName(projectApplication.getDomainBrainAccount()) - .useCommonData(projectApplication.getUseCommonData()) - .dataName(projectApplication.getDataName()) - .commonComponents(projectApplication.getCommonComponents()) - .useCommonComponent(projectApplication.getUseCommonComponent()) - .isProduceCommonComponent(projectApplication.getProduceCommonComponent()) - .produceCommonComponent(projectApplication.getProduceCommonComponents()) - .publishSide(projectApplication.getPublishSide()) - .isS2(projectApplication.getIsAccountAppName()) - .accountAppName(projectApplication.getAccountAppName()) - .applicationEstimateFile(convertFile(projectApplication.getApplicationEstimateFile(), fileService)) - .cooperativeUnit(projectApplication.getBizCooperateInfo()) - .build(); - } - - private static String convertFile(String applicationEstimateFile, FileService fileService) { - try { - JSONArray jsonArrays = JSON.parseArray(applicationEstimateFile); - List files = jsonArrays.stream().map(json -> { - JSONObject fileJson = (JSONObject) JSON.toJSON(json); - Long fileId = fileJson.getLong("id"); - String fileName = fileJson.getString("originalFileName"); - Map fileMap = fileService.findUrlById(Arrays.asList(fileId)); - String url = fileMap.get(fileId); - url = removeExpire(url); - FileDTO file = new FileDTO(); - file.setFileId(String.valueOf(fileId)); - file.setFileName(fileName); - file.setAccessUrl(url); - return file; - }).collect(Collectors.toList()); - return JSON.toJSONString(files); - } catch (Exception e) { - log.info("转换省局上传 文件出错 {}", e.getMessage()); - } - return null; - } - - /** - * 去除掉 oss链接的超时时间 - * - * @param url - * @return - */ - private static String removeExpire(String url) { - if (StringUtils.isNotBlank(url)) { - String s = "Expires"; - return url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY); - } - return StringUtils.EMPTY; - } - - //立项依据的文件格式不一样 - private static String convertBasicFile(String applicationEstimateFile, FileService fileService) { - try { - List files = Lists.newArrayList(); - JSONArray jsonArrays = JSON.parseArray(applicationEstimateFile); - jsonArrays.forEach(json -> { - JSONObject fileJson = (JSONObject) JSON.toJSON(json); - JSONArray fileList = fileJson.getJSONArray("fileList"); - fileList.forEach(f -> { - JSONObject fJson = (JSONObject) JSON.toJSON(f); - Long fileId = fJson.getLong("id"); - String fileName = fJson.getString("originalFileName"); - Map fileMap = fileService.findUrlById(Lists.newArrayList(fileId)); - String url = fileMap.get(fileId); - url = removeExpire(url); - FileDTO file = new FileDTO(); - file.setFileId(String.valueOf(fileId)); - file.setFileName(fileName); - file.setAccessUrl(url); - files.add(file); - }); - }); - return JSON.toJSONString(files); - } catch (Exception e) { - log.info("转换省局上传 basic文件出错 {}", e.getMessage()); - } - return null; - } - - private static List convertCloud(ProjectApplication projectApplication) { - return Lists.newArrayList(ProvincialApplicationDTO.Cloud.builder() - .cloudType(projectApplication.getCloudsType()) - .cloudNums(projectApplication.getCloudsNumber()) - .cloudBasicSpec(projectApplication.getCloudsFoundationSpecifications()) - .cloudUseDescription(projectApplication.getCloudsDescription()) - .build()); - } - -} 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 deleted file mode 100644 index 823e3c1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ /dev/null @@ -1,574 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.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.helper.UserInfoHelper; -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.projectdeclared.model.dto.*; -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.*; -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.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * @Classname ContructionManage - * @Description - * @Date 2023/5/29 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ConstructionManage { - - private final IProjectService projectService; - private final UserInfoHelper userInfoHelper; - - private final IPurchaseService purchaseService; - - private final IContractService contractService; - - private final IPaymentPlanService paymentPlanService; - - private final IPreInsAcceptancePersonService acceptancePersonService; - - private final StateMachineUtils stateMachineUtils; - - /** - * 待采购的-项目列表 - * - * @param req - * @return - */ - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //建设中状态 - query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - query.isNull(Project::getContractAmount); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.orderByAsc(Project::getTransactionTime); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - 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); - } - - /** - * 已完善合同信息的列表 - * @param req - * @return - */ - public PageVo projectlistPerfect(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //建设中状态以后的 都是 - query.and(q1 -> q1.gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) - .or(q2 -> q2.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) - .isNotNull(Project::getContractAmount))); - query.eq(Project::getNewest, Boolean.TRUE); - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.orderByAsc(Project::getUpdateOn); - Page page = projectService.page(req.page(), query); - - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - List projects = page.getRecords(); - List projectCodes = projects.stream().map(Project::getProjectCode) - .collect(Collectors.toList()); - List paymentPlans = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .in(PaymentPlan::getProjectCode, projectCodes)); - Map> paymentMap = paymentPlans.stream() - .collect(Collectors.groupingBy(PaymentPlan::getProjectCode)); - - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectContractListVO item = BeanUtil.copyProperties(w,ProjectContractListVO.class); - item.setBuildOrg(w.getBuildOrgName()); - item.setSupplemented(checkIsSupplement(w,paymentMap)); - return item; - }); - return PageVo.of(records, page.getTotal()); - } - - /** - * 判断 是否需要补充 - * @param w - * @param paymentMap - * @return - */ - private Boolean checkIsSupplement(Project w, Map> paymentMap) { - if(paymentMap.containsKey(w.getProjectCode())){ - List paymentPlans = paymentMap.get(w.getProjectCode()); - if(CollUtil.isEmpty(paymentPlans)){ - return Boolean.FALSE; - } - for (PaymentPlan plan : paymentPlans){ - if(Objects.isNull(plan.getActualPaymentAmount())){ - return Boolean.FALSE; - } - } - return Boolean.TRUE; - } - return Boolean.FALSE; - } - - public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待采购状态 - query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - query.isNull(Project::getContractAmount); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - query.orderByAsc(Project::getTransactionTime); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = Lists.newArrayList(); - if (CollUtil.isNotEmpty(records)) { - List projectIds = records.stream().map(Project::getId).collect(Collectors.toList()); - - List purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, projectIds)); - Map purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v)); - - collect = records.stream().map(r -> { - DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - exportDTO.setApprovedAmount(r.getApprovalAmount()); - exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - if (purchaseMap.containsKey(r.getId())) { - Purchase purchase = purchaseMap.get(r.getId()); - exportDTO.setTransactionAmount(purchase.getTransactionAmount()); - exportDTO.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - } - return exportDTO; - }).collect(Collectors.toList()); - } - - String fileName = "合同备案项目列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * 获取合同备案详情 - * - * @param projectId - * @return - */ - public ContractVO detailContractByProjectId(Long projectId) { - Project project = projectService.getNewProject(projectId); - if(Objects.isNull(project)){ - return null; - } - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .eq(Contract::getProjectCode, project.getProjectCode()) - .last(BizConst.LIMIT_1)); - - ContractVO vo = BeanUtil.copyProperties(contract, ContractVO.class); - - List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .eq(PaymentPlan::getProjectCode, project.getProjectCode()) - .orderByAsc(PaymentPlan::getPaymentTime)); - - if (CollUtil.isNotEmpty(payments)) { - vo.setPayments(convertPayments(payments, contract.getTotalAmount())); - } - - return vo; - } - - private List convertPayments(List payments, BigDecimal totalAmount) { - if (CollUtil.isEmpty(payments)) { - return Collections.emptyList(); - } - return payments.stream().map(p -> { - PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); - vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" - : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) - .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); - return vo; - }) - .collect(Collectors.toList()); - } - - /** - * 填写合同信息 - * - * @param dto - * @return - */ - public String submitContract(ContractSaveDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Long projectId = dto.getProjectId(); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); - Project project = projectService.getNewProject(dto.getProjectId()); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 采购结果备案 - VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); - - Contract contractEntity = new Contract(); - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .eq(Contract::getProjectId, projectId) - .last(BizConst.LIMIT_1)); - - BeanUtil.copyProperties(dto, contractEntity); - if (Objects.isNull(contract)) { - contractEntity.setCreateOn(LocalDateTime.now()); - contractEntity.setCreateBy(employeeCode); - } else { - contractEntity.setId(contract.getId()); - } - contractEntity.setProjectId(projectId); - contractEntity.setProjectCode(project.getProjectCode()); - if (contractService.saveOrUpdate(contractEntity)) { - //存 付款计划信心 - if (Objects.nonNull(dto.getPayments())) { - //先删除 - paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class) - .eq(PaymentPlan::getProjectId, projectId)); - if (CollUtil.isNotEmpty(dto.getPayments())) { - List payments = dto.getPayments().stream().map(d -> { - PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class); - plan.setProjectId(projectId); - plan.setProjectCode(project.getProjectCode()); - plan.setCreateOn(LocalDateTime.now()); - plan.setUpdateOn(LocalDateTime.now()); - plan.setCreateBy(employeeCode); - plan.setUpdateBy(employeeCode); - return plan; - }).collect(Collectors.toList()); - - paymentPlanService.saveBatch(payments); - } - } - } - - //判断下 如果和初验都完成了 才进入下一阶段 - if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { - //进入到下一状态 - stateMachineUtils.pass(project); - } - project.setUpdateOn(LocalDateTime.now()); - if (Objects.nonNull(dto.getDeliveryTime())) { - project.setDeliveryTime(dto.getDeliveryTime()); - } - if (Objects.nonNull(dto.getTotalAmount())) { - project.setContractAmount(dto.getTotalAmount()); - } - projectService.updateById(project); - - return "填写成功"; - } - - /** - * 待初验项目列表 - * - * @param req - * @return - */ - public PageVo preProjectlist(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //建设中状态 - query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - //交货时间 排序 - query.isNotNull(Project::getDeliveryTime); - query.orderByAsc(Project::getDeliveryTime); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setApprovalDate(w.getApprovalDate()); - 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); - } - - public void exportPreList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待采购状态 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - //交货时间 排序 - query.isNotNull(Project::getDeliveryTime); - query.orderByAsc(Project::getDeliveryTime); - List records = projectService.list(query); - - List collect = Lists.newArrayList(); - if (CollUtil.isNotEmpty(records)) { - AtomicInteger serialNumber = new AtomicInteger(0); - collect = records.stream().map(r -> { - DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - 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()); - } - - String fileName = "合同备案项目列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * 查询初验信息 - * - * @param projectId - * @return - */ - public PreInsVO detailPreInsByProjectId(Long projectId) { - Project project = projectService.getById(projectId); - PreInsVO vo = new PreInsVO(); - vo.setProjectId(projectId); - vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials()); - vo.setIsCompletedLogCollection(project.getIsCompletedLogCollection()); - vo.setActualPerformanceIndicators(project.getActualPerformanceIndicators()); - LambdaQueryWrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .eq(PreInsAcceptancePerson::getProjectId, projectId) - .orderByAsc(PreInsAcceptancePerson::getCreateOn); - List acceptancePersons = acceptancePersonService.list(query); - vo.setAcceptancePersons(convertPersons(acceptancePersons)); - return vo; - } - - private List convertPersons(List acceptancePersons) { - if (CollUtil.isEmpty(acceptancePersons)) { - return Collections.emptyList(); - } - return acceptancePersons.stream() - .map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)) - .collect(Collectors.toList()); - } - - /** - * 填写初验信息 - * - * @param dto - * @return - */ - public String submitPreIns(PreInsSaveDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Long projectId = dto.getProjectId(); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); - Project project = projectService.getNewProject(dto.getProjectId()); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 采购结果备案 - VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); - - //初验人员 - if (Objects.nonNull(dto.getAcceptancePersons())) { - //先删除 - acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .eq(PreInsAcceptancePerson::getProjectId, projectId)); - if (CollUtil.isNotEmpty(dto.getAcceptancePersons())) { - List persons = dto.getAcceptancePersons().stream().map(d -> { - PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class); - person.setProjectId(projectId); - person.setCreateOn(LocalDateTime.now()); - person.setUpdateOn(LocalDateTime.now()); - person.setCreateBy(employeeCode); - person.setUpdateBy(employeeCode); - return person; - }).collect(Collectors.toList()); - - acceptancePersonService.saveBatch(persons); - } - } - - - //判断下 如果和初验都完成了 才进入下一阶段 - if (Objects.nonNull(project.getDeliveryTime())) { - //进入到下一状态 - stateMachineUtils.pass(project); - } - project.setUpdateOn(LocalDateTime.now()); - project.setPreliminaryInspectionMaterials(dto.getPreliminaryInspectionMaterials()); - project.setIsCompletedLogCollection(dto.getIsCompletedLogCollection()); - project.setActualPerformanceIndicators(dto.getActualPerformanceIndicators()); - projectService.updateById(project); - - return "填写成功"; - } - - /** - * 补充项目 合同 实际支付信息 - * @param plans - * @return - */ - public String supplement(List plans) { - if(CollUtil.isEmpty(plans)){ - throw new BizException("入参"); - } - - for(PaymentPlanSupplementDTO plan : plans){ - PaymentPlan paymentPlan = paymentPlanService.getById(plan.getId()); - VUtils.isTrue(Objects.isNull(paymentPlan)) - .throwMessage("保存失败 该支付信息不存在 :" + plan.getId()); - VUtils.isTrue(Objects.nonNull(paymentPlan.getActualPaymentAmount())) - .throwMessage("保存失败 该支付信息已经保存过 实际支付金额 :" + plan.getId() + "," + paymentPlan.getActualPaymentAmount()); - paymentPlan.setActualPaymentAmount(plan.getActualPaymentAmount()); - paymentPlanService.updateById(paymentPlan); - } - - return "保存成功"; - } -} 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 deleted file mode 100644 index 31e7cd3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ /dev/null @@ -1,369 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.NdDateUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -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.projectdeclared.model.dto.ConstructionPlanExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ContructionSuggestionsDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq; -import com.ningdatech.pmapi.projectdeclared.service.IConstrctionSuggestionsService; -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.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -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.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.util.LoginUserUtil; -import com.wflow.bean.entity.WflowModels; -import com.wflow.exception.BusinessException; -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 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.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -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; - -/** - * @Classname DeclaredProjectManage - * @Description - * @Date 2023/2/1 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ConstructionPlanManage { - - private final IProjectService projectService; - private final ProcessInstanceService processService; - private final ProcessModelService processModelService; - private final StateMachineUtils stateMachineUtils; - private final IProjectInstService projectInstService; - private final ProjectLibManage projectLibManage; - private final UserInfoHelper userInfoHelper; - private final DefaultDeclaredProjectManage declaredProjectManage; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - private final NoticeManage noticeManage; - private final RegionCacheHelper regionCacheHelper; - private final HistoryService historyService; - - private final IConstrctionSuggestionsService constrctionSuggestionsService; - /** - * 建设方案 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - - ProjectDTO projectInfo = dto.getProjectInfo(); - Long projectInfoId = projectInfo.getId(); - VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败 缺少项目ID!"); - Project oldProject = projectService.getById(projectInfoId); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); - - // 判断 项目当前状态 是不是 方案待申报 - VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(oldProject.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) - .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); - - if(StringUtils.isNotBlank(user.getRegionCode())){ - projectInfo.setAreaCode(user.getRegionCode()); - projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - } - - projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); - projectInfo.setBuildOrgName(user.getEmpPosUnitName()); - - // 项目名称去重 - if(StringUtils.isNotBlank(projectInfo.getProjectName()) && !projectInfo.getProjectName() - .equals(oldProject.getProjectName())){ - projectInfo.setProjectCode(oldProject.getProjectCode()); - defaultDeclaredProjectManage.checkDuplication(projectInfo); - } - //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 - defaultDeclaredProjectManage.checkAmount(projectInfo); - - //如果主管单位没有 那么主管单位就是自己 - if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); - } - - Project constructProject = new Project(); - BeanUtils.copyProperties(projectInfo,constructProject); - constructProject.setStatus(oldProject.getStatus()); - constructProject.setStage(oldProject.getStage()); - - String regionCode = user.getRegionCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 建设申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 建设申报流程配置", regionCode)); - } - - //如果被禁用了的话 直接跳过 进入到下一个状态 - if(model.getIsStop()){ - //被禁用了 调2次状态机 - stateMachineUtils.pass(constructProject); - stateMachineUtils.pass(constructProject); - constructProject.setUpdateOn(LocalDateTime.now()); - projectService.updateById(constructProject); - return "因为建设方案流程被禁用了 直接跳过!"; - } - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params, oldProject,dto); - // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); - String instanceId = processService.startProcessLs(model, params, orgModelMap); - log.info("建设方案项目申报成功 【{}】", instanceId); - - // 保存建设项目相关 - Project buildProject = new Project(); - if(dto.getRestart()){ - //如果是重新提交 不用生成新版本 前面已经生成过了 - buildProject = contructionPlanModifyProject(oldProject, instanceId); - }else{ - buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject); - } - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - private Project contructionPlanModifyProject(Project project, String instanceId) { - stateMachineUtils.pass(project); - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - projectService.updateById(project); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - - return project; - } - - /** - * 驳回 重新提交建设方案 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String restartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) - .throwMessage("获取登录用户失败!"); - - ProjectDTO projectDto = dto.getProjectInfo(); - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getById(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); - //直接先到待方案审批 - Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, - ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),Boolean.TRUE); - dto.getProjectInfo().setId(project.getId()); - dto.setRestart(Boolean.TRUE); - return startTheProcess(dto); - } - - /** - * 提交建设方案项目 时 更新信息 - * - * @param project - * @param instanceId - */ - private void modifyProject(Project project, String instanceId, String constructionPlanFile) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - project.setConstructionPlanFile(constructionPlanFile); - //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); - projectService.updateById(project); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setInstType(InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInstService.save(projectInst); - } catch (Exception e) { - log.error("提交建设方案 项目信息修改 错误 ", e); - throw new BusinessException("提交建设方案 项目信息修改 错误 :" + e.getMessage()); - } - } - - /** - * 查项目 - * - * @param planReq - * @return - */ - public PageVo projectLibList(ConstrctionPlanListReq planReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); - return projectLibManage.projectLibList(req); - } - - public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); - req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - Page page = projectService.page(req.page(), query); - List records = page.getRecords(); - - - List collect = records.stream().map(r -> { - ConstructionPlanExportDTO exportDTO = new ConstructionPlanExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - return exportDTO; - }).collect(Collectors.toList()); - for (int i = 0; i < collect.size(); i++) { - collect.get(i).setSerialNumber(i + 1); - } - String fileName = "建设方案申报项目列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * 专家建设方案建议 暂存 等流程成功后 保存到项目 - * @param dto - */ - public void constructionSuggestions(ContructionSuggestionsDTO dto) { - String instanceId = dto.getInstanceId(); - - Project project = projectService.getProjectByCode(dto.getProjectCode()); - if(Objects.isNull(project)){ - throw new BizException("该项目不存在!"); - } - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .eq(ProjectInst::getProjectId,project.getId()) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(projectInst)){ - throw new BizException("该流程的项目关联信息不存在!"); - } - - if(!InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(projectInst.getInstType())){ - throw new BizException("此流程不是建设方案流程 保存失败!"); - } - - ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto,ProjectConstructionSuggestions.class); - ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) - .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) - .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(pcs)){ - saveEntity.setId(pcs.getId()); - } - saveEntity.setInstanceId(instanceId); - constrctionSuggestionsService.saveOrUpdate(saveEntity); - } - -} 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 deleted file mode 100644 index 5444034..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ /dev/null @@ -1,505 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -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; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.google.common.collect.Lists; -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.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -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.gov.manage.GovProjectCollectionManage; -import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; -import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; -import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; -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; -import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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; -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; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * @Classname DeclaredProjectManage - * @Description - * @Date 2023/2/1 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class DeclaredProjectManage { - - private final IProjectService projectService; - - private final ProjectLibManage projectLibManage; - - private final IProjectDraftService projectDraftService; - - private final ProcessInstanceService processService; - - private final ProcessModelService processModelService; - - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - - private final NoticeManage noticeManage; - - private final UserInfoHelper userInfoHelper; - - private final RegionCacheHelper regionCacheHelper; - - private final ProjectIrsManage projectIrsManage; - - private final GovProjectCollectionManage collectionManage; - - @Value("${spring.profiles.active}") - private String active; - - /** - * 新项目 启动实例 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - ProjectDTO projectInfo = dto.getProjectInfo(); - - if(StringUtils.isNotBlank(user.getRegionCode())){ - projectInfo.setAreaCode(user.getRegionCode()); - projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - } - - projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); - projectInfo.setBuildOrgName(user.getEmpPosUnitName()); - - //项目名称去重 - defaultDeclaredProjectManage.checkDuplication(projectInfo); - //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 - defaultDeclaredProjectManage.checkAmount(projectInfo); - - //写死 是否有主管单位 - projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); - projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); - - //如果主管单位没有 那么主管单位就是自己 - if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); - } - - //如果是重新提交的话 判断下 项目是否存在 - if(Objects.nonNull(projectInfo.getId())){ - //新申报的项目不允许带项目id - projectInfo.setId(null); - } - - String regionCode = user.getRegionCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到单位流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); - } - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); - dto.getFormData().putAll( - JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - }) - ); - params.setFormData(dto.getFormData()); - //开始申报 - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Project project = new Project(); - BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); - log.info("申报项目成功 【{}】", instanceId); - - //如果是重新提交的话 判断下 项目是否存在 - //保存项目相关 - Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); - if(Objects.nonNull(projectInfo.getDraftId())){ - //如果是草稿箱提交 删除对应的草稿箱 - projectDraftService.removeById(projectInfo.getDraftId()); - } - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - - /** - * 重新提交 启动实例 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String reStartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) - .throwMessage("获取登录用户失败!"); - String employeeCode = user.getEmployeeCode(); - ProjectDTO projectDto = dto.getProjectInfo(); - projectDto.setAreaCode(user.getRegionCode()); - projectDto.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - projectDto.setBuildOrgCode(user.getEmpPosUnitCode()); - projectDto.setBuildOrgName(user.getEmpPosUnitName()); - - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getById(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - - //项目名称去重 - if(StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())){ - projectDto.setProjectCode(projectInfo.getProjectCode()); - defaultDeclaredProjectManage.checkDuplication(projectDto); - } - - //写死 是否有主管单位 - projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); - projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); - - //如果主管单位没有 那么主管单位就是自己 - if(CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())){ - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); - projectDto.setSuperOrgCode(user.getEmpPosUnitCode()); - projectDto.setSuperOrg(user.getEmpPosUnitName()); - } - - //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 - defaultDeclaredProjectManage.checkAmount(projectDto); - - String regionCode = projectInfo.getAreaCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到单位流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); - } - - //首先要判断 项目当前状态 是不是 单位内部拒绝 - VUtils.isTrue(!ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(projectInfo.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - - //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,dto); - - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); - log.info("重新申报项目成功 【{}】", instanceId); - - //保存项目相关 - Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - public PageVo pageDraft(DeclaredProjectListParamDTO params) { - Long userId = LoginUserUtil.getUserId(); - Page page = params.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectDraft.class) - .eq(ProjectDraft::getUserId,userId) - .ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime()) - .le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime()) - .eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType()) - .eq(Objects.nonNull(params.getProjectYear()), ProjectDraft::getProjectYear, params.getProjectYear()) - .eq(Objects.nonNull(params.getProjectStage()), ProjectDraft::getStage, params.getProjectStage()) - .eq(Objects.nonNull(params.getProjectStatus()), ProjectDraft::getStatus, params.getProjectStatus()) - .like(StringUtils.isNotBlank(params.getProjectName()), ProjectDraft::getProjectName, params.getProjectName()) - .orderByDesc(ProjectDraft::getUpdateOn); - projectDraftService.page(page, wrapper); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - List res = page.getRecords().stream().map(record -> { - ProjectDraftVO vo = new ProjectDraftVO(); - BeanUtils.copyProperties(record, vo); - vo.setBizDomain(Objects.nonNull(record.getBizDomain()) ? String.valueOf(record.getBizDomain()) : StringUtils.EMPTY); - return vo; - }).collect(Collectors.toList()); - return PageVo.of(res, page.getTotal()); - } - - public ProjectDraftVO draftDatail(Long id) { - ProjectDraft draft = projectDraftService.getById(id); - ProjectDraftVO vo = new ProjectDraftVO(); - BeanUtils.copyProperties(draft, vo); - vo.setBizDomain(Objects.nonNull(draft.getBizDomain()) ? String.valueOf(draft.getBizDomain()) : StringUtils.EMPTY); - if(StringUtils.isNotBlank(draft.getProjectApplicationList())){ - vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class)); - } - if(StringUtils.isNotBlank(draft.getDynamicForm())){ - vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class)); - } - return vo; - } - - /** - * 保存至草稿箱 - * - * @param dto - * @return - */ - public Long saveToDraft(ProjectDraftSaveDTO dto) { - Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - - ProjectDTO projectInfo = dto.getProjectInfo(); - ProjectDraft draft = new ProjectDraft(); - BeanUtils.copyProperties(projectInfo, draft); - //写死 是否有主管单位 - draft.setIsHigherSuperOrg(CommonEnum.YES.getCode()); - draft.setIsSuperOrg(CommonEnum.YES.getCode()); - draft.setUserId(String.valueOf(userId)); - draft.setBuildOrgCode(user.getEmpPosUnitCode()); - draft.setBuildOrgName(user.getEmpPosUnitName()); - draft.setAreaCode(user.getRegionCode()); - - if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ - draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); - } - if(CollUtil.isNotEmpty(projectInfo.getApplicationList())){ - draft.setProjectApplicationList(JSON.toJSONString(projectInfo.getApplicationList())); - } - if (Objects.isNull(draft.getId())) { - draft.setCreateOn(LocalDateTime.now()); - }else{ - ProjectDraft old = projectDraftService.getById(draft.getId()); - if(Objects.isNull(old)){ - draft.setCreateOn(LocalDateTime.now()); - } - } - draft.setUpdateOn(LocalDateTime.now()); - draft.setUserId(String.valueOf(userId)); - projectDraftService.saveOrUpdate(draft); - return draft.getId(); - } - - /** - * 项目列表 - * @param req - * @return - */ - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 - preQuery(query,user); - query.eq(Project::getNewest,Boolean.TRUE); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = BeanUtil.copyProperties(w,ProjectLibListItemVO.class); - return item; - }); - return PageVo.of(records, total); - } - - //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 - private void preQuery(LambdaQueryWrapper query,UserFullInfoDTO user) { - //如果当前登录是单位管理员 - if(user.getIsOrgAdmin()){ - query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) - .eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()) - .or(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()))); - }else{ - //否则 只能看到 非预审 并且 - query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode())); - } - } - - public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 - preQuery(query,user); - query.eq(Project::getNewest,Boolean.TRUE); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = records.stream().map(r -> { - DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - return exportDTO; - }).collect(Collectors.toList()); - String fileName = "项目申报列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * 查询 核心业务 - * @param businessName - * @return - */ - public JSONObject bizList(String businessName,Integer limit, Integer page,String orgCode) { - 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 = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_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)){ - if(StringUtils.isNotBlank(orgCode)){ - String[] orgCodes = orgCode.split(StrPool.COMMA); - JSONArray finalArray = new JSONArray(); - for(String og : orgCodes){ - JSONObject res = projectIrsManage.searchCoreBiz(businessName,og,limit,page); - if(Objects.nonNull(res)){ - JSONArray dataArray = res.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isNotEmpty(dataArray)){ - finalArray.addAll(dataArray); - } - } - } - jsonObject.put("data",finalArray); - jsonObject.put("total",finalArray.size()); - }else{ - jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); - } - } - return jsonObject; - } - - /** - * 预审失败的时候 可以删除项目 - * @param projectCode - */ - @Transactional - public String removeProject(String projectCode) { - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("该项目不存在"); - VUtils.isTrue(Objects.isNull(project.getStatus()) || - !ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode().equals(project.getStatus())) - .throwMessage("不是预审不通过 状态 不能删除!"); - - return collectionManage.removeProject(Lists.newArrayList(projectCode)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java deleted file mode 100644 index 682013e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ /dev/null @@ -1,352 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Maps; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import com.ningdatech.pmapi.projectdeclared.service.IDeclaredStatisticsService; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.bean.entity.WflowOrgModels; -import com.wflow.enums.OrgTypeEnum; -import com.wflow.enums.ProcessDefTypeEnum; -import com.wflow.exception.BusinessException; -import com.wflow.service.OrgProcdefService; -import com.wflow.workflow.bean.dto.OrgInfoDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import com.wflow.workflow.bean.vo.ProcessStartParamsVo; -import com.wflow.workflow.service.ProcessModelService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname DefaultDeclaredProjectManage - * - * @Description - * @Date 2023/2/14 17:12 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class DefaultDeclaredProjectManage { - - private final IProjectService projectService; - - private final UserInfoHelper userInfoHelper; - - private final ProcessModelService processModelService; - private final OrgProcdefService orgProcdefService; - - private final IDeclaredStatisticsService statisticsService; - - /** - * 公共的发起流程方法 - */ - public void startProcess(ProjectDTO projectDTO,UserFullInfoDTO user,Integer processType){ - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, user.getRegionCode()) - .eq(WflowModels::getProcessType, processType) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到对应流程配置", user.getRegionCode()); - throw new BusinessException(String.format("此 【%s】区域找不到对应流程配置", user.getRegionCode())); - } - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(buildUser(user.getEmployeeCode())); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - BeanUtils.copyProperties(projectDTO, conditionDto); - Map formData = Maps.newHashMap(); - formData.putAll( - JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - }) - ); - params.setFormData(formData); - - } - - //项目名称去重 - public void checkDuplication(ProjectDTO project){ - VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectName,project.getProjectName()) - .eq(Project::getNewest,Boolean.TRUE) - .ne(Objects.nonNull(project.getProjectCode()),Project::getProjectCode,project.getProjectCode())) > 0) - .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); - } - - public void checkAmount(ProjectDTO projectInfo) { - if(Objects.nonNull(projectInfo.getDeclareAmount())){ - BigDecimal declareAmount = projectInfo.getDeclareAmount(); - BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); - BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); - BigDecimal bankLendingAmount = projectInfo.getDeclareBankLendingAmount(); - BigDecimal haveAmount = projectInfo.getDeclareHaveAmount(); - BigDecimal otherAmount = projectInfo.getDeclareOtherAmount(); - BigDecimal totalAmount = govSuperFinanceAmount - .add(govOwnFinanceAmount).add(bankLendingAmount).add(haveAmount).add(otherAmount); - VUtils.isTrue(declareAmount.compareTo(totalAmount) != 0) - .throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】",declareAmount,totalAmount)); - - //判断 年度计划金额 如果开着的话 - if(Objects.nonNull(projectInfo.getAnnualPlanAmount())){ - BigDecimal annualPlanAmount = projectInfo.getAnnualPlanAmount(); - - VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0",annualPlanAmount)); - VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】",annualPlanAmount,declareAmount)); - - BigDecimal annualGovSuperAmount = projectInfo.getAnnualPlanGovSuperiorFinanceAmount(); - BigDecimal annualOwnSuperAmount = projectInfo.getAnnualPlanGovOwnFinanceAmount(); - BigDecimal annualBankLendingAmount = projectInfo.getAnnualPlanBankLendingAmount(); - BigDecimal annualHaveAmount = projectInfo.getAnnualPlanHaveAmount(); - BigDecimal anualOtherAmount = projectInfo.getAnnualPlanOtherAmount(); - BigDecimal totalAnnual = annualGovSuperAmount - .add(annualOwnSuperAmount).add(annualBankLendingAmount).add(annualHaveAmount).add(anualOtherAmount); - VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】",annualPlanAmount,totalAnnual)); - } - } - } - - public ProcessInstanceUserDto buildUser(String employeeCode){ - UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - - VUtils.isTrue(Objects.isNull(userInfoDetail)) - .throwMessage(String.format("【%s】获取不到用户!",employeeCode)); - - return ProcessInstanceUserDto.builder() - .userId(String.valueOf(userInfoDetail.getEmployeeCode())) - .userName(userInfoDetail.getRealName()) - .orgCode(userInfoDetail.getEmpPosUnitCode()) - .orgName(userInfoDetail.getEmpPosUnitName()) - .build(); - } - - public Map buildOrgModelMap(String employeeCode,Project project) { - Map orgMap = new HashMap<>(); - - // 查出所有的单位流程配置 - List orgModelsList = orgProcdefService.list(); - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - if(Objects.isNull(userFullInfo)){ - log.warn("取不到员工 返回空map"); - return Collections.emptyMap(); - } - - String startOrgCode = userFullInfo.getEmpPosUnitCode(); - String startOrgName = userFullInfo.getEmpPosUnitName(); - String startOrgParentCode; - String startOrgParentName; - // 如果申报时 上级主管单位,由该单位自己审核 - if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ - startOrgParentCode = startOrgCode; - startOrgParentName = startOrgName; - }else { - startOrgParentCode = project.getSuperOrgCode(); - startOrgParentName = project.getSuperOrg(); - } - //查询 当前发起人及主管单位所在区域的 单位流程配置 - OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); - startOrgInfoDto.setOrganizationCode(startOrgCode); - startOrgInfoDto.setOrganizationName(startOrgName); - - startOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(startOrgCode) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType())|| - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - OrgInfoDTO parentOrgInfoDto = new OrgInfoDTO(); - parentOrgInfoDto.setOrganizationCode(startOrgParentCode); - parentOrgInfoDto.setOrganizationName(startOrgParentName); - parentOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(startOrgParentCode) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); - orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); - - // 如果是指定单位,直接根据流程定义ID放入map - OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); - orgInfoDTO.setOrgModelMap(orgModelsList.stream() - .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); - - //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_LS.equals(project.getAreaCode()) && - CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ - OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); - parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); - parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); - parentLineOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(project.getHigherSuperOrgCode()) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); - } - return orgMap; - } - - public Map buildOrgModelMapUserOrgCode(Project project) { - Map orgMap = new HashMap<>(); - - // 查出所有的单位流程配置 - List orgModelsList = orgProcdefService.list(); - - String startOrgCode = project.getBuildOrgCode(); - String startOrgName = project.getBuildOrgName(); - String startOrgParentCode; - String startOrgParentName; - // 如果申报时 上级主管单位,由该单位自己审核 - if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ - startOrgParentCode = startOrgCode; - startOrgParentName = startOrgName; - }else { - startOrgParentCode = project.getSuperOrgCode(); - startOrgParentName = project.getSuperOrg(); - } - //查询 当前发起人及主管单位所在区域的 单位流程配置 - OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); - startOrgInfoDto.setOrganizationCode(startOrgCode); - startOrgInfoDto.setOrganizationName(startOrgName); - - startOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(startOrgCode) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - OrgInfoDTO parentOrgInfoDto = new OrgInfoDTO(); - parentOrgInfoDto.setOrganizationCode(startOrgParentCode); - parentOrgInfoDto.setOrganizationName(startOrgParentName); - parentOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(startOrgParentCode) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); - orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); - - // 如果是指定单位,直接根据流程定义ID放入map - OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); - orgInfoDTO.setOrgModelMap(orgModelsList.stream() - .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); - - //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_LS.equals(project.getAreaCode()) && - CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ - OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); - parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); - parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); - parentLineOrgInfoDto.setOrgModelMap(orgModelsList.stream() - .filter(v -> v.getOrgCode().equals(project.getHigherSuperOrgCode()) - && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || - ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || - ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) - .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - - orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); - } - return orgMap; - } - - //根据提交者的单位 - public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ - //查此人建设单位的项目 - return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); - } - - //根据提交者的区域 他是区管或者超管 - public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ - //查此人建设单位的项目 - return statisticsService.getRegionStatistics(user.getRegionCode(),year); - } - - /** - * 把条件值放入工作流 用于判断条件 根据dto - * @param params - * @param dto - */ - public void buildCondition(ProcessStartParamsVo params, DefaultDeclaredDTO dto) { - //放入条件判断的项目字段 - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); - dto.getFormData().putAll( - JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - }) - ); - params.setFormData(dto.getFormData()); - } - - /** - * 把条件值放入工作流 用于判断条件 根据d项目实体 - * @param params - * @param projectInfo - */ - public void buildCondition(ProcessStartParamsVo params, Project projectInfo) { - //放入条件判断的项目字段 - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - BeanUtils.copyProperties(projectInfo, conditionDto); - params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - })); - } - - public void buildCondition(ProcessStartParamsVo params, Project projectInfo,DefaultDeclaredDTO dto) { - //放入条件判断的项目字段 优先取dto的 再取项目的 - ProjectDTO pdto = dto.getProjectInfo(); - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - conditionDto.setProjectId(projectInfo.getId()); - conditionDto.setDeclareAmount(Objects.nonNull(pdto) && Objects.nonNull(pdto.getDeclareAmount()) - ?pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); - conditionDto.setIsDigitalReform(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsDigitalReform()) - ?pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); - conditionDto.setIsTemporaryAugment(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsTemporaryAugment()) - ?pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); - conditionDto.setBizDomain(Objects.nonNull(pdto) && Objects.nonNull(pdto.getBizDomain()) - ?pdto.getBizDomain() : projectInfo.getBizDomain()); - params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - })); - } -} 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 deleted file mode 100644 index ca8d5ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ /dev/null @@ -1,330 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.google.common.collect.Lists; -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.enumeration.ProjectProcessStageEnum; -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.projectdeclared.model.dto.DeclaredProjectExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.DelayedApplyVO; -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.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.util.LoginUserUtil; -import com.wflow.bean.entity.WflowModels; -import com.wflow.contants.HisProInsEndActId; -import com.wflow.exception.BusinessException; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * @Classname DelayedManage - * @Description - * @Date 2023/5/29 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class DelayedApplyManage { - - private final IProjectService projectService; - private final UserInfoHelper userInfoHelper; - private final ProcessModelService processModelService; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - private final ProcessInstanceService processInstanceService; - private final ProjectLibManage projectLibManage; - private final NoticeManage noticeManage; - private final IProjectInstService projectInstService; - private final HistoryService historyService; - - private final INdProjectDelayApplyService projectDelayApplyService; - - /** - * 延期的-项目列表 - * @param req - * @return - */ - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //待终验 并且已经过期 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); - query.eq(Project::getNewest,Boolean.TRUE); - query.isNotNull(Project::getApprovalDate); - query.isNotNull(Project::getBuildCycle); - query.orderByAsc(Project::getApprovalDate); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setApprovalDate(w.getApprovalDate()); - item.setBuildCycle(StringUtils.isNotBlank(w.getBuildCycle()) ? - Integer.valueOf(w.getBuildCycle()) : null); - item.setPlanAcceptanceTime(w.getPlanAcceptanceTime()); - // 判断当前项目是否已经开启了延期申请并且没有审批完成 - ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) - .eq(ProjectDelayApply::getProjectId, w.getId()) - .orderByDesc(ProjectDelayApply::getCreateOn) - .last("limit 1")); - if (Objects.nonNull(delayApply)) { - String instCode = delayApply.getInstanceId(); - // 获取流程实例 - HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instCode) - .singleResult(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode)); - Integer instType = projectInst.getInstType(); - // 延期申请流程还未审核结束 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && - Objects.isNull(newInstance.getEndActivityId())) { - item.setCanDelayApply(Boolean.FALSE); - } - // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && - HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { - item.setCanDelayApply(Boolean.TRUE); - } - } - return item; - }); - return PageVo.of(records, total); - } - - public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待终验 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest,Boolean.TRUE); - query.isNotNull(Project::getApprovalDate); - query.isNotNull(Project::getBuildCycle); - query.orderByAsc(Project::getApprovalDate); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ - collect = records.stream().map(r -> { - DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? - NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); - return exportDTO; - }).collect(Collectors.toList()); - } - - String fileName = "待终验申请项目列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * 延期申请 - * @param dto - * @return - */ - public String delayedApply(DelayedApplyDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Long projectId = dto.getProjectId(); - Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 以终验 - VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 已立项|待终验"); - - VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) - .throwMessage("当前项目还未过期验收"); - - return "申请发起成功"; - } - - /** - * 开启延期申请审批流程 - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String startDelayedApplyProcess(DelayedApplyDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Long projectId = dto.getProjectId(); - Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 以终验 - VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 已立项|待终验"); - - VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) - .throwMessage("当前项目还未过期验收"); - - String regionCode = project.getAreaCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_DELAY.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到延期申请流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到延期申请流程配置", regionCode)); - } - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params, project); - // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); - String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); - log.info("延期申请申报成功 【{}】", instanceId); - - // 保存项目延期实例相关 - projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(project,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - /** - * 查询延期 详情 - * @param projectId - * @return - */ - public DelayedApplyVO detailByProjectId(Long projectId) { - ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) - .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 deleted file mode 100644 index cb6b0c4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.google.common.collect.Lists; -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.enumeration.ProjectProcessStageEnum; -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.projectdeclared.model.dto.DeclaredProjectExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO; -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.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.util.LoginUserUtil; -import com.wflow.bean.entity.WflowModels; -import com.wflow.exception.BusinessException; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * @Classname FinalAcceptanceManage - * @Description 终验 - * @Date 2023/6/2 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class FinalAcceptanceManage { - - private final IProjectService projectService; - private final UserInfoHelper userInfoHelper; - - private final ProcessModelService processModelService; - - private final ProcessInstanceService processInstanceService; - - private final DefaultDeclaredProjectManage declaredProjectManage; - - private final NoticeManage noticeManage; - - private final ProjectLibManage projectLibManage; - - /** - * 待采购的-项目列表 - * @param req - * @return - */ - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //待终验 并且还未过期 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); - query.eq(Project::getNewest,Boolean.TRUE); - query.isNotNull(Project::getApprovalDate); - query.isNotNull(Project::getBuildCycle); - query.orderByAsc(Project::getApprovalDate); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setApprovalDate(w.getApprovalDate()); - item.setBuildCycle(StringUtils.isNotBlank(w.getBuildCycle()) ? - Integer.valueOf(w.getBuildCycle()) : null); - item.setPlanAcceptanceTime(w.getPlanAcceptanceTime()); - return item; - }); - return PageVo.of(records, total); - } - - public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待终验 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest,Boolean.TRUE); - query.isNotNull(Project::getApprovalDate); - query.isNotNull(Project::getBuildCycle); - query.orderByAsc(Project::getApprovalDate); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ - collect = records.stream().map(r -> { - DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? - NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); - return exportDTO; - }).collect(Collectors.toList()); - } - - String fileName = "待终验申请项目列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - - public FinalAcceptanceVO detailByProjectId(Long projectId) { - FinalAcceptanceVO vo = new FinalAcceptanceVO(); - - Project project = projectService.getById(projectId); - vo.setProjectId(projectId); - if(Objects.nonNull(project)){ - vo.setFinalAcceptanceMaterials(project.getFinalAcceptanceMaterials()); - // TODO IRS接口获取 应用信息 - vo.setApps(Collections.emptyList()); - } - - return vo; - } - - /** - * 开启流程 - * @param dto - * @return - */ - public String startProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - - ProjectDTO projectDto = dto.getProjectInfo(); - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); - - String regionCode = projectInfo.getAreaCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); - } - - //首先要判断 项目当前状态 是不是 方案待申报 - VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && - !ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - declaredProjectManage.buildCondition(params, projectInfo); - // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); - String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); - log.info("终验方案项目申报成功 【{}】", instanceId); - - //保存终验项目 - //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.FALSE); - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - /** - * 重新申报 - * @param dto - * @return - */ - public String restartProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - - ProjectDTO projectDto = dto.getProjectInfo(); - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("重新提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("重新提交失败 此项目不存在!"); - VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); - - String regionCode = projectInfo.getAreaCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); - } - - //首先要判断 项目当前状态 是不是 方案待申报 - VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && - !ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - declaredProjectManage.buildCondition(params,projectInfo, dto); - // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); - String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); - log.info("终验方案项目重新申报成功 【{}】", instanceId); - - //保存终验项目 - //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/IrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/IrsManage.java deleted file mode 100644 index 742857d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/IrsManage.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.google.common.base.Joiner; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.irs.manage.AppIrsManage; -import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; -import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; -import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil; -import com.ningdatech.pmapi.projectdeclared.model.entity.IrsApplication; -import com.ningdatech.pmapi.projectdeclared.model.entity.NdPiotTasks; -import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; -import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; -import com.ningdatech.pmapi.projectdeclared.service.INdPiotTasksService; -import com.ningdatech.pmapi.projectdeclared.service.IrsApplicationService; -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.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.security.NoSuchAlgorithmException; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname IrsManage - * @Description - * @Date 2023/3/1 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class IrsManage { - - @Value("${irs.is-search-app}") - private Boolean isSearchApp; - - private final IrsApplicationService irsApplicationService; - - private final INdPiotTasksService piotTasksService; - - private final AppIrsManage appIrsManage; - - - public List applicationList(String areaCode) { - //不请求IRS - if(!isSearchApp) { - List list = irsApplicationService.list(); - if(CollUtil.isEmpty(list)){ - return Collections.emptyList(); - } - return CollUtils.convert(list,app -> BeanUtil.copyProperties(app,IrsApplicationVO.class)); - } - - try { - ApiApplyDTO apiApplay = new ApiApplyDTO(); - apiApplay.setAreaCode(areaCode); - JSONArray jsonArray = appIrsManage.searchApps(apiApplay); - if(CollUtil.isNotEmpty(jsonArray)){ - return jsonArray.stream().map(apply -> { - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(apply)); - IrsApplicationVO vo = new IrsApplicationVO(); - vo.setApplicationCode(jsonObject.getString("appId")); - vo.setApplicationName(jsonObject.getString("name")); - return vo; - }).collect(Collectors.toList()); - } - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - return Collections.emptyList(); - } - - public List listPiotTasks() { - List list = piotTasksService.list(); - if(CollUtil.isEmpty(list)){ - return Collections.emptyList(); - } - return CollUtils.convert(list,task -> BeanUtil.copyProperties(task,PiotTasksVO.class)); - } - - public String getCreditCode() throws NoSuchAlgorithmException { - String appSecret = RefreshTokenUtil.refrshByAppScret(); - String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; - String dataName = "丽水市大数据"; - long timestamp = System.currentTimeMillis(); - String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp); - String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey + - "&sign=" + sign + "&requestTime=" + timestamp; - RestTemplate restTemplate = new RestTemplate(HttpUtil.generateHttpRequestFactory()); - log.info("url:" + url); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - } - - /** - * 转发IRS请求 - * @param dto - * @return - */ - public String forward(ForwardDTO dto) { - try{ - String url = dto.getUrl(); - url = url + "?" + asUrlParams(dto.getData()); - log.info("url :{}",url); - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - }catch (Exception e){ - log.error("e:" + e); - } - return BizConst.OP_FAIL; - } - - public static String asUrlParams(Map source){ - return Joiner.on("&") - // 用指定符号代替空值,key 或者value 为null都会被替换 - .useForNull("") - .withKeyValueSeparator("=") - .join(source); - } -} 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 deleted file mode 100644 index 7a33308..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectdeclared.model.dto.OperationDTO; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; -import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO; -import com.ningdatech.pmapi.projectdeclared.service.IOperationService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -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.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * @Classname OperationManage - * @Description - * @Date 2023/7/31 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class OperationManage { - - private final IOperationService operationService; - - private final IProjectService projectService; - - private final StateMachineUtils stateMachineUtils; - - /** - * 获取实施详情 - * @param projectId - * @return - */ - public OperationVO detail(Long projectId) { - Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("项目不存在!"); - - Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode, project.getProjectCode()) - .last(BizConst.LIMIT_1)); - - return BeanUtil.copyProperties(operation,OperationVO.class); - } - - public String pushOperation(OperationDTO operation) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - Project project = projectService.getNewProject(operation.getProjectId()); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("项目不存在!"); - - //首先要判断 项目当前状态 是不是 待开工状态 - VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); - - Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode, project.getProjectCode()) - .last(BizConst.LIMIT_1)); - - Operation entity = BeanUtil.copyProperties(operation, Operation.class); - if(Objects.nonNull(old)){ - entity.setId(old.getId()); - }else{ - entity.setCreateOn(LocalDateTime.now()); - entity.setCreateBy(user.getUsername()); - } - 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()); - projectService.updateById(project); - } - - return entity.getProjectCode(); - } -} 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 deleted file mode 100644 index 52756ad..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ /dev/null @@ -1,351 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import com.alibaba.excel.EasyExcel; -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.google.common.collect.Lists; -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.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -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.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PretrialDeclaredExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -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.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.wflow.bean.entity.WflowModels; -import com.wflow.exception.BusinessException; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname ProqualificationDeclaredProjectManage - * @Description - * @Date 2023/2/13 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class PrequalificationDeclaredProjectManage { - - private final IProjectService projectService; - - private final ProjectLibManage projectLibManage; - - private final StateMachineUtils stateMachineUtils; - - private final IProjectStagingService projectStagingService; - - private final UserInfoHelper userInfoHelper; - - private final ProcessModelService processModelService; - - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - - private final ProcessInstanceService processInstanceService; - - private final IProjectInstService projectInstService; - - private final NoticeManage noticeManage; - - /** - * 提交预审 - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); - - ProjectDTO projectDto = dto.getProjectInfo(); - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - - //要判断 当前操作人 是不是项目主管单位的人 - VUtils.isTrue(Objects.isNull(user.getEmpPosUnitCode())) - .throwMessage(String.format("当前登录人没有单位 【%s】",user.getRealName())); - VUtils.isTrue(!user.getEmpPosUnitCode().equals(projectInfo.getSuperOrgCode())) - .throwMessage(String.format("只有主管单位 【%s】的人 才能够提交",projectInfo.getSuperOrg())); - - //首先要判断 项目当前状态 是不是 待预审 - VUtils.isTrue((!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) && - !ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(projectInfo.getStatus())) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 待预审状态(省级部门联审成功)或者未立项阶段"); - - //使用状态机 进入下一步 看看需不需要走省级审批 放入文件 - if(StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())){ - projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); - } - stateMachineUtils.pass(projectInfo); - String instanceId = null; - //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) - if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS - .getCode().equals(projectInfo.getStatus())){ - //入库暂存表 后续处理 对接外部接口 - projectInfo.setUpdateOn(LocalDateTime.now()); - //保存一下 当前的主管单位发起人 - projectInfo.setPreStartUserId(employeeCode); - //当前实例置为空 - projectInfo.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); - if(projectStagingService.addByProject(projectInfo,"省级部门联审") - && projectService.updateById(projectInfo)){ - return "提交省级部门联审成功"; - } - return "提交省级部门联审失败"; - }else if(ProjectStatusEnum.PRE_APPLYING - .getCode().equals(projectInfo.getStatus())){ - //如果是非省级联审的项目 直接提交 预审 - instanceId = directStartProcess(projectInfo,employeeCode,dto.getRestart()); - }else{ - throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); - } - - return "提交预审成功【" + instanceId + "】"; - } - - /** - * 重新提交预审 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String restartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); - - ProjectDTO projectDto = dto.getProjectInfo(); - VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getById(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - //重新提交 生成新版本号 回到 待预审状态 - Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),Boolean.FALSE); - dto.getProjectInfo().setId(project.getId()); - dto.setRestart(Boolean.TRUE); - return startTheProcess(dto); - } - - //直接提交预审方法 提取 在省级联审通过的时候 也可以用 - public String directStartProcess(Project projectInfo,String employeeCode,Boolean restart){ - VUtils.isTrue(Objects.isNull(employeeCode)) - .throwMessage("发起人 员工code 不能为空!"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); - params.setProcessUsers(Collections.emptyMap()); - - //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,projectInfo); - - String regionCode = projectInfo.getAreaCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 预审流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode)); - } - - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); - String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); - log.info("提交预审项目成功 【{}】", instanceId); - - log.info("restart 【{}】", restart); - //保存预审项目 - if(restart){ - //如果是重新提交 不用生成新版本 前面已经生成过了 - preModifyProject(projectInfo, instanceId); - }else{ - projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, - ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); - } - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return instanceId; - } - - /** - * 提交预审项目 时 更新信息 - * - * @param project - * @param instanceId - */ - private void preModifyProject(Project project, String instanceId) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - projectService.updateById(project); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - } catch (Exception e) { - log.error("提交预审 项目信息修改 错误 ", e); - throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage()); - } - } - - /** - * 查询项目库 - * @param preReq - * @return - */ - public PageVo pageInfo(PrequalificationDeclaredListReq preReq) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); - //项目阶段 状态 已定 待预审和省级部门联审成功 - req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), - ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - buildPermission(query,user); - query.eq(Project::getNewest,Boolean.TRUE); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if(user.getIsOrgAdmin() && - (ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) || - ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(item.getStatus())) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())){ - item.setCanPreDeclared(Boolean.TRUE); - } - return item; - }); - return PageVo.of(records, total); - } - - /** - * build 项目的角色权限到req - * @param query - */ - public UserFullInfoDTO buildPermission(LambdaQueryWrapper query,UserFullInfoDTO user){ - if(user.getIsOrgAdmin()){ - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()) - .or(q2 -> q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) - .and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) - .or(s2 -> s2.eq(Project::getStatus,ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) - .eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()))); - }else{ - query.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()); - } - return user; - } - - public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) { - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); - //项目阶段 状态 已定 待预审 - req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), - ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //角色权限 - buildPermission(query,user); - query.eq(Project::getNewest,Boolean.TRUE); - List records = projectService.list(query); - - List collect = records.stream().map(r -> { - PretrialDeclaredExportDTO exportDTO = new PretrialDeclaredExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - return exportDTO; - }).collect(Collectors.toList()); - for (int i = 0; i < collect.size(); i++) { - collect.get(i).setSerialNumber(i + 1); - } - String fileName = "预审申报项目列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), PretrialDeclaredExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java deleted file mode 100644 index b2a7522..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.excel.EasyExcel; -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.NdDateUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -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.projectdeclared.model.dto.DeclaredProjectExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectAdjustmentExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.projectdeclared.utils.ReStartProcessMapUtil; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @Classname ProjectAdjustmentManage - * @Description 项目内容调整 - * @Date 2023/2/1 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ProjectAdjustmentManage { - - private final IProjectService projectService; - - private final IProjectApplicationService projectApplicationService; - - private final ReStartProcessMapUtil reStartProcessMapUtil; - - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - - private final ProjectLibManage projectLibManage; - - private final UserInfoHelper userInfoHelper; - private final GenerateProjectCodeUtil generateProjectCodeUtil; - - /** - * 项目内容调整 - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String adjustment(DefaultDeclaredDTO dto) { - ProjectDTO projectDto = dto.getProjectInfo(); - Project projectInfo = projectService.getById(projectDto.getId()); - - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); - - //项目名称去重 - if(StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())){ - projectDto.setProjectCode(projectInfo.getProjectCode()); - defaultDeclaredProjectManage.checkDuplication(projectDto); - } - - //金额check - if(Objects.nonNull(projectDto.getDeclareAmount())){ - defaultDeclaredProjectManage.checkAmount(projectDto); - } - - //修改项目内容 -// if(!modifyProject(projectDto)){ -// throw new BusinessException("调整项目失败!"); -// } - - //最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 - Function declaredFunction = - reStartProcessMapUtil.reStartProcessMap.get(projectInfo.getStatus()); - VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); - return declaredFunction.apply(dto); - } - - private Boolean modifyProject(ProjectDTO projectDto) { - //先修改项目信息 - Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); - project.setUpdateOn(LocalDateTime.now()); - if(!projectService.updateById(project)){ - throw new BusinessException("项目调整失败"); - } - //再修改应用信息 - if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ - //采取批量删除 批量添加的方式 - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); - //批量添加 - List applications = projectDto.getApplicationList().stream().map(application -> { - ProjectApplication projectApplication = new ProjectApplication(); - BeanUtils.copyProperties(application, projectApplication); - projectApplication.setProjectId(project.getId()); - projectApplication.setProjectCode(project.getProjectCode()); - projectApplication.setProjectVersion(project.getVersion()); - return projectApplication; - }).collect(Collectors.toList()); - projectApplicationService.saveBatch(applications); - } - return Boolean.TRUE; - } - - /** - * 项目库 - * @param preReq - * @return - */ - public PageVo projectLibList(AdjustmentListReq preReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); - //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); - //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); - return projectLibManage.projectLibList(req); - } - - public void exportList(HttpServletResponse response, AdjustmentListReq preReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); - //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); - //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); - - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = records.stream().map(r -> { - ProjectAdjustmentExportDTO exportDTO = new ProjectAdjustmentExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - return exportDTO; - }).collect(Collectors.toList()); - String fileName = "项目内容调整列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} 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 deleted file mode 100644 index 6328274..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.lang.Assert; -import com.alibaba.excel.EasyExcel; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -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.helper.UserInfoHelper; -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.projectdeclared.model.dto.DeclaredProjectExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @Classname PurchaseManage - * @Description - * @Date 2023/5/29 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class PurchaseManage { - - private final IProjectService projectService; - private final UserInfoHelper userInfoHelper; - - private final IPurchaseService purchaseService; - - private final StateMachineUtils stateMachineUtils; - - /** - * 待采购的-项目列表 - * - * @param req - * @return - */ - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - //待采购状态 - query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), - ProjectStatusEnum.OPERATION.getCode())); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - query.orderByAsc(Project::getApprovalDate); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setApprovalDate(w.getApprovalDate()); - return item; - }); - return PageVo.of(records, total); - } - - public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待采购状态 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); - query.orderByAsc(Project::getApprovalDate); - List records = projectService.list(query); - Assert.notEmpty(records, "暂无数据可导出"); - List data = Lists.newArrayList(); - - AtomicInteger serialNumber = new AtomicInteger(0); - records.forEach(r -> { - DeclaredProjectExportDTO dpe = new DeclaredProjectExportDTO(); - BeanUtils.copyProperties(r, dpe); - dpe.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - dpe.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - dpe.setCreateOn(createOnStr); - dpe.setSerialNumber(serialNumber.incrementAndGet()); - dpe.setApprovedAmount(r.getApprovalAmount()); - dpe.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - data.add(dpe); - }); - - String fileName = "采购结果待备案项目列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(data); - } catch (IOException e) { - log.error("导出异常", e); - throw BizException.wrap("导出失败,请重试"); - } - } - - /** - * 获取采购结果备案详情 - * - * @param projectId - * @return - */ - public List detailByProjectId(Long projectId) { - List purchases = purchaseService.listByProjectId(projectId); - return BeanUtil.copyToList(purchases, PurchaseVO.class); - } - - /** - * 填写采购结果 - * - * @param dto - * @return - */ - public String submitResult(PurchaseSaveDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - - Long projectId = dto.getProjectId(); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); - Project project = projectService.getNewProject(dto.getProjectId()); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 采购结果备案 - VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) - || !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) - .throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段"); - - List purchases = purchaseService.listByProjectId(projectId); - Map purchaseMap = CollUtils.listToMap(purchases, Purchase::getId); - List purchaseEntities = CollUtils.convert(dto.getTenders(), w -> { - Purchase purchase = BeanUtil.copyProperties(w, Purchase.class); - purchase.setProjectId(projectId); - if (!purchaseMap.containsKey(w.getId())) { - purchase.setCreateBy(employeeCode); - } - return purchase; - }); - - if (purchaseService.saveOrUpdateBatch(purchaseEntities)) { - // 如果 需要推送项目和应用管理的话 只有遂昌县才有 - // String areaCode = project.getAreaCode(); - // String appCode = dto.getAppCode(); - // if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){ - // try{ - // - // }catch (Exception e){ - // log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage()); - // } - // } - //进入到下一状态 - stateMachineUtils.pass(project); - project.setUpdateOn(LocalDateTime.now()); - - // 获取总的成交时间及金额 - LocalDateTime lastTransactionTime = null; - BigDecimal transactionAmountTotal = BigDecimal.ZERO; - for (Purchase purchase : purchaseEntities) { - if (lastTransactionTime == null) { - lastTransactionTime = purchase.getTransactionTime(); - } else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) { - lastTransactionTime = purchase.getTransactionTime(); - } - transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount()); - } - - project.setTransactionAmount(transactionAmountTotal); - project.setTransactionTime(lastTransactionTime); - projectService.updateById(project); - - return "填写成功"; - } - - return "保存失败"; - } - -} 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 deleted file mode 100644 index 3491627..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Maps; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -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.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant; -import com.wflow.bean.entity.WflowModels; -import com.wflow.exception.BusinessException; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname ReviewByDeptJointManage - * @Description 部门联审 - * @Date 2023/2/17 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ReviewByDeptJointManage { - - private final IProjectService projectService; - - private final ProcessModelService processModelService; - - private final ProcessInstanceService processService; - - private final IProjectInstService projectInstService; - private final DefaultDeclaredProjectManage declaredProjectManage; - private final ProjectLibManage projectLibManage; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - - private final NoticeManage noticeManage; - - /** - * 部门联审 - * @param project - * @return - */ - @Transactional(rollbackFor = Exception.class) - public Boolean startTheProcess(Project project) { - //这里是任务发起的 所以用项目发起人 - String startUserCode = project.getSponsor(); - - VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(project.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - String regionCode = projectInfo.getAreaCode(); - - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()) - .last("limit 1")); - - if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode)); - } - //要判断 项目当前状态 是不是 部门联审 - VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); - - // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 - VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())) - .throwMessage("提交失败 项目信息 缺少项目发起人!"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - //发起人的信息 - params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); - params.setProcessUsers(Collections.emptyMap()); - - Map formData = Maps.newHashMap(); - //放入条件判断的项目字段 - //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,projectInfo); - - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); - log.info("部门联审申报成功 【{}】", instanceId); - - //保存项目信息 - projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); - - //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - - return Boolean.TRUE; - } - - private Boolean modifyProject(Project project, String instanceId) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - projectService.updateById(project); - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - } catch (Exception e) { - log.error("部门联审 修改项目信息 错误 ", e); - throw new BusinessException("部门联审 修改项目信息 错误 :" + e.getMessage()); - } - return Boolean.TRUE; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java deleted file mode 100644 index cb67e28..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.wflow.exception.BusinessException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * @Classname ReviewByProvincialDeptManage - * @Description 省级部门联审 - * @Date 2023/2/17 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ReviewByProvincialDeptManage { - - private final IProjectService projectService; - - private final FileService fileService; - - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - private final IProjectApplicationService applicationService; - - private final ProjectLibManage projectLibManage; - - @Value("${spring.profiles.active}") - private String active; - - /** - * 省级部门联审 - * @param project - * @return - */ - @Transactional(rollbackFor = Exception.class) - public Boolean startTheProcess(Project project) { - VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getById(project.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - String regionCode = projectInfo.getAreaCode(); - - //首先要判断 项目当前状态 是不是 省级部门联审 - VUtils.isTrue(!ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(projectInfo.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); - - // 对接省级联审的接口 - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, projectInfo.getId())); - if(joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(projectInfo,applications,fileService,active))){ - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * 省级部门联审 重新提交 - * @param declaringDTO - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String restartTheProcess(DefaultDeclaredDTO declaringDTO) { - ProjectDTO project = declaringDTO.getProjectInfo(); - VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(project.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - String regionCode = projectInfo.getAreaCode(); - - //首先要判断 项目当前状态 是不是 省级部门联审不通过 - VUtils.isTrue(!ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode().equals(projectInfo.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 省级部门联审不通过状态或者未立项阶段"); - - // 对接省级联审的接口 - Project p = projectLibManage.saveProjectWithVersionAndStatus(project,null, - ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(),Boolean.FALSE); - - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, p.getId())); - - //入库暂存表 后续处理 对接外部接口 - p.setUpdateOn(LocalDateTime.now()); - //保存一下 当前的主管单位发起人 - p.setPreStartUserId(p.getSponsor()); - //当前实例置为空 - p.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); - declaringDTO.getProjectInfo().setId(p.getId()); - projectService.updateById(p); - if(!joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(p,applications,fileService,active))){ - throw new BusinessException("提交省级部门联审失败"); - } - - return String.valueOf(p.getId()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java deleted file mode 100644 index a20a471..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java +++ /dev/null @@ -1,447 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -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.google.common.collect.Lists; -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.CollUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; -import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; -import com.ningdatech.pmapi.projectdeclared.model.dto.ReviewChecklistApproveDTO; -import com.ningdatech.pmapi.projectdeclared.model.entity.ReviewChecklistApprove; -import com.ningdatech.pmapi.projectdeclared.service.IReviewChecklistApproveService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectReviewCheckListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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.dto.FormsReviewChecklistDto; -import com.wflow.bean.dto.ReviewChecklistModuleDto; -import com.wflow.enums.ReviewChecklistResultEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname ReviewChecklistManage - * @Description - * @Date 2023/11/7 17:04 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ReviewChecklistManage { - - @Value("${spring.profiles.active}") - private String active; - - private final IProjectService projectService; - - private final RegionCacheHelper regionCacheHelper; - - private final IReviewChecklistApproveService reviewChecklistApproveService; - - private final UserInfoHelper userInfoHelper; - - public PageVo projectLibList(ProjectListReq req) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - //建设方案提交后的状态 - query.ge(Project::getStatus,ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()) - .ne(Project::getStatus,ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()) - .eq(Project::getAreaCode,RegionConst.RC_LS); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - buildReviewCheckPermission(query, user); - - Page page = projectService.page(req.page(), query); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - List projectCodes = page.getRecords().stream().map(Project::getProjectCode) - .collect(Collectors.toList()); - //求出 审查了的 信息 - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .in(ReviewChecklistApprove::getProjectCode, projectCodes)); - Map> approveMap = - approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode)); - - List reviewHumans = Lists.newArrayList();; - if(BizConst.DEV.equals(active)){ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; - }else{ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - List users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans); - Set userSet = Sets.newHashSet(); - Map userMap = users.stream().filter(u -> userSet.add(u.getEmployeeCode())) - .collect(Collectors.toMap(u -> u.getEmployeeCode() - , u -> u.getUsername())); - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); - // 审查人员情况 - item.setVerifiedHumans(computeVerify(item,approveMap.get(w.getProjectCode()),userMap,user)); - item.setReviewCheckFinish(w.getReviewCheckFinish()); - return item; - }); - return PageVo.of(records, page.getTotal()); - } - - private String computeVerify(ProjectReviewCheckListItemVO item,List reviewChecklistApproves, - Map userMap,UserInfoDetails user) { - List reviewHumans = Lists.newArrayList();; - if(BizConst.DEV.equals(active)){ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; - }else{ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - - Integer maxNums = reviewHumans.size(); - Integer finishNums = 0; - Set computeHumanSet = reviewHumans.stream().collect(Collectors.toSet()); - - if(CollUtil.isEmpty(reviewChecklistApproves)){ - item.setReviewCheckNotApprove(convertUser(userMap,computeHumanSet)); - return finishNums + StrPool.SLASH + maxNums; - } - for(ReviewChecklistApprove approve : reviewChecklistApproves){ - if(StringUtils.isNotBlank(approve.getCreateByCode()) || - computeHumanSet.contains(approve.getCreateByCode())){ - if(StringUtils.isNotBlank(user.getEmployeeCode()) && - user.getEmployeeCode().equals(approve.getCreateByCode())){ - item.setApproved(Boolean.TRUE); - } - if(computeHumanSet.remove(approve.getCreateByCode())){ - //说明 有指定人 审核过 - finishNums++; - } - } - } - item.setReviewCheckNotApprove(convertUser(userMap,computeHumanSet)); - - return finishNums + StrPool.SLASH + maxNums; - } - - private String convertUser(Map userMap, Set computeHumanSet) { - if(CollUtil.isEmpty(userMap) || CollUtil.isEmpty(computeHumanSet)){ - return StringUtils.EMPTY; - } - return computeHumanSet.stream().filter(s -> StringUtils.isNotBlank(s) && userMap.containsKey(s)) - .map(s -> userMap.get(s)).collect(Collectors.joining(StrPool.COMMA)); - } - - public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper query, UserInfoDetails user) { - UserFullInfoDTO userDto = BeanUtil.copyProperties(user,UserFullInfoDTO.class); - //1.只有 市本级能看到 - String regionCode = user.getRegionCode(); - String employeeCode = user.getEmployeeCode(); - //如果是七大审查之一 就可以看 - List reviewHumans = Lists.newArrayList();; - if(BizConst.DEV.equals(active)){ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; - }else{ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - if(reviewHumans.contains(employeeCode)){ - log.warn("为七大审查人之一 可以查看"); - return userDto; - } - - if(!regionCode.equals(RegionConst.RC_LS) || StringUtils.isBlank(employeeCode)){ - log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}",user.getUsername(), - user.getRegionCode(),user.getEmployeeCode()); - query.eq(Project::getId, 0L); - return userDto; - } - - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - query.eq(Project::getId, 0L); - return userDto; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 看不了 - query.eq(Project::getId, 0L); - break; - case COMPANY_MANAGER: - case VISITOR: - case DASHBOARD: - //单位管理员 看 - query.eq(Project::getId, 0L); - break; - case SUPER_ADMIN: - //超级管理员 可以看 - break; - case REGION_MANAGER: - //区域管理员 可以看 - break; - default: - //没有权限的话 就让它查不到 - query.eq(Project::getId, 0L); - break; - } - return userDto; - } - - /** - * 去审批 - * @param dtos - * @return - */ - public String approve(List dtos) { - if(CollUtil.isEmpty(dtos)){ - throw new BizException("传入数据不能为空!"); - } - ReviewChecklistApproveDTO reviewChecklistApproveFirst = dtos.get(0); - String projectCode = reviewChecklistApproveFirst.getProjectCode(); - - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Long userId = user.getUserId(); - String employeeCode = user.getEmployeeCode(); - String username = user.getUsername(); - List reviewHumans = Lists.newArrayList();; - if(BizConst.DEV.equals(active)){ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; - }else{ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - - if(StringUtils.isBlank(employeeCode) || !reviewHumans.contains(employeeCode)){ - throw new BizException("当前操作员 不是七大审查人之一!"); - } - - VUtils.isTrue(reviewChecklistApproveService.count(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode,projectCode) - .eq(ReviewChecklistApprove::getCreateByCode,employeeCode)) > 0) - .throwMessage("此项目 当前审查员 已经审批过 请不要重复审批"); - - for(ReviewChecklistApproveDTO dto : dtos){ - ReviewChecklistApprove saveEntity = new ReviewChecklistApprove(); - saveEntity.setCreateBy(username); - saveEntity.setCreateById(userId); - saveEntity.setCreateByCode(employeeCode); - saveEntity.setTitle(dto.getTitle()); - saveEntity.setContent(dto.getContent()); - saveEntity.setSubTitle(dto.getSubTitle()); - saveEntity.setCorrPageNum(dto.getCorrPageNum()); - saveEntity.setRejectionSituation(dto.getRejectionSituation()); - saveEntity.setResponseSituation(dto.getResponseSituation()); - saveEntity.setReviewComments(dto.getReviewComments()); - saveEntity.setReviewResult(dto.getReviewResult()); - saveEntity.setProjectCode(dto.getProjectCode()); - reviewChecklistApproveService.save(saveEntity); - } - - return BizConst.OP_SUCCESS; - } - - /** - * 查看待意见汇总 列表 - * @param projectCode - * @return - */ - public List summaryList(String projectCode) { - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode, projectCode) - .orderByAsc(ReviewChecklistApprove::getCreateOn)); - if(CollUtil.isEmpty(approves)){ - return Collections.emptyList(); - } - - //做成map - Map> groupTitleMap = approves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); - //去重标题 - Set titleSet = Sets.newHashSet(); - List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())) - .collect(Collectors.toList()); - - List res = dupTitle.stream() - .map(r -> { - FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); - vo.setTitle(r.getTitle()); - if(groupTitleMap.containsKey(r.getTitle())){ - List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); - vo.setModules(convertModules(reviewChecklistApproves)); - } - return vo; - }) - .collect(Collectors.toList()); - - return res; - } - - public String summary(String projectCode) { - //修改到 项目里去 - Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); - VUtils.isTrue(Objects.nonNull(project.getReviewCheckFinish()) && project.getReviewCheckFinish()) - .throwMessage("项目的审查清单已经合并过了!"); - - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode, projectCode) - .orderByAsc(ReviewChecklistApprove::getCreateOn)); - if(CollUtil.isEmpty(approves)){ - throw new BizException("该项目 未被七大审查人 审批!"); - } - - List reviewHumans = Lists.newArrayList();; - if(BizConst.DEV.equals(active)){ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; - }else{ - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - Set computeHumanSet = reviewHumans.stream().collect(Collectors.toSet()); - for(ReviewChecklistApprove approve : approves){ - if(computeHumanSet.contains(approve.getCreateByCode())){ - computeHumanSet.remove(approve.getCreateByCode()); - } - } - if(CollUtil.isNotEmpty(computeHumanSet)){ - throw new BizException("此项目的审查清单 未被七大审核人 审批完!"); - } - - //做成map 并且还要 未通过的 - Map> groupTitleMap = approves.stream() - .filter(r -> Objects.nonNull(r.getReviewResult()) && Lists.newArrayList( - ReviewChecklistResultEnum.NOT_PASS.getCode(),ReviewChecklistResultEnum.ONE_VOTE_VETO.getCode()) - .contains(r.getReviewResult())) - .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); - //去重子标题 - Set titleSet = Sets.newHashSet(); - List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())).collect(Collectors.toList()); - - List res = dupTitle.stream() - .map(r -> { - FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); - vo.setTitle(r.getTitle()); - if(groupTitleMap.containsKey(r.getTitle())){ - List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); - vo.setModules(convertModulesFinal(reviewChecklistApproves)); - } - return vo; - }) - .collect(Collectors.toList()); - //修改 并且 已经合并 - project.setReviewChecklist(JSON.toJSONString(res)); - project.setReviewCheckFinish(Boolean.TRUE); - projectService.updateById(project); - - return BizConst.OP_SUCCESS; - } - - private List convertModules(List reviewChecklistApproves) { - //做成map - Map> groupSubTitleMap = reviewChecklistApproves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); - //去重子标题 - Set subSubTitleSet = Sets.newHashSet(); - List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) - .collect(Collectors.toList()); - return dupSubTitle.stream() - .map(r -> { - ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); - vo.setSubTitle(r.getSubTitle()); - vo.setContent(r.getContent()); - vo.setReviewComments(r.getReviewComments()); - vo.setRejectionSituation(r.getRejectionSituation()); - vo.setResponseSituation(r.getResponseSituation()); - vo.setCorrPageNum(r.getCorrPageNum()); - if(groupSubTitleMap.containsKey(r.getSubTitle())){ - List approves = groupSubTitleMap.get(r.getSubTitle()); - StringBuffer reviewCommentsSb = new StringBuffer(); - - for(ReviewChecklistApprove approve : approves){ - ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); - reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + (Objects.nonNull(match)?match.getDesc():StringUtils.EMPTY) + - (StringUtils.isNotBlank(approve.getReviewComments())?StrPool.COMMA+approve.getReviewComments():StringUtils.EMPTY) + "\n"); - } - vo.setReviewComments(reviewCommentsSb.toString()); - } - return vo; - }) - .collect(Collectors.toList()); - } - - private List convertModulesFinal(List reviewChecklistApproves) { - //做成map - Map> groupSubTitleMap = reviewChecklistApproves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); - //去重子标题 - Set subSubTitleSet = Sets.newHashSet(); - List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) - .collect(Collectors.toList()); - return dupSubTitle.stream() - .map(r -> { - ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); - vo.setSubTitle(r.getSubTitle()); - vo.setContent(r.getContent()); - vo.setReviewComments(r.getReviewComments()); - vo.setRejectionSituation(r.getRejectionSituation()); - vo.setResponseSituation(r.getResponseSituation()); - vo.setCorrPageNum(r.getCorrPageNum()); - if(groupSubTitleMap.containsKey(r.getSubTitle())){ - List approves = groupSubTitleMap.get(r.getSubTitle()); - StringBuffer reviewCommentsSb = new StringBuffer(); - if(CollUtil.isEmpty(approves)){ - vo.setReviewComments("通过"); - }else{ - Integer index = 1; - for(ReviewChecklistApprove approve : approves){ - ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); - reviewCommentsSb.append(index + StrPool.DOT + (Objects.nonNull(match)?match.getDesc():StringUtils.EMPTY) + - (StringUtils.isNotBlank(approve.getReviewComments())?StrPool.COMMA+approve.getReviewComments():StringUtils.EMPTY) + "\n"); - index++; - } - vo.setReviewComments(reviewCommentsSb.toString()); - } - } - return vo; - }) - .collect(Collectors.toList()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ConstructionSuggestionsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ConstructionSuggestionsMapper.java deleted file mode 100644 index 0d62310..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ConstructionSuggestionsMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectConstructionSuggestions; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface ConstructionSuggestionsMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.java deleted file mode 100644 index 0d91d08..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface ContractMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.xml deleted file mode 100644 index 29cb5e1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ContractMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.java deleted file mode 100644 index 4db9f07..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import org.apache.ibatis.annotations.Param; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface DeclaredStatisticsMapper extends BaseMapper { - - DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); - - DeclaredProjectStatisticsPO getRegionStatistics(@Param("regionCode") String regionCode,@Param("year") Integer year); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.xml deleted file mode 100644 index 3087d8c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.java deleted file mode 100644 index 84203d2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.IrsApplication; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface IrsApplicationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.xml deleted file mode 100644 index c68d8be..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/IrsApplicationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.java deleted file mode 100644 index 7a1e2a0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.IrsApplication; -import com.ningdatech.pmapi.projectdeclared.model.entity.NdPiotTasks; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface NdPiotTasksMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.xml deleted file mode 100644 index 7740164..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/NdPiotTasksMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java deleted file mode 100644 index 5310923..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface OperationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml deleted file mode 100644 index fdc4810..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.java deleted file mode 100644 index fa0a66a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface PaymentPlanMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.xml deleted file mode 100644 index 944f7b2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PaymentPlanMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.java deleted file mode 100644 index 16f9e74..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface PreInsAcceptancePersonMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml deleted file mode 100644 index 8ffebfa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PreInsAcceptancePersonMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.java deleted file mode 100644 index 56749c1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface ProjectDraftMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.xml deleted file mode 100644 index 4f2f7bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/ProjectDraftMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.java deleted file mode 100644 index 121ace6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface PurchaseMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.xml deleted file mode 100644 index ad43270..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/PurchaseMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ConstructionPlanExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ConstructionPlanExportDTO.java deleted file mode 100644 index 7487224..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ConstructionPlanExportDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import java.math.BigDecimal; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - - -/** - * 建设方案申报列表导出实体类 - * - * @author CMM - * @since 2023/03/10 10:20 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ConstructionPlanExportDTO { - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("申报金额(万元)") - private BigDecimal declareAmount; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("创建时间") - private String createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContractSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContractSaveDTO.java deleted file mode 100644 index b99766b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContractSaveDTO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname Contract - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "合同对象", description = "") -public class ContractSaveDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("合同名称") - private String name; - - @ApiModelProperty("合同总金额") - private BigDecimal totalAmount; - - @ApiModelProperty("供应商开户行") - private String supplierBank; - - @ApiModelProperty("供应商开户行帐号") - private String supplierAccount; - - @ApiModelProperty("质保期 年") - private Integer warrantyPeriod; - - @ApiModelProperty("质保金") - private BigDecimal retentionMoney; - - @ApiModelProperty("合同完成时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime contractTime; - - @ApiModelProperty("交货日期") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime deliveryTime; - - @ApiModelProperty("附件") - private String attachment; - - @ApiModelProperty("支付计划") - private List payments; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java deleted file mode 100644 index 1612224..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ContructionSuggestionsDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -/** - * @Classname ContructionSuggestionsDTO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "专家建设建议", description = "") -public class ContructionSuggestionsDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("实例ID") - @NotNull(message = "实例ID不能为空") - private String instanceId; - - @ApiModelProperty("项目编号") - @NotNull(message = "项目编号不能为空") - private String projectCode; - - @ApiModelProperty("建议项目总投资") - @NotNull(message = "建议项目总投资不能为空") - private BigDecimal proposeTotalInvest; - - @ApiModelProperty("建议年度预算") - @NotNull(message = "建议年度预算不能为空") - private BigDecimal proposeAnnualBudget; - - @ApiModelProperty("建议评审意见附件") - @NotBlank(message = "建议评审意见附件不能为空") - private String proposeAttachFiles; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java deleted file mode 100644 index 5c021c4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - - -/** - * 申报项目列表导出实体类 - * - * @author CMM - * @since 2023/03/10 10:20 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class DeclaredProjectExportDTO { - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("申报金额(万元)") - private BigDecimal declareAmount; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("创建时间") - private String createOn; - - @ExcelProperty("项目状态") - private String statusName; - - @ExcelProperty("批复金额") - private BigDecimal approvedAmount; - - @ExcelProperty("立项批复时间") - private String approvalDate; - - @ExcelProperty("成交金额") - private BigDecimal transactionAmount; - - @ExcelProperty("成交时间") - private String transactionTime; - - @ExcelProperty("成交时间") - private String deliveryTime; - - @ExcelProperty("合同金额") - private BigDecimal contractAmount; - - @ExcelProperty("年度预算") - private BigDecimal annualPlanAmount; - - @ExcelProperty("计划验收时间") - private String planAcceptanceTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectListParamDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectListParamDTO.java deleted file mode 100644 index f23d59e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectListParamDTO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.format.annotation.DateTimeFormat; - -/** - * @Classname DeclaredProjectParamDto - * @Description - * @Date 2023/2/1 14:52 - * @Author PoffyZhang - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class DeclaredProjectListParamDTO extends PagePo { - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目类型 1建设 2运维") - private Integer projectType; - - @ApiModelProperty("项目阶段") - private Integer projectStage; - - @ApiModelProperty("项目状态") - private Integer projectStatus; - - @ApiModelProperty("项目年份") - private Integer projectYear; - - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty("开始时间") - private String startTime; - - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty("结束时间") - private String endTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java deleted file mode 100644 index d3500ff..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Map; - -/** - * @Classname DefaultDeclaredDTO - * @Description - * @Date 2023/2/14 17:16 - * @Author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class DefaultDeclaredDTO implements Serializable { - - @NotNull - @ApiModelProperty("项目信息") - private ProjectDTO projectInfo; - - @ApiModelProperty("表单信息 新增模块") - private Map formData; - - @ApiModelProperty("是否是重新提交 默认false") - private Boolean restart = Boolean.FALSE; - - public Map getFormData(){ - if(CollUtil.isEmpty(this.formData)){ - this.formData = Maps.newHashMap(); - return this.formData; - } - return this.formData; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DelayedApplyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DelayedApplyDTO.java deleted file mode 100644 index 3752dac..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DelayedApplyDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotNull; - -/** - * @Classname DelayedApplyDTO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "DelayedApplyDTO", description = "延期申请") -public class DelayedApplyDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("延期时长 月") - @NotNull(message = "请填写时长") - private Integer delayedMonth; - - @ApiModelProperty("延期理由") - private String delayedReason; - - @ApiModelProperty("佐证材料") - private String supportingMaterials; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java deleted file mode 100644 index 3fc30c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -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.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -/** - * @Classname OperationDTO - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@ApiModel(value = "实施对象DTO", description = "实施对象DTO") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class OperationDTO { - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("项目Code") - private String projectCode; - - @ApiModelProperty("项目开工时间") - @NotNull(message = "项目开工时间不能为空") - private LocalDateTime projectStartDate; - - @ApiModelProperty("初验时间") - @NotNull(message = "初验时间不能为空") - private LocalDateTime initialInspectionDate; - - @ApiModelProperty("终验时间") - @NotNull(message = "终验时间不能为空") - private LocalDateTime finalInspectionDate; - - @ApiModelProperty("开始实施时间") - @NotNull(message = "开始实施时间不能为空") - private LocalDateTime startTrialOperationDate; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSaveDTO.java deleted file mode 100644 index 8135244..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSaveDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PaymentPlan - * @Description - * @Date 2023/5/30 16:11 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PaymentPlan", description = "") -public class PaymentPlanSaveDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("付款计划") - private String planAmount; - - @ApiModelProperty("支付金额") - private BigDecimal paymentAmount; - - @ApiModelProperty("实际支付金额") - private BigDecimal actualPaymentAmount; - - @ApiModelProperty("支付时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime paymentTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSupplementDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSupplementDTO.java deleted file mode 100644 index bbee7c7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PaymentPlanSupplementDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PaymentPlan - * @Description - * @Date 2023/5/30 16:11 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PaymentPlanSupplementDTO", description = "") -public class PaymentPlanSupplementDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - @NotNull(message = "id必传") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("实际支付金额") - private BigDecimal actualPaymentAmount; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java deleted file mode 100644 index 591d831..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -/** - * @Classname PreInsAcceptancePerson - * @Description 初验人员 - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PreInsAcceptancePersonSaveDTO", description = "") -public class PreInsAcceptancePersonSaveDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("人员名称") - private String personName; - - @ApiModelProperty("单位") - private String unit; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsSaveDTO.java deleted file mode 100644 index 158b0dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PreInsSaveDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname PreInsSaveDTO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PreInsSaveDTO", description = "") -public class PreInsSaveDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("初验材料") - @NotBlank(message = "请提交初验材料") - private String preliminaryInspectionMaterials; - - @ApiModelProperty("初验验收人员") - private List acceptancePersons; - - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PretrialDeclaredExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PretrialDeclaredExportDTO.java deleted file mode 100644 index 655b947..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PretrialDeclaredExportDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import java.math.BigDecimal; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - - -/** - * 预审申报列表导出实体类 - * - * @author CMM - * @since 2023/03/10 10:20 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class PretrialDeclaredExportDTO { - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("申报金额(万元)") - private BigDecimal declareAmount; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("创建时间") - private String createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java deleted file mode 100644 index 04b7067..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import java.math.BigDecimal; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - - -/** - * 项目内容调整列表导出实体类 - * - * @author CMM - * @since 2023/03/10 10:20 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ProjectAdjustmentExportDTO { - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("申报金额(万元)") - private BigDecimal declareAmount; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("项目状态") - private String statusName; - - @ExcelProperty("创建时间") - private String createOn; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectConditionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectConditionDTO.java deleted file mode 100644 index 8f00c79..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectConditionDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @Classname DeclaredProjectDto - * @Description 申报项目 里的条件判断实体 - * @Date 2023/2/1 14:52 - * @Author PoffyZhang - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ProjectConditionDTO implements Serializable { - - private Long projectId; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") - private Integer bizDomain; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectDraftSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectDraftSaveDTO.java deleted file mode 100644 index 42c92c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectDraftSaveDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - *

- * 项目草稿箱 - *

- * - * @author zpf - * @since 2023-02-06 - */ -@ApiModel(value = "NdProjectDraftDto", description = "") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class ProjectDraftSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @NotNull - @ApiModelProperty("项目信息") - private ProjectDTO projectInfo; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java deleted file mode 100644 index bcd396d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectRenewalDeclareExportDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import java.io.Serializable; -import java.math.BigDecimal; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.Data; - -/** - * 项目续建申报列表导出实体 - * - * @author CMM - * @since 2023/02/21 15:03 - */ -@Data -public class ProjectRenewalDeclareExportDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("年度支付金额(万元)") - private BigDecimal annualPaymentAmount; - - @ExcelProperty("状态") - private String approvalStatusName; - - @ExcelProperty("创建时间") - private String createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java deleted file mode 100644 index a9f825d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname Purchase - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "采购对象", description = "采购对象") -@AllArgsConstructor -public class PurchaseSaveDTO { - - @ApiModelProperty("项目ID") - @NotNull(message = "请传项目ID") - private Long projectId; - - @NotEmpty(message = "标段信息不能为空") - private List tenders; - - @Data - public static class TenderDTO { - - @ApiModelProperty("标段ID") - private Long id; - - @ApiModelProperty("标段名称") - private String bidName; - - @ApiModelProperty("供应商") - private String supplier; - - @ApiModelProperty("供应商联系人") - private String supplierContact; - - @ApiModelProperty("供应商联系方式") - private String supplierContactInfo; - - @ApiModelProperty("供应商社会信用代码") - private String supplierSocialCreditCode; - - @ApiModelProperty("采购方式") - private String purchaseMethod; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime transactionTime; - - @ApiModelProperty("代理机构") - private String agency; - - @ApiModelProperty("代理机构社会统一信用代码") - private String purchaseSocialCreditCode; - - @ApiModelProperty("投标文件") - private String biddingDoc; - - @ApiModelProperty("招标文件") - private String bidDoc; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("应用编码") - private String appCode; - - @ApiModelProperty("预算执行确认书编号") - private String budgetExecConfirmNo; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ReviewChecklistApproveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ReviewChecklistApproveDTO.java deleted file mode 100644 index 58fe0db..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ReviewChecklistApproveDTO.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - * @Classname ReviewChecklistApproveDTO - * @Description - * @Date 2023/11/07 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ReviewChecklistApproveDTO", description = "") -public class ReviewChecklistApproveDTO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目编号") - @NotBlank(message = "请传项目编号") - private String projectCode; - - @ApiModelProperty("标题") - @NotBlank(message = "请传入标题") - private String title; - - @ApiModelProperty("子标题") - @NotBlank(message = "请传入子标题") - private String subTitle; - - @ApiModelProperty("内容") - @NotBlank(message = "请传入内容") - private String content; - - @ApiModelProperty("对应页码") - @NotBlank(message = "请传入对应页码") - private String corrPageNum; - - @ApiModelProperty("否决情形") - @NotBlank(message = "请传入否决情形") - private String rejectionSituation; - - @ApiModelProperty("响应情况") - @NotBlank(message = "请传入响应情况") - private String responseSituation; - - @ApiModelProperty("评审意见") - @NotBlank(message = "请传入评审意见") - private String reviewComments; - - @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") - @NotNull(message = "请传入审核结果") - private Integer reviewResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Contract.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Contract.java deleted file mode 100644 index 9774dc3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Contract.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.joda.time.LocalDate; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname Contract - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@TableName("nd_contract") -@ApiModel(value = "合同对象", description = "") -public class Contract { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("修改人人") - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("合同名称") - private String name; - - @ApiModelProperty("合同总金额") - private BigDecimal totalAmount; - - @ApiModelProperty("供应商开户行") - private String supplierBank; - - @ApiModelProperty("供应商开户行帐号") - private String supplierAccount; - - @ApiModelProperty("质保期 年") - private Integer warrantyPeriod; - - @ApiModelProperty("质保金") - private BigDecimal retentionMoney; - - @ApiModelProperty("合同完成时间") - private LocalDateTime contractTime; - - @ApiModelProperty("交货日期") - private LocalDateTime deliveryTime; - - @ApiModelProperty("附件") - private String attachment; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/IrsApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/IrsApplication.java deleted file mode 100644 index c939b2f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/IrsApplication.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * irs项目 - *

- * - * @author zpf - * @since 2023-03-06 - */ -@TableName("irs_application") -@ApiModel(value = "irs_application对象", description = "irs项目对象") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class IrsApplication implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("应用编码") - private String applicationCode; - - private LocalDateTime createOn; - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/NdPiotTasks.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/NdPiotTasks.java deleted file mode 100644 index bea2cad..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/NdPiotTasks.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * irs任务对象 - *

- * - * @author zpf - * @since 2023-03-06 - */ -@TableName("nd_piot_tasks") -@ApiModel(value = "irs_piot_tasks对象", description = "irs任务对象") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class NdPiotTasks implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("试点任务名称") - private String taskName; - - @ApiModelProperty("试点任务编号") - private String taskCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; - - private LocalDateTime createOn; - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java deleted file mode 100644 index da99fc6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - -/** - * @Classname Operation - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@TableName("nd_project_operation") -@ApiModel(value = "实施对象", description = "实施对象") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class Operation { - - @TableId(type = IdType.AUTO) - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目Code") - private String projectCode; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人 工号") - private String createBy; - - @ApiModelProperty("修改人 工号") - private String updateBy; - - @ApiModelProperty("项目开工时间") - private LocalDateTime projectStartDate; - - @ApiModelProperty("初验时间") - private LocalDateTime initialInspectionDate; - - @ApiModelProperty("终验时间") - private LocalDateTime finalInspectionDate; - - @ApiModelProperty("开始实施时间") - private LocalDateTime startTrialOperationDate; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PaymentPlan.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PaymentPlan.java deleted file mode 100644 index c3e99ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PaymentPlan.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * @Classname PaymentPlan - * @Description - * @Date 2023/5/30 16:11 - * @Author PoffyZhang - */ -@Data -@TableName("nd_payment_plan") -@ApiModel(value = "PaymentPlan", description = "") -public class PaymentPlan { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("修改人人") - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("付款计划") - private String planAmount; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("计划支付金额") - private BigDecimal paymentAmount; - - @ApiModelProperty("实际支付金额") - private BigDecimal actualPaymentAmount; - - @ApiModelProperty("支付时间") - private LocalDateTime paymentTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PreInsAcceptancePerson.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PreInsAcceptancePerson.java deleted file mode 100644 index 886469e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/PreInsAcceptancePerson.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PreInsAcceptancePerson - * @Description 初验人员 - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@TableName("nd_pre_ins_acceptance_person") -@ApiModel(value = "PreInsAcceptancePerson", description = "") -public class PreInsAcceptancePerson { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("修改人人") - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("人员名称") - private String personName; - - @ApiModelProperty("单位") - private String unit; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectConstructionSuggestions.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectConstructionSuggestions.java deleted file mode 100644 index cef816f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectConstructionSuggestions.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.math.BigDecimal; - -/** - * @Classname ProjectContructionSuggestions - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@TableName("nd_project_constrctiuon_suggestions") -@ApiModel(value = "专家建设建议", description = "") -public class ProjectConstructionSuggestions { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("实例ID") - private String instanceId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("建议项目总投资") - private BigDecimal proposeTotalInvest; - - @ApiModelProperty("建议年度预算") - private BigDecimal proposeAnnualBudget; - - @ApiModelProperty("建议评审意见附件") - private String proposeAttachFiles; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java deleted file mode 100644 index c6980be..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java +++ /dev/null @@ -1,370 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.ningdatech.pmapi.common.compare.Compare; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目草稿箱 - *

- * - * @author zpf - * @since 2023-02-06 - */ -@TableName("nd_project_draft") -@ApiModel(value = "NdProjectDraft对象", description = "") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ProjectDraft implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域") - private Integer bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - private Integer isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - @ApiModelProperty("流程实例编号") - private String instCode; - - @ApiModelProperty("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("项目应用") - private String projectApplicationList; - - @ApiModelProperty("新增form内容") - private String dynamicForm; - - @ApiModelProperty("用户id") - private String userId; - - @ApiModelProperty("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - private Long createBy; - private Long updateBy; - - @ApiModelProperty("是否开启评审清单") - private Boolean isReviewChecklist; - - @ApiModelProperty("评审清单") - private String reviewChecklist; - - @ApiModelProperty("是否推送省里") - private Boolean push; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java deleted file mode 100644 index 659b58e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * @Classname Purchase - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@TableName("nd_purchase") -@ApiModel(value = "采购对象", description = "采购对象") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class Purchase { - - @TableId(type = IdType.AUTO) - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("标段名称") - private String bidName; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人 工号") - private String createBy; - - @ApiModelProperty("修改人 工号") - private String updateBy; - - @ApiModelProperty("供应商") - private String supplier; - - @ApiModelProperty("供应商联系人") - private String supplierContact; - - @ApiModelProperty("供应商联系方式") - private String supplierContactInfo; - - @ApiModelProperty("供应商社会信用代码") - private String supplierSocialCreditCode; - - @ApiModelProperty("采购方式 1公开招标 2自行采购") - private String purchaseMethod; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - private LocalDateTime transactionTime; - - @ApiModelProperty("代理机构") - private String agency; - - @ApiModelProperty("代理机构社会统一信用代码") - private String purchaseSocialCreditCode; - - @ApiModelProperty("投标文件") - private String biddingDoc; - - @ApiModelProperty("招标文件") - private String bidDoc; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("预算执行确认书编号") - private String budgetExecConfirmNo; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ReviewChecklistApprove.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ReviewChecklistApprove.java deleted file mode 100644 index d5ef091..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ReviewChecklistApprove.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.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.time.LocalDateTime; - -/** - * @Classname ReviewChecklistApprove - * @Description - * @Date 2023/11/07 15:35 - * @Author PoffyZhang - */ -@Data -@TableName("nd_project_review_checklist_approve") -@ApiModel(value = "审查清单审核信息", description = "") -public class ReviewChecklistApprove { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("审批人") - private String createBy; - - @ApiModelProperty("审批时间") - private LocalDateTime createOn; - - @ApiModelProperty("审批人ID") - private Long createById; - - @ApiModelProperty("审批人code") - private String createByCode; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("子标题") - private String subTitle; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("对应页码") - private String corrPageNum; - - @ApiModelProperty("否决情形") - private String rejectionSituation; - - @ApiModelProperty("响应情况") - private String responseSituation; - - @ApiModelProperty("评审意见") - private String reviewComments; - - @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") - private Integer reviewResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/po/DeclaredProjectStatisticsPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/po/DeclaredProjectStatisticsPO.java deleted file mode 100644 index 28dbfb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/po/DeclaredProjectStatisticsPO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.po; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; - -/** - * @Classname DeclaredProjectStatistics - * @Description - * @Date 2023/3/20 16:29 - * @Author PoffyZhang - */ -@Data -public class DeclaredProjectStatisticsPO { - - @ApiModelProperty("总项目数") - private Integer totalNum; - @ApiModelProperty("建设项目数") - private Integer buildNum; - @ApiModelProperty("运维项目数") - private Integer operationNum; - - @ApiModelProperty("待立项数") - private Integer notApprovedNum; - @ApiModelProperty("已立项数") - private Integer approvedNum; - @ApiModelProperty("建设中数") - private Integer constructionNum; - @ApiModelProperty("待验收数") - private Integer tobeInspectedNum; - @ApiModelProperty("已归档数") - private Integer archivedNum; - - @ApiModelProperty("申报总金额") - private BigDecimal declaredAmount; - @ApiModelProperty("立项总金额") - private BigDecimal approvalAmount; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/AdjustmentListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/AdjustmentListReq.java deleted file mode 100644 index dc7c87e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/AdjustmentListReq.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -/** - * @Classname AdjustmentListReq - * @Description - * @Date 2023/2/14 11:42 - * @Author PoffyZhang - */ -@Data -public class AdjustmentListReq extends PagePo { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/ConstrctionPlanListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/ConstrctionPlanListReq.java deleted file mode 100644 index efa731a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/ConstrctionPlanListReq.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -/** - * @Classname PrequalificationDeclaredReq - * @Description - * @Date 2023/2/14 11:42 - * @Author PoffyZhang - */ -@Data -public class ConstrctionPlanListReq extends PagePo { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/PrequalificationDeclaredListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/PrequalificationDeclaredListReq.java deleted file mode 100644 index 3e40df3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/req/PrequalificationDeclaredListReq.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -/** - * @Classname PrequalificationDeclaredReq - * @Description - * @Date 2023/2/14 11:42 - * @Author PoffyZhang - */ -@Data -public class PrequalificationDeclaredListReq extends PagePo { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ContractVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ContractVO.java deleted file mode 100644 index 658b4e9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ContractVO.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname Contract - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ContractVO", description = "") -public class ContractVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建人") - @TableField(fill = FieldFill.INSERT) - private String createBy; - - @ApiModelProperty("修改人人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("合同名称") - private String name; - - @ApiModelProperty("合同总金额") - private BigDecimal totalAmount; - - @ApiModelProperty("供应商开户行") - private String supplierBank; - - @ApiModelProperty("供应商开户行帐号") - private String supplierAccount; - - @ApiModelProperty("质保期 年") - private Integer warrantyPeriod; - - @ApiModelProperty("质保金") - private BigDecimal retentionMoney; - - @ApiModelProperty("合同完成时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime contractTime; - - @ApiModelProperty("交货日期") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime deliveryTime; - - @ApiModelProperty("附件") - private String attachment; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("支付计划") - private List payments; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/DelayedApplyVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/DelayedApplyVO.java deleted file mode 100644 index 60faa95..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/DelayedApplyVO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -/** - * @Classname DelayedApplyVO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "DelayedApplyVO", description = "延期申请") -public class DelayedApplyVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("延期时间(几个月)") - private Integer delayTime; - - @ApiModelProperty("延期申请佐证材料") - private String delayApplyFile; - - @ApiModelProperty("延期申请理由") - private String delayApplyReason; - - @ApiModelProperty("创建人") - private Long createBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新人") - private Long updateBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("延期申请实例ID") - private String instanceId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/FinalAcceptanceVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/FinalAcceptanceVO.java deleted file mode 100644 index 6fa5ebd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/FinalAcceptanceVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * @Classname FinalAcceptanceVO - * @Description 终验 - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@ApiModel(value = "终验", description = "终验") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class FinalAcceptanceVO { - - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("关联应用信息") - private List apps; - - @ApiModelProperty("终验材料") - private String finalAcceptanceMaterials; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/IrsApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/IrsApplicationVO.java deleted file mode 100644 index 6561bba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/IrsApplicationVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * irs项目 - *

- * - * @author zpf - * @since 2023-03-06 - */ -@ApiModel(value = "irs_application对象", description = "irs项目对象") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class IrsApplicationVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("应用编码") - private String applicationCode; - - private LocalDateTime createOn; - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java deleted file mode 100644 index 64de66c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @Classname Operation - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@ApiModel(value = "实施对象", description = "实施对象") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class OperationVO { - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目Code") - private String projectCode; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人 工号") - private String createBy; - - @ApiModelProperty("修改人 工号") - private String updateBy; - - @ApiModelProperty("项目开工时间") - private LocalDateTime projectStartDate; - - @ApiModelProperty("初验时间") - private LocalDateTime initialInspectionDate; - - @ApiModelProperty("终验时间") - private LocalDateTime finalInspectionDate; - - @ApiModelProperty("开始实施时间") - private LocalDateTime startTrialOperationDate; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java deleted file mode 100644 index e87c2e6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname PaymentPlan - * @Description - * @Date 2023/5/30 16:11 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PaymentPlanVO", description = "") -public class PaymentPlanVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建人") - @TableField(fill = FieldFill.INSERT) - private String createBy; - - @ApiModelProperty("修改人人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("付款计划") - private String planAmount; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("计划支付金额") - private BigDecimal paymentAmount; - - @ApiModelProperty("实际支付金额") - private BigDecimal actualPaymentAmount; - - @ApiModelProperty("支付比例") - private String ratio; - - @ApiModelProperty("支付时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime paymentTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PiotTasksVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PiotTasksVO.java deleted file mode 100644 index e002f79..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PiotTasksVO.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * irs任务对象 - *

- * - * @author zpf - * @since 2023-03-06 - */ -@ApiModel(value = "irs_piot_tasks对象", description = "irs任务对象") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class PiotTasksVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("试点任务名称") - private String taskName; - - @ApiModelProperty("试点任务编号") - private String taskCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; - - private LocalDateTime createOn; - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsAcceptancePersonVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsAcceptancePersonVO.java deleted file mode 100644 index 98ea3f4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsAcceptancePersonVO.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -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.time.LocalDateTime; - -/** - * @Classname PreInsAcceptancePerson - * @Description 初验人员 - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PreInsAcceptancePersonVO", description = "") -public class PreInsAcceptancePersonVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建人") - private String createBy; - - @ApiModelProperty("修改人人") - private String updateBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("人员名称") - private String personName; - - @ApiModelProperty("单位") - private String unit; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsVO.java deleted file mode 100644 index 824a9da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PreInsVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname PreInsVO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "PreInsVO", description = "初验备案详情") -public class PreInsVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("初验材料") - private String preliminaryInspectionMaterials; - - @ApiModelProperty("初验验收人员") - private List acceptancePersons; - - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectContractListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectContractListVO.java deleted file mode 100644 index 43d30bc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectContractListVO.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ningdatech.pmapi.common.compare.Compare; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * ProjectContractListVO - *

- * - * @author ZPF - * @since 15:13 2023/11/15 - */ -@Data -@Builder -@ApiModel("合同项目库列表视图") -public class ProjectContractListVO { - - @Tolerate - public ProjectContractListVO() { - } - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("区域") - private String area; - - @ApiModelProperty("区域Code") - private String areaCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("申报年度") - private Integer projectYear; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - private String projectTypeName; - - @ApiModelProperty("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(元)") - private BigDecimal annualPlanAmount; - - public String getProjectTypeName() { - if (Objects.nonNull(this.projectType)) { - Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) - .ifPresent(desc -> this.projectTypeName = desc); - } - return this.projectTypeName; - } - - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime updateOn; - - @ApiModelProperty("能否能补充") - private Boolean supplemented = Boolean.FALSE; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java deleted file mode 100644 index 0bffceb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * - *

- * - * @author ZPF - * @since 15:13 2023/2/1 - */ -@Data -@ApiModel("项目详情") -public class ProjectDeclaredDetailVO { - - @ApiModelProperty("应用ID 新增为空") - private Long id; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildUnitName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - private String buildUnitZheJiangGovernmentDingId; - - @ApiModelProperty("项目类型 1:建设 2:运维") - private Integer projectType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域") - private String bizDomain; - - @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") - private String buildLevel; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - private Integer isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovernmentOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovernmentSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovernmentOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovernmentSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - @ApiModelProperty("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("上级主管部门") - private String higherSuperUnit; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperUnitCode; - - @ApiModelProperty("主管部门名称") - private String superUnit; - - @ApiModelProperty("主管部门Code") - private String superUnitCode; - - @ApiModelProperty("前端所需验证字段") - private Integer allApplicationsDone; - - @ApiModelProperty("项目一级状态 10000 20000 30000") - private Integer projectStatusFirst; - - @ApiModelProperty("项目二级状态") - private Integer projectStatusSecond; - - @ApiModelProperty("项目应用") - private List projectApplications; - - @ApiModelProperty("新增form内容") - private String formData; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredListItemVO.java deleted file mode 100644 index 329ce94..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredListItemVO.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * ProjectLibListItemVO - *

- * - * @author WendyYang - * @since 15:13 2023/2/1 - */ -@Data -@ApiModel("申报项目列表视图") -public class ProjectDeclaredListItemVO { - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("批复金额") - private BigDecimal approvedAmount; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("项目状态1") - private Integer projectStatusFirst; - - @ApiModelProperty("项目状态") - private Integer projectStatusSecond; - - @ApiModelProperty("申报年度") - private Integer projectYear; - - @ApiModelProperty("申报单位") - private String buildUnit; - - @ApiModelProperty("业务领域") - private String bizDomain; - - 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 LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java deleted file mode 100644 index f1d0df6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java +++ /dev/null @@ -1,373 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.ningdatech.pmapi.common.compare.Compare; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -/** - *

- * 项目草稿箱 - *

- * - * @author zpf - * @since 2023-02-06 - */ -@ApiModel(value = "NdProjectDraft对象", description = "") -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ProjectDraftVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域") - private String bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - private Integer isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - @ApiModelProperty("流程实例编号") - private String instCode; - - @ApiModelProperty("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("项目应用") - private List applicationList; - - @ApiModelProperty("新增form内容") - private Map dynamicForm; - - @ApiModelProperty("用户id") - private String userId; - - @ApiModelProperty("21位项目编号") - private String projectCode; - - @ApiModelProperty("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("是否开启评审清单") - private Boolean isReviewChecklist; - - @ApiModelProperty("评审清单") - private String reviewChecklist; - - private Long createBy; - private Long updateBy; - - @ApiModelProperty("是否推送省里") - private Boolean push; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PurchaseVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PurchaseVO.java deleted file mode 100644 index 55f99d8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PurchaseVO.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname Purchase - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang - */ -@ApiModel(value = "采购对象", description = "采购对象") -@Data -@AllArgsConstructor -public class PurchaseVO { - - @ApiModelProperty("id") - private Long id; - - @ApiModelProperty("标段名称") - private String bidName; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("创建人 工号") - private String createBy; - - @ApiModelProperty("修改人 工号") - private String updateBy; - - @ApiModelProperty("供应商") - private String supplier; - - @ApiModelProperty("供应商联系人") - private String supplierContact; - - @ApiModelProperty("供应商联系方式") - private String supplierContactInfo; - - @ApiModelProperty("供应商社会信用代码") - private String supplierSocialCreditCode; - - @ApiModelProperty("采购方式 1公开招标 2自行采购") - private String purchaseMethod; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - private LocalDateTime transactionTime; - - @ApiModelProperty("代理机构") - private String agency; - - @ApiModelProperty("代理机构社会统一信用代码") - private String purchaseSocialCreditCode; - - @ApiModelProperty("投标文件") - private String biddingDoc; - - @ApiModelProperty("招标文件") - private String bidDoc; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("预算执行确认书编号") - private String budgetExecConfirmNo; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewCheckInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewCheckInfoVO.java deleted file mode 100644 index 8c8cf5f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewCheckInfoVO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import com.wflow.enums.ReviewChecklistResultEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * @Classname ReviewCheckInfoVO - * @Description - * @Date 2023/11/08 10:00 - * @Author PoffyZhang - */ -@ApiModel(value = "ReviewCheckInfoVO", description = "ReviewCheckInfoVO") -@Data -@AllArgsConstructor -public class ReviewCheckInfoVO { - - @ApiModelProperty("审批人名") - private String username; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("员工号") - private String employeeCode; - - @ApiModelProperty("结果编号") - private Integer result; - - @ApiModelProperty("结果描述") - private String resultName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewChecklistApproveVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewChecklistApproveVO.java deleted file mode 100644 index 79745c9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ReviewChecklistApproveVO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @Classname ReviewChecklistApproveVO - * @Description - * @Date 2023/11/07 15:35 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ReviewChecklistApproveVO", description = "") -public class ReviewChecklistApproveVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("审批人") - private String createBy; - - @ApiModelProperty("审批时间") - private LocalDateTime createOn; - - @ApiModelProperty("审批人ID") - private Long createById; - - @ApiModelProperty("审批人code") - private String createByCode; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("子标题") - private String subTitle; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("对应页码") - private String corrPageNum; - - @ApiModelProperty("否决情形") - private String rejectionSituation; - - @ApiModelProperty("响应情况") - private String responseSituation; - - @ApiModelProperty("评审意见") - private String reviewComments; - - @ApiModelProperty("审核结果 1.通过 2不通过 3一票否决") - private Integer reviewResult; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IConstrctionSuggestionsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IConstrctionSuggestionsService.java deleted file mode 100644 index db75cdd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IConstrctionSuggestionsService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectConstructionSuggestions; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IConstrctionSuggestionsService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IContractService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IContractService.java deleted file mode 100644 index ae75108..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IContractService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IContractService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IDeclaredStatisticsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IDeclaredStatisticsService.java deleted file mode 100644 index 63396a1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IDeclaredStatisticsService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface IDeclaredStatisticsService { - - DeclaredProjectStatisticsPO getOrgStatistics(String organizationCode, Integer year); - - DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/INdPiotTasksService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/INdPiotTasksService.java deleted file mode 100644 index 7aa6776..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/INdPiotTasksService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.NdPiotTasks; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface INdPiotTasksService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java deleted file mode 100644 index 1003f76..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IOperationService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPaymentPlanService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPaymentPlanService.java deleted file mode 100644 index d3e3431..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPaymentPlanService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IPaymentPlanService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPreInsAcceptancePersonService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPreInsAcceptancePersonService.java deleted file mode 100644 index ed7043f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPreInsAcceptancePersonService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IPreInsAcceptancePersonService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IProjectDraftService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IProjectDraftService.java deleted file mode 100644 index db798fd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IProjectDraftService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface IProjectDraftService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java deleted file mode 100644 index cbfc3c1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IPurchaseService extends IService { - - default List listByProjectId(Long projectId) { - return list(Wrappers.lambdaQuery(Purchase.class) - .eq(Purchase::getProjectId, projectId)); - } - - default List listByProjectIds(List projectIds) { - return list(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, projectIds)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IReviewChecklistApproveService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IReviewChecklistApproveService.java deleted file mode 100644 index f189fea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IReviewChecklistApproveService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.ReviewChecklistApprove; - -/** - *

- * 服务类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -public interface IReviewChecklistApproveService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IrsApplicationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IrsApplicationService.java deleted file mode 100644 index 0b64011..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IrsApplicationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectdeclared.model.entity.IrsApplication; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -public interface IrsApplicationService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java deleted file mode 100644 index f49656d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.ConstructionSuggestionsMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.ningdatech.pmapi.projectdeclared.service.IConstrctionSuggestionsService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class ConstructionSuggestionsServiceImpl extends ServiceImpl - implements IConstrctionSuggestionsService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ContractServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ContractServiceImpl.java deleted file mode 100644 index 19e224c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ContractServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.ContractMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; -import com.ningdatech.pmapi.projectdeclared.service.IContractService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class ContractServiceImpl extends ServiceImpl - implements IContractService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java deleted file mode 100644 index 6931a7f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.ningdatech.pmapi.projectdeclared.mapper.DeclaredStatisticsMapper; -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import com.ningdatech.pmapi.projectdeclared.service.IDeclaredStatisticsService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -@AllArgsConstructor -public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService { - - private final DeclaredStatisticsMapper declaredStatisticsMapper; - - /** - * 根据userId 去查询 申报项目统计 根据单位 - * @param orgCode - * @return - */ - @Override - public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode,Integer year) { - return declaredStatisticsMapper.getOrgStatistics(orgCode,year); - } - - /** - * 根据userId 去查询 申报项目统计 根据区域 - * @param regionCode - * @return - */ - @Override - public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year) { - return declaredStatisticsMapper.getRegionStatistics(regionCode,year); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/IrsApplicationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/IrsApplicationServiceImpl.java deleted file mode 100644 index 01f5517..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/IrsApplicationServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.IrsApplicationMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.IrsApplication; -import com.ningdatech.pmapi.projectdeclared.service.IrsApplicationService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class IrsApplicationServiceImpl extends ServiceImpl - implements IrsApplicationService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/NdPiotTasksServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/NdPiotTasksServiceImpl.java deleted file mode 100644 index 30cdedb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/NdPiotTasksServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.NdPiotTasksMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.NdPiotTasks; -import com.ningdatech.pmapi.projectdeclared.service.INdPiotTasksService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class NdPiotTasksServiceImpl extends ServiceImpl - implements INdPiotTasksService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java deleted file mode 100644 index cb1eb1a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.OperationMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; -import com.ningdatech.pmapi.projectdeclared.service.IOperationService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class OperationServiceImpl extends ServiceImpl - implements IOperationService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PaymentPlanServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PaymentPlanServiceImpl.java deleted file mode 100644 index ad51158..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PaymentPlanServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.PaymentPlanMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; -import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class PaymentPlanServiceImpl extends ServiceImpl - implements IPaymentPlanService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java deleted file mode 100644 index 506c440..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PreInsAcceptancePersonServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.PreInsAcceptancePersonMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; -import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class PreInsAcceptancePersonServiceImpl extends ServiceImpl - implements IPreInsAcceptancePersonService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ProjectDraftServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ProjectDraftServiceImpl.java deleted file mode 100644 index d53f0a4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ProjectDraftServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; -import com.ningdatech.pmapi.projectdeclared.mapper.ProjectDraftMapper; -import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class ProjectDraftServiceImpl extends ServiceImpl - implements IProjectDraftService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PurchaseServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PurchaseServiceImpl.java deleted file mode 100644 index 5155258..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/PurchaseServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.mapper.PurchaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-05 - */ -@Service -public class PurchaseServiceImpl extends ServiceImpl - implements IPurchaseService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java deleted file mode 100644 index 6b628a5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/ReviewChecklistApproveServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectdeclared.model.entity.ReviewChecklistApprove; -import com.ningdatech.pmapi.projectlib.mapper.ReviewChecklistApproveMapper; -import com.ningdatech.pmapi.projectdeclared.service.IReviewChecklistApproveService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -@Service -public class ReviewChecklistApproveServiceImpl extends ServiceImpl - implements IReviewChecklistApproveService { - -} 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 deleted file mode 100644 index f6ea38f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.utils; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.model.dto.*; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; -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; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * 生成项目编号工具类 - * - * @author CMM - * @since 2023/04/04 14:13 - */ -@Component -public class GenerateProjectCodeUtil { - - @Autowired - private IProjectService projectService; - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovOperationProjectBaseinfoService operationProjectBaseinfoService; - - public String generateProjectCode(ProjectDTO project){ - // 获取所属行政区划代码(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 = project.getProjectType(); - // 16-20 项目序号00001 - String currentCode = areaCode + year + projectType; - // 16-20 项目序号00001 - //要查询 两边的项目序号 - Long max = getMaxProjectCode(currentCode); - // 生成20位的项目编号 - return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); - } - - public String generateProjectCode(ProjectCollection project){ - // 获取所属行政区划代码(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 - String currentCode = areaCode + year + projectType; - // 16-20 项目序号00001 - //要查询 最大的项目编号 - Long max = getMaxProjectCode(currentCode); - // 生成20位的项目编号 - return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); - } - - public String generateProjectCode(GovBizProjectSaveDTO dto) { - // 获取所属行政区划代码(9位) - GovBizProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); - GovBizProjectApplyDTO apply = dto.getApply(); - - VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); - VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); - // 获取建设年度 (10-13) - String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() - : String.valueOf(LocalDateTime.now().getYear()); - // 14-15 项目类型 - String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : - BizProjectContant.ProjectCollection.IS_EFFECTIVE; - String currentCode = areaCode + year + projectType; - // 16-20 项目序号00001 - //要查询 最大的项目编号 - Long max = getMaxProjectCode(currentCode); - // 生成20位的项目编号 - return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); - } - - public String generateProjectCode(GovOperationProjectSaveDTO dto) { - // 获取所属行政区划代码(9位) - GovOperationProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); - GovBizProjectApplyDTO apply = dto.getApply(); - - VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); - VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); - // 获取建设年度 (10-13) - String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() - : String.valueOf(LocalDateTime.now().getYear()); - // 14-15 项目类型 - String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : - BizProjectContant.ProjectCollection.IS_EFFECTIVE; - String currentCode = areaCode + year + projectType; - // 16-20 项目序号00001 - //要查询 最大的项目编号 - Long max = getMaxProjectCode(currentCode); - // 生成20位的项目编号 - return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); - } - private Long getMaxProjectCode(String currentCode) { - Long max = 0L; - GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .like(GovBizProjectBaseinfo::getBaseProjId, currentCode) - .orderByDesc(GovBizProjectBaseinfo::getBaseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ - max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); - } - GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) - .orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ - Long operationMax = Long.valueOf(operationBaseMax.getBaseProjId().substring(operationBaseMax.getBaseProjId().length() - 5)); - max = Math.max(max,operationMax); - } - Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .like(Project::getProjectCode, currentCode) - .orderByDesc(Project::getProjectCode) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())){ - Long projectMaxCode = Long.valueOf(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5)); - max = Math.max(max,projectMaxCode); - } - max = max + 1; - return max; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java deleted file mode 100644 index bcd31a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.projectdeclared.utils; - -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.projectdeclared.manage.*; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.function.Function; - -/** - * @Classname ReSubmitProcessMap - * @Description 项目调整 重新提交时的 事件函数MAP - * @Date 2023/2/15 11:19 - * @Author PoffyZhang - */ -@Component -public class ReStartProcessMapUtil { - @Autowired - private DeclaredProjectManage declaredProjectManage; - - @Autowired - private ConstructionPlanManage constructionPlanManage; - - @Autowired - private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; - - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - - @Autowired - private FinalAcceptanceManage finalAcceptanceManage; - - public Map> reStartProcessMap = Maps.newHashMap(); - /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 - */ - public ReStartProcessMapUtil(){ - //重新项目申报 - reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - dto->declaredProjectManage.reStartTheProcess(dto)); - //建设方案 - reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), - dto->constructionPlanManage.restartTheProcess(dto)); - //预审方案 - reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - dto->prequalificationDeclaredProjectManage.restartTheProcess(dto)); - //省级联审 - reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - dto->provincialDeptManage.restartTheProcess(dto)); - //终审 - reStartProcessMap.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), - dto->finalAcceptanceManage.restartProcess(dto)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java deleted file mode 100644 index bc0c61f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.projectlib.constant; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; - -import java.util.*; - - -/** - *

- * ImportTemplateEnumConstant - *

- * - * @author WendyYang - * @since 20:11 2022/11/4 - */ -public class ImportTemplateConstant { - - public static final List ANNUAL_PLAN_COL_LIST = Arrays.asList("序号","项目id","项目名称","建设内容","建设依据","建设性质","建设起止年限(填写到月)", "总投资", "自有资金","年度投资额","政府投资-本级财政","政府投资-上级补助资金","银行贷款","其他","一季度","二季度","三季度","四季度","建设单位","项目联系人","项目分管领导","备注"); - - private static final Map> IMPORT_TEMPLATE_MAP; - - static { - IMPORT_TEMPLATE_MAP = new HashMap<>(ProjectLibFlagEnum.values().length); - IMPORT_TEMPLATE_MAP.put(ProjectLibFlagEnum.ANNUAL_PLAN, ANNUAL_PLAN_COL_LIST); - } - - public static List getTemplateTitle(ProjectLibFlagEnum template) { - return IMPORT_TEMPLATE_MAP.getOrDefault(template, Collections.emptyList()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java deleted file mode 100644 index c34a508..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.projectlib.constant; - -/** - * @Classname ProjectConstant - * @Description - * @Date 2023/7/21 14:13 - * @Author PoffyZhang - */ -public interface ProjectConstant { - - class ProjectLib{ - public static final String PROJECT_BASIC = "basic"; - public static final String PROJECT_CONSTRUCT = "construct"; - - public static final String CHANGES_KEY = "changes"; - - public static final String PROCESS_KEY = "process"; - } -} 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 deleted file mode 100644 index 5202441..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ningdatech.pmapi.projectlib.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; -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 io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -/** - *

- * AnnualPlanController - *

- * - * @author WendyYang - * @since 14:07 2023/2/11 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "年度计划库") -@RequestMapping("/api/v1/annualPlan") -public class AnnualPlanController { - - private final AnnualPlanLibManage annualPlanLibManage; - - @GetMapping("/list") - @ApiOperation("年度计划库列表") - public PageVo annualPlanLibList(ProjectListReq req) { - return annualPlanLibManage.annulPlanLibList(req); - } - - @PostMapping("/startProjectDeclared") - @ApiOperation("开启项目申报") - @WebLog("开启项目申报") - public void startProjectDeclared(@RequestBody @Valid StartProjectDeclareReq req) { - annualPlanLibManage.startProjectDeclared(req); - } - - @PostMapping("/projectApproved") - @ApiOperation("立项批复") - @WebLog("立项批复") - public void projectApproved(@RequestBody @Valid ProjectApprovedReq req) throws Exception { - annualPlanLibManage.projectApproved(req); - } - - @PostMapping("/suspendAnnualPlan") - @ApiOperation("暂缓年度计划") - @WebLog("暂缓年度计划") - public void suspendAnnualPlan(@RequestBody @Valid ProjectIdReq req) throws Exception { - annualPlanLibManage.suspendAnnualPlan(req); - } - - @PostMapping("/importAnnualPlan") - @ApiOperation("导入年度计划") - @WebLog("导入年度计划") - public void importAnnualPlan(@RequestParam("importFlag") ProjectLibFlagEnum importFlag, MultipartFile file) { - annualPlanLibManage.importAnnualPlan(importFlag,file); - } - - @PostMapping("/modify") - @ApiOperation("年度计划编辑") - @WebLog("年度计划编辑") - public void modify(@RequestBody ProjectDTO req) { - annualPlanLibManage.updateAnnualPlan(req); - } - - @PostMapping("/exportList") - @ApiOperation("项目(增补)库列表导出") - @WebLog("项目(增补)库列表导出") - public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response) { - annualPlanLibManage.exportList(param, response); - } - - @PostMapping("/exportModifyList") - @ApiOperation("项目(增补)库编辑表导出") - @WebLog("项目(增补)库编辑表导出") - public void exportModifyList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response) { - annualPlanLibManage.exportModifyList(param, response); - } - -} 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 deleted file mode 100644 index a5b7123..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.projectlib.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -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 io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - -/** - * @Classname ProjectApplicationController - * @Description - * @Date 2023/6/27 11:32 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "项目应用控制器") -@RequestMapping("/api/v1/application") -public class ProjectApplicationController { - - private final ApplicationManage applicationManage; - - @GetMapping("/get-report/{appCode}") - @ApiOperation("获取应用 试运行报告") - @WebLog("获取应用 试运行报告") - public String getReport(@PathVariable String appCode) { - return applicationManage.getReport(appCode); - } - - @PostMapping("/save-appcode") - @ApiOperation("保存应用注册的appCode") - @WebLog("保存应用注册的appCode") - public String saveAppCode(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { - return applicationManage.saveAppCode(dto); - } - - @GetMapping("/to-register-app-project-list") - @ApiOperation("待应用预注册的项目应用列表") - public PageVo toRegisterAppProjectLibList(ProjectListReq req) { - return applicationManage.toRegisterAppProjectLibList(req); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java deleted file mode 100644 index 5a6a913..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.projectlib.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.projectlib.manage.ProjectCollectionManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectCollectionVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - * @Classname ProjectCollectionController - * @Description - * @Date 2023/6/25 9:11 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "项目归集控制器") -@RequestMapping("/api/v1/project-collection") -public class ProjectCollectionController { - - private final ProjectCollectionManage collectionManage; - - @GetMapping("/list") - @ApiOperation("项目归集列表") - public PageVo list(ProjectListReq req) { - return collectionManage.list(req); - } - - @GetMapping("/detail/{id}") - @ApiOperation("项目归集详情") - public ProjectCollectionVO detail(@PathVariable Long id) { - return collectionManage.detail(id); - } - - @PostMapping("/save") - @ApiOperation("项目归集保存") - @WebLog("项目归集保存") - public String save(@Valid @RequestBody ProjectCollectionSaveDTO dto) { - return collectionManage.save(dto); - } - - @PostMapping("/delete/{id}") - @ApiOperation("项目归集删除") - @WebLog("项目归集删除") - public String delete(@PathVariable Long id) { - return collectionManage.delete(id); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java deleted file mode 100644 index 5132402..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.ningdatech.pmapi.projectlib.controller; - -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.req.ProjectApplicationListReq; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -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.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import java.util.List; - -/** - *

- * ProjectLibController - *

- * - * @author WendyYang - * @since 17:30 2023/2/1 - */ -@RestController -@RequestMapping("/api/v1/project/lib") -@AllArgsConstructor -@Api(tags = "项目库") -public class ProjectLibController { - - private final ProjectLibManage projectLibManage; - - private final UserInfoHelper userInfoHelper; - - @GetMapping("/list") - @ApiOperation("项目库列表") - public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.projectLibListWithPermission(req,user); - } - - @GetMapping("/all-list") - @ApiOperation("包含申报项目列表和项目归集列表") - public PageVo projectAllList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.projectAllListWithPermission(req,user); - } - - @GetMapping("/lib-list") - @ApiOperation("包含申报项目列表和项目归集(运维项目)列表") - public PageVo libList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.libListWithPermission(req,user); - } - - @GetMapping("/history-list/{id}") - @ApiOperation("项目历史版本列表") - public JSONObject historyProjects(@PathVariable Long id) { - return projectLibManage.historyProjects(id); - } - - @GetMapping("/change-record/{id}") - @ApiOperation("查看项目变更记录") - public JSONObject changeRecord(@PathVariable Long id) { - return projectLibManage.changeRecord(id); - } - - @GetMapping("/application/list") - @ApiOperation("应用列表") - public PageVo applicationList(ProjectApplicationListReq req) { - return projectLibManage.applicationList(req); - } - - @GetMapping("/prePlan/{id}") - @ApiOperation("获取项目初步方案详情") - public ProjectDetailVO constructDetail (@PathVariable Long id){ - return projectLibManage.getPrePlanProjectDetail(id); - } - - @GetMapping("/{id}") - @ApiOperation("获取项目详情") - public ProjectDetailVO detail (@PathVariable Long id){ - return projectLibManage.getProjectDetail(id); - } - - @GetMapping("/convert-to-collection/{projectCode}") - @ApiOperation("申报项目转化为项目归集") - public GovBizProjectDetailVO convertToCollection(@PathVariable String projectCode){ - return projectLibManage.convertToCollection(projectCode); - } - - @GetMapping("/detail/{projectCode}") - @ApiOperation("获取项目详情(编号)") - public ProjectDetailVO detailProjectCode (@PathVariable String projectCode){ - return projectLibManage.detailProjectCode(projectCode); - } - - @GetMapping("/processSchedule/{projectId}") - @ApiOperation("项目库申报项目当前进度详情") - public List processScheduleDetail(@PathVariable("projectId") Long projectId){ - return projectLibManage.processScheduleDetail(projectId); - } - - @PostMapping("/exportList") - @ApiOperation("项目库列表导出") - @WebLog("项目库列表导出") - public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response){ - projectLibManage.exportList(param,response); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java deleted file mode 100644 index 0dbea5f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.ningdatech.pmapi.projectlib.controller; - - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; -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.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; - -/** - *

- * 续建项目资金申请表 前端控制器 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@RestController -@RequestMapping("/api/v1/project/renewal") -@AllArgsConstructor -@Api(tags = "续建项目资金库") -public class ProjectRenewalFundDeclarationController { - private final ProjectRenewalFundManage projectRenewalFundManage; - - private final UserInfoHelper userInfoHelper; - - @GetMapping("/list") - @ApiOperation("项目续建资金库") - public PageVo list(ProjectRenewalListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectRenewalFundManage.list(req,user); - } - - @GetMapping("/project-list") - @ApiOperation("项目续建资金库能关联的项目列表") - public PageVo projectlist(ProjectRenewalListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectRenewalFundManage.projectlist(req,user); - } - - @GetMapping("/{id}") - @ApiOperation("项目续建资金详情") - @WebLog("项目续建资金详情") - public ProjectRenewalFundDeclarationVO detail (@PathVariable Long id){ - return projectRenewalFundManage.detail(id); - } - - @PostMapping("/declared") - @ApiOperation("项目续建资金申请") - @WebLog("项目续建资金申请") - public Long declared (@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto){ - return projectRenewalFundManage.declared(dto); - } - - @PostMapping("/audit") - @ApiOperation("续建项目审核") - @WebLog("续建项目审核") - public Long audit(@Validated @RequestBody ProjectRenewalAuditReq param){ - return projectRenewalFundManage.audit(param); - } - - @DeleteMapping("/delete/{projectRenewalId}") - @ApiOperation("续建项目删除") - @WebLog("续建项目删除") - public Long delete(@PathVariable("projectRenewalId") Long projectRenewalId){ - return projectRenewalFundManage.delete(projectRenewalId); - } - - @GetMapping("/export") - @ApiOperation("项目库续建项目列表导出") - @WebLog("项目库续建项目列表导出") - public void exportList(ProjectRenewalListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportList); - } - - @GetMapping("/exportRenewalDeclare") - @ApiOperation("申报管理续建项目资金申报列表导出") - @WebLog("申报管理续建项目资金申报列表导出") - public void exportRenewalDeclareList(ProjectRenewalListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportRenewalDeclareList); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/BizDomainEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/BizDomainEnum.java deleted file mode 100644 index abe2b0c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/BizDomainEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.projectlib.enumeration; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * 综合业务领域枚举 - * - * @return - * @author CMM - * @since 2023/03/16 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum BizDomainEnum { - /** - * 项目类型 - */ - PARTY_GOV_ORG_OVERALL(1, "党政机关整体智治"), - DIG_GOV(2, "数字政府"), - DIG_ECO(3, "数字经济"), - DIG_SOC(4, "数字社会"), - DIG_LAW(5, "数字法治"), - ALL_INTEL_PUB_DATA_PLAT(6, "一体化智能化公共数据平台"), - DIG_CUL(7, "数字文化"), - GRA_WISE(8, "基层智治"); - - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (BizDomainEnum t : BizDomainEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/CloudTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/CloudTypeEnum.java deleted file mode 100644 index bdb250a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/CloudTypeEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.projectlib.enumeration; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * 云类型枚举 - * - * @return - * @author CMM - * @since 2023/03/16 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum CloudTypeEnum { - /** - * 云类型 - */ - GOV_CLOUD_NON_LETTER(1, "政务云(非信创)"), - GOV_CLOUD_LETTER(2, "数字政府"), - OTHER(3,"其他"); - - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (CloudTypeEnum t : CloudTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/FourSystemEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/FourSystemEnum.java deleted file mode 100644 index 144dbb9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/FourSystemEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.projectlib.enumeration; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * 四大体系枚举 - * - * @return - * @author CMM - * @since 2023/03/16 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum FourSystemEnum { - /** - * 项目类型 - */ - BUSINESS_APPLICATION(1, "业务应用"), - APPLICATION_SUPPORT(2, "应用支撑"), - DATA_RESOURCES(3, "数据资源"), - INFRASTRUCTURE(4, "基础设施"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (FourSystemEnum t : FourSystemEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java deleted file mode 100644 index 92511c4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -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 InstTypeEnum { - /** - * 流程实例类型 - */ - UNIT_INNER_AUDIT(1, "单位内部审批流程"), - PRELIMINARY_PREVIEW(2, "项目预审审批流程"), - DEPT_UNITED_REVIEW(3,"部门联合审批流程"), - CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"), - PROJECT_FINAL_INSPECTION(5,"验收申报审批流程"), - - APPLY_DELAY(6,"申请延期审批流程"), - - APPLY_BORROW(7,"申请借阅审批流程"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (InstTypeEnum t : InstTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static InstTypeEnum getByCode(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (InstTypeEnum t : InstTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectLibFlagEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectLibFlagEnum.java deleted file mode 100644 index 53707ae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectLibFlagEnum.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.projectlib.enumeration; - -import lombok.Getter; - -/** - *

- * 项目库标志枚举 - *

- * - * @author WendyYang - * @since 2022-11-04 - */ -@Getter -public enum ProjectLibFlagEnum { - - /** - * 项目库标志枚举 - */ - - ANNUAL_PLAN("年度计划库"), - ANNUAL_PLAN_SUPPLEMENT("年度计划增补库"); - - private final String value; - - ProjectLibFlagEnum(String value) { - this.value = value; - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java deleted file mode 100644 index 7e042da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -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; - -/** - *

- * ProjectRenewalApprovalStatusEnum - *

- * - * @author Poffy - * @since 16:54 2023/2/11 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectRenewalApprovalStatusEnum { - /** - * 续建项目 审核状态 - * 审核中 - * 通过 - * 不通过 - */ - PENDING(1,"审核中"), - PASS(2,"通过"), - NOT_PASS(3,"不通过"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static ProjectRenewalApprovalStatusEnum match(String name) { - if (StringUtils.isBlank(name)) { - return null; - } - for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { - if (name.equals(t.name())) { - return t; - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java deleted file mode 100644 index d424929..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ningdatech.pmapi.projectlib.enumeration; - -import com.ningdatech.pmapi.gov.enumeration.GovProjectStatusEnum; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import java.util.Objects; - -/** - *

- * ProjectStatusEnum - *

- * - * @author Poffy - * @since 16:54 2023/2/11 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectStatusEnum { - /** - * 项目阶段:未立项 - */ - NOT_APPROVED(10000, "未立项",null), - UNDER_INTERNAL_AUDIT(10001, "单位内部审核中",null), - UNDER_INTERNAL_AUDIT_NOT_PASS(10002, "单位内部审核不通过",null), - PENDING_PREQUALIFICATION(10003, "待预审",null), - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS(10004, "省级部门联审中",null), - - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS(10018, "省级部门联审通过",null), - THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED(10005, "省级部门联审不通过",null), - PRE_APPLYING(10006, "预审中",null), - PREQUALIFICATION_FAILED(10007, "预审不通过",null), - DEPARTMENT_JOINT_REVIEW(10008, "部门联审中",null), - DEPARTMENT_JOINT_REVIEW_FAILED(10009, "部门联审不通过",null), - IN_THE_ANNUAL_PLAN(10010, "年度计划中",null), - BE_SUSPENDED(10011, "被暂缓",null), - SCHEME_UNDER_REVIEW(10012, "方案评审中",GovProjectStatusEnum.APPROVAL), - SCHEME_REVIEW_FAILED(10013, "方案评审不通过",null), - TO_BE_APPROVED(10014, "待立项批复",GovProjectStatusEnum.PENDING), - TO_BE_DECLARED(10015, "待申报",null), - PLAN_TO_BE_DECLARED(10016, "方案待申报",null), - PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态",null), - PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态",null), - APPROVED_AFTER_CHOICE(10020, "立项批复后选择态",null), - TO_BE_APP_REGISTER(10021, "待应用注册",null), - /** - * 项目阶段:已立项 - */ - PROJECT_APPROVED(20000, "已立项",null), - TO_BE_PURCHASED(20001, "待采购",GovProjectStatusEnum.APPROVED), - UNDER_CONSTRUCTION(20002, "建设中",null), - TO_BE_FINALLY_INSPECTED(20003, "待终验",GovProjectStatusEnum.HAS_PRE_INS), - FINAL_ACCEPTANCE_IS_UNDER_REVIEW(20004, "终验审核中",null), - FINAL_ACCEPTANCE_REVIEW_FAILED(20005, "终验审核不通过",null), - OPERATION(20006, "待开工",GovProjectStatusEnum.PURCHASED), - /** - * 项目阶段:已归档 - */ - ARCHIVED(30000, "已归档",null), - ACCEPTED(30001, "已验收",GovProjectStatusEnum.HAS_FINAL_INS); - - private Integer code; - private String desc; - - private GovProjectStatusEnum collectionStatus; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectStatusEnum t : ProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static ProjectStatusEnum match(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (ProjectStatusEnum t : ProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } - - public boolean eq(int code) { - return this.getCode().equals(code); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeEnum.java deleted file mode 100644 index 2ba2688..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeEnum.java +++ /dev/null @@ -1,42 +0,0 @@ -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; - -/** - *

- * ProjectTypeEnum - *

- * - * @author Poffy - * @since 16:56 2023/2/11 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectTypeEnum { - /** - * 项目类型 - */ - BUILD(1, "建设"), - DEV_OPS(2, "运维"); - - private Integer code; - private String desc; - - public static String getDesc(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectTypeEnum t : ProjectTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeNewEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeNewEnum.java deleted file mode 100644 index 57f653b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectTypeNewEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -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; - -/** - *

- * ProjectTypeNewEnum - *

- * - * @author Poffy - * @since 16:56 2023/2/11 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum ProjectTypeNewEnum { - /** - * 项目类型 - */ - FIRST_BUILD("01", "首次建设"), - SJ_BUILD("02", "迭代升级"), - SZ_BUILD("03", "结转建设"), - NEW_OPERA("04", "新运维"), - XU_OPERA("05", "续运维"); - - private String code; - private String desc; - - public static String getDesc(String code) { - if (StringUtils.isBlank(code)) { - return StringUtils.EMPTY; - } - for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static ProjectTypeNewEnum match(String code) { - if (StringUtils.isBlank(code)) { - return null; - } - for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} 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 deleted file mode 100644 index 73160e4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningFlowTypeEnum.java +++ /dev/null @@ -1,60 +0,0 @@ -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(),"declareManage/planDeclaration/preExaminationDeclare"), - PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"), - DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode(),"declareManage/procurementRecord/purchaseResults"), - CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/acceptanceApply/initialInspectionRecord"), - PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); - - private Integer code; - private String desc; - - //对应的 待提交时的项目状态 - private Integer projectStutas; - - private String path; - - 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/WarningNoticeTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningNoticeTypeEnum.java deleted file mode 100644 index 7de61d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningNoticeTypeEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -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 ZPF - * @since 2023/10/31 16:14 - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum WarningNoticeTypeEnum { - /** - * 预警提醒类型枚举 - */ - CONTACT(1, "项目联系人"), - RESPONSIBLE(2, "项目负责人"); - - private Integer code; - private String desc; - - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static WarningNoticeTypeEnum getByCode(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (WarningNoticeTypeEnum t : WarningNoticeTypeEnum.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 deleted file mode 100644 index 3fbad57..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -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(),"declareManage/acceptanceApply/initialInspectionRecord"), - ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); - - private Integer code; - private String desc; - - //对应的 待提交时的项目状态 - private Integer projectStutas; - - private String path; - - 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/AbstractProcessBusinessHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AbstractProcessBusinessHandle.java deleted file mode 100644 index 7973155..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AbstractProcessBusinessHandle.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import com.wflow.workflow.bean.vo.ProcessDetailVO; - -import java.util.List; - -/** - * 流程业务抽象处理类 - * - * @author CMM - * @since 2023/02/24 14:22 - */ - -public abstract class AbstractProcessBusinessHandle { - /** - * 构造,子类必须实现 - */ - public AbstractProcessBusinessHandle(){} - - /** - * 抽象的,所有具体处理者应该实现的处理逻辑 - * @param projectId - * @param processSchedule - * @return void - * @author CMM - * @since 2023/02/27 9:01 - */ - abstract void businessHandle(Long projectId, List processSchedule); - - abstract Integer getOrder(); - - abstract void setOrder(Integer order); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java deleted file mode 100644 index 6cd3a9f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.ningdatech.pmapi.common.constant.CommonConst; - -import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; - -/** - * 年度计划处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(6) -@Component -public class AnnualPlanHandle extends AbstractProcessBusinessHandle { - private final INdProjectStatusChangeService projectStatusChangeService; - private final IProjectService projectService; - - private Integer order = 6; - - /** - * 项目状态为:年度计划中之前的状态 - */ - private static final List ANNUAL_PLAN_LIST_STATUS = Arrays.asList( - NOT_APPROVED, - UNDER_INTERNAL_AUDIT, - UNDER_INTERNAL_AUDIT_NOT_PASS, - PENDING_PREQUALIFICATION, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, - THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, - PRE_APPLYING, - PREQUALIFICATION_FAILED, - DEPARTMENT_JOINT_REVIEW, - DEPARTMENT_JOINT_REVIEW_FAILED - ); - - public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ - this.projectStatusChangeService = projectStatusChangeService; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - // 根据项目状态判断年度计划是否开始 - Project project = projectService.getById(projectId); - Integer status = project.getStatus(); - List fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); - - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - - // 项目状态为年度计划中之前的状态 - if (fieldList.contains(status)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); - processSchedule.add(processDetailVO); - return; - } - - // 项目状态为年度计划中 - if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ - // 根据部门联审通过的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } - } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { - // 根据年度计划暂缓的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } - } else { - // 根据开启方案申报的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - } - processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java deleted file mode 100644 index 58b8d57..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - - -import java.util.List; -import java.util.Objects; - -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; - -/** - * 归档处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(12) -@Component -public class ArchivedHandle extends AbstractProcessBusinessHandle { - private final IProjectService projectService; - private final INdProjectStatusChangeService projectStatusChangeService; - - private Integer order = 12; - - public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ - this.projectService = projectService; - this.projectStatusChangeService = projectStatusChangeService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); - Integer status = project.getStage(); - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - // 根据项目阶段判断是否已归档 - // 项目阶段不为已归档 - if (!ProjectStatusEnum.ARCHIVED.getCode().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.ARCHIVED); - processSchedule.add(processDetailVO); - return; - } - // 项目阶段为已归档 - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 根据项目终验获取归档时间 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setProcessName(CommonConst.ARCHIVED); - } - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java deleted file mode 100644 index 5b040fd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; - -/** - * 建设方案评审处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(7) -@Component -public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle { - - private final IProjectInstService projectInstService; - private final ProcessInstanceService processInstanceService; - private final BuildUserUtils buildUserUtils; - private final ProjectVersionUtil projectVersionUtil; - private final IProjectService projectService; - - private Integer order = 7; - - public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ - this.projectInstService = projectInstService; - this.processInstanceService = processInstanceService; - this.buildUserUtils = buildUserUtils; - this.projectVersionUtil = projectVersionUtil; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - // 根据项目ID查询出建设方案评审流程的流程状态 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) - .orderByDesc(ProjectInst::getCreatOn) - .last(BizConst.LIMIT_1)); - ProcessProgressVo instanceDetail = null; - // 未找到当前版本项目的建设方案审核流程且当前项目版本号大于1(是被驳回重新申报的项目) - if (Objects.isNull(projectInst)) { - if (project.getVersion() > CommonConst.VERSION_ONE ){ - // 获取上个版本的信息 - instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW); - } - }else { - String instCode = projectInst.getInstCode(); - instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); - } - if (Objects.isNull(instanceDetail)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); - processSchedule.add(processDetailVO); - return; - } - String status = instanceDetail.getStatus(); - if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - - // 装配节点审核人员信息 - List progressInfo = instanceDetail.getProgressInfo(); - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - // 根据流程处理详情获取流程完成时间 - if (StepStatusEnum.contains(processDetailVO.getStepStatus(), - Lists.newArrayList(StepStatusEnum.REJECTED, - StepStatusEnum.COMPLETED))) { - ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - processDetailVO.setFinishTime(finishTime); - } - }else { - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); - processDetailVO.setFinishTime(finishTime); - } - processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java deleted file mode 100644 index a93b73e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; - -/** - * 部门联审审核处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(5) -@Component -public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { - - private final IProjectInstService projectInstService; - - private final IProjectService projectService; - private final ProcessInstanceService processInstanceService; - private final BuildUserUtils buildUserUtils; - private final ProjectVersionUtil projectVersionUtil; - - private Integer order = 5; - - public DeptUnitedReviewHandle(IProjectInstService projectInstService,IProjectService projectService - , ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, - ProjectVersionUtil projectVersionUtil){ - this.projectInstService = projectInstService; - this.projectService = projectService; - this.processInstanceService = processInstanceService; - this.buildUserUtils = buildUserUtils; - this.projectVersionUtil = projectVersionUtil; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(projectId); - - // 根据项目ID查询出部门联审流程的流程状态 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) - .orderByDesc(ProjectInst::getCreatOn) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(projectInst)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); - processSchedule.add(processDetailVO); - return; - } - String instCode = projectInst.getInstCode(); - ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); - String status = instanceDetail.getStatus(); - if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - // 装配节点审核人员信息 - List progressInfo = instanceDetail.getProgressInfo(); - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - // 根据流程处理详情获取流程完成时间 - if (StepStatusEnum.contains(processDetailVO.getStepStatus(), - Lists.newArrayList(StepStatusEnum.REJECTED, - StepStatusEnum.COMPLETED))) { - ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - processDetailVO.setFinishTime(finishTime); - } - }else { - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); - processDetailVO.setFinishTime(finishTime); - } - processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java deleted file mode 100644 index e23cb42..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.enums.StepStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * 项目预审处理 - * - * @author CMM - * @since 2023/02/27 10:09 - */ -@Order(4) -@Component -public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { - - private final IProjectInstService projectInstService; - private final ProcessInstanceService processInstanceService; - private final BuildUserUtils buildUserUtils; - private final ProjectVersionUtil projectVersionUtil; - private final IProjectService projectService; - - private Integer order = 4; - - public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) { - this.projectInstService = projectInstService; - this.processInstanceService = processInstanceService; - this.buildUserUtils = buildUserUtils; - this.projectVersionUtil = projectVersionUtil; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); - - if (Objects.isNull(project)){ - throw new BizException("当前项目不存在!"); - } - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(projectId); - // 根据项目ID查询项目预审流程的流程状态 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) - .orderByDesc(ProjectInst::getCreatOn) - .last("limit 1")); - ProcessProgressVo instanceDetail = null; - // 未找到当前版本项目的预审审核流程且当前项目版本号大于1(是被驳回重新申报的项目或者建设方案申报的项目) - if (Objects.isNull(projectInst)) { - if (project.getVersion() > CommonConst.VERSION_ONE){ - // 获取上个版本的信息 - instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.PRELIMINARY_PREVIEW); - } - }else { - String instCode = projectInst.getInstCode(); - instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); - } - if (Objects.isNull(instanceDetail)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); - processSchedule.add(processDetailVO); - return; - } - String status = instanceDetail.getStatus(); - if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - - // 装配节点审核人员信息 - List progressInfo = instanceDetail.getProgressInfo(); - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - // 根据流程处理详情获取流程完成时间 - if (StepStatusEnum.contains(processDetailVO.getStepStatus(), - Lists.newArrayList(StepStatusEnum.REJECTED, - StepStatusEnum.COMPLETED))) { - ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - processDetailVO.setFinishTime(finishTime); - } - }else { - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); - processDetailVO.setFinishTime(finishTime); - } - processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java deleted file mode 100644 index 2673690..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.bean.entity.WflowModels; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.service.ProcessModelService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 流程执行链 - * - * @author CMM - * @since 2023/02/26 21:36 - */ -@Component -public class ProcessExecuteChainHandle { - - @Autowired - private IProjectService projectService; - - @Autowired - private ProcessModelService processModelService; - - /** - * 具体处理者的集合 - */ - private List processBusinessHandles; - - public ProcessExecuteChainHandle(List processBusinessHandles) { - this.processBusinessHandles = processBusinessHandles; - } - - /** - * 遍历处理链,通过前缀判断能否处理逻辑,如果不能继续遍历 - * @param projectId - * @return void - * @author CMM - * @since 2023/02/26 - */ - public List handle(Long projectId, List processSchedule){ - Project project = projectService.getById(projectId); - - List handles = Lists.newArrayList(); - for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { - if(Objects.nonNull(project) && RegionContant.LS_LQ_CODE.equals(project.getAreaCode())) { - if(processBusinessHandle instanceof AnnualPlanHandle){ - processBusinessHandle.setOrder(7); - }else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ - processBusinessHandle.setOrder(6); - } - }else{ - if(processBusinessHandle instanceof AnnualPlanHandle){ - processBusinessHandle.setOrder(6); - }else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ - processBusinessHandle.setOrder(7); - } - } - - //建设方案 - if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, project.getAreaCode()) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(model)){ - if(!model.getIsStop()){ - handles.add(processBusinessHandle); - } - } - }else if(processBusinessHandle instanceof ProvinceUnitedReviewHandle){ - //省级联审 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ - handles.add(processBusinessHandle); - } - }else{ - handles.add(processBusinessHandle); - } - } - - handles = handles.stream() - .sorted(Comparator.comparing(AbstractProcessBusinessHandle::getOrder)) - .collect(Collectors.toList()); - if (handles.size() > 0) { - for (AbstractProcessBusinessHandle processBusinessHandle : handles) { - processBusinessHandle.businessHandle(projectId, processSchedule); - } - return processSchedule; - } - return Collections.emptyList(); - } -} 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 deleted file mode 100644 index 037e537..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ /dev/null @@ -1,125 +0,0 @@ -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; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; - -import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; - -/** - * 立项批复处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(8) -@Component -public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { - private final INdProjectStatusChangeService projectStatusChangeService; - private final IProjectService projectService; - private final AnnualPlanLibManage annualPlanLibManage; - - private Integer order = 8; - - /** - * 项目状态为:待立项批复之前的状态 - */ - private static final List PROJECT_APPROVAL_LIST_STATUS = Arrays.asList( - NOT_APPROVED, - UNDER_INTERNAL_AUDIT, - UNDER_INTERNAL_AUDIT_NOT_PASS, - PENDING_PREQUALIFICATION, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, - THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, - PRE_APPLYING, - PREQUALIFICATION_FAILED, - DEPARTMENT_JOINT_REVIEW, - DEPARTMENT_JOINT_REVIEW_FAILED, - IN_THE_ANNUAL_PLAN, - BE_SUSPENDED, - SCHEME_UNDER_REVIEW, - SCHEME_REVIEW_FAILED, - TO_BE_DECLARED, - PLAN_TO_BE_DECLARED - ); - - public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ - this.annualPlanLibManage = annualPlanLibManage; - this.projectStatusChangeService = projectStatusChangeService; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - - Project project = projectService.getNewProject(projectId); - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - Integer status = project.getStatus(); - if(Objects.isNull(status)){ - return; - } - - // 项目状态为待立项批复之前的状态 - if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); - processSchedule.add(processDetailVO); - return; - } - - // 当前项目状态为待立项批复 - if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ - // 根据建设方案评审通过的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - - } else { - // 取 状态机 改变状态时间 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PROJECT_APPROVAL.name()) - .last(BizConst.LIMIT_1)); - if (Objects.nonNull(projectStatusChange)) { - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - } - processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java deleted file mode 100644 index 55d9e61..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 项目申报处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ - -@Order(1) -@Component -public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { - - private final IProjectService projectService; - - public ProjectDeclareHandle(IProjectService projectService){ - this.projectService = projectService; - } - - private Integer order = 1; - - @Override - void businessHandle(Long projectId, List processSchedule) { - // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 项目库中查出申报完成时间 - Project project = projectService.getById(projectId); - LocalDateTime createOn = project.getCreateOn(); - processDetailVO.setFinishTime(createOn); - processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java deleted file mode 100644 index 0eef546..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.enums.StepStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConst; - - -/** - * 项目终验处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(11) -@Component -public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { - private final IProjectInstService projectInstService; - private final ProcessInstanceService processInstanceService; - private final BuildUserUtils buildUserUtils; - - private final IProjectService projectService; - - private Integer order = 11; - public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, - BuildUserUtils buildUserUtils,IProjectService projectService){ - this.projectInstService = projectInstService; - this.processInstanceService = processInstanceService; - this.buildUserUtils = buildUserUtils; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - // 根据项目ID查询出项目终验流程的流程状态 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) - .orderByDesc(ProjectInst::getCreatOn) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(projectInst)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); - processSchedule.add(processDetailVO); - return; - } - - String instCode = projectInst.getInstCode(); - ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); - String status = instanceDetail.getStatus(); - // 项目状态不在待终验之后的状态 - if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - - // 装配节点审核人员信息 - List progressInfo = instanceDetail.getProgressInfo(); - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - // 根据流程处理详情获取流程完成时间 - if (StepStatusEnum.contains(processDetailVO.getStepStatus(), - Lists.newArrayList(StepStatusEnum.REJECTED, - StepStatusEnum.COMPLETED))) { - ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - processDetailVO.setFinishTime(finishTime); - } - }else { - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); - processDetailVO.setFinishTime(finishTime); - } - processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java deleted file mode 100644 index ffd7c1a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; - -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import com.ningdatech.pmapi.common.constant.BizConst; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; - -/** - * 项目初验处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(10) -@Component -public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessHandle { - private final INdProjectStatusChangeService projectStatusChangeService; - private final IProjectService projectService; - - private Integer order = 10; - - /** - * 项目状态为:建设中及之后的状态 - */ - private static final List PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS = Arrays.asList( - UNDER_CONSTRUCTION, - TO_BE_FINALLY_INSPECTED, - FINAL_ACCEPTANCE_IS_UNDER_REVIEW, - FINAL_ACCEPTANCE_REVIEW_FAILED, - ARCHIVED, - ACCEPTED - ); - - public ProjectPreliminaryInspectionHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ - this.projectStatusChangeService = projectStatusChangeService; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - // 根据项目状态是否在建设中及之后的状态判断项目初验是否开始 - List fieldList = CollUtils.fieldList(PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS, ProjectStatusEnum::getCode); - Project project = projectService.getNewProject(projectId); - //查出历史版本的 所有项目ID - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - Integer status = project.getStatus(); - // 项目状态不在建设中及之后的状态 - if (!fieldList.contains(status)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); - processSchedule.add(processDetailVO); - return; - } - // 项目状态为建设中或之后的状态 - if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus())){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - }else { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 根据初验备案的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - } - } - processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProvinceUnitedReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProvinceUnitedReviewHandle.java deleted file mode 100644 index 48afa8a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProvinceUnitedReviewHandle.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Objects; - -/** - * 省级联审审核处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(3) -@Component -public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { - private final IProjectService projectService; - private final INdProjectStatusChangeService projectStatusChangeService; - - private Integer order = 3; - - public ProvinceUnitedReviewHandle(IProjectService projectService, - INdProjectStatusChangeService projectStatusChangeService){ - this.projectService = projectService; - this.projectStatusChangeService = projectStatusChangeService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - - //查询项目 - Project project = projectService.getNewProject(projectId); - List allVersionProjectId = projectService.getAllVersionProjectId(projectId); - - // 根据项目ID查询出部门联审流程的流程状态 - if (Objects.isNull(project)){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); - processSchedule.add(processDetailVO); - return; - } - - Integer status = project.getStatus(); - if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - ProjectStatusChange startChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectId) - .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) - .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()).orderByDesc(ProjectStatusChange::getCreateOn) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(startChange)){ - processDetailVO.setFinishTime(startChange.getCreateOn()); - } - } else if(status.compareTo(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) > 0){ - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - ProjectStatusChange passChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectId) - .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) - .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(passChange)){ - processDetailVO.setFinishTime(passChange.getCreateOn()); - } - }else if(status.compareTo(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()) > 0){ - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - ProjectStatusChange rejectChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectId) - .eq(ProjectStatusChange::getBeforeStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) - .eq(ProjectStatusChange::getAfterStatus, ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(rejectChange)){ - processDetailVO.setFinishTime(rejectChange.getCreateOn()); - } - }else{ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); - processSchedule.add(processDetailVO); - return; - } -// processDetailVO.setProcessProgressVo(project.getSjlsResult()); - processDetailVO.setContent(project.getSjlsResult()); - processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java deleted file mode 100644 index db9abad..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; - -import java.util.*; -import java.util.stream.Collectors; - -import com.ningdatech.pmapi.common.constant.BizConst; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.enums.StepStatusEnum; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; - -/** - * 招标采购处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(9) -@Component -public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { - private final INdProjectStatusChangeService projectStatusChangeService; - private final IProjectService projectService; - - private Integer order = 9; - - /** - * 项目状态为:建设中及之后的状态 - */ - private static final List TENDER_PURCHASE_LIST_STATUS = Arrays.asList( - UNDER_CONSTRUCTION, - TO_BE_FINALLY_INSPECTED, - FINAL_ACCEPTANCE_IS_UNDER_REVIEW, - FINAL_ACCEPTANCE_REVIEW_FAILED, - ARCHIVED, - ACCEPTED - ); - - public TenderPurchaseHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ - this.projectStatusChangeService = projectStatusChangeService; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - // 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 - Project project = projectService.getNewProject(projectId); - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - Integer status = project.getStatus(); - // 未进行立项批复 - if (Objects.isNull(project.getApprovalDate())){ - processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); - processSchedule.add(processDetailVO); - return; - } - List fieldList = CollUtils.fieldList(TENDER_PURCHASE_LIST_STATUS, ProjectStatusEnum::getCode); - // 进行了立项批复且项目状态是待采购 - if (ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus())){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - }else if (fieldList.contains(status)){ - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 根据采购备案的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); - processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - } - processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java deleted file mode 100644 index 776f5ca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.ningdatech.pmapi.projectlib.handle; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; - -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.enums.StepStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -/** - * 单位内部审核处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Order(2) -@Component -public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { - - private final IProjectInstService projectInstService; - - private final ProcessInstanceService processInstanceService; - private final BuildUserUtils buildUserUtils; - private final ProjectVersionUtil projectVersionUtil; - private final IProjectService projectService; - - private Integer order = 2; - - public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ - this.projectInstService = projectInstService; - this.processInstanceService = processInstanceService; - this.buildUserUtils = buildUserUtils; - this.projectVersionUtil = projectVersionUtil; - this.projectService = projectService; - } - - @Override - void businessHandle(Long projectId, List processSchedule) { - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); - List allVersionProjectIds = projectService.getAllVersionProjectId(project); - // 根据项目ID查询出单位内部审核流程的流程状态 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) - .orderByDesc(ProjectInst::getCreatOn) - .last(BizConst.LIMIT_1)); - ProcessProgressVo instanceDetail = null; - - // 未找到当前版本项目的单位内部审核流程且当前项目版本号大于1(是被驳回重新申报的项目) - // 注意:已经在项目库中的项目,一定是单位内部审核已经开始的项目 - if (Objects.isNull(projectInst)) { - if (project.getVersion() > CommonConst.VERSION_ONE){ - // 获取上个版本的信息 - instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId, InstTypeEnum.UNIT_INNER_AUDIT); - } - }else { - String instCode = projectInst.getInstCode(); - instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); - } - if (Objects.isNull(instanceDetail)){ - throw new BizException("未获取到单位内部审核流程详情!"); - } - String status = instanceDetail.getStatus(); - if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ - processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); - } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.REJECTED); - } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - } - - // 装配节点审核人员信息 - List progressInfo = instanceDetail.getProgressInfo(); - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - // 根据流程处理详情获取流程完成时间 - if (StepStatusEnum.contains(processDetailVO.getStepStatus(), - Lists.newArrayList(StepStatusEnum.REJECTED, - StepStatusEnum.COMPLETED))) { - // 如果是驳回,获取流程信息时可能 - ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - processDetailVO.setFinishTime(finishTime); - } - }else { - LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); - processDetailVO.setFinishTime(finishTime); - } - processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); - processSchedule.add(processDetailVO); - } - - @Override - Integer getOrder() { - return order; - } - - @Override - void setOrder(Integer order) { - this.order = order; - } - - private void buildUser(List progressInfo, Map userMap) { - for (ProgressNode progressNode : progressInfo) { - progressNode.setUser(userMap.get(progressNode.getUserId())); - if (CollUtil.isNotEmpty(progressNode.getChildren())) { - buildUser(progressNode.getChildren(), userMap); - } - } - } -} 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 deleted file mode 100644 index 0ca0dd6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ /dev/null @@ -1,89 +0,0 @@ -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; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; - -import cn.hutool.core.collection.CollUtil; - -import java.util.List; -import java.util.Map; - -/** - *

- * ProjectHelper - *

- * - * @author WendyYang - * @since 14:15 2023/2/11 - */ -public class ProjectHelper { - - /** - * 通用项目查询 - * - * @param req 查询条件 - * @return / - **/ - public static LambdaQueryWrapper projectQuery(ProjectListReq req) { - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode()) - .eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) - .like(req.getProjectName() != null, Project::getProjectName, req.getProjectName()) - .eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType()) - .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) - .eq(req.getStage() != null, Project::getStage, req.getStage()) - .eq(req.getStatus() != null, Project::getStatus, req.getStatus()) - // 申报金额 - .ge(req.getDeclareAmountMin() != null, Project::getDeclareAmount, req.getDeclareAmountMin()) - .le(req.getDeclareAmountMax() != null, Project::getDeclareAmount, req.getDeclareAmountMax()) - // 申报时间 - .ge(req.getCreateOnMin() != null, Project::getCreateOn, req.getCreateOnMin()) - .le(req.getCreateOnMax() != null, Project::getCreateOn, req.getCreateOnMax()) - // 批复金额 - .ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin()) - .le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax()) - - .like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg()) - .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) - .eq(req.getSuperOrgCode() != null, Project::getSuperOrgCode, req.getSuperOrgCode()) - .eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment()) - //状态 阶段 list - .in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList()) - .in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList()) - //实例code - .in(CollUtil.isNotEmpty(req.getInstCodes()),Project::getInstCode,req.getInstCodes()) - //已添加评价计划的项目code - .notIn(CollUtil.isNotEmpty(req.getProjectCodes()),Project::getProjectCode,req.getProjectCodes()) - .orderByDesc(Project::getUpdateOn); - return query; - } - - /** - * 转换VO - * @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); - return appVo; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectRenewwalFundHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectRenewwalFundHelper.java deleted file mode 100644 index 82743c1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectRenewwalFundHelper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.projectlib.helper; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; - -import java.util.List; -import java.util.Map; - -/** - *

- * ProjectRenewwalFundHelper - *

- * - * @author ZPF - * @since 14:15 2023/11/16 - */ -public class ProjectRenewwalFundHelper { - - /** - * 通用项目查询 - * - * @param req 查询条件 - * @return / - **/ - public static LambdaQueryWrapper projectQuery(ProjectRenewalListReq req) { - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode()) - .eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) - .like(req.getProjectName() != null, Project::getProjectName, req.getProjectName()) - .eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType()) - .eq(req.getStage() != null, Project::getStage, req.getStage()) - .eq(req.getStatus() != null, Project::getStatus, req.getStatus()) - - //状态 阶段 list - .in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList()) - .in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList()) - .orderByDesc(Project::getUpdateOn); - return query; - } -} 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 deleted file mode 100644 index 66797b9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ /dev/null @@ -1,493 +0,0 @@ -package com.ningdatech.pmapi.projectlib.manage; - -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ImportParams; -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.fastjson.JSON; -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.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; -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.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.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibExportDTO; -import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibImportDTO; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; -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.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.util.LoginUserUtil; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.poi.ss.usermodel.Workbook; -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.http.HttpServletResponse; -import java.io.*; -import java.net.URLEncoder; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; -import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; - -/** - *

- * AnnualPlanLibManage - *

- * - * @author WendyYang - * @since 14:09 2023/2/11 - */ -@Component -@AllArgsConstructor -@Slf4j -public class AnnualPlanLibManage { - - private final IProjectService projectService; - - private final IProjectApplicationService applicationService; - private final StateMachineUtils stateMachine; - private final UserInfoHelper userInfoHelper; - private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; - - /** - * 年度计划查询状态 - */ - private static final List ANNUAL_PLAN_LIST_STATUS = - Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED, - PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION, - TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED); - - public PageVo annulPlanLibList(ProjectListReq req) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - Integer isTemporaryAugment = req.getIsTemporaryAugment(); - if (Objects.isNull(isTemporaryAugment)) { - throw new BizException("请传入是否临时增补标志!"); - } - query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); - query.eq(Project::getNewest, Boolean.TRUE); - query.orderByDesc(Project::getAnnualPlanAddTime); - query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); - // 数据权限 - buildProjectLibPermission(query); - Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - PageVo result = PageVo.of(new ArrayList<>(), total); - page.getRecords().forEach(w -> { - AnnualPlanListItemVO item = new AnnualPlanListItemVO(); - item.setProjectId(w.getId()); - item.setProjectId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectYear(w.getProjectYear()); - item.setProjectType(w.getProjectType()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setBuildOrg(w.getBuildOrgName()); - item.setCreateOn(w.getCreateOn()); - item.setApprovalAmount(w.getApprovalAmount()); - item.setIsStartDeclaredProject(!IN_THE_ANNUAL_PLAN.eq(w.getStatus())); - result.getRecords().add(item); - }); - return result; - } - - @Transactional(rollbackFor = Exception.class) - public void startProjectDeclared(StartProjectDeclareReq req) { - List projects = projectService.listByIds(req.getProjectIds()); - projects.forEach(w -> { - if (!IN_THE_ANNUAL_PLAN.eq(w.getStatus())) { - throw BizException.wrap("开启方案申报失败"); - } - }); - projects.forEach(project -> { - try { - stateMachine.pass(project); - } catch (Exception e) { - throw new BizException("开启方案申报失败"); - } - }); - projectService.updateBatchById(projects); - } - - @Transactional(rollbackFor = Exception.class) - public void projectApproved(ProjectApprovedReq req) { - 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); - //立项批复总投资 - project.setApprovalAmount(req.getApprovedAmount()); - //立项批复预算 - project.setApprovalBudget(req.getApprovalBudget()); - 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){ - if (Objects.nonNull(req.getApprovedDate()) && Objects.nonNull(req.getBuildCycle())) { - return req.getApprovedDate().plusMonths(req.getBuildCycle()); - } - return null; - } - - @Transactional(rollbackFor = Exception.class) - public void suspendAnnualPlan(ProjectIdReq req) { - Project project = projectService.getById(req.getProjectId()); - stateMachine.reject(project); - projectService.updateById(project); - } - - public void updateAnnualPlan(ProjectDTO req) { - Project project = BeanUtil.copyProperties(req, Project.class); - projectService.updateById(project); - } - - public void exportList(ProjectListReq param, HttpServletResponse response) { - param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - Integer isTemporaryAugment = param.getIsTemporaryAugment(); - if (Objects.isNull(isTemporaryAugment)) { - throw new BizException("请传入是否临时增补标志!"); - } - param.setIsTemporaryAugment(isTemporaryAugment); - param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest, Boolean.TRUE); - query.orderByDesc(Project::getAnnualPlanAddTime); - List projects = projectService.list(query); - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - String fileName = null; - if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { - fileName = "年度计划库列表"; - } else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { - fileName = "年度计划增补库列表"; - } - excelExportWriter.setFileName(fileName); - List sheetsNames = new ArrayList<>(); - sheetsNames.add(fileName); - // 表体行数据集合 - List> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects); - // sheet列表集合 - List>> sheets = new ArrayList<>(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - } - - /** - * build 项目的角色权限到req - * - * @param query - */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - return user; - } - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - // 普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); - break; - case COMPANY_MANAGER: - // 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); - break; - case SUPER_ADMIN: - // 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 - break; - case REGION_MANAGER: - // 区域管理员 看到自己区域的项目 - query.eq(Project::getAreaCode, user.getRegionCode()); - break; - default: - // 没有权限的话 就让它查不到 - query.eq(Project::getId, "NULL"); - break; - } - return user; - } - - @Transactional(rollbackFor = Exception.class) - public void importAnnualPlan(ProjectLibFlagEnum importFlag, MultipartFile file) { - Long userId = LoginUserUtil.getUserId(); - ImportParams params = new ImportParams(); - // 标题行数 - params.setTitleRows(2); - // 从第几行开始,因为第一、二个大标题被上面的参数给占了,所以不是5 - params.setHeadRows(3); - // 表格数量 - params.setSheetNum(2); - List list = null; - try { - list = ExcelImportUtil.importExcel(file.getInputStream(), AnnualLibImportDTO.class, params); - } catch (Exception e) { - throw new BizException(e.getMessage()); - } - // 筛选出导入的新建项目 - List newList = - list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); - List projectList = newList.stream().map(n -> { - Project project = new Project(); - assemblyProjectInfo(n, project); - // 根据传入标志判断是否临时增补 - if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)) { - project.setIsTemporaryAugment(CommonEnum.NO.getCode()); - } else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)) { - project.setIsTemporaryAugment(CommonEnum.YES.getCode()); - } - project.setCreateBy(userId); - project.setUpdateBy(userId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - return project; - }).collect(Collectors.toList()); - // 保存到项目库中 - projectService.saveOrUpdateBatch(projectList); - - // 筛选出导入的续建项目 - List continuedList = list.stream() - .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); - List renewalFundDeclarationList = continuedList.stream().map(c -> { - ProjectRenewalFundDeclaration renewalFundDeclaration = new ProjectRenewalFundDeclaration(); - BeanUtils.copyProperties(c, renewalFundDeclaration); - renewalFundDeclaration.setAnnualPaymentAmount(c.getAnnualPlanAmount()); - renewalFundDeclaration.setOtherAmount(c.getDeclareOtherAmount()); - renewalFundDeclaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); - renewalFundDeclaration.setCreateOn(LocalDateTime.now()); - renewalFundDeclaration.setUpdateOn(LocalDateTime.now()); - return renewalFundDeclaration; - }).collect(Collectors.toList()); - // 保存到续建项目资金库中 - projectRenewalFundDeclarationService.saveBatch(renewalFundDeclarationList); - } - - private void assemblyProjectInfo(AnnualLibImportDTO data, Project project) { - Long projectId = data.getProjectId(); - // 从项目库中先查询出对应的项目ID的项目 - Project projectInfo = projectService.getById(projectId); - if (Objects.nonNull(projectInfo)){ - BeanUtils.copyProperties(projectInfo,project); - }else { - // 新增的年度计划库项目 - throw new BizException("项目库中不存在项目ID为:" + projectId + "的项目"); - } - project.setId(data.getProjectId()); - project.setProjectName(data.getProjectName()); - project.setProjectIntroduction(data.getProjectIntroduction()); - // 建设依据忽略 - project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); - String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); - if (CollectionUtils.isEmpty(Arrays.asList(dataArr))) { - throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!"); - } - project.setBeginTime(dataArr[0].trim()); - project.setEndTime(dataArr[1].trim()); - project.setDeclareAmount(data.getDeclaredAmount()); - project.setAnnualPlanAmount(data.getAnnualPlanAmount()); - project.setDeclareHaveAmount(data.getDeclareHaveAmount()); - project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); - project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); - project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); - project.setDeclareOtherAmount(data.getDeclareOtherAmount()); - project.setEngineeringSpeedOne(data.getFirstQuarter()); - project.setEngineeringSpeedTwo(data.getSecondQuarter()); - project.setEngineeringSpeedThree(data.getThirdQuarter()); - project.setEngineeringSpeedFour(data.getFourthQuarter()); - project.setBuildOrgName(data.getBuildUnitName()); - project.setContactName(data.getContactName()); - project.setResponsibleMan(data.getResponsibleMan()); - project.setProjectRemarks(data.getProjectRemarks()); - } - - public void exportModifyList(ProjectListReq param, HttpServletResponse response) { - int year = LocalDateTime.now().getYear(); - Integer isTemporaryAugment = param.getIsTemporaryAugment(); - if (Objects.isNull(isTemporaryAugment)) { - throw new BizException("请传入是否临时增补标志!"); - } - param.setIsTemporaryAugment(isTemporaryAugment); - String fileName = null; - // 设置excel的文件名称和是否增补 - if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { - fileName = "丽水市" + year + "年数字化项目年度计划库编辑表"; - } else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { - fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; - } - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest,Boolean.TRUE); - query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); - query.orderByDesc(Project::getAnnualPlanAddTime); - query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); - // 数据权限 - buildProjectLibPermission(query); - List projects = projectService.list(query); - List list = projects.stream().map(p -> { - AnnualLibExportDTO dto = new AnnualLibExportDTO(); - BeanUtils.copyProperties(p, dto); - String beginTime = p.getBeginTime(); - String begin = beginTime.replace(StrPool.DASH, CommonConst.YEAR); - begin = begin + CommonConst.MONTH; - String endTime = p.getEndTime(); - String end = endTime.replace(StrPool.DASH, CommonConst.YEAR); - end = end + CommonConst.MONTH; - String buildCycle = begin + CommonConst.ZHI + end; - dto.setBuildCycle(buildCycle); - dto.setProjectId(p.getId()); - dto.setDeclaredAmount(p.getDeclareAmount()); - dto.setBuildUnitName(p.getBuildOrgName()); - String buildBasis = p.getBuildBasis(); - List fileArray = JSON.parseArray(buildBasis, JSONObject.class); - List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.TITLE) - + StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); - String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); - dto.setBuildBasis(basis); - if (CommonEnum.YES.getCode().equals(p.getIsFirst())) { - dto.setIsFirst(CommonConst.NEW_CONSTRUCTION); - } else if (CommonEnum.NO.getCode().equals(p.getIsFirst())) { - dto.setIsFirst(CommonConst.CONTINUED_CONSTRUCTION); - } - dto.setFirstQuarter(p.getEngineeringSpeedOne()); - dto.setSecondQuarter(p.getEngineeringSpeedTwo()); - dto.setThirdQuarter(p.getEngineeringSpeedThree()); - dto.setFourthQuarter(p.getEngineeringSpeedFour()); - return dto; - }).collect(Collectors.toList()); - - int count = 0; - for (AnnualLibExportDTO annualLibExportDTO : list) { - count++; - annualLibExportDTO.setSerialNumber(count); - } - - // 获取本地目录的年度计划编辑表Excel模板 - File directory = new File(""); - String templateName = "丽水市" + year + "年数字化项目年度计划编辑表"; - String templatePath = - directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; - TemplateExportParams temp = new TemplateExportParams(templatePath); - temp.setSheetNum(new Integer[] {0, 1}); - temp.setSheetName(new String[] {"实施类(新建)", "实施类(续建)"}); - Map map = new HashMap<>(4); - map.put("mapList", list); - map.put("mapList1", Lists.newArrayList()); - Workbook workbook = ExcelExportUtil.exportExcel(temp, map); - if (CollUtil.isEmpty(list)) { - // 输出空模板 - // 获取本地目录的年度计划编辑表空Excel模板 - String emptyTemplate = "丽水市" + year + "年数字化项目年度计划编辑表(空)"; - try { - InputStream templateInputStream = - this.getClass().getClassLoader().getResourceAsStream("template" + File.separator + emptyTemplate + ".xls"); - - OutputStream outputStream = response.getOutputStream(); - // 设置要下载的文件的名称 - response.setHeader("Content-disposition", "attachment;fileName=" + new String(templateName.getBytes("UTF-8"),"ISO8859-1")); - // 设置文件的MIME类型 - response.setContentType("application/vnd.ms-excel;charset=UTF-8"); - - byte[] b = new byte[2048]; - int len; - while ((len = templateInputStream.read(b)) != -1) { - outputStream.write(b, 0, len); - } - templateInputStream.close(); - outputStream.flush(); - outputStream.close(); - } catch (IOException e) { - throw new BizException("读取模板失败!"); - } - return; - } - if (workbook == null){ - throw new BizException("读取编辑表模板失败!"); - } - // 重置响应对象 - response.reset(); - try { - response.setHeader("Content-disposition", - "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); - response.setHeader("Pragma", "no-cache"); - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expires", 0); - // 写出数据输出流到页面 - try { - OutputStream output = response.getOutputStream(); - BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output); - workbook.write(bufferedOutPut); - bufferedOutPut.flush(); - bufferedOutPut.close(); - output.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java deleted file mode 100644 index dfe6fa1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.ningdatech.pmapi.projectlib.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -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.ApiResponse; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.util.HmacAuthUtil; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -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.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.*; -import org.springframework.stereotype.Component; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -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; - -/** - *

- * ApplicationManage - *

- * - * @author ZPF - * @since 14:19 2023/2/1 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ApplicationManage { - - @Value("${irs.app-report.url}") - private String url; - - @Value("${irs.app-report.appKey}") - private String appKey; - - @Value("${irs.app-report.appScret}") - private String appScret; - - private final IProjectApplicationService applicationService; - - private final IProjectService projectService; - - /** - * 保存 appCode - * @param dto - * @return - */ - public String saveAppCode(ApplicationAppCodeSaveDTO dto) { - Long userId = LoginUserUtil.getUserId(); - ProjectApplication app = applicationService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(app)).throwMessage("该应用不存在"); - - app.setAppCode(dto.getAppCode()); - app.setUpdateOn(LocalDateTime.now()); - app.setUpdateBy(userId); - if(applicationService.updateById(app)){ - return BizConst.SAVE_SUCCESS; - } - return BizConst.SAVE_FAIL; - } - - /** - * 获取试运行报告 - * @param appCode - * @return - */ - public String getReport(String appCode) { - String method = HttpMethod.GET.name(); - String appUrl = url + "?appCode=" + appCode; - - Map header = HmacAuthUtil.generateHeader(appUrl, method, appKey, appScret); - //请求头 - HttpHeaders headers = new HttpHeaders(); - - for(Map.Entry entry : header.entrySet()){ - headers.add(entry.getKey(), entry.getValue()); - } - //封装请求头 - HttpEntity> formEntity = new HttpEntity>(headers); - - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class); - - log.info("forEntity:",JSON.toJSONString(forEntity)); - log.info("body:",forEntity.getBody()); - ApiResponse body = forEntity.getBody(); - - if(!body.getCode().equals(HttpStatus.OK.value())){ - throw new BizException(body.getMessage()); - } - - Object data = body.getData(); - if(Objects.nonNull(data)){ - JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data)); - JSONArray resourceList = dataJson.getJSONArray("resourceList"); - if(CollUtil.isNotEmpty(resourceList)){ - JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0))); - if(StringUtils.isBlank(resource.getString("reportOss"))){ - //暂时没有 appCode 所以先返回测试数据 - return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D"; - }else{ - return resource.getString("reportOss"); - } - } - } - throw new BizException("获取报告失败!"); - } - - /** - * 查询 待注册的 - * @param req - * @return - */ - public PageVo toRegisterAppProjectLibList(ProjectListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - //建设单位 就是当前人的单位 - String orgCode = user.getEmpPosUnitCode(); - Page page = req.page(); - projectService.page(page,Wrappers.lambdaQuery(Project.class) - .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) - .eq(Project::getStatus, ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()) - .eq(Project::getBuildOrgCode,orgCode)); - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List projectCodes = page.getRecords().stream().map(Project::getProjectCode).collect(Collectors.toList()); - //要去查询应用 此阶段 必定是 建设方案后的 所以直接查 建设方案的应用 - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getProjectCode, projectCodes) - .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); - Map> appMap = apps.stream().collect(Collectors.groupingBy(ProjectApplication::getProjectCode)); - List res = page.getRecords().stream().map(p -> { - ProjectDetailVO vo = BeanUtil.copyProperties(p,ProjectDetailVO.class); - if(appMap.containsKey(p.getProjectCode())){ - List projectApplications = appMap.get(p.getProjectCode()); - vo.setProjectApplications(convert(projectApplications)); - } - return vo; - }).collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - private List convert(List projectApplications) { - if(CollUtil.isNotEmpty(projectApplications)){ - return projectApplications.stream() - .map(a -> BeanUtil.copyProperties(a,ProjectApplicationVO.class)) - .collect(Collectors.toList()); - } - return Collections.emptyList(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java deleted file mode 100644 index d73e21e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.ningdatech.pmapi.projectlib.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.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectCollectionVO; -import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -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 ProjectCollectionManage - * @Description - * @Date 2023/6/25 9:13 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class ProjectCollectionManage { - - private final IProjectCollectionService collectionService; - - private final RegionCacheHelper regionCacheHelper; - - private final GenerateProjectCodeUtil generateProjectCodeUtil; - - /** - * 项目归集 - * @param req - * @return - */ - public PageVo list(ProjectListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String buildOrgCode = req.getBuildOrgCode(); - //如果是超管 可以看所有 - if(user.getSuperAdmin()){ - buildOrgCode = null; - } - - Page page = req.page(); - - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) - .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()), ProjectCollection::getBuildOrg, req.getBuildOrg()) - .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); - //处理 行政区域 - if(StringUtils.isNotBlank(req.getRegionCode())){ - List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); - - if(CollUtil.isNotEmpty(regions)){ - wrapper.in(ProjectCollection::getAreaCode,regions.stream().map(RegionDTO::getRegionCode).collect(Collectors.toList())); - } - } - - collectionService.page(page,wrapper); - - if(CollUtil.isEmpty(page.getRecords())){ - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(record -> { - ProjectCollectionVO vo = BeanUtil.copyProperties(record, ProjectCollectionVO.class); - vo.setArea(regionCacheHelper.getDisplayName(record.getAreaCode(), RegionConst.RL_COUNTY)); - return vo; - }) - .collect(Collectors.toList()); - - return PageVo.of(res,page.getTotal()); - } - - /** - * 项目归集详情 - * @param id - * @return - */ - public ProjectCollectionVO detail(Long id) { - ProjectCollection projectCollection = collectionService.getById(id); - - return BeanUtil.copyProperties(projectCollection,ProjectCollectionVO.class); - } - - /** - * 保存 - * @param dto - * @return - */ - public String save(ProjectCollectionSaveDTO dto) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - - ProjectCollection projectCollection = BeanUtil.copyProperties(dto,ProjectCollection.class); - if(Objects.nonNull(dto.getId())){ - ProjectCollection old = collectionService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); - projectCollection.setId(dto.getId()); - }else{ - projectCollection.setProjectCode(generateProjectCodeUtil.generateProjectCode(projectCollection)); - projectCollection.setCreateBy(user.getUsername()); - projectCollection.setCreateOn(LocalDateTime.now()); - } - - projectCollection.setUpdateBy(user.getUsername()); - projectCollection.setUpdateOn(LocalDateTime.now()); - if(collectionService.saveOrUpdate(projectCollection)){ - return BizConst.SAVE_SUCCESS; - } - return BizConst.SAVE_FAIL; - } - - /** - * 删除 - * @param id - * @return - */ - public String delete(Long id) { - ProjectCollection projectCollection = collectionService.getById(id); - - VUtils.isTrue(Objects.isNull(projectCollection)).throwMessage("该项目归集不存在 删除失败"); - - if(collectionService.removeById(id)){ - return "删除成功"; - } - return "删除失败"; - } -} 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 deleted file mode 100644 index 3de85a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ /dev/null @@ -1,1708 +0,0 @@ -package com.ningdatech.pmapi.projectlib.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -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; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.File; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.compare.CompareUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -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.BizUtils; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler; -import com.ningdatech.pmapi.datascope.model.DataScopeDTO; -import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; -import com.ningdatech.pmapi.expert.model.entity.ExpertReview; -import com.ningdatech.pmapi.expert.model.enumeration.ReviewTemplateTypeEnum; -import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO; -import com.ningdatech.pmapi.gov.utils.ProjectConvertUtil; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -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.*; -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.ProjectDTO; -import com.ningdatech.pmapi.projectlib.model.entity.*; -import com.ningdatech.pmapi.projectlib.model.po.ProjectPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectApplicationListReq; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; -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.entity.UserInfo; -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; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.TaskService; -import org.flowable.task.api.Task; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * ProjectLibManage - *

- * - * @author WendyYang - * @since 14:19 2023/2/1 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectLibManage { - - private final IProjectService projectService; - private final IProjectApplicationService applicationService; - private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; - private final ProcessExecuteChainHandle processExecuteHandle; - private final RegionCacheHelper regionCacheHelper; - private final FileService fileService; - private final IProjectApplicationService projectApplicationService; - private final GenerateProjectCodeUtil generateProjectCodeUtil; - private final IProjectInstService projectInstService; - private final StateMachineUtils stateMachineUtils; - private final INdProjectDelayApplyService projectDelayApplyService; - private final INdProjectApplyBorrowService projectApplyBorrowService; - private final IDingOrganizationService dingOrganizationService; - private final IContractService contractService; - private final IPurchaseService purchaseService; - private final IPreInsAcceptancePersonService acceptancePersonService; - private final IPaymentPlanService paymentPlanService; - 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; - - private final ApplicationHandler applicationHandler; - - private final TaskService taskService; - - private final UserInfoHelper userInfoHelper; - - private final IExpertReviewService expertReviewService; - - public PageVo projectLibList(ProjectListReq req) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - query.eq(Project::getNewest, Boolean.TRUE); - Page page = projectService.page(req.page(), query); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - // - List projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toList()); - - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .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()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - 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, page.getTotal()); - } - - public PageVo projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - user = buildProjectLibPermission(query, user); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - Page page = projectService.page(req.page(), query); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - 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; - - - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .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()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && 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, page.getTotal()); - } - - /** - * 项目列表带当前审批人(工作流的) - * @param req - * @param user - * @return - */ - public PageVo projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - user = buildProjectLibPermission(query, user); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - Page page = projectService.page(req.page(), query); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - UserFullInfoDTO finalUser = user; - - Set instCodes = page.getRecords().stream() - .filter(p -> StringUtils.isNotBlank(p.getInstCode())) - .map(Project::getInstCode).collect(Collectors.toSet()); - List tasks = taskService.createTaskQuery() - .processInstanceIdIn(instCodes) - .orderByTaskCreateTime() - .asc() - .list(); - Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(tasks)){ - map = tasks.stream() - .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - userMap = searchUser(tasks,userInfoHelper); - } - - List records = Lists.newArrayList(); - for(Project w : page.getRecords()){ - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { - item.setCanPreDeclared(Boolean.TRUE); - } - item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); - item.setPrePlanProjectId(w.getPrePlanProjectId()); - records.add(item); - } - return PageVo.of(records, page.getTotal()); - } - - private List buildApproveUsers(String instCode, Map> map, - Map userMap) { - if(map.containsKey(instCode)){ - List tasks = map.get(instCode); - return tasks.stream().map(task -> userMap.get(task.getAssignee())) - .filter(Objects::nonNull).collect(Collectors.toList()); - } - return Collections.emptyList(); - } - - private Map searchUser(List tasks, UserInfoHelper userInfoHelper) { - if(CollUtil.isEmpty(tasks)){ - return Collections.emptyMap(); - } - List users = userInfoHelper.getUserFullInfoByEmployeeCodes( - tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); - if(CollUtil.isNotEmpty(users)){ - Set employeeSet = Sets.newHashSet(); - return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors - .toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); - } - return Collections.emptyMap(); - } - - /** - * 项目申报和项目归集的并集 - * @param req - * @param user - * @return - */ - public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); - Page page = projectService.pageAllWithPermission(req.page(), req); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - UserFullInfoDTO finalUser = user; - - Set projectCodes = page.getRecords().stream() - .map(ProjectPO::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; - - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .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()); - item.setFromType(w.getFromType()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && 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, page.getTotal()); - } - - public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); - Page page = projectService.pagelibWithPermission(req.page(), req); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - UserFullInfoDTO finalUser = user; - - Set projectCodes = page.getRecords().stream() - .map(ProjectPO::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; - - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .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()); - item.setFromType(w.getFromType()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && 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, page.getTotal()); - } - - public PageVo listWithPermissionWorkbentch(ProjectListReq req, - UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); - Page page = projectService.pagelibWithPermission(req.page(), req); - long total; - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - UserFullInfoDTO finalUser = user; - - Set instCodes = page.getRecords().stream() - .filter(p -> StringUtils.isNotBlank(p.getInstCode())) - .map(ProjectPO::getInstCode).collect(Collectors.toSet()); - List tasks = taskService.createTaskQuery() - .processInstanceIdIn(instCodes) - .orderByTaskCreateTime() - .asc() - .list(); - Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(tasks)){ - map = tasks.stream() - .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - userMap = searchUser(tasks,userInfoHelper); - } - - List records = Lists.newArrayList(); - for(ProjectPO w : page.getRecords()){ - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { - item.setCanPreDeclared(Boolean.TRUE); - } - item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); - item.setPrePlanProjectId(w.getPrePlanProjectId()); - records.add(item); - } - return PageVo.of(records, page.getTotal()); - } - - public static BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { - BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; - for(ProjectRenewalFundDeclaration prf : prfs){ - res = res.add(prf.getAnnualPaymentAmount()); - } - return res; - } - - public static List convertAccmulate(ProjectPO 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; - } - - public static 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; - } - return getProjectDetailLogic(projectInfo); - } - - public ProjectDetailVO detailProjectCode(String projectCode) { - // 查询最新的项目申报信息 - Project projectInfo = projectService.getProjectByCode(projectCode); - if (Objects.isNull(projectInfo)) { - return null; - } - return getProjectDetailLogic(projectInfo); - } - - /** - * @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; - } - return getProjectDetailLogic(projectInfo); - } - - private ProjectDetailVO getProjectDetailLogic(Project projectInfo) { - 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(projectInfo.getId()); - vo.setProcess(todoService.getProcessDetail(req)); - - List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); - - //查询采购备案 - List purchases = purchaseService.listByProjectIds(allVersionProjectId); - vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); - - //查询合同备案 - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .eq(Contract::getProjectCode, projectInfo.getProjectCode()) - .last(BizConst.LIMIT_1)); - ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); - vo.setContract(contractVO); - List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .eq(PaymentPlan::getProjectCode, projectInfo.getProjectCode()) - .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)); - - //查询终验信息 - vo.setFinalIrsApps(applicationHandler.generateIrsApp(projectInfo.getProjectCode())); - - //查询年度投资金额 要是已验收的项目 - 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())); - } - //专家评审 其它建议 -> 建设方案的会议 - ExpertReview finalReview = expertReviewService.getFinalReview(projectInfo.getProjectCode(), - ReviewTemplateTypeEnum.CONSTRUCTION_SCHEME_REVIEW.getCode()); - - if(Objects.nonNull(finalReview)){ - vo.setProposeAttach(finalReview.getOtherAdvice()); - vo.setBaseReviewResults(finalReview.getReviewResult()); - } - return vo; - } - - - /** - * 申报新项目时 保存项目信息和其它相关联的信息 - * - * @param projectDto - * @param instanceId - * @param employeeCode - * @return - */ - public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode) { - Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE); - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - return project; - } - - - /** - * 建设方案申报项目时 保存项目信息和其它相关联的信息 - * - * @param projectDto - * @param instanceId - * @param employeeCode - * @param oldProject - * @return - */ - public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode, Project oldProject) { - - Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject); - // 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表 - LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Project.class); - updateWrapper.set(Project::getStage, null) - .set(Project::getStatus, null) - .eq(Project::getId, oldProject.getId()); - projectService.update(updateWrapper); - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - return project; - } - - /** - * 申报新项目时 保存项目信息和其它相关联的信息 - * - * @param projectDto - * @param instanceId - * @param employeeCode - * @return - */ - public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode,Boolean isContruct) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - Project project = new Project(); - //为空 代表是新申报的 - if (Objects.isNull(projectDto.getId())) { - BeanUtils.copyProperties(projectDto, project); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - project.setInstCode(instanceId); - project.setSponsor(employeeCode); - String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); - project.setProjectCode(projectCode); - if(projectService.save(project)){ - saveApplication(projectDto,project,null); - } - } else { - //否则是重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto,isContruct); - if (Objects.nonNull(project)) { - project.setInstCode(instanceId); - project.setSponsor(employeeCode); - projectService.updateById(project); - } - } - return project; - } catch (Exception e) { - log.error("项目信息入库错误 " + e); - throw new BusinessException("项目信息入库错误 :" + e); - } - } - - /** - * 建设方案申报项目时 保存项目信息和其它相关联的信息 - * - * @param projectDto - * @param instanceId - * @param employeeCode - * @param oldProject - * @return - */ - public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode, Project oldProject) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - Project project = new Project(); - //为空 代表是新申报的 - if (Objects.isNull(projectDto.getId())) { - BeanUtils.copyProperties(projectDto, project); - // 被撤回重新申报的项目,项目ID要置空 - project.setId(null); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - project.setInstCode(instanceId); - project.setSponsor(employeeCode); - // 项目编号不变,版本号加1 - project.setProjectCode(oldProject.getProjectCode()); - project.setVersion(oldProject.getVersion() + 1); - // 标记为建设方案申报 - project.setIsConstruct(Boolean.TRUE); - project.setIsBackReject(Boolean.FALSE); - // 保存初步方案项目ID - if (Boolean.TRUE.equals(oldProject.getIsConstruct())) { - // 重新提交 - project.setPrePlanProjectId(oldProject.getPrePlanProjectId()); - } else { - project.setPrePlanProjectId(oldProject.getId()); - } - if(projectService.save(project)){ - saveApplication(projectDto,project,Boolean.TRUE); - - // 将旧的项目版本置为不是最新 - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - } - - } else { - //否则是被驳回,重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto,Boolean.TRUE); - if (Objects.nonNull(project)) { - project.setInstCode(instanceId); - project.setSponsor(employeeCode); - projectService.updateById(project); - } - } - return project; - } catch (Exception e) { - log.error("项目信息入库错误 " + e); - throw new BusinessException("项目信息入库错误 :" + e); - } - } - - - /** - * 在其它项目阶段 保存项目信息和其它相关联的信息 - * - * @param projectDto - * @return - */ - public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - return newProjectWithVersion(projectDto,isContruct); - } catch (Exception e) { - log.error("项目信息入库错误 " + e); - throw new BusinessException("项目信息入库错误 :" + e); - } - } - - /** - * 重新提交工作流时 舍弃在原有项目修改 - * 新增一个新的项目 新的版本号 - */ - public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) { - Project oldProject = projectService.getById(projecDto.getId()); - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - project.setIsBackReject(Boolean.FALSE); - stateMachineUtils.pass(project); - projectService.save(project); - - oldProject.setIsBackReject(Boolean.TRUE); - projectService.updateById(oldProject); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - saveApplication(projecDto,project,isContruct); - - return project; - } - - public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { - Project oldProject = projectService.getById(projecDto.getId()); - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - //都是在驳回 重新提交时用的 - project.setIsBackReject(Boolean.FALSE); - if (Objects.nonNull(stageCode)) { - project.setStage(stageCode); - } - if (Objects.nonNull(statusCode)) { - project.setStatus(statusCode); - } - - oldProject.setIsBackReject(Boolean.TRUE); - projectService.updateById(oldProject); - - if (projectService.save(project)) { - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - //app - saveApplication(projecDto,project,isConstruct); - } - - return project; - } - - public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) { - Project oldProject = projectService.getById(projecDto.getId()); - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - - if (projectService.save(project)) { - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(instType); - projectInstService.save(projectInst); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - //app - saveApplication(projecDto,project,isConstruct); - } - - return project; - } - - public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) { - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - - if (projectService.save(project)) { - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(instType); - projectInstService.save(projectInst); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - saveApplication(project,oldProject,null); - } - - return project; - } - - public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) { - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - // 标识保存的项目信息是否为建设方案申报项目 - project.setIsConstruct(Boolean.TRUE); - project.setIsBackReject(isBackReject); - //终验材料 - project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); - stateMachineUtils.pass(project); - - oldProject.setIsBackReject(isBackReject); - projectService.updateById(oldProject); - - if (projectService.save(project)) { - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(instType); - projectInstService.save(projectInst); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - //APP - saveApplication(project,oldProject,Boolean.TRUE); - } - - return project; - } - - public Project saveConstructProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - // 标识保存的项目信息是否为建设方案申报项目 - project.setIsConstruct(Boolean.FALSE); - stateMachineUtils.pass(project); - - oldProject.setIsBackReject(Boolean.TRUE); - projectService.updateById(oldProject); - - if (projectService.save(project)) { - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(instType); - projectInstService.save(projectInst); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - saveApplication(project,oldProject,Boolean.TRUE); - } - - return project; - } - - /** - * 获取项目初步方案详情 - * - * @param projectId - * @return com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO - * @author CMM - * @since 2023/07/12 11:43 - */ - public ProjectDetailVO getPrePlanProjectDetail(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, Boolean.FALSE) - .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); - - Optional.ofNullable(applications).ifPresent(apps -> - vo.setProjectApplications(CollUtils.convert(apps, - ProjectHelper::convertVO) - )); - - return vo; - } - - public List processScheduleDetail(Long projectId) { - List processDetailVOS = new ArrayList<>(); - return processExecuteHandle.handle(projectId, processDetailVOS); - } - - private boolean checkCanRead(Set subOrgSet, Project project) { - // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 - HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowProjectIdList = projectApplyBorrowService - .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); - return applyBorrowProjectIdList.contains(project.getId()); - } - - private Set getSubOrgList(String empPosUnitCode) { - HashSet orgSet = new HashSet<>(); - // 先将自己加入子集 - orgSet.add(empPosUnitCode); - Set subOrgList = dingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) - .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); - // 遍历子集 - for (String orgCode : subOrgList) { - orgSet.addAll(getSubOrgList(orgCode)); - } - return orgSet; - } - - - public void exportList(ProjectListReq param, HttpServletResponse response) { - param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest, Boolean.TRUE); - List projects = projectService.list(query); - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - - String fileName = "项目库列表"; - excelExportWriter.setFileName(fileName); - - List sheetsNames = new ArrayList<>(); - sheetsNames.add(fileName); - // 表体行数据集合 - List> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects); - // sheet列表集合 - List>> sheets = new ArrayList<>(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - } - - /** - * build 项目的角色权限到req - * - * @param query - */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - return user; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); - break; - case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()).or(q2 -> - q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) - .eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) - .eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); - break; - case SUPER_ADMIN: - //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 - break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - query.in(Project::getAreaCode, regionCodes); - } else { - query.eq(Project::getAreaCode, user.getRegionCode()); - } - break; - case VISITOR: - //访客可以看全市的 - break; - case DASHBOARD: - break; - default: - //没有权限的话 就让它查不到 - query.eq(Project::getId, 0L); - break; - } - return user; - } - - public ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) { - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - return req; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - req.setUserType("normal"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case SUPER_ADMIN: - //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 - break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - req.setRegionCodes(regionCodes); - } else { - req.setUserRegionCode(user.getRegionCode()); - } - req.setUserType("region"); - break; - case VISITOR: - //访客可以看全市的 - break; - case DASHBOARD: - break; - default: - //没有权限的话 就让它查不到 - req.setId(0L); - break; - } - return req; - } - - public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { - - // 更新项目流程实例ID - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); - - // 保存延期申请信息和申请延期前项目建设周期和验收时间 - ProjectDelayApply projectDelayApply = new ProjectDelayApply(); - projectDelayApply.setDelayTime(dto.getDelayedMonth()); - projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); - projectDelayApply.setDelayApplyReason(dto.getDelayedReason()); - projectDelayApply.setProjectId(project.getId()); - projectDelayApply.setInstanceId(instanceId); - projectDelayApply.setCreateBy(LoginUserUtil.getUserId()); - projectDelayApply.setCreateOn(LocalDateTime.now()); - projectDelayApply.setUpdateBy(LoginUserUtil.getUserId()); - projectDelayApply.setUpdateOn(LocalDateTime.now()); - projectDelayApplyService.save(projectDelayApply); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setInstType(InstTypeEnum.APPLY_DELAY.getCode()); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInstService.save(projectInst); - } - - public void saveProjectByApplyBorrow(Project project, UserFullInfoDTO user, String instanceId) { - // 更新项目流程实例ID - project.setInstCode(instanceId); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); - - // 保存项目借阅信息 - ProjectApplyBorrow projectApplyBorrow = new ProjectApplyBorrow(); - projectApplyBorrow.setProjectId(project.getId()); - projectApplyBorrow.setApplyBorrowEmployeeCode(user.getEmployeeCode()); - projectApplyBorrow.setApplyBorrowEmpPosUnitCode(user.getEmpPosUnitCode()); - projectApplyBorrow.setInstanceId(instanceId); - projectApplyBorrow.setCreateOn(LocalDateTime.now()); - projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); - projectApplyBorrow.setUpdateOn(LocalDateTime.now()); - projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); - projectApplyBorrow.setIsSuccess(Boolean.FALSE); - projectApplyBorrowService.save(projectApplyBorrow); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setInstType(InstTypeEnum.APPLY_BORROW.getCode()); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInstService.save(projectInst); - } - - /** - * 应用列表 - * - * @param req - * @return - */ - public PageVo applicationList(ProjectApplicationListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .eq(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()); - - if (StringUtils.isNotBlank(req.getApplicationName())) { - wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName()) - .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName()))); - } - wrapper.orderByDesc(ProjectApplication::getUpdateOn); - projectApplicationService.page(page, wrapper); - - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - List res = page.getRecords().stream() - .map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class)) - .collect(Collectors.toList()); - - return PageVo.of(res, page.getTotal()); - } - - private List convertPersons(List acceptancePersons) { - if (CollUtil.isEmpty(acceptancePersons)) { - return Collections.emptyList(); - } - - return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); - } - - private List convertPayments(List payments, BigDecimal totalAmount) { - if (CollUtil.isEmpty(payments)) { - return Collections.emptyList(); - } - return payments.stream().map(p -> { - PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); - vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" - : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) - .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); - return vo; - }) - .collect(Collectors.toList()); - } - - /** - * 历史版本 项目列表 - * - * @param id - * @return - */ - public JSONObject historyProjects(Long id) { - JSONObject res = new JSONObject(); - Project project = projectService.getById(id); - - if (Objects.isNull(project)) { - return res; - } - - //只查 当前版本 和历史被驳回|退回的版本 - List historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, project.getProjectCode()) - .and(q1->q1.eq(Project::getNewest, Boolean.TRUE) - .or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE))) - .orderByDesc(Project::getCreateOn)); - - if (CollUtil.isEmpty(historyProjects)) { - return res; - } - - List basicProjects = historyProjects.stream() - .map(p -> this.getProjectDetailThisVersion(p.getId())) - .filter(p -> Objects.isNull(p.getIsConstruct()) || !p.getIsConstruct()) - .collect(Collectors.toList()); - List constructProjects = historyProjects.stream() - .map(p -> this.getProjectDetailThisVersion(p.getId())) - .filter(p -> Objects.nonNull(p.getIsConstruct()) && p.getIsConstruct()) - .collect(Collectors.toList()); - res.put(ProjectConstant.ProjectLib.PROJECT_BASIC, basicProjects); - res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT, constructProjects); - return res; - } - - /** - * 查看 项目的 变更记录(驳回 重新发起的 和上个版本的变更字段) - * - * @param projectId - * @return - */ - public JSONObject changeRecord(Long projectId) { - JSONObject res = new JSONObject(); - - //1.先判断下 项目存不存在 - Project project = projectService.getById(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); - - - //2.要判断 项目在当前状态 有没有被驳回和退回过 - //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 - Boolean isChangeRecord = todoService.isChangeRecord(projectId); - if (!isChangeRecord) { - return res; - } - - //3. 去对比 当前版本和上个版本 的字段对比 - String projectCode = project.getProjectCode(); - List twoVersions = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode) - .orderByDesc(Project::getVersion) - .last("limit 2")); - if (CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2) { - return res; - } - - Project lastProject = twoVersions.get(1); - Project thisProject = twoVersions.get(0); - res.put(ProjectConstant.ProjectLib.CHANGES_KEY, - new CompareUtils().compareToJson(thisProject, lastProject, null)); - ProcessDetailReq req = new ProcessDetailReq(); - req.setProjectId(lastProject.getId()); - req.setInstanceId(lastProject.getInstCode()); - res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req)); - return res; - } - - 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.forEach(app -> { - Long oldAppId = app.getId(); - app.setProjectVersion(project.getVersion()); - app.setProjectId(project.getId()); - app.setId(null); - if(Objects.nonNull(isConstruct)){ - app.setIsConstruct(isConstruct); - } - 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; - //采取批量删除 批量添加的方式 - Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; - //删除当前版本的app 一般情况是没有 保险起见 - List applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion, version)); - if (CollUtil.isNotEmpty(applications)) { - projectApplicationService.removeBatchByIds(applications); - } - - if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { - Project finalProject = project; - projectDto.getApplicationList().forEach(application -> { - ProjectApplication projectApplication = new ProjectApplication(); - BeanUtils.copyProperties(application, projectApplication); - projectApplication.setId(null); - projectApplication.setProjectId(finalProject.getId()); - projectApplication.setProjectCode(finalProject.getProjectCode()); - projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); - projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); - projectApplication.setProjectVersion(version); - projectApplication.setIsConstruct(isConstruct); - if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ - projectApplication.setApplicationName(null); - } - - boolean result = projectApplicationService.save(projectApplication); - // 保存应用关联的核心业务 - List coreBusinessList = application.getCoreBusinessList(); - Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; - if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ - for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { - ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); - BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); - projectCoreBusinessIndicators.setId(null); - projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); - projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); - projectCoreBusinessIndicators.setCreateBy(user.getUsername()); - projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); - } - } - }); - } - } - - /** - * 申报项目转化为 项目归集 - * @param projectCode - * @return - */ - public GovBizProjectDetailVO convertToCollection(String projectCode) { - ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode); - return ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); - } -} 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 deleted file mode 100644 index 35b64f2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ /dev/null @@ -1,653 +0,0 @@ -package com.ningdatech.pmapi.projectlib.manage; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.excel.EasyExcel; -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.google.common.collect.Lists; -import com.google.common.collect.Maps; -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.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -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.gov.model.entity.GovBizProjectApply; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; -import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; -import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectApproveService; -import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; -import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.model.entity.Tag; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; -import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; -import com.ningdatech.pmapi.projectlib.helper.ProjectRenewwalFundHelper; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalExportDTO; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -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.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; -import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -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 lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * ProjectRenewalFundManage - *

- * - * @author ZPF - * @since 14:19 2023/2/15 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectRenewalFundManage { - - private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; - - private final IProjectService projectService; - - private final IGovBizProjectBaseinfoService baseinfoService; - - private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; - - private final IGovBizProjectApplyService applyService; - - private final IGovBizProjectApproveService approveService; - - private final RegionCacheHelper regionCacheHelper; - - private final IPaymentPlanService paymentPlanService; - - /** - * 项目续建资金库列表 分页 - * @param req - * @return - */ - public PageVo list(ProjectRenewalListReq req, UserFullInfoDTO user) { - Page page = req.page(); - req = buildProjectLibPermission(req,user); - projectRenewalFundDeclarationService.pageSql(page, req); - long total; - if ((total = page.getTotal()) == 0) { - return PageVo.empty(); - } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectRenewalFundDeclarationVO item = new ProjectRenewalFundDeclarationVO(); - BeanUtils.copyProperties(w,item); - return item; - }); - return PageVo.of(records, total); - } - - public PageVo projectlist(ProjectRenewalListReq req, UserFullInfoDTO user) { - LambdaQueryWrapper query = ProjectRenewwalFundHelper.projectQuery(req); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - //自己单位 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - //立项批复后 都可以 - query.gt(Project::getStatus,ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); - Page page = projectService.page(req.page(), query); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - UserFullInfoDTO finalUser = user; - - Set projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toSet()); - - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ - List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .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()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { - item.setCanPreDeclared(Boolean.TRUE); - } - item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); - item.setPrePlanProjectId(w.getPrePlanProjectId()); - if(finalRenewalMap.containsKey(item.getId())){ - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,prfs)); - }else{ - item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,Collections.emptyList())); - } - return item; - }); - return PageVo.of(records, page.getTotal()); - } - - /** - * @param id - * @author ZPF - * @since 2023/02/15 11:15 - */ - public ProjectRenewalFundDeclarationVO detail(Long id) { - // 查询项目申报信息 - ProjectRenewalFundDeclaration renewal = projectRenewalFundDeclarationService.getById(id); - if(Objects.isNull(renewal)){ - return null; - } - ProjectRenewalFundDeclarationVO vo = new ProjectRenewalFundDeclarationVO(); - BeanUtils.copyProperties(renewal, vo); - // 查询项目信息 - Project project = projectService.getProjectByCode(renewal.getProjectCode()); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, renewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, renewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, renewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, renewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(project)){ - vo.setApprovalAmount(project.getApprovalAmount()); - vo.setProjectName(project.getProjectName()); - vo.setProjectType(project.getProjectType()); - vo.setStage(project.getStage()); - vo.setStatus(project.getStatus()); - vo.setBuildOrgName(project.getBuildOrgName()); - vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(project.getId()) - .projectCode(project.getProjectCode()) - .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()) - .projectCode(project.getProjectCode()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - }else if(Objects.nonNull(baseinfo)){ - if(Objects.nonNull(approve)){ - vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); - } - vo.setProjectName(baseinfo.getBaseProjName()); - vo.setProjectType(baseinfo.getBaseProjType()); -// vo.setStage(project.getStage()); - vo.setStatus(StringUtils.isNotBlank(baseinfo.getBaseProjSetProg()) ? - Integer.parseInt(baseinfo.getBaseProjSetProg()) : null); - vo.setBuildOrgName(baseinfo.getBaseBuildDeprt()); - vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(baseinfo.getId()) - .projectCode(baseinfo.getBaseProjId()) - .projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) - .annualAmount(apply.getBaseProjDeclAmount()) - .build()); - List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) - .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(baseinfo.getId()) - .projectCode(baseinfo.getBaseProjId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - }else if(Objects.nonNull(operationBaseinfo)){ - if(Objects.nonNull(approve)){ - vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); - } - vo.setProjectName(operationBaseinfo.getBaseProjName()); - vo.setProjectType(operationBaseinfo.getBaseProjType()); -// vo.setStage(project.getStage()); - vo.setStatus(StringUtils.isNotBlank(operationBaseinfo.getBaseProjSetProg()) ? - Integer.parseInt(operationBaseinfo.getBaseProjSetProg()) : null); - vo.setBuildOrgName(operationBaseinfo.getBaseBuildDeprt()); - vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(operationBaseinfo.getId()) - .projectCode(operationBaseinfo.getBaseProjId()) - .projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) - .annualAmount(apply.getBaseProjDeclAmount()) - .build()); - List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) - .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(operationBaseinfo.getId()) - .projectCode(operationBaseinfo.getBaseProjId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - } - return vo; - } - - /** - * 申报 - * @param dto - * @return - */ - public Long declared(ProjectRenewalFundDeclarationDTO dto) { - Integer projectYear = dto.getProjectYear(); - //要判断 项目id 是否 以及状态是 已验收 - String projectCode = dto.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, projectCode) - .last(BizConst.LIMIT_1)); - - VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectCode)); - ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); - //如果是重新申报 - if(Objects.nonNull(dto.getId())){ - 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); - - //有2个条件要判断 续建资金 - //1. 如果有审核中的 是不能继续申请的 - long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) - .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::getProjectCode, projectCode) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) - .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) - .last(BizConst.LIMIT_1)); - //如果没有续建资金信息 就要比 当前项目的年度要大 - if(Objects.isNull(lastRenewalFund)){ - if(Objects.nonNull(project)){ - VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) - .throwMessage("续建资金年度错误!"); - }else if(Objects.nonNull(apply)){ - VUtils.isTrue(StringUtils.isBlank(apply.getBaseProjSetYear()) || - Integer.parseInt(apply.getBaseProjSetYear()) >= dto.getProjectYear()) - .throwMessage("续建资金年度错误!"); - } - }else{ - VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) - .throwMessage("续建资金年度错误!"); - } - - //判断金额 -// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); - - declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); - if(Objects.nonNull(project)){ - declaration.setRegionCode(project.getAreaCode()); - declaration.setOrgCode(project.getBuildOrgCode()); - }else if(Objects.nonNull(baseinfo)){ - declaration.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); - declaration.setOrgCode(baseinfo.getBaseBuildDeprtDing()); - }else if(Objects.nonNull(operationBaseinfo)){ - declaration.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); - declaration.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); - } - - if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){ - throw new BusinessException(String.format("申报失败 【%s】",dto.getId())); - } - return declaration.getId(); - } - - //判断金额 - private void checkPaymentAmount(String projectCode, Integer projectYear, BigDecimal annualPlanAmount) { - //判断金额问题 - //1 是否有该年度的合同支付计划 - List paymentPlans = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .eq(PaymentPlan::getProjectCode, projectCode) - .orderByAsc(PaymentPlan::getPaymentTime)); - VUtils.isTrue(CollUtil.isEmpty(paymentPlans)).throwMessage("未有所选年度的支付计划,无法提交"); - Boolean hasYearPlan = Boolean.FALSE; - - for(PaymentPlan plan : paymentPlans){ - if(Objects.isNull(plan.getPaymentTime())){ - continue; - } - int year = plan.getPaymentTime().getYear(); - if(Objects.nonNull(year) && projectYear.equals(year)){ - hasYearPlan = Boolean.TRUE; - }else if(Objects.nonNull(year) && projectYear.compareTo(year) > 0){ - //2 如果有 这一年前的实际支付金额有没有填 - VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) - .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); - } - } - VUtils.isTrue(!hasYearPlan).throwMessage("未有所选年度的支付计划,无法提交"); - - //3. 算出 所能申报的最大金额 - //3.1 算出 申报年 以及 之前的所有合同计划金额 - BigDecimal planSum = BigDecimal.ZERO; - Optional planSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) && - (c.getPaymentTime().getYear() - projectYear) <= 0) - .map(c -> Objects.nonNull(c.getPaymentAmount()) ? c.getPaymentAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add); - if(planSumOp.isPresent()){ - planSum = planSumOp.get(); - } - BigDecimal actualPlanSum = BigDecimal.ZERO; - Optional actualPlanSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) && - (c.getPaymentTime().getYear() - projectYear) < 0) - .map(c -> Objects.nonNull(c.getActualPaymentAmount()) ? c.getActualPaymentAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add); - if(actualPlanSumOp.isPresent()){ - actualPlanSum = actualPlanSumOp.get(); - } - BigDecimal maxAmount = planSum.subtract(actualPlanSum); - VUtils.isTrue(annualPlanAmount.compareTo(maxAmount) > 0).throwMessage("所填年度支付金额 超出 最大限额"); - } - - - /** - * 续建项目审核 - * @param param - * @return - */ - public Long audit(ProjectRenewalAuditReq param) { - Long projectRenewalId = param.getProjectRenewalId(); - ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); - VUtils.isTrue(Objects.isNull(projectRenewal)).throwMessage("该续建信息不存在!"); - Project project = projectService.getProjectByCode(projectRenewal.getProjectCode()); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projectRenewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - GovOperationProjectBaseinfo operationBaseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjId, projectRenewal.getProjectCode()) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage("关联的项目已经被删除!"); - if (Boolean.TRUE.equals(param.getResult())){ - projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PASS.name()); - }else { - String auditOpinion = param.getAuditOpinion(); - if (StrUtil.isBlank(auditOpinion)){ - throw new BizException("审核意见不能为空"); - } - projectRenewal.setAuditOpinion(auditOpinion); - projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.NOT_PASS.name()); - } - if(Objects.nonNull(project)){ - projectRenewal.setRegionCode(project.getAreaCode()); - projectRenewal.setOrgCode(project.getBuildOrgCode()); - }else if(Objects.nonNull(baseinfo)){ - projectRenewal.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); - projectRenewal.setOrgCode(baseinfo.getBaseBuildDeprtDing()); - }else if(Objects.nonNull(operationBaseinfo)){ - projectRenewal.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); - projectRenewal.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); - } - projectRenewal.setAuditOpinion(param.getAuditOpinion()); - projectRenewal.setUpdateOn(LocalDateTime.now()); - projectRenewalFundDeclarationService.updateById(projectRenewal); - return projectRenewal.getId(); - } - - /** - * 续建项目删除 - * @param projectRenewalId - * @return - */ - public Long delete(Long projectRenewalId) { - ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); - projectRenewal.setDeleted(true); - projectRenewal.setUpdateOn(LocalDateTime.now()); - projectRenewalFundDeclarationService.updateById(projectRenewal); - return projectRenewal.getId(); - } - - public void exportList(HttpServletResponse response, ProjectRenewalListReq param) { - - param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - Page page = param.page(); - projectRenewalFundDeclarationService.pageSql(page, param); - List records = page.getRecords(); - - List collect = records.stream().map(r -> { - ProjectRenewalExportDTO exportDTO = new ProjectRenewalExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - if (ProjectRenewalApprovalStatusEnum.PENDING.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PENDING.getDesc()); - } else if (ProjectRenewalApprovalStatusEnum.PASS.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PASS.getDesc()); - } else if (ProjectRenewalApprovalStatusEnum.NOT_PASS.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.NOT_PASS.getDesc()); - } - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - return exportDTO; - }).collect(Collectors.toList()); - - for (int i = 0; i < collect.size(); i++) { - collect.get(i).setSerialNumber(i + 1); - } - - - String fileName = "续建项目资金库列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ProjectRenewalExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void exportRenewalDeclareList(HttpServletResponse response, ProjectRenewalListReq param) { - param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - Page page = param.page(); - projectRenewalFundDeclarationService.pageSql(page, param); - List records = page.getRecords(); - - List collect = records.stream().map(r -> { - ProjectRenewalDeclareExportDTO exportDTO = new ProjectRenewalDeclareExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - if (ProjectRenewalApprovalStatusEnum.PENDING.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PENDING.getDesc()); - } else if (ProjectRenewalApprovalStatusEnum.PASS.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PASS.getDesc()); - } else if (ProjectRenewalApprovalStatusEnum.NOT_PASS.name().equals(r.getApprovalStatus())) { - exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.NOT_PASS.getDesc()); - } - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - return exportDTO; - }).collect(Collectors.toList()); - - for (int i = 0; i < collect.size(); i++) { - collect.get(i).setSerialNumber(i + 1); - } - - String fileName = "续建项目资金申报列表"; - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ProjectRenewalDeclareExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ProjectRenewalListReq buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - return req; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - req.setUserType("normal"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case SUPER_ADMIN: - //超级管理员 也只能看本单位的 - req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - req.setRegionCodes(regionCodes); - } else { - req.setUserRegionCode(user.getRegionCode()); - } - req.setUserType("region"); - break; - case VISITOR: - //访客可以看全市的 - break; - case DASHBOARD: - break; - default: - //没有权限的话 就让它查不到 - req.setId(0L); - break; - } - return req; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java deleted file mode 100644 index 4a205fb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 项目延期申请记录表 Mapper 接口 - *

- * - * @author CMM - * @since 2023-06-15 - */ -public interface NdProjectDelayApplyMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml deleted file mode 100644 index 0413769..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java deleted file mode 100644 index 5d608fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-02-27 - */ -public interface NdProjectStatusChangeMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.xml deleted file mode 100644 index b1b0fed..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.java deleted file mode 100644 index 1398ade..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -public interface ProjectApplicationMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.xml deleted file mode 100644 index d58ad5e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectApplicationMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java deleted file mode 100644 index 297d91b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; - -/** - *

- * Mapper 接口 - *

- * - * @author ZPF - * @since 2023-06-25 - */ -public interface ProjectCollectionMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml deleted file mode 100644 index 463409d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.java deleted file mode 100644 index 3af978f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -public interface ProjectInstMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.xml deleted file mode 100644 index 96bb279..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectInstMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.java deleted file mode 100644 index 43c73ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectlib.model.po.ProjectPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import org.apache.ibatis.annotations.Param; - -/** - *

- * Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-03 - */ -public interface ProjectMapper extends BaseMapper { - - Page pageAllWithPermission(Page page, @Param("req") ProjectListReq req); - - Page pagelibWithPermission(Page page, @Param("req") ProjectListReq req); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.xml deleted file mode 100644 index d7dd17c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectMapper.xml +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java deleted file mode 100644 index 35b931f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; -import org.apache.ibatis.annotations.Param; - -/** - *

- * 续建项目资金申请表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -public interface ProjectRenewalFundDeclarationMapper extends BaseMapper { - - Page pageSql(Page page,@Param("param") ProjectRenewalListReq req); -} 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 deleted file mode 100644 index 08fe194..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ReviewChecklistApproveMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ReviewChecklistApproveMapper.java deleted file mode 100644 index a20f6e3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ReviewChecklistApproveMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectdeclared.model.entity.ReviewChecklistApprove; - -/** - *

- * Mapper 接口 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -public interface ReviewChecklistApproveMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java deleted file mode 100644 index 7635e3f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -/** - *

- * AnnualLibImportDTO - *

- * - * @author WendyYang - * @since 13:46 2023/2/13 - */ -@Data -public class AnnualLibExportDTO { - - @NotNull(message = "年度投资额不能为空") - @Excel(name = "年度投资额",groupName = "2023年计划") - private BigDecimal annualPlanAmount; - - @NotNull(message = "自由资金不能为空") - @Excel(name = "自有资金",groupName = "资金来源") - private BigDecimal declareHaveAmount; - @Excel(name = "政府投资-本级财政资金") - @NotNull(message = "政府投资-本级财政不能为空") - private BigDecimal declareGovOwnFinanceAmount; - @Excel(name = "政府投资-上级补助资金") - @NotNull(message = "政府投资-上级补助资金不能为空") - private BigDecimal declareGovSuperiorFinanceAmount; - @Excel(name = "银行贷款") - @NotNull(message = "银行贷款不能为空") - private BigDecimal declareBankLendingAmount; - @Excel(name = "其他") - @NotNull(message = "其他不能为空") - private BigDecimal declareOtherAmount; - - @Excel(name = "一季度",groupName = "进度和支付计划") - @NotBlank(message = "一季度不能为空") - private String firstQuarter; - @Excel(name = "二季度") - @NotBlank(message = "二季度不能为空") - private String secondQuarter; - @Excel(name = "三季度") - @NotBlank(message = "三季度不能为空") - private String thirdQuarter; - @Excel(name = "四季度") - @NotBlank(message = "四季度不能为空") - private String fourthQuarter; - - @NotNull(message = "序号不能为空") - @Excel(name = "序号") - private Integer serialNumber; - - @Excel(name = "项目id") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @Excel(name = "项目名称") - @NotBlank(message = "项目名称不能为空") - private String projectName; - - @NotBlank(message = "建设内容不能为空") - @Excel(name = "建设内容") - private String projectIntroduction; - - @NotBlank(message = "建设依据不能为空") - @Excel(name = "建设依据") - private String buildBasis; - - @Excel(name = "建设性质") - @NotBlank(message = "建设性质不能为空") - private String isFirst; - - @Excel(name = "建设起止年限(填写到月)") - @NotBlank(message = "建设起止年限不能为空") - private String buildCycle; - - @NotBlank(message = "总投资不能为空") - @Excel(name = "总投资") - private BigDecimal declaredAmount; - - @Excel(name = "建设单位") - @NotBlank(message = "建设单位不能为空") - private String buildUnitName; - - @Excel(name = "项目联系人") - @NotBlank(message = "项目联系人不能为空") - private String contactName; - - @Excel(name = "项目分管领导") - @NotBlank(message = "项目分管领导不能为空") - private String responsibleMan; - - @Excel(name = "备注") - private String projectRemarks; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java deleted file mode 100644 index 4e2bf9c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -/** - *

- * AnnualLibImportDTO - *

- * - * @author WendyYang - * @since 13:46 2023/2/13 - */ -@Data -public class AnnualLibImportDTO { - - @Excel(name = "项目进展",groupName = "到2022年底完成情况") - @NotNull(message = "项目进展不能为空") - private String projectProgress; - @Excel(name = "累计投资") - @NotNull(message = "累计投资不能为空") - private BigDecimal cumulativeInvest; - - @NotNull(message = "年度投资额不能为空") - @Excel(name = "年度投资额",groupName = "2023年计划") - private BigDecimal annualPlanAmount; - - @NotNull(message = "自由资金不能为空") - @Excel(name = "自有资金",groupName = "资金来源") - private BigDecimal declareHaveAmount; - @Excel(name = "政府投资-本级财政资金") - @NotNull(message = "政府投资-本级财政不能为空") - private BigDecimal declareGovOwnFinanceAmount; - @Excel(name = "政府投资-上级补助资金") - @NotNull(message = "政府投资-上级补助资金不能为空") - private BigDecimal declareGovSuperiorFinanceAmount; - @Excel(name = "银行贷款") - @NotNull(message = "银行贷款不能为空") - private BigDecimal declareBankLendingAmount; - @Excel(name = "国家、省补助",groupName = "资金来源") - @NotNull(message = "国家、省补助不能为空") - private BigDecimal govSuperiorFinanceAmount; - @Excel(name = "地方财政统筹") - @NotNull(message = "地方财政统筹不能为空") - private BigDecimal govOwnFinanceAmount; - @Excel(name = "建设单位自筹") - @NotNull(message = "建设单位自筹不能为空") - private BigDecimal haveAmount; - @Excel(name = "其他") - @NotNull(message = "其他不能为空") - private BigDecimal declareOtherAmount; - - @Excel(name = "一季度",groupName = "进度和支付计划") - @NotBlank(message = "一季度不能为空") - private String firstQuarter; - @Excel(name = "二季度") - @NotBlank(message = "二季度不能为空") - private String secondQuarter; - @Excel(name = "三季度") - @NotBlank(message = "三季度不能为空") - private String thirdQuarter; - @Excel(name = "四季度") - @NotBlank(message = "四季度不能为空") - private String fourthQuarter; - - @NotNull(message = "序号不能为空") - @Excel(name = "序号") - private Integer serialNumber; - - @Excel(name = "项目id") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @Excel(name = "项目名称") - @NotBlank(message = "项目名称不能为空") - private String projectName; - - @NotBlank(message = "建设内容不能为空") - @Excel(name = "建设内容") - private String projectIntroduction; - - @NotBlank(message = "建设依据不能为空") - @Excel(name = "建设依据") - private String buildBasis; - - @Excel(name = "建设性质") - @NotBlank(message = "建设性质不能为空") - private String isFirst; - - @Excel(name = "建设周期") - @NotBlank(message = "建设周期不能为空") - private String constructionCycle; - - @Excel(name = "建设起止年限(填写到月)") - @NotBlank(message = "建设起止年限不能为空") - private String buildCycle; - - @NotBlank(message = "总投资不能为空") - @Excel(name = "总投资") - private BigDecimal declaredAmount; - - @Excel(name = "建设单位") - @NotBlank(message = "建设单位不能为空") - private String buildUnitName; - - @Excel(name = "项目联系人") - @NotBlank(message = "项目联系人不能为空") - private String contactName; - - @Excel(name = "项目分管领导") - @NotBlank(message = "项目分管领导不能为空") - private String responsibleMan; - - @Excel(name = "备注") - private String projectRemarks; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java deleted file mode 100644 index d2fe905..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - *

- * 项目应用保存appCode - *

- * - * @author ZPF - * @since 2023-06-21 - */ -@Data -@ApiModel(value = "ProjectApplicationSaveDTO", description = "项目应用保存appCode") -public class ApplicationAppCodeSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用的id") - @NotNull(message = "应用id必填") - private Long id; - - @ApiModelProperty("应用编码") - @NotBlank(message = "请输入应用编码") - private String appCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java deleted file mode 100644 index 035e943..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; -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; - -/** - *

- * 项目应用表 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -@ApiModel(value = "NdProjectApplication对象", description = "") -@Data -public class ProjectApplicationDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("是否初次建设 0否 1是") - private Integer isFirst; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("关联IRS现有应用") - private String relatedExistsApplication; - - @ApiModelProperty("关联IRS现有应用-IRS应用编码") - private String relatedExistsApplicationCode; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") - private Integer buildLevel; - - @ApiModelProperty("是否统建应用 0:否 1:是") - private Integer isUniteBuild; - - @ApiModelProperty("统建类型 1:全省统建 2:全市统建") - private Integer unionBuildKind; - - @ApiModelProperty("是否数改系统 0:否 1:是") - private Integer isDigitalModification; - - @ApiModelProperty("数改系统") - private String digitalModification; - - @ApiModelProperty("业务领域") - private String bizDomain; - - @ApiModelProperty("发布端") - private String publishSide; - - @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") - private Integer isAccountAppName; - - @ApiModelProperty("一本账应用名称") - private String accountAppName; - - @ApiModelProperty("领域大脑一本账") - private String domainBrainAccount; - - @ApiModelProperty("是否业务协同 0:否 1:是") - private Integer isBizCooperate; - - @ApiModelProperty("业务协同描述") - private String bizCooperateInfo; - - @ApiModelProperty("使用范围") - private String usesRangeRemark; - - @ApiModelProperty("应用简介") - private String applicationSummary; - - @ApiModelProperty("应用备注") - private String applicationRemark; - - @ApiModelProperty("应用总投资测算明细-文件") - private String applicationEstimateFile; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; - - @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") - private Integer nationalItSpec; - - @ApiModelProperty("是否使用政务云资源 0否 1是") - private Integer useGovCloud; - - @ApiModelProperty("云资源类型") - private String cloudsType; - - @ApiModelProperty("云资源基础规格") - private String cloudsFoundationSpecifications; - - @ApiModelProperty("云资源台数") - private Integer cloudsNumber; - - @ApiModelProperty("云资源用户描述") - private String cloudsDescription; - - @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") - private Integer netEnv; - - @ApiModelProperty("是否使用公共数据 0否 1是") - private Integer useCommonData; - - @ApiModelProperty("数据名称") - private String dataName; - - @ApiModelProperty("是否使用公共组件 0否 1是") - private Integer useCommonComponent; - - @ApiModelProperty("使用的公共组件名称") - private String commonComponents; - - @ApiModelProperty("是否产生公共组件 0否 1是") - private Integer produceCommonComponent; - - @ApiModelProperty("预计产生组件名称") - private String produceCommonComponents; - - @ApiModelProperty("试点任务名称") - private String pilotTasksName; - - @ApiModelProperty("试点任务编号") - private String pilotTasksCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; - - @ApiModelProperty("试点文件") - private String experimentsFile; - - @ApiModelProperty("申报单位名称") - private String buildOrgName; - - @ApiModelProperty("申报单位编码") - private String buildOrgCode; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("应用编码") - private String appCode; - - @ApiModelProperty("核心业务列表") - private List coreBusinessList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java deleted file mode 100644 index 6d31b36..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * 项目归集对象 - *

- * - * @author ZPF - * @since 2023-06-21 - */ -@Data -@ApiModel(value = "ProjectCollectionSaveDTO", description = "项目归集对象保存") -public class ProjectCollectionSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("建设单位名称") - private String buildOrg; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("项目类型 1:建设 2:运维") - private Integer projectType; - - @ApiModelProperty("建设类型 1软件,2硬件,3服务") - private Integer constructionType; - - @ApiModelProperty("预算来源") - private Integer budgetSource; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") - private Integer buildLevel; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - @ApiModelProperty("关联应用") - private String applicationName; - - @ApiModelProperty("关联应用IRS编码") - private String applicationIrsCode; - - @ApiModelProperty("可行性研究报告") - private String feasibilityStudyReport; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("采购文件") - private String purchaseFile; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("验收报告") - private String acceptanceReport; - - @ApiModelProperty("变更批复文件") - private String changeApprovalDoc; - - @ApiModelProperty("承建单位") - private String constructionOrg; - - @ApiModelProperty("承建单位统一信用编码") - private String constructionOrgCreditCode; - - @ApiModelProperty("监理单位") - private String supervisorOrg; - - @ApiModelProperty("监理单位统一信用编码") - private String supervisorOrgCreditCode; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("上级条线主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - 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; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java deleted file mode 100644 index d2480bf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ /dev/null @@ -1,379 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ningdatech.pmapi.common.compare.Compare; -import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -/** - *

- * - *

- * - * @author zpf - * @since 2023-02-03 - */ -@Data -@ApiModel(value = "NdProjectDto", description = "") -public class ProjectDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("如果是通过草稿箱提交的 要传下草稿id") - private Long draftId; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") - private Integer bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - private Integer isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - @ApiModelProperty("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("项目应用实例") - private List applicationList; - - @ApiModelProperty("流程状态") - private Integer processStatus; - - @ApiModelProperty("项目发起人 员工code") - private String sponsor; - - @ApiModelProperty("预审发起人 员工code") - private String preStartUserId; - - @ApiModelProperty("上级条线单位审核意见") - private String higherLineSuperOrgReviewComments; - - @ApiModelProperty("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("终验材料") - private String finalAcceptanceMaterials; - - private Map dynamicForm; - - //P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级 - private String baseLowestLevel; - - //01评审中;02待立项;03已驳回;04已立项;05已采购;06已初验;07已终验;00已终止 - private String baseProjSetProg; - - //P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级 - private String baseProjConsClass; - - //01政策、法规,02规划或决策部署,03上级下达任务,04领导批示,05单位核心业务或单位职能,00其他,多个时用中文;分割 - private String baseProjBasis; - - @ApiModelProperty("项目类型 01首次建设;02迭代升级;03结转建设;04新运维;05续运维") - private String baseProjType; - - @ApiModelProperty("是否退回|驳回的项目版本") - private Boolean isBackReject = Boolean.FALSE; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("咨询公司") - private String consultancy; - - @ApiModelProperty("是否开启评审清单") - private Boolean isReviewChecklist; - - @ApiModelProperty("评审清单") - private String reviewChecklist; - - @ApiModelProperty("是否推送省里") - private Boolean push; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalExportDTO.java deleted file mode 100644 index c9ff7eb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalExportDTO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 项目续建列表导出实体 - * - * @author CMM - * @since 2023/02/21 15:03 - */ -@Data -public class ProjectRenewalExportDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ExcelProperty(value = "序号",index = 0) - private Integer serialNumber; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("申报单位") - private String buildOrgName; - - @ExcelProperty("项目类型") - private String projectTypeName; - - @ExcelProperty("预算年度") - private Integer projectYear; - - @ExcelProperty("年度支付金额(万元)") - private BigDecimal annualPaymentAmount; - - @ExcelProperty("状态") - private String approvalStatusName; - - @ExcelProperty("创建时间") - private String createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java deleted file mode 100644 index 4656554..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectRenewalFundDeclarationDTO.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.math.BigDecimal; - -/** - *

- * 续建项目资金申请 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@ApiModel(value = "NdProjectRenewalFundDeclarationDTO", description = "续建项目资金申请表") -@Data -public class ProjectRenewalFundDeclarationDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("关联项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("项目年份") - private Integer projectYear; - - @ApiModelProperty("年度支付金额") - private BigDecimal annualPaymentAmount; - - @ApiModelProperty("自有资金") - private BigDecimal haveAmount; - - @ApiModelProperty("政府投资 本级财务金额") - private BigDecimal govOwnFinanceAmount; - - @ApiModelProperty("政府投资 上级财务金额") - private BigDecimal govSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款金额") - private BigDecimal bankLendingAmount; - - @ApiModelProperty("其它金额") - private BigDecimal otherAmount; - - @ApiModelProperty("单位code") - private String orgCode; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("是否删除 false未删 true已删") - private Boolean deleted; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/AnalysisEventMonitor.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/AnalysisEventMonitor.java deleted file mode 100644 index 41416a5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/AnalysisEventMonitor.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.event.AnalysisEventListener; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; - -import java.util.*; - -/** - * @author CMM - * @since 2023/04/17 18:26 - */ -@Data -public class AnalysisEventMonitor extends AnalysisEventListener> { - - private final List records = new ArrayList<>(); - - /** - * 存储Key - */ - Map key = new HashMap<>(); - /** - * keyList - */ - List keyList = new ArrayList<>(); - - @Override - public void onException(Exception exception, AnalysisContext context) throws Exception { - super.onException(exception, context); - throw BizException.wrap("导入年度计划解析失败"); - } - - @Override - public void invokeHeadMap(Map headMap, AnalysisContext context) { - Set integerSet = headMap.keySet(); - for (Integer integer : integerSet) { - keyList.add(headMap.get(integer)); - } - key.putAll(headMap); - } - - @Override - public void invoke(Map integerStringMap, AnalysisContext context) { - //Project project = new Project(); - //project.setId(data.getProjectId()); - //project.setProjectName(data.getProjectName()); - //project.setProjectIntroduction(data.getProjectIntroduction()); - //// 建设依据忽略 - //project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); - //String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); - //project.setBeginTime(dataArr[0].trim()); - //project.setEndTime(dataArr[1].trim()); - //project.setDeclareAmount(data.getDeclaredAmount()); - //project.setAnnualPlanAmount(data.getAnnualPlanAmount()); - //project.setDeclareHaveAmount(data.getDeclareHaveAmount()); - //project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); - //project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); - //project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); - //project.setDeclareOtherAmount(data.getDeclareOtherAmount()); - //project.setEngineeringSpeedOne(data.getFirstQuarter()); - //project.setEngineeringSpeedTwo(data.getSecondQuarter()); - //project.setEngineeringSpeedThree(data.getThirdQuarter()); - //project.setEngineeringSpeedFour(data.getFourthQuarter()); - //project.setBuildOrgName(data.getBuildUnitName()); - //project.setContactName(data.getContactName()); - //project.setResponsibleMan(data.getResponsibleMan()); - //project.setProjectRemarks(data.getProjectRemarks()); - //records.add(project); - } - - @Override - public void doAfterAllAnalysed(AnalysisContext context) { - //if (records.isEmpty()) { - // throw BizException.wrap("导入年度计划为空"); - //} - //List projectIds = CollUtils.fieldList(records, Project::getId); - //long count = projectService.count(Wrappers.lambdaQuery(Project.class) - // .in(Project::getId, projectIds)); - //if (count != records.size()) { - // throw BizException.wrap("请确保所有项目都存在"); - //} - //projectService.updateBatchById(records); - } -} 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 deleted file mode 100644 index ddee407..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ /dev/null @@ -1,580 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.ningdatech.pmapi.common.compare.Compare; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目b - *

- * - * @author WendyYang - * @since 2023-02-03 - */ -@Data -@TableName("nd_project") -@ApiModel(value = "NdProject对象", description = "") -public class Project implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("所属地区编号") - @Compare("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - @Compare("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - @Compare("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("是否临时增补 0:否 1:是") - @Compare("是否临时增补") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - @Compare("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - @Compare("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - @Compare("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - @Compare("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - @Compare("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - @Compare("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - @Compare("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - @Compare("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - @Compare("是否首次新建") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - @Compare("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - @Compare("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - @Compare("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - @Compare("四大体系") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - @Compare("是否数字化改革项目") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") - @Compare("综合业务领域") - private Integer bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - @Compare("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("发改编码") - @Compare("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - @Compare("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - @Compare("是否上云") - private Integer isCloud; - - @ApiModelProperty("云类型") - @Compare("云类型") - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - @Compare("等保级别") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - @Compare("是否密评") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - @Compare("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - @Compare("资金申报情况-申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - @Compare("资金申报情况-自有金额") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - @Compare("资金申报情况-政府投资-本级财政资金") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - @Compare("资金申报情况-政府投资-上级补助资金") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - @Compare("银行贷款") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - @Compare("其它资金") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - @Compare("资金分配情况-软件开发") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - @Compare("资金分配情况-云资源、硬件购置") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - @Compare("资金分配情况-第三方服务") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - @Compare("年度支付计划-年度支付计划") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - @Compare("年度支付计划-自有金额") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - @Compare("年度支付计划-政府投资-本级财政资金") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - @Compare("年度支付计划-政府投资-上级补助资金") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - @Compare("年度支付计划-银行贷款") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - @Compare("年度支付计划-其它资金") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复总投资(万元)") - @Compare("立项批复总投资") - private BigDecimal approvalAmount; - - @ApiModelProperty("立项批复总预算(万元)") - @Compare("立项批复总预算") - private BigDecimal approvalBudget; - - @ApiModelProperty("年度计划添加时间") - @Compare("年度计划添加时间") - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - @Compare("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - @Compare("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - @Compare("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - @Compare("安全投入-金额") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - @Compare("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - @Compare("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - @Compare("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - @Compare("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - @Compare("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - @Compare("是否包含应用") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - @Compare("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - @Compare("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - @Compare("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - @Compare("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - @Compare("核心业务-是否开启核心业务模块") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - @Compare("安全投入-是否开启安全投入模块") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - @Compare("工程形象进度-是否开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - @Compare("附件-是否开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - @Compare("备注-是否开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - @Compare("年度支付计划-是否开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - @Compare("一地创新全省共享项目-是否开启") - private Boolean isInnovateWholeProvinceShare; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - - @ApiModelProperty("流程实例编号") - private String instCode; - - @ApiModelProperty("安全投入-模块信息") - @Compare("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - @Compare("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - @Compare("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - @Compare("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("原始建设周期(月)") - @Compare("建设周期(月)") - private Integer originBuildCycle; - - @ApiModelProperty("建设方案文件") - @Compare("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复建设方案文件") - @Compare("立项批复建设方案文件") - private String approvedConstructionPlanFile; - - @ApiModelProperty("立项批复文件") - @Compare("立项批复文件") - private String approvedFile; - - @ApiModelProperty("立项批复时间") - @Compare("立项批复时间") - private LocalDateTime approvalDate; - - @ApiModelProperty("批复金额") - @Compare("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - @Compare("是否有上级条线主管部门") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级条线主管部门") - @Compare("上级条线主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - @Compare("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - @Compare("是否有主管部门") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - @Compare("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - @Compare("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - @ApiModelProperty("前端所需验证字段") - @Compare("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("流程状态") - @Compare("流程状态") - private Integer processStatus; - - @ApiModelProperty("动态表单 json") - @Compare("动态表单 json") - private String dynamicForm; - - @ApiModelProperty("项目发起人 员工code") - @Compare("项目发起人 员工code") - private String sponsor; - - @ApiModelProperty("预审发起人 员工code") - @Compare("预审发起人 员工code") - private String preStartUserId; - - @ApiModelProperty("上级条线单位审核意见") - @Compare("上级条线单位审核意见") - private String higherLineSuperOrgReviewComments; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("项目预审申请单文件ID") - @Compare("项目预审申请单文件ID") - private Long pretrialFileId; - - @ApiModelProperty("项目预审申请单文件名") - @Compare("项目预审申请单文件名") - private String pretrialFileName; - - @ApiModelProperty("项目建设方案申请单文件ID") - @Compare("项目建设方案申请单文件ID") - private Long constructFileId; - - @ApiModelProperty("项目建设方案申请单文件名") - @Compare("项目建设方案申请单文件名") - private String constructFileName; - - @ApiModelProperty("21位项目编号") - @Compare("项目编号") - private String projectCode; - - @ApiModelProperty("项目申报书") - @Compare("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("省级联审 审批结果") - private String sjlsResult; - - @ApiModelProperty("版本号") - private Integer version; - - @ApiModelProperty("是否是最新版本") - private Boolean newest; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - private LocalDateTime transactionTime; - - @ApiModelProperty("交货时间") - private LocalDateTime deliveryTime; - - @ApiModelProperty("初验材料") - @Compare("初验材料") - private String preliminaryInspectionMaterials; - - @ApiModelProperty("终验材料") - @Compare("终验材料") - private String finalAcceptanceMaterials; - - @ApiModelProperty("合同总金额") - @Compare("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("计划验收时间(有可能是延期后的)") - private LocalDateTime planAcceptanceTime; - - @ApiModelProperty("原本计划验收时间") - private LocalDateTime originPlanAcceptanceTime; - - @ApiModelProperty("延期月份数") - private Integer applyDelayMonths; - - @ApiModelProperty("申请延期佐证材料") - private String applyDelayFile; - - @ApiModelProperty("申请延期理由") - private String applyDelayReason; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("初步方案项目ID") - private Long prePlanProjectId; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") - private String countryHigherSealAuditOpinion; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") - private String countryHigherSealAuditDate; - - @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") - private String countryHigherSealNo; - - @ApiModelProperty("区县预审本级主管单位盖章审核意见") - private String countrySealAuditOpinion; - - @ApiModelProperty("区县预审本级主管单位盖章审核日期") - private String countrySealAuditDate; - - @ApiModelProperty("是否退回|驳回的项目版本") - private Boolean isBackReject; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; - - @ApiModelProperty("建议项目总投资") - private BigDecimal proposeTotalInvest; - - @ApiModelProperty("建议年度预算") - private BigDecimal proposeAnnualBudget; - - @ApiModelProperty("建议评审意见附件") - private String proposeAttachFiles; - - @ApiModelProperty("咨询公司") - private String consultancy; - - @ApiModelProperty("是否开启评审清单") - private Boolean isReviewChecklist; - - @ApiModelProperty("评审清单") - private String reviewChecklist; - - @ApiModelProperty("是否完成清单合并") - private Boolean reviewCheckFinish; - - @ApiModelProperty("是否推送省里") - private Boolean push; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - -} 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 deleted file mode 100644 index 7ef8ca7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目应用表 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -@TableName("nd_project_application") -@ApiModel(value = "NdProjectApplication对象", description = "") -@Data -public class ProjectApplication implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("应用编码") - private String appCode; - - @ApiModelProperty("是否初次建设 0否 1是") - private Integer isFirst; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("删除时间") - private LocalDateTime deleteOn; - - @ApiModelProperty("关联IRS现有应用") - private String relatedExistsApplication; - - @ApiModelProperty("关联IRS现有应用-IRS应用编码") - private String relatedExistsApplicationCode; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") - private Integer buildLevel; - - @ApiModelProperty("是否统建应用 0:否 1:是") - private Integer isUniteBuild; - - @ApiModelProperty("统建类型 1:全省统建 2:全市统建") - private Integer unionBuildKind; - - @ApiModelProperty("是否数改系统 0:否 1:是") - private Integer isDigitalModification; - - @ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") - private String digitalModification; - - @ApiModelProperty("业务领域") - private String bizDomain; - - @ApiModelProperty("发布端") - private String publishSide; - - @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") - private Integer isAccountAppName; - - @ApiModelProperty("一本账应用名称") - private String accountAppName; - - @ApiModelProperty("领域大脑一本账") - private String domainBrainAccount; - - @ApiModelProperty("是否业务协同 0:否 1:是") - private Integer isBizCooperate; - - @ApiModelProperty("业务协同描述") - private String bizCooperateInfo; - - @ApiModelProperty("使用范围") - private String usesRangeRemark; - - @ApiModelProperty("应用简介") - private String applicationSummary; - - @ApiModelProperty("应用备注") - private String applicationRemark; - - @ApiModelProperty("应用总投资测算明细-文件") - private String applicationEstimateFile; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; - - @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") - private Integer nationalItSpec; - - @ApiModelProperty("是否使用政务云资源 0否 1是") - private Integer useGovCloud; - - @ApiModelProperty("云资源类型") - private String cloudsType; - - @ApiModelProperty("云资源基础规格") - private String cloudsFoundationSpecifications; - - @ApiModelProperty("云资源台数") - private Integer cloudsNumber; - - @ApiModelProperty("云资源用户描述") - private String cloudsDescription; - - @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") - private Integer netEnv; - - @ApiModelProperty("是否使用公共数据 0否 1是") - private Integer useCommonData; - - @ApiModelProperty("数据名称") - private String dataName; - - @ApiModelProperty("是否使用公共组件 0否 1是") - private Integer useCommonComponent; - - @ApiModelProperty("使用的公共组件名称") - private String commonComponents; - - @ApiModelProperty("是否产生公共组件 0否 1是") - private Integer produceCommonComponent; - - @ApiModelProperty("预计产生组件名称") - private String produceCommonComponents; - - @ApiModelProperty("试点任务名称") - private String pilotTasksName; - - @ApiModelProperty("试点任务编号") - private String pilotTasksCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; - - @ApiModelProperty("试点文件") - private String experimentsFile; - - @ApiModelProperty("申报单位名称") - private String buildOrgName; - - @ApiModelProperty("申报单位编码") - private String buildOrgCode; - - private Long createBy; - - private Long updateBy; - - @ApiModelProperty("项目编码") - private String projectCode; - - @ApiModelProperty("项目版本") - private Integer projectVersion; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("应用核心业务") - private Boolean coreBusinessList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java deleted file mode 100644 index 615dddc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.ningdatech.pmapi.projectlib.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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目归集对象 - *

- * - * @author ZPF - * @since 2023-06-21 - */ -@Data -@TableName("nd_project_collection") -@ApiModel(value = "NdProject_collection", description = "项目归集对象") -public class ProjectCollection implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrg; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("项目类型 1:建设 2:运维") - private Integer projectType; - - @ApiModelProperty("建设类型 1软件,2硬件,3服务") - private Integer constructionType; - - @ApiModelProperty("预算来源") - private Integer budgetSource; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") - private Integer buildLevel; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - @ApiModelProperty("关联应用") - private String applicationName; - - @ApiModelProperty("关联应用IRS编码") - private String applicationIrsCode; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("可行性研究报告") - private String feasibilityStudyReport; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("采购文件") - private String purchaseFile; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("验收报告") - private String acceptanceReport; - - @ApiModelProperty("变更批复文件") - private String changeApprovalDoc; - - @ApiModelProperty("承建单位") - private String constructionOrg; - - @ApiModelProperty("承建单位统一信用编码") - private String constructionOrgCreditCode; - - @ApiModelProperty("监理单位") - private String supervisorOrg; - - @ApiModelProperty("监理单位统一信用编码") - private String supervisorOrgCreditCode; - - @ApiModelProperty("本级主管部门名称") - private String superOrg; - - @ApiModelProperty("本级主管部门Code") - private String superOrgCode; - - @ApiModelProperty("上级条线主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; -} 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 deleted file mode 100644 index 58ad501..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目延期申请记录表 - *

- * - * @author CMM - * @since 2023-06-15 - */ -@Data -@TableName("nd_project_delay_apply") -@ApiModel(value = "NdProjectDelayApply对象", description = "项目延期申请记录表") -public class ProjectDelayApply implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("延期时间(几个月)") - private Integer delayTime; - - @ApiModelProperty("延期申请佐证材料") - private String delayApplyFile; - - @ApiModelProperty("延期申请理由") - private String delayApplyReason; - - @ApiModelProperty("创建人") - private Long createBy; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新人") - private Long updateBy; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("延期申请实例ID") - private String instanceId; - - @ApiModelProperty("是否审批成功") - private Boolean success; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectInst.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectInst.java deleted file mode 100644 index f56ae46..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectInst.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * - *

- * - * @author Poffy - * @since 2023-02-13 - */ -@TableName("nd_project_inst") -@Data -@ApiModel(value = "NdProjectInst对象", description = "") -public class ProjectInst implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("实例ID") - private String instCode; - - @ApiModelProperty("实例类型 1单位内部审批流程 2项目预审审批流程 3部门联合审批流程 4建设方案审批流程 5验收申报审批流程") - private Integer instType; - - @ApiModelProperty("创建时间") - private LocalDateTime creatOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectRenewalFundDeclaration.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectRenewalFundDeclaration.java deleted file mode 100644 index eabbd65..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectRenewalFundDeclaration.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -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 WendyYang - * @since 2023-02-15 - */ -@TableName("nd_project_renewal_fund_declaration") -@ApiModel(value = "NdProjectRenewalFundDeclaration对象", description = "续建项目资金申请表") -@Data -public class ProjectRenewalFundDeclaration implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("关联项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("项目年份") - private Integer projectYear; - - @ApiModelProperty("年度支付金额") - private BigDecimal annualPaymentAmount; - - @ApiModelProperty("自有资金") - private BigDecimal haveAmount; - - @ApiModelProperty("政府投资 本级财务金额") - private BigDecimal govOwnFinanceAmount; - - @ApiModelProperty("政府投资 上级财务金额") - private BigDecimal govSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款金额") - private BigDecimal bankLendingAmount; - - @ApiModelProperty("其它金额") - private BigDecimal otherAmount; - - @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") - private String approvalStatus; - - @ApiModelProperty("单位code") - private String orgCode; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("是否删除 false未删 true已删") - private Boolean deleted; - - @ApiModelProperty("审核意见") - private String auditOpinion; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java deleted file mode 100644 index ba55b15..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-02-27 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@TableName("nd_project_status_change") -@ApiModel(value = "NdProjectStatusChange对象", description = "") -public class ProjectStatusChange implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("状态机执行前的项目状态") - private Integer beforeStatus; - - @ApiModelProperty("状态机执行后的项目状态") - private Integer afterStatus; - - @ApiModelProperty("状态变更对应的事件") - private String event; - - @ApiModelProperty("状态变更发生的时间") - private LocalDateTime createOn; - - @ApiModelProperty("项目code") - private String projectCode; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectPO.java deleted file mode 100644 index 1f6a605..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectPO.java +++ /dev/null @@ -1,547 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.po; - -import com.baomidou.mybatisplus.annotation.*; -import com.ningdatech.pmapi.common.compare.Compare; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 项目所有并集 - *

- * - * @author ZPF - * @since 2023-09-26 - */ -@Data -@ApiModel(value = "NdProject对象", description = "") -public class ProjectPO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("来源 1申报项目 2项目归集") - private String fromType; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("所属地区编号") - @Compare("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - @Compare("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - @Compare("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("是否临时增补 0:否 1:是") - @Compare("是否临时增补") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - @Compare("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - @Compare("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - @Compare("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - @Compare("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - @Compare("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - @Compare("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - @Compare("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - @Compare("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - @Compare("是否首次新建") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - @Compare("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - @Compare("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - @Compare("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - @Compare("四大体系") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - @Compare("是否数字化改革项目") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'") - @Compare("综合业务领域") - private Integer bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - @Compare("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("发改编码") - @Compare("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - @Compare("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - @Compare("是否上云") - private Integer isCloud; - - @ApiModelProperty("云类型") - @Compare("云类型") - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - @Compare("等保级别") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - @Compare("是否密评") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - @Compare("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - @Compare("资金申报情况-申报金额") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - @Compare("资金申报情况-自有金额") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - @Compare("资金申报情况-政府投资-本级财政资金") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - @Compare("资金申报情况-政府投资-上级补助资金") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - @Compare("银行贷款") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - @Compare("其它资金") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - @Compare("资金分配情况-软件开发") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - @Compare("资金分配情况-云资源、硬件购置") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - @Compare("资金分配情况-第三方服务") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - @Compare("年度支付计划-年度支付计划") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - @Compare("年度支付计划-自有金额") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - @Compare("年度支付计划-政府投资-本级财政资金") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - @Compare("年度支付计划-政府投资-上级补助资金") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - @Compare("年度支付计划-银行贷款") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - @Compare("年度支付计划-其它资金") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复总投资(万元)") - @Compare("立项批复总投资") - private BigDecimal approvalAmount; - - @ApiModelProperty("立项批复总预算(万元)") - @Compare("立项批复总预算") - private BigDecimal approvalBudget; - - @ApiModelProperty("年度计划添加时间") - @Compare("年度计划添加时间") - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - @Compare("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - @Compare("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - @Compare("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - @Compare("安全投入-金额") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - @Compare("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - @Compare("附件-佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - @Compare("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - @Compare("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - @Compare("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - @Compare("是否包含应用") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - @Compare("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - @Compare("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - @Compare("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - @Compare("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - @Compare("核心业务-是否开启核心业务模块") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - @Compare("安全投入-是否开启安全投入模块") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - @Compare("工程形象进度-是否开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - @Compare("附件-是否开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - @Compare("备注-是否开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - @Compare("年度支付计划-是否开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - @Compare("一地创新全省共享项目-是否开启") - private Boolean isInnovateWholeProvinceShare; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - - @ApiModelProperty("流程实例编号") - private String instCode; - - @ApiModelProperty("安全投入-模块信息") - @Compare("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - @Compare("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - @Compare("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - @Compare("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("原始建设周期(月)") - @Compare("建设周期(月)") - private Integer originBuildCycle; - - @ApiModelProperty("建设方案文件") - @Compare("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复建设方案文件") - @Compare("立项批复建设方案文件") - private String approvedConstructionPlanFile; - - @ApiModelProperty("立项批复文件") - @Compare("立项批复文件") - private String approvedFile; - - @ApiModelProperty("立项批复时间") - @Compare("立项批复时间") - private LocalDateTime approvalDate; - - @ApiModelProperty("批复金额") - @Compare("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - @Compare("是否有上级条线主管部门") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级条线主管部门") - @Compare("上级条线主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - @Compare("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - @Compare("是否有主管部门") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - @Compare("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - @Compare("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - @ApiModelProperty("前端所需验证字段") - @Compare("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("流程状态") - @Compare("流程状态") - private Integer processStatus; - - @ApiModelProperty("动态表单 json") - @Compare("动态表单 json") - private String dynamicForm; - - @ApiModelProperty("项目发起人 员工code") - @Compare("项目发起人 员工code") - private String sponsor; - - @ApiModelProperty("预审发起人 员工code") - @Compare("预审发起人 员工code") - private String preStartUserId; - - @ApiModelProperty("上级条线单位审核意见") - @Compare("上级条线单位审核意见") - private String higherLineSuperOrgReviewComments; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("项目预审申请单文件ID") - @Compare("项目预审申请单文件ID") - private Long pretrialFileId; - - @ApiModelProperty("项目预审申请单文件名") - @Compare("项目预审申请单文件名") - private String pretrialFileName; - - @ApiModelProperty("项目建设方案申请单文件ID") - @Compare("项目建设方案申请单文件ID") - private Long constructFileId; - - @ApiModelProperty("项目建设方案申请单文件名") - @Compare("项目建设方案申请单文件名") - private String constructFileName; - - @ApiModelProperty("21位项目编号") - @Compare("项目编号") - private String projectCode; - - @ApiModelProperty("项目申报书") - @Compare("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("省级联审 审批结果") - private String sjlsResult; - - @ApiModelProperty("版本号") - private Integer version; - - @ApiModelProperty("是否是最新版本") - private Boolean newest; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - private LocalDateTime transactionTime; - - @ApiModelProperty("交货时间") - private LocalDateTime deliveryTime; - - @ApiModelProperty("初验材料") - @Compare("初验材料") - private String preliminaryInspectionMaterials; - - @ApiModelProperty("终验材料") - @Compare("终验材料") - private String finalAcceptanceMaterials; - - @ApiModelProperty("合同总金额") - @Compare("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("计划验收时间(有可能是延期后的)") - private LocalDateTime planAcceptanceTime; - - @ApiModelProperty("原本计划验收时间") - private LocalDateTime originPlanAcceptanceTime; - - @ApiModelProperty("延期月份数") - private Integer applyDelayMonths; - - @ApiModelProperty("申请延期佐证材料") - private String applyDelayFile; - - @ApiModelProperty("申请延期理由") - private String applyDelayReason; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("初步方案项目ID") - private Long prePlanProjectId; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") - private String countryHigherSealAuditOpinion; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") - private String countryHigherSealAuditDate; - - @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") - private String countryHigherSealNo; - - @ApiModelProperty("区县预审本级主管单位盖章审核意见") - private String countrySealAuditOpinion; - - @ApiModelProperty("区县预审本级主管单位盖章审核日期") - private String countrySealAuditDate; - - @ApiModelProperty("是否退回|驳回的项目版本") - private Boolean isBackReject; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectRenewalFundDeclarationPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectRenewalFundDeclarationPO.java deleted file mode 100644 index 1bac08f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/po/ProjectRenewalFundDeclarationPO.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.po; - -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.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * 续建项目资金申请表 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@ApiModel(value = "NdProjectRenewalFundDeclarationPO", description = "续建项目资金申请表") -@Data -public class ProjectRenewalFundDeclarationPO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("关联项目ID") - private Long projectId; - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("项目年份") - private Integer projectYear; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("年度支付金额") - private BigDecimal annualPaymentAmount; - - @ApiModelProperty("自有资金") - private BigDecimal haveAmount; - - @ApiModelProperty("政府投资 本级财务金额") - private BigDecimal govOwnFinanceAmount; - - @ApiModelProperty("政府投资 上级财务金额") - private BigDecimal govSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款金额") - private BigDecimal bankLendingAmount; - - @ApiModelProperty("其它金额") - private BigDecimal otherAmount; - - @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") - private String approvalStatus; - - @ApiModelProperty("单位code") - private String orgCode; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("是否删除 false未删 true已删") - private Boolean deleted; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java deleted file mode 100644 index 0ec5190..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import com.ningdatech.basic.model.PagePo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; - -/** - *

- * ProjectLibListReq - *

- * - * @author ZPF - * @since 14:35 2023/2/1 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@ApiModel("应用列表查询") -@EqualsAndHashCode(callSuper = true) -public class ProjectApplicationListReq extends PagePo { - - @ApiModelProperty("申报单位code") - private String buildOrgCode; - - @ApiModelProperty("申报单位名") - private String buildOrgName; - - @ApiModelProperty("应用名") - private String applicationName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java deleted file mode 100644 index 6915840..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Range; - -import javax.validation.constraints.DecimalMax; -import javax.validation.constraints.DecimalMin; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - *

- * 立项批复参数类 - *

- * - * @author WendyYang - * @since 20:04 2023/2/12 - */ -@Data -@ApiModel("立项批复参数类") -public class ProjectApprovedReq { - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - - @ApiModelProperty("批复总投资") - @NotNull(message = "批复总投资不能为空") - @DecimalMax(value = "999999999.99", message = "批复总投资无效") - @DecimalMin(value = "0.01", message = "批复总投资无效") - private BigDecimal approvedAmount; - - @ApiModelProperty("批复总预算") - @NotNull(message = "批复总预算不能为空") - @DecimalMax(value = "999999999.99", message = "批复总预算无效") - @DecimalMin(value = "0.01", message = "批复总预算无效") - private BigDecimal approvalBudget; - - - @NotNull(message = "批复时间不能为空") - @JsonFormat(pattern = "yyyy-MM-dd") - @ApiModelProperty("批复时间") - private LocalDateTime approvedDate; - - @ApiModelProperty("建设周期") - @NotNull(message = "建设周期不能为空") - @Range(min = 1, max = 99999, message = "建设周期无效") - private Integer buildCycle; - - @ApiModelProperty("批复文件ID") - @NotNull(message = "批复文件不能为空") - private Long approvedFileId; - - @ApiModelProperty("建设方案文件ID") - @NotNull(message = "建设方案不能为空") - private Long buildPlanFileId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java deleted file mode 100644 index 82278b1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * ProjectIdReq - *

- * - * @author WendyYang - * @since 09:32 2023/2/13 - */ -@Data -public class ProjectIdReq { - - @ApiModelProperty("项目ID") - @NotNull(message = "项目ID不能为空") - private Long projectId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java deleted file mode 100644 index 6344fbe..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import org.springframework.format.annotation.DateTimeFormat; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.List; - -/** - *

- * ProjectLibListReq - *

- * - * @author WendyYang - * @since 14:35 2023/2/1 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@ApiModel("项目列表查询") -@EqualsAndHashCode(callSuper = true) -public class ProjectListReq extends PagePo { - - private Long id; - - @ApiModelProperty("区域编码") - private String regionCode; - - @ApiModelProperty("区域编码") - private String areaCode; - - @ApiModelProperty("区域等级") - private Integer regionLevel = 3; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("申报单位code") - private String buildOrgCode; - - @ApiModelProperty("申报单位名") - private String buildOrgName; - - @ApiModelProperty("主管单位code") - private String superOrgCode; - - @ApiModelProperty("项目类型 老的 1建设2运维") - private Integer oldProjectType; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmountMin; - - @ApiModelProperty("申报金额") - private BigDecimal declareAmountMax; - - @ApiModelProperty("批复金额") - private BigDecimal approveAmountMin; - - @ApiModelProperty("批复金额") - private BigDecimal approveAmountMax; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; - - @ApiModelProperty("用户ID") - private Long userId; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目阶段 多个") - private List stageList; - - @ApiModelProperty("项目状态 多个") - private List statusList; - - @ApiModelProperty("实例code 多个") - private List instCodes; - - @ApiModelProperty("项目code 多个") - private List projectCodes; - - @ApiModelProperty("导出选项") - private List exportOptionList; - - private String userType; - private String userValue; - - private Collection regionCodes; - - @ApiModelProperty("区域编码") - private String userRegionCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalAuditReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalAuditReq.java deleted file mode 100644 index c60ba41..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalAuditReq.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.Max; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -/** - * 续建项目审核请求实体 - * - * @author CMM - * @since 2023/02/21 13:43 - */ -@Data -@ApiModel("续建项目审核请求参数") -public class ProjectRenewalAuditReq { - - @NotNull - @ApiModelProperty("续建项目ID") - private Long projectRenewalId; - - @NotNull(message = "审核结果不能为空") - @ApiModelProperty("审核结果") - private Boolean result; - - @ApiModelProperty("审核意见") - @Length(max = 200) - private String auditOpinion; -} 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 deleted file mode 100644 index ba3f8c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ningdatech.pmapi.projectlib.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; -import java.util.Collection; -import java.util.List; - -/** - *

- * ProjectRenewalListReq - *

- * - * @author zpf - * @since 14:35 2023/2/15 - */ -@Data -@ApiModel("项目续建资金库列表查询") -@EqualsAndHashCode(callSuper = true) -public class ProjectRenewalListReq extends PagePo { - - private Long id; - - @ApiModelProperty("区域编码") - private String regionCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目类型") - private Integer projectType; - - @ApiModelProperty("预算年度") - private Integer year; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime startTime; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; - - @ApiModelProperty("用户ID") - private Long userId; - - @ApiModelProperty("单位code") - private String orgCode; - - @ApiModelProperty("项目阶段 多个") - private List stageList; - - @ApiModelProperty("项目状态 多个") - private List statusList; - - @ApiModelProperty("审核状态") - private String approvalStatus; - - private String userType; - private String userValue; - - private Collection regionCodes; - - @ApiModelProperty("区域编码") - private String userRegionCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java deleted file mode 100644 index 0bcb177..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import java.util.List; - -/** - *

- * StartProjectDeclareReq - *

- * - * @author WendyYang - * @since 17:47 2023/2/11 - */ -@Data -public class StartProjectDeclareReq { - - @ApiModelProperty("项目ID") - @NotEmpty(message = "项目ID不能为空") - private List projectIds; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java deleted file mode 100644 index 08cda8b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.math.BigDecimal; - -/** - * @Classname AnnualAmountVO - * @Description - * @Date 2023/2/17 13:37 - * @Author PoffyZhang - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class AnnualAmountVO { - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目Code") - private String projectCode; - - @ApiModelProperty("年份") - private Integer projectYear; - - @ApiModelProperty("年度投资资金") - private BigDecimal annualAmount; - - @ApiModelProperty("自有资金") - private BigDecimal haveAmount; - - @ApiModelProperty("政府投资 本级财务金额") - private BigDecimal govOwnFinanceAmount; - - @ApiModelProperty("政府投资 上级财务金额") - private BigDecimal govSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款金额") - private BigDecimal bankLendingAmount; - - @ApiModelProperty("其它金额") - private BigDecimal otherAmount; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualPlanListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualPlanListItemVO.java deleted file mode 100644 index 80d5d94..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualPlanListItemVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - *

- * AnnualPlanListItemVO - *

- * - * @author WendyYang - * @since 15:19 2023/2/11 - */ -@Data -public class AnnualPlanListItemVO { - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("建设单位") - private String buildOrg; - - @ApiModelProperty("项目类型") - private String projectType; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("立项批复金额") - private BigDecimal approvalAmount; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("项目是否开起方案申报") - private Boolean isStartDeclaredProject; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - -} 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 deleted file mode 100644 index 709544d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java +++ /dev/null @@ -1,188 +0,0 @@ -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; - -/** - *

- * 项目应用表 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -@ApiModel(value = "NdProjectApplicationVO", description = "") -@Data -public class ProjectApplicationVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("应用ID") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("应用编码") - private String appCode; - - @ApiModelProperty("是否初次建设 0否 1是") - private Integer isFirst; - - @ApiModelProperty("应用名称") - private String applicationName; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; - - @ApiModelProperty("删除时间") - private LocalDateTime deleteOn; - - @ApiModelProperty("关联IRS现有应用") - private String relatedExistsApplication; - - @ApiModelProperty("关联IRS现有应用-IRS应用编码") - private String relatedExistsApplicationCode; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("建设层级 1:国家 2:省级 3:市级 4:县(市、区)") - private Integer buildLevel; - - @ApiModelProperty("是否统建应用 0:否 1:是") - private Integer isUniteBuild; - - @ApiModelProperty("统建类型 1:全省统建 2:全市统建") - private Integer unionBuildKind; - - @ApiModelProperty("是否数改系统 0:否 1:是") - private Integer isDigitalModification; - - @ApiModelProperty("数改系统") - private String digitalModification; - - @ApiModelProperty("业务领域") - private String bizDomain; - - @ApiModelProperty("发布端") - private String publishSide; - - @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") - private Integer isAccountAppName; - - @ApiModelProperty("一本账应用名称") - private String accountAppName; - - @ApiModelProperty("领域大脑一本账") - private String domainBrainAccount; - - @ApiModelProperty("是否业务协同 0:否 1:是") - private Integer isBizCooperate; - - @ApiModelProperty("业务协同描述") - private String bizCooperateInfo; - - @ApiModelProperty("使用范围") - private String usesRangeRemark; - - @ApiModelProperty("应用简介") - private String applicationSummary; - - @ApiModelProperty("应用备注") - private String applicationRemark; - - @ApiModelProperty("应用总投资测算明细-文件") - private String applicationEstimateFile; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; - - @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") - private Integer nationalItSpec; - - @ApiModelProperty("是否使用政务云资源 0否 1是") - private Integer useGovCloud; - - @ApiModelProperty("云资源类型") - private String cloudsType; - - @ApiModelProperty("云资源基础规格") - private String cloudsFoundationSpecifications; - - @ApiModelProperty("云资源台数") - private Integer cloudsNumber; - - @ApiModelProperty("云资源用户描述") - private String cloudsDescription; - - @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") - private Integer netEnv; - - @ApiModelProperty("是否使用公共数据 0否 1是") - private Integer useCommonData; - - @ApiModelProperty("数据名称") - private String dataName; - - @ApiModelProperty("是否使用公共组件 0否 1是") - private Integer useCommonComponent; - - @ApiModelProperty("使用的公共组件名称") - private String commonComponents; - - @ApiModelProperty("是否产生公共组件 0否 1是") - private Integer produceCommonComponent; - - @ApiModelProperty("预计产生组件名称") - private String produceCommonComponents; - - @ApiModelProperty("试点任务名称") - private String pilotTasksName; - - @ApiModelProperty("试点任务编号") - private String pilotTasksCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; - - @ApiModelProperty("试点文件") - private String experimentsFile; - - @ApiModelProperty("申报单位名称") - private String buildOrgName; - - @ApiModelProperty("申报单位编码") - private String buildOrgCode; - - @ApiModelProperty("项目编码") - private String projectCode; - - @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/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java deleted file mode 100644 index 51254b5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * 项目归集对象 - *

- * - * @author ZPF - * @since 2023-06-21 - */ -@Data -@ApiModel(value = "ProjectCollectionVO", description = "项目归集对象") -public class ProjectCollectionVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrg; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("项目类型 1:建设 2:运维") - private Integer projectType; - - @ApiModelProperty("建设类型 1软件,2硬件,3服务") - private Integer constructionType; - - @ApiModelProperty("预算来源") - private Integer budgetSource; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") - private Integer buildLevel; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - @ApiModelProperty("关联应用") - private String applicationName; - - @ApiModelProperty("关联应用IRS编码") - private String applicationIrsCode; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - private String createBy; - private String updateBy; - - @ApiModelProperty("可行性研究报告") - private String feasibilityStudyReport; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("采购文件") - private String purchaseFile; - - @ApiModelProperty("中标通知书") - private String acceptanceLetter; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("验收报告") - private String acceptanceReport; - - @ApiModelProperty("变更批复文件") - private String changeApprovalDoc; - - @ApiModelProperty("承建单位") - private String constructionOrg; - - @ApiModelProperty("承建单位统一信用编码") - private String constructionOrgCreditCode; - - @ApiModelProperty("监理单位") - private String supervisorOrg; - - @ApiModelProperty("监理单位统一信用编码") - private String supervisorOrgCreditCode; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("上级条线主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - 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; - } -} 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 deleted file mode 100644 index aa367f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ /dev/null @@ -1,567 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.compare.Compare; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectOutputVO; -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.projectlib.enumeration.ProjectTypeNewEnum; -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; -import lombok.Data; -import org.apache.commons.lang3.StringUtils; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * ProjectLibListItemVO - *

- * - * @author WendyYang - * @since 15:13 2023/2/1 - */ -@Data -@ApiModel("项目详情") -public class ProjectDetailVO { - - @ApiModelProperty("来源 1申报项目 2项目归集") - private String fromType; - - @ApiModelProperty("应用ID") - private Long id; - - @ApiModelProperty("所属地区编号") - private String areaCode; - - @ApiModelProperty("所属地区名称") - private String area; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("'历年项目编码'") - private String baseHistorProjId; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("历年项目年度") - private String baseHistorProjYear; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private Integer isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("公司编码code") - private String buildOrgCode; - - @ApiModelProperty("建设单位浙政钉ID") - private String buildOrgZheJiangGovDingId; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("是否省级 1省级 2非省级") - private Integer baseProvManDeprtType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private Integer isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起始时间") - private String beginTime; - - @ApiModelProperty("项目建设终止时间") - private String endTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private Integer fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private Integer isDigitalReform; - - @ApiModelProperty("综合业务领域") - private Integer bizDomain; - - @ApiModelProperty("建设层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("建设层级") - private String buildLevel; - - @ApiModelProperty("贯通层级 P省级 M市级 C县级 T乡镇级 V村级") - @Compare("贯通层级") - private String lowestLevel; - - @ApiModelProperty("立项依据") - private String buildBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("发改编码") - private String developCode; - - @ApiModelProperty("财政编码") - private String financialCode; - - @ApiModelProperty("是否上云 0:否 1:是") - private Integer isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("立项批复资金(万元)") - private BigDecimal approvalAmount; - - @ApiModelProperty("立项批复总预算(万元)") - @Compare("立项批复总预算") - private BigDecimal approvalBudget; - - private LocalDateTime annualPlanAddTime; - - @ApiModelProperty("核心业务-核心业务模块") - private String coreBusiness; - - @ApiModelProperty("安全投入-投入项") - private String safetyInputTitle; - - @ApiModelProperty("安全投入-内容描述") - private String safetyInputDescribe; - - @ApiModelProperty("安全投入-金额(万元)") - private BigDecimal safetyInputAmount; - - @ApiModelProperty("附件-初步方案") - private String preliminaryPlanFile; - - @ApiModelProperty("附件-延期佐证材料") - private String supportingMaterialsFile; - - @ApiModelProperty("附件-项目总投资测算明细") - private String calculationTotalInvestmentFile; - - @ApiModelProperty("附件-申报单位主要职责(单位三定方案)") - private String mainResponsibilitiesApplicantFile; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("是否包含应用 0:否 1:是") - private Integer includeApplication; - - @ApiModelProperty("工程形象进度-第一季度") - private String engineeringSpeedOne; - - @ApiModelProperty("工程形象进度-第二季度") - private String engineeringSpeedTwo; - - @ApiModelProperty("工程形象进度-第三季度") - private String engineeringSpeedThree; - - @ApiModelProperty("工程形象进度-第四季度") - private String engineeringSpeedFour; - - @ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启") - private Boolean isOpenCoreBusiness; - - @ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启") - private Boolean isOpenSafetyInput; - - @ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启") - private Boolean isEngineeringSpeed; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - @ApiModelProperty("安全投入-模块信息") - private String safetyInputModular; - - @ApiModelProperty("项目申报pdf") - private String projectPdf; - - @ApiModelProperty("立项申报pdf") - private String declarationPdf; - - @ApiModelProperty("建设周期(月)") - private String buildCycle; - - @ApiModelProperty("建设方案文件") - private String constructionPlanFile; - - @ApiModelProperty("立项批复建设方案文件") - private String approvedConstructionPlanFile; - - @ApiModelProperty("立项批复建设方案文件名") - private String approvedConstructionPlanFileName; - - @ApiModelProperty("立项批复文件") - private String approvedFile; - - @ApiModelProperty("立项批复文件名") - private String approvedFileName; - - @ApiModelProperty("批复金额") - private BigDecimal approvedTotalInvestmentIncrease; - - @ApiModelProperty("立项批复时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime approvalDate; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - private Integer isHigherSuperOrg; - - @ApiModelProperty("上级主管部门") - private String higherSuperOrg; - - @ApiModelProperty("上级主管部门Code") - private String higherSuperOrgCode; - - @ApiModelProperty("是否有主管部门 0没有 1有") - private Integer isSuperOrg; - - @ApiModelProperty("主管部门名称") - private String superOrg; - - @ApiModelProperty("主管部门Code") - private String superOrgCode; - - @ApiModelProperty("前端所需验证字段") - private String allApplicationsDone; - - @ApiModelProperty("项目应用") - private List projectApplications; - - @ApiModelProperty("动态form") - private Map dynamicForm; - - @ApiModelProperty("年度投资金额详情") - private List annualAccumulateAmountList; - - @ApiModelProperty("项目发起人 员工code") - private String sponsor; - - @ApiModelProperty("上级条线单位审核意见") - private String higherLineSuperOrgReviewComments; - private String projectTypeName; - - @ApiModelProperty("项目预审申请单文件ID") - private Long pretrialFileId; - - @ApiModelProperty("项目预审申请单文件名") - private String pretrialFileName; - - @ApiModelProperty("项目建设方案申请单文件ID") - private Long constructFileId; - - @ApiModelProperty("项目建设方案申请单文件名") - private String constructFileName; - - @ApiModelProperty("21位项目编号") - private String projectCode; - - @ApiModelProperty("项目申报书") - private String projectApplicationForm; - - @ApiModelProperty("省级联审 审批结果") - private String sjlsResult; - - @ApiModelProperty("版本号") - private Integer version; - - @ApiModelProperty("是否是最新版本") - private Boolean newest; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime transactionTime; - - @ApiModelProperty("交货时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime deliveryTime; - - @ApiModelProperty("初验材料") - private String preliminaryInspectionMaterials; - - @ApiModelProperty("终验材料") - private String finalAcceptanceMaterials; - - @ApiModelProperty("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("合同信息") - private ContractVO contract; - - @ApiModelProperty("采购信息") - private List purchases; - - @ApiModelProperty("初审人员") - private List acceptancePersons; - - @ApiModelProperty("实施信息") - private OperationVO operation; - - @ApiModelProperty("版本号str") - private String versionStr; - - @ApiModelProperty("初步方案项目ID") - private Long prePlanProjectId; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") - private String countrySealAuditOpinion; - - @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") - private String countrySealAuditDate; - - @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") - private String countrySealNo; - - @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 = "当前版本"; - return this.versionStr; - } - this.versionStr = "v" + NdDateUtils.format(this.createOn, "yyyyMMddHHmmss"); - return this.versionStr; - } - - - public String getProjectTypeName() { - if (Objects.nonNull(this.projectType)) { - Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) - .ifPresent(desc -> this.projectTypeName = desc); - } - return this.projectTypeName; - } - - public void buildDynamicForm(String dynamicFormStr) { - if (StringUtils.isNotBlank(dynamicFormStr) && BizUtils.getJSONType(dynamicFormStr)) { - 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; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("可研报告") - private String baseResearchReportFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; - - @ApiModelProperty("主管单位统一社会信用代码") - @Compare("主管单位统一社会信用代码") - private String superOrgCreditCode; - - @ApiModelProperty("终验信息 IRS档案") - private List finalIrsApps; - - @ApiModelProperty("建议项目总投资") - private BigDecimal proposeTotalInvest; - - @ApiModelProperty("建议年度预算") - private BigDecimal proposeAnnualBudget; - - @ApiModelProperty("建议评审意见附件") - private String proposeAttachFiles; - - @ApiModelProperty("专家评审意见") - private String proposeAttach; - - @ApiModelProperty("专家评审结果") - private Integer baseReviewResults; - - @ApiModelProperty("咨询公司") - private String consultancy; - - @ApiModelProperty("是否开启评审清单") - private Boolean isReviewChecklist; - - @ApiModelProperty("评审清单") - private String reviewChecklist; - - @ApiModelProperty("是否开启评审清单") - private Boolean reviewCheckFinish; - - @ApiModelProperty("是否推送省里") - private Boolean push; - - @ApiModelProperty("系统定位") - private String systemPosition; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; -} 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 deleted file mode 100644 index 48d1646..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ningdatech.pmapi.common.compare.Compare; -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.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.user.entity.UserInfo; -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 io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -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; - -/** - *

- * ProjectLibListItemVO - *

- * - * @author WendyYang - * @since 15:13 2023/2/1 - */ -@Data -@Builder -@ApiModel("项目库列表视图") -public class ProjectLibListItemVO { - - @Tolerate - public ProjectLibListItemVO() { - } - - @ApiModelProperty("来源 1申报项目 2项目归集") - private String fromType; - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("区域") - private String area; - - @ApiModelProperty("区域Code") - private String areaCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("批复金额") - private BigDecimal approvedAmount; - - @ApiModelProperty("立项批复时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime approvalDate; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("申报年度") - private Integer projectYear; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("业务领域") - private Integer bizDomain; - - @ApiModelProperty("流程状态") - private Integer processStatus; - - @ApiModelProperty("实例code") - private String instCode; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String buildOrgCode; - - private String projectTypeName; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime transactionTime; - - @ApiModelProperty("交货时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime deliveryTime; - - @ApiModelProperty("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("建设周期 月") - private Integer buildCycle; - - @ApiModelProperty("计划验收时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime planAcceptanceTime; - - public String getProjectTypeName() { - if (Objects.nonNull(this.projectType)) { - Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) - .ifPresent(desc -> this.projectTypeName = desc); - } - return this.projectTypeName; - } - - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime updateOn; - - @ApiModelProperty("能否被预审申报") - private Boolean canPreDeclared = Boolean.FALSE; - - @ApiModelProperty("是否有上级条线主管部门 0没有 1有") - private Integer isHigherSuperOrg; - - @ApiModelProperty("是否可以申请延期") - private Boolean canDelayApply = Boolean.TRUE; - - @ApiModelProperty("是否为建设方案申报") - private Boolean isConstruct; - - @ApiModelProperty("初步方案项目ID") - private Long prePlanProjectId; - - @ApiModelProperty("标签") - private List tags; - - //预审申报时候 需不需要上传上级条线意见文件 - private Boolean needUploadSuperLineFile; - - @ApiModelProperty("当前审批人") - private List approveUsers; - - @ApiModelProperty("年度投资金额总额") - private BigDecimal annualAccumulateAmount; - private List annualAccumulateAmountList; - public Boolean getNeedUploadSuperLineFile() { - UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); - //要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审 - if (Objects.nonNull(userInfoDetail) && userInfoDetail.getIsMunicipalOrg() - && Objects.nonNull(this.isHigherSuperOrg) - && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(this.status) - && CommonEnum.YES.getCode().equals(this.isHigherSuperOrg)) { - this.needUploadSuperLineFile = Boolean.TRUE; - return this.needUploadSuperLineFile; - } - this.needUploadSuperLineFile = null; - return this.needUploadSuperLineFile; - } -} 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 deleted file mode 100644 index f092ac1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.apache.commons.lang3.StringUtils; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - *

- * 续建项目资金申请表 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@ApiModel(value = "NdProjectRenewalFundDeclarationVO", description = "续建项目资金申请表") -@Data -public class ProjectRenewalFundDeclarationVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; - - @ApiModelProperty("项目年份") - private Integer projectYear; - - @ApiModelProperty("年度支付金额") - private BigDecimal annualPaymentAmount; - - @ApiModelProperty("自有资金") - private BigDecimal haveAmount; - - @ApiModelProperty("政府投资 本级财务金额") - private BigDecimal govOwnFinanceAmount; - - @ApiModelProperty("政府投资 上级财务金额") - private BigDecimal govSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款金额") - private BigDecimal bankLendingAmount; - - @ApiModelProperty("其它金额") - private BigDecimal otherAmount; - - @ApiModelProperty("审核状态 待审核PENGING 审核通过PASS 审核不通过NO_PASS") - private String approvalStatus; - - @ApiModelProperty("是否删除 false未删 true已删") - private Boolean deleted; - - @ApiModelProperty("单位code") - private String orgCode; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("立项批复资金") - private BigDecimal approvalAmount; - - @ApiModelProperty("关联项目ID") - private Long projectId; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("关联项目名字") - private String projectName; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - private String projectType; - - @ApiModelProperty("审核意见") - private String auditOpinion; - - @ApiModelProperty("年度投资金额详情") - private List annualAccumulateAmountList; - - public String getProjectTypeName(){ - if(Objects.nonNull(this.projectType)){ - return ProjectTypeNewEnum.getDesc(this.projectType); - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectReviewCheckListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectReviewCheckListItemVO.java deleted file mode 100644 index 9e64f58..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectReviewCheckListItemVO.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ningdatech.pmapi.common.compare.Compare; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; -import java.util.Optional; - -/** - *

- * ProjectReviewCheckListItemVO - *

- * - * @author ZPF - * @since 15:13 2023/11/07 - */ -@Data -@Builder -@ApiModel("项目库审查列表视图") -public class ProjectReviewCheckListItemVO { - - @Tolerate - public ProjectReviewCheckListItemVO() { - } - - @ApiModelProperty("来源 1申报项目 2项目归集") - private String fromType; - - @ApiModelProperty("项目ID") - private Long id; - - @ApiModelProperty("项目编号") - private String projectCode; - - @ApiModelProperty("区域") - private String area; - - @ApiModelProperty("区域Code") - private String areaCode; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("批复金额") - private BigDecimal approvedAmount; - - @ApiModelProperty("立项批复时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime approvalDate; - - @ApiModelProperty("项目类型 01:首次建设 02:迭代升级 03:结转建设 04新运维 05续运维") - @Compare("项目类型") - private String projectType; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("申报年度") - private Integer projectYear; - - @ApiModelProperty("申报单位") - private String buildOrg; - - @ApiModelProperty("业务领域") - private Integer bizDomain; - - @ApiModelProperty("流程状态") - private Integer processStatus; - - @ApiModelProperty("实例code") - private String instCode; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String buildOrgCode; - - private String projectTypeName; - - @ApiModelProperty("成交金额") - private BigDecimal transactionAmount; - - @ApiModelProperty("成交时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime transactionTime; - - @ApiModelProperty("交货时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime deliveryTime; - - @ApiModelProperty("合同总金额") - private BigDecimal contractAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("建设周期 月") - private Integer buildCycle; - - @ApiModelProperty("计划验收时间") - @JSONField(format = "yyyy-MM-dd") - private LocalDateTime planAcceptanceTime; - - @ApiModelProperty("是否完成评审清单合并") - private Boolean reviewCheckFinish; - - @ApiModelProperty("当前人 是否审批") - private Boolean approved = Boolean.FALSE; - - @ApiModelProperty("未审批人员") - private String reviewCheckNotApprove; - - public String getProjectTypeName() { - if (Objects.nonNull(this.projectType)) { - Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType)) - .ifPresent(desc -> this.projectTypeName = desc); - } - return this.projectTypeName; - } - - @ApiModelProperty("已核查人数 7/7") - private String verifiedHumans; - - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java deleted file mode 100644 index 613edde..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 项目延期申请记录表 服务类 - *

- * - * @author CMM - * @since 2023-06-15 - */ -public interface INdProjectDelayApplyService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java deleted file mode 100644 index 9732a35..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-02-27 - */ -public interface INdProjectStatusChangeService extends IService { - - ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId); - -} 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 deleted file mode 100644 index 1c52dd5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -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/IProjectCollectionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java deleted file mode 100644 index e48b496..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; - -/** - *

- * 服务类 - *

- * - * @author ZPF - * @since 2023-06-25 - */ -public interface IProjectCollectionService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectInstService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectInstService.java deleted file mode 100644 index 8f80015..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectInstService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -public interface IProjectInstService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectRenewalFundDeclarationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectRenewalFundDeclarationService.java deleted file mode 100644 index 12f904e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectRenewalFundDeclarationService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; - -/** - *

- * 续建项目资金申请表 服务类 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -public interface IProjectRenewalFundDeclarationService extends IService { - - Page pageSql(Page page, ProjectRenewalListReq req); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectService.java deleted file mode 100644 index c9b39f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.po.ProjectPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author WendyYang - * @since 2023-02-03 - */ -public interface IProjectService extends IService { - - public List getAllVersionProjectId(Project project); - - public List getAllVersionProjectId(Long projectId); - - Project getNewProject(Long projectId); - - Project getNewConstructProject(Long projectId); - - Project getProjectByCode(String projectCode); - - Page pageAllWithPermission(Page page, ProjectListReq req); - - Page pagelibWithPermission(Page page, ProjectListReq req); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java deleted file mode 100644 index 845c6c4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; -import com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper; -import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 项目延期申请记录表 服务实现类 - *

- * - * @author CMM - * @since 2023-06-15 - */ -@Service -public class NdProjectDelayApplyServiceImpl extends ServiceImpl implements INdProjectDelayApplyService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java deleted file mode 100644 index 1923018..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -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.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-02-27 - */ -@Service -public class NdProjectStatusChangeServiceImpl extends ServiceImpl implements INdProjectStatusChangeService { - - @Override - public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getEvent, event) - .eq(ProjectStatusChange::getProjectId, projectId) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1); - return getOne(query); - } - -} 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 deleted file mode 100644 index 16f41f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -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; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -@Service -@Slf4j -@AllArgsConstructor -public class ProjectApplicationServiceImpl extends ServiceImpl - implements IProjectApplicationService { - - private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; - - @Override - public List getApplicationsByProject(Project project) { - List apps = this.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, project.getProjectCode())); - return apps; - } - - @Override - public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { - List 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/ProjectCollectionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java deleted file mode 100644 index 2504fe0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectlib.mapper.ProjectCollectionMapper; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; -import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author ZPF - * @since 2023-06-25 - */ -@Service -public class ProjectCollectionServiceImpl extends ServiceImpl - implements IProjectCollectionService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectInstServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectInstServiceImpl.java deleted file mode 100644 index 58650e9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectInstServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.mapper.ProjectInstMapper; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Poffy - * @since 2023-02-13 - */ -@Service -public class ProjectInstServiceImpl extends ServiceImpl implements IProjectInstService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java deleted file mode 100644 index 90f1ed3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.mapper.ProjectRenewalFundDeclarationMapper; -import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; -import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -/** - *

- * 续建项目资金申请表 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-15 - */ -@Service -@RequiredArgsConstructor -public class ProjectRenewalFundDeclarationServiceImpl extends - ServiceImpl implements IProjectRenewalFundDeclarationService { - - private final ProjectRenewalFundDeclarationMapper mapper; - @Override - public Page pageSql(Page page, ProjectRenewalListReq req) { - return mapper.pageSql(page,req); - } -} 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 deleted file mode 100644 index 4c4e216..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -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.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.model.po.ProjectPO; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-03 - */ -@Service -@RequiredArgsConstructor -public class ProjectServiceImpl extends ServiceImpl implements IProjectService { - - private final ProjectMapper projectMapper; - - @Override - public List getAllVersionProjectId(Project project) { - //查出 项目code - String projectCode = project.getProjectCode(); - - List projects = list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - - if(CollUtil.isEmpty(projects)){ - return Collections.emptyList(); - } - - return projects.stream().map(Project::getId).collect(Collectors.toList()); - } - - @Override - public List getAllVersionProjectId(Long projectId) { - Project project = getById(projectId); - - if(Objects.isNull(project)){ - return null; - } - - return getAllVersionProjectId(project); - } - - @Override - public Project getNewProject(Long projectId) { - Project project = getById(projectId); - - if(Objects.isNull(project)){ - return null; - } - - String projectCode = project.getProjectCode(); - - LambdaQueryWrapper last = Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getProjectCode, projectCode) - .last(BizConst.LIMIT_1); - Project newest = getOne(last); - - return newest; - } - - @Override - public Project getNewConstructProject(Long projectId) { - Project project = getById(projectId); - - if(Objects.isNull(project)){ - return null; - } - - String projectCode = project.getProjectCode(); - - LambdaQueryWrapper last = Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getProjectCode, projectCode) - .eq(Project::getIsConstruct, Boolean.TRUE) - .last(BizConst.LIMIT_1); - Project newest = getOne(last); - - return newest; - } - - @Override - public Project getProjectByCode(String projectCode) { - Project project = this.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode) - .eq(Project::getNewest,Boolean.TRUE) - .last(BizConst.LIMIT_1)); - return project; - } - - @Override - public Page pageAllWithPermission(Page page, ProjectListReq req) { - return projectMapper.pageAllWithPermission(page,req); - } - - @Override - public Page pagelibWithPermission(Page page, ProjectListReq req) { - return projectMapper.pagelibWithPermission(page,req); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java deleted file mode 100644 index 4a5227b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.ningdatech.pmapi.projectlib.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.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessHandlerEnum; -import com.wflow.workflow.enums.ProcessStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; -import liquibase.pro.packaged.I; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 根据项目版本获取流程详情工具类 - * - * @author CMM - * @since 2023/04/20 09:57 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ProjectVersionUtil { - - private final IProjectService projectService; - private final ProcessInstanceService processInstanceService; - private final IProjectInstService projectInstService; - - /** - * 根据最新的项目ID获取临近项目版本的审核记录信息 - * @param projectId - * @return - */ - public ProcessProgressVo getPreVerProcessInfo(Long projectId, InstTypeEnum instTypeEnum){ - Project project = projectService.getById(projectId); - if (Objects.isNull(project)){ - throw new BizException("当前项目不存在!"); - } - String projectCode = project.getProjectCode(); - if (StringUtils.isEmpty(projectCode)){ - throw new BizException("当前项目编号为空!"); - } - // 获取相同项目编号的项目 - List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - if (projectList.size() < CommonConst.VERSION_SIZE){ - throw new BizException("未发现该项目的历史版本!"); - } - - // 获取之前版本的项目 - for (Project preProject : projectList) { - // 从项目流程实例关联表中查出实例详情 - List projectInstList = projectInstService - .list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, preProject.getId()) - .eq(ProjectInst::getInstType, instTypeEnum.getCode())); - if (CollUtil.isNotEmpty(projectInstList)) { - List processProgressVoList = projectInstList.stream() - .map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) - .collect(Collectors.toList()); - // 筛选出上个版本该类型审核流程通过的流程详情 - List instanceDetailList = processProgressVoList.stream() - .filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus())) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(instanceDetailList)) { - // 获取最后一个流程详情 - return instanceDetailList.get(instanceDetailList.size() - 1); - } - } - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/contants/ProvincialContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/contants/ProvincialContant.java deleted file mode 100644 index 88efe8b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/contants/ProvincialContant.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ningdatech.pmapi.provincial.contants; - -/** - * @Classname ProvincialContant - * @Description - * @Date 2023/9/6 9:16 - * @Author PoffyZhang - */ -public interface ProvincialContant { - - class OssUpload { - public static final String OSS_UPLOAD_URL = "https://pms.zj.gov.cn/prometheus-zhejiang_file_service/api/v1/file/uploadFile"; - public static final String MEDIA_TYPE = "multipart/form-data"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/controller/TestController.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/controller/TestController.java deleted file mode 100644 index 369412c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/controller/TestController.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.provincial.controller; - -import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.provincial.model.res.SjApiResponse; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.io.IOException; -import java.io.InputStream; - -/** - * @Classname TestController - * @Description - * @Date 2023/3/2 15:08 - * @Author PoffyZhang - */ -@RestController -@RequestMapping("/api/v1/test") -@Api(tags = "测试省局接口") -public class TestController { - - @Autowired - private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - - @GetMapping("/push") - @ApiOperation("测试推送") - private Boolean push(@Valid @RequestParam Long projectId){ - Project project = new Project(); - project.setId(projectId); - return provincialDeptManage.startTheProcess(project); - } - - @GetMapping("/detail") - @ApiOperation("测试获取详情") - private SjApiResponse detail(@RequestParam String projectId){ - return joinReviewProvincialBureauService.processInfo(projectId); - } - - @GetMapping("/path") - @ApiOperation("测试获取详情") - private String path() throws IOException { -// String template = ResourceUtil.getResource("template").getPath(); -// return template; - - InputStream in = this.getClass().getResourceAsStream("/template/simsun.ttc"); - StringBuilder sb = new StringBuilder(); - int n; - while ((n=in.read())!=-1){ - sb.append((char)n); - System.out.print((char)n); - } - - return sb.toString(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java deleted file mode 100644 index 7a90c46..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.provincial.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * @Classname ProjectProvincialAuditStatusEnum - * @Description - * @Date 2023/3/16 11:04 - * @Author PoffyZhang - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum ProjectProvincialAuditStatusEnum { - /** - * 省级联审的状态 - */ - NOT_AUDIT(0,"未审核"), - AUDITING(1,"审核中"), - SUCCESS(2,"审核通过"), - FAIL(3,"审核不通过"), - WITHDRAW(4,"被撤回"), - BACK(5,"退回地市"); - - private Integer code; - private String desc; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/manage/ProvincialManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/manage/ProvincialManage.java deleted file mode 100644 index 6e0967d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/manage/ProvincialManage.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.pmapi.provincial.manage; - -import com.alibaba.fastjson.JSON; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.util.CommonInputStreamResource; -import com.ningdatech.pmapi.provincial.contants.ProvincialContant; -import com.ningdatech.pmapi.provincial.model.res.OssApiData; -import com.ningdatech.pmapi.provincial.model.res.OssApiResponse; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.*; -import org.springframework.stereotype.Component; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; -import java.io.ByteArrayInputStream; -import java.util.Objects; - -/** - * @Classname ProvincialManage - * @Description - * @Date 2023/9/6 9:08 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProvincialManage { - - public static String uploadToOss(byte[] fileBytes,String fileName) { - String url = ProvincialContant.OssUpload.OSS_UPLOAD_URL; - MultiValueMap params = new LinkedMultiValueMap<>(); - ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes); - CommonInputStreamResource commonInputStreamResource = new CommonInputStreamResource(inputStream, fileBytes.length, fileName); - params.add("file", commonInputStreamResource); - RestTemplate restTemplate = new RestTemplate(); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType(ProvincialContant.OssUpload.MEDIA_TYPE); - headers.setContentType(type); - HttpEntity formEntity = new HttpEntity(params, headers); - ResponseEntity res = restTemplate.postForEntity(url, formEntity, OssApiResponse.class); - log.info("oss res :{}", res); - OssApiResponse body = res.getBody(); - if(Objects.isNull(body)){ - throw new BizException("上传省局oss请求失败"); - } - - if(HttpStatus.OK.value() != body.getRespCode()){ - throw new BizException("上传省局oss失败:" + body.getRespMsg()); - } - - OssApiData ossApiData = JSON.parseObject(JSON.toJSONString(body.getData()), OssApiData.class); - - return ossApiData.getAccessUrl(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/FileDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/FileDTO.java deleted file mode 100644 index c25027c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/FileDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname FileDTO - * @Description - * @Date 2023/4/13 9:55 - * @Author PoffyZhang - */ -@Data -public class FileDTO { - - @ApiModelProperty("文件id") - private String fileId; - - @ApiModelProperty("文件名") - private String fileName; - - @ApiModelProperty("url") - private String accessUrl; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProcessCommentDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProcessCommentDTO.java deleted file mode 100644 index 64cd1f8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProcessCommentDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; - -/** - * @Classname ProcessCommentDTO - * @Description - * @Date 2023/3/2 15:25 - * @Author PoffyZhang - */ -@Data -@Builder -@ApiModel(value = "ProcessCommentDTO", description = "省局返回流程审核详情") -public class ProcessCommentDTO { - - @ApiModelProperty("任务id") - private String taskId; - - @ApiModelProperty("comment") - private String comment; - - @ApiModelProperty("流程步骤") - private String stepName; - - @ApiModelProperty("审批状态") - private String status; - - @ApiModelProperty("审批人") - private String label; - - @ApiModelProperty("时间") - private String approverTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvinceApiResponse.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvinceApiResponse.java deleted file mode 100644 index b966f62..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvinceApiResponse.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.dto; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * ApiResponse - 统一的接口返回值封装 - *

- * - * @author WendyYang - * @since 14:29 2022/9/29 - */ -@Data -@NoArgsConstructor -public class ProvinceApiResponse implements Serializable { - private static final long serialVersionUID = 532384723325394156L; - - public static final int SUCCESS_CODE = 200; - - public static final String SUCCESS_MSG = "success"; - - public static final int ERROR_CODE = 500; - - public static final String ERROR_MSG = "Internal server error"; - - /** - * 状态码 - */ - private Integer code; - - /** - * 返回内容 - */ - private String message; - private String msg; - - /** - * 返回数据 - */ - private T data; - - /** - * 全参构造函数 - * - * @param code 状态码 - * @param message 返回内容 - * @param data 返回数据 - */ - private ProvinceApiResponse(Integer code, String message, T data) { - this.code = code; - this.message = message; - this.data = data; - } - - /** - * 构造一个自定义的API返回 - * - * @param code 状态码 - * @param message 返回内容 - * @param data 返回数据 - * @return ApiResponse - */ - public static ProvinceApiResponse of(Integer code, String message, T data) { - return new ProvinceApiResponse(code, message, data); - } - - /** - * 构造一个成功且不带数据的API返回 - * - * @return ApiResponse - */ - public static ProvinceApiResponse ofSuccess() { - return ofSuccess(null); - } - - /** - * 构造一个成功且带数据的API返回 - * - * @param data 返回数据 - * @return ApiResponse - */ - public static ProvinceApiResponse ofSuccess(T data) { - return ofStatus(Status.OK, data); - } - - /** - * 构造一个成功且自定义消息的API返回 - * - * @param message 返回内容 - * @return ApiResponse - */ - public static ProvinceApiResponse ofMessage(String message) { - return of(Status.OK.getCode(), message, null); - } - - /** - * 构造一个有状态的API返回 - * - * @param status 状态 {@link Status} - * @return ApiResponse - */ - public static ProvinceApiResponse ofStatus(ApiStatus status) { - return ofStatus(status, null); - } - - /** - * 构造一个有状态且带数据的API返回 - * - * @param status 状态 {@link Status} - * @param data 返回数据 - * @return ApiResponse - */ - public static ProvinceApiResponse ofStatus(ApiStatus status, T data) { - return of(status.getCode(), status.getReasonPhrase(), data); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialApplicationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialApplicationDTO.java deleted file mode 100644 index 396f853..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialApplicationDTO.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.dto; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -/** - * @Classname ProvincialApplicationDTO - * @Description - * @Date 2023/3/2 10:06 - * @Author PoffyZhang - */ -@Data -@Builder -@ApiModel(value = "ProvincialApplicationDTO", description = "") -public class ProvincialApplicationDTO implements Serializable { - - - //云 信息 - private List clouds; - //是否初次建设 1是 2不是 - private Integer isFirst; - //应用名称 - private String applicationName; - //关联 关联的IRS应用code - private String applicationCode; - //关联的IRS应用name - private String relatedExistsApplication; - //1: '办公类系统',2: '业务应用类系统',3: '门户网站',4: '宣传微博/微信公众号',5: '硬件类系统',6: '工具类系统',99: '其他' - private Integer applicationType; - //建设层级 1:国家 2:省级 3:市级 4:县(市、区) - private Integer buildLevel; - //是否统建 0:否 1:是 - private Integer isUniteBuild; - //统建类型 1:全省统建 2:全市统建 - private Integer unionBuildKind; - //应用简介 - private String applicationSummary; - //应用备注 - private String applicationRemark; - //应用总投资测算明细 - private String applicationEstimateFile; - //是否数改系统 0:否 1:是 - private Integer isFiveDomain; - //1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔 - private String fiveDomain; - //业务领域 - private String bizDomain; - //否涉及业务协同 0:否 1:是 - private Integer isBizCooperate; - //协同单位111111 - private String cooperativeUnit; - //用户范围 0: '机关事业单位人员','0-1': '跨部门跨系统','0-2': '系统内地方各级','0-3': '本部门本级','0-4': '处室内部','0-6': '主管处室内部','0-5': '其他',1: '企业', 2: '社会公众',3: '其他' 多个用英文,分隔 - private String userRange; - //是否使用政务云资源 1使用 - private Integer useGovCloud; - //是否符合国家信息技术应用创新相关规范 0:否 1:是 - private Integer nationalITSpec; - //网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机 - private String netEnv; - //等保级别 1:一级 2:二级 3:三级 4:四级 5:五级 - private Integer secrecyGrade; - //密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级 - private Integer passwordGrade; - //是否是S2 0:否 1:是 - private Integer isS2; - //一本账应用名称 - private String accountAppName; - //领域”大脑”一本帐名称 - private String brainAccountAppName; - //是否使用公共数据 - private Integer useCommonData; - //使用的公共数据名称 - private String dataName; - //使用公共组件的名称 - private String commonComponents; - //是否使用公共组件 - private Integer useCommonComponent; - //是否产生公共组件 - private Integer isProduceCommonComponent; - //产生的组件名称 - private String produceCommonComponent; - //发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' - private String publishSide; - - @Builder - @Data - @JsonIgnoreProperties(value = { "handler"}) - public static class Cloud implements Serializable { - //云资源台数 11 - private Integer cloudNums; - //云资源类型 云服务器(ECS) - private String cloudType; - //云资源规格 1核8G - private String cloudBasicSpec; - //云资源描述 - private String cloudUseDescription; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialProjectDTO.java deleted file mode 100644 index 4a6f91b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/dto/ProvincialProjectDTO.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** - * @Classname ProvincialProjectDTO - * @Description - * @Date 2023/3/2 10:06 - * @Author PoffyZhang - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "ProvincialProjectDTO", description = "") -public class ProvincialProjectDTO implements Serializable { - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("区域名称") - private String regionName; - - @ApiModelProperty("数字化改革系统 可以多选 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台',8: '基层智治'") - private String digitalReform; - - @ApiModelProperty("业务主管单位浙政钉code,多个单位用英文;组成字符串。数据通过接口-查询省本级业务主管单位获取对应数据") - private String operationManageUnit; - - @ApiModelProperty("重大项目名称") - private String projectName; - - @ApiModelProperty("重大项目code 21位") - private String projectId; - - @ApiModelProperty("项目类型 1新建 2续建") - private Integer projectType; - - @ApiModelProperty("项目总投资(万元)") - private BigDecimal totalMoney; - - @ApiModelProperty("项目年度预算(万元)") - private BigDecimal yearBudget; - - @ApiModelProperty("自有资金,政府投资-本级财政资金,政府投资-上级补助资金") - private String budgetFrom; - - @ApiModelProperty("预算年度 2023") - private String year; - - @ApiModelProperty("财政code 32") - private String financialCode; - - @ApiModelProperty("发改code 23") - private String developCode; - - @ApiModelProperty("开始时间 比如2022-11-18") - private String beginTime; - - @ApiModelProperty("结束时间 比如2022-12-13") - private String endTime; - - @ApiModelProperty("立项依据1111") - private String buildBasis; - - @ApiModelProperty("立项依据材料 [{\"fileId\":\"\"}]") - private String buildBasisFile; - - @ApiModelProperty("项目概述") - private String projectSummary; - - @ApiModelProperty("负责人") - private String responsibleMan; - - @ApiModelProperty("联系人联系方式") - private String responsibleManPhone; - - @ApiModelProperty("联系人") - private String contactName; - - @ApiModelProperty("联系人联系方式") - private String contactPhone; - - @ApiModelProperty("建设单位 比如财政局") - private String buildUnit; - - @ApiModelProperty("建设单位浙政钉code") - private String buildUnitCode; - - @ApiModelProperty("主管单位") - private String superUnit; - - @ApiModelProperty("主管单位浙政钉code") - private String superUnitCode; - - @ApiModelProperty("可研报告文件") - private String researchReport; - - @ApiModelProperty("项目申报书") - private String projectApplyFile; - - @ApiModelProperty("项目总投资测算明细") - private String projectEstimateFile; - - @ApiModelProperty("申报单位主要职责") - private String unitThreePlan; - - @ApiModelProperty("其他附件") - private String otherFile; - - @ApiModelProperty("项目备注111") - private String projectRemark; - - @ApiModelProperty("是否有效 1有效 2无效 3撤回") - private Integer isEffective; - - @ApiModelProperty("是否包含应用 1包含") - private Integer includeApplication; - - @ApiModelProperty("app信息") - private List applicationInfo; - - @ApiModelProperty("条线单位 先写死") - private String lineManageUnit; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiData.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiData.java deleted file mode 100644 index 0e1fff7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiData.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * OssApiResponse - - *

- * - * @author ZPF - * @since 14:29 2022/9/29 - */ -@Data -@NoArgsConstructor -public class OssApiData implements Serializable { - - private String fileId; - - private String fileName; - - private String accessUrl; - - private Long fileSize; - - private String uploadUserCode; - - private String ossObject; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiResponse.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiResponse.java deleted file mode 100644 index 0507d73..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/OssApiResponse.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * OssApiResponse - - *

- * - * @author ZPF - * @since 14:29 2022/9/29 - */ -@Data -@NoArgsConstructor -public class OssApiResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static final int SUCCESS_CODE = 200; - - public static final String SUCCESS_MSG = "成功"; - - public static final int ERROR_CODE = 500; - - public static final String ERROR_MSG = "Internal server error"; - - /** - * 状态码 - */ - private Integer respCode; - - /** - * 返回描述 - */ - private String respMsg; - - /** - * 返回数据 - */ - private T data; - - /** - * 全参构造函数 - * - * @param respCode 状态码 - * @param respMsg 返回内容 - * @param data 返回数据 - */ - private OssApiResponse(Integer respCode, String respMsg, T data) { - this.respCode = respCode; - this.respMsg = respMsg; - this.data = data; - } - - /** - * 构造一个自定义的API返回 - * - * @param respCode 状态码 - * @param respMsg 返回内容 - * @param data 返回数据 - * @return ApiResponse - */ - public static OssApiResponse of(Integer respCode, String respMsg, T data) { - return new OssApiResponse(respCode, respMsg, data); - } - - /** - * 构造一个成功且不带数据的API返回 - * - * @return ApiResponse - */ - public static OssApiResponse ofSuccess() { - return ofSuccess(null); - } - - /** - * 构造一个成功且带数据的API返回 - * - * @param data 返回数据 - * @return ApiResponse - */ - public static OssApiResponse ofSuccess(T data) { - return ofStatus(Status.OK, data); - } - - /** - * 构造一个成功且自定义消息的API返回 - * - * @param msg 返回内容 - * @return ApiResponse - */ - public static OssApiResponse ofMessage(String msg) { - return of(Status.OK.getCode(), msg, null); - } - - /** - * 构造一个有状态的API返回 - * - * @param status 状态 {@link Status} - * @return ApiResponse - */ - public static OssApiResponse ofStatus(ApiStatus status) { - return ofStatus(status, null); - } - - /** - * 构造一个有状态且带数据的API返回 - * - * @param status 状态 {@link Status} - * @param data 返回数据 - * @return ApiResponse - */ - public static OssApiResponse ofStatus(ApiStatus status, T data) { - return of(status.getCode(), status.getReasonPhrase(), data); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java deleted file mode 100644 index 02cbc30..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProcessCommentRes.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @Classname ProcessCommentDTO - * @Description - * @Date 2023/3/2 15:25 - * @Author PoffyZhang - */ -@Data -@Builder -@ApiModel(value = "ProcessCommentRes", description = "省局返回流程审核详情") -@AllArgsConstructor -@NoArgsConstructor -public class ProcessCommentRes { - - @ApiModelProperty("任务id") - private String taskId; - - @ApiModelProperty("comment") - private String comment; - - @ApiModelProperty("流程步骤") - private String stepName; - - @ApiModelProperty("节点ID") - private String nodeId; - - @ApiModelProperty("审批状态") - private String status; - - @ApiModelProperty("审批人") - private String label; - - @ApiModelProperty("时间") - private String approverTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java deleted file mode 100644 index a505ec8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialApplicationRes.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -/** - * @Classname ProvincialApplicationDTO - * @Description - * @Date 2023/3/2 10:06 - * @Author PoffyZhang - */ -@Data -@Builder -@ApiModel(value = "ProvincialApplicationRes", description = "") -@NoArgsConstructor -@AllArgsConstructor -public class ProvincialApplicationRes implements Serializable { - - - //云 信息 - private List clouds; - //是否初次建设 1是 2不是 - private Integer isFirst; - //应用名称 - private String applicationName; - //关联 关联的IRS应用code - private String applicationCode; - //关联的IRS应用name - private String relatedExistsApplication; - //1: '办公类系统',2: '业务应用类系统',3: '门户网站',4: '宣传微博/微信公众号',5: '硬件类系统',6: '工具类系统',99: '其他' - private Integer applicationType; - //建设层级 1:国家 2:省级 3:市级 4:县(市、区) - private Integer buildLevel; - //是否统建 0:否 1:是 - private Integer isUniteBuild; - //统建类型 1:全省统建 2:全市统建 - private Integer unionBuildKind; - //应用简介 - private String applicationSummary; - //应用备注 - private String applicationRemark; - //应用总投资测算明细 - private String applicationEstimateFile; - //是否数改系统 0:否 1:是 - private Integer isFiveDomain; - //1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔 - private String fiveDomain; - //业务领域 - private String bizDomain; - //否涉及业务协同 0:否 1:是 - private Integer isBizCooperate; - //协同单位111111 - private String cooperativeUnit; - //用户范围 0: '机关事业单位人员','0-1': '跨部门跨系统','0-2': '系统内地方各级','0-3': '本部门本级','0-4': '处室内部','0-6': '主管处室内部','0-5': '其他',1: '企业', 2: '社会公众',3: '其他' 多个用英文,分隔 - private String userRange; - //是否使用政务云资源 1使用 - private Integer useGovCloud; - //是否符合国家信息技术应用创新相关规范 0:否 1:是 - private Integer nationalITSpec; - //网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机 - private String netEnv; - //等保级别 1:一级 2:二级 3:三级 4:四级 5:五级 - private Integer secrecyGrade; - //密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级 - private Integer passwordGrade; - //是否是S2 0:否 1:是 - private Integer isS2; - //一本账应用名称 - private String accountAppName; - //领域”大脑”一本帐名称 - private String brainAccountAppName; - //是否使用公共数据 - private Integer useCommonData; - //使用的公共数据名称 - private String dataName; - //使用公共组件的名称 - private String commonComponents; - //是否使用公共组件 - private Integer useCommonComponent; - //是否产生公共组件 - private Integer isProduceCommonComponent; - //产生的组件名称 - private String produceCommonComponent; - //发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' - private String publishSide; - - @Builder - @JsonIgnoreProperties(value = { "handler"}) - @NoArgsConstructor - @AllArgsConstructor - public static class Cloud implements Serializable { - //云资源台数 11 - private Integer cloudNums; - //云资源类型 云服务器(ECS) - private String cloudType; - //云资源规格 1核8G - private String cloudBasicSpec; - //云资源描述 - private String cloudUseDescription; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java deleted file mode 100644 index 62670a0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/ProvincialProjectRes.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** - * @Classname ProvincialProjectDTO - * @Description - * @Date 2023/3/2 10:06 - * @Author PoffyZhang - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "ProvincialProjectDTO", description = "") -public class ProvincialProjectRes implements Serializable { - - @ApiModelProperty("项目审核结果 1审核中 2审核通过 3审核不通过") - private Integer projectStatus; - - @ApiModelProperty("区域code") - private String regionCode; - - @ApiModelProperty("区域名称") - private String regionName; - - @ApiModelProperty("重大项目名称") - private String projectName; - - @ApiModelProperty("重大项目code 21位") - private String projectId; - - @ApiModelProperty("项目类型 1新建 2续建") - private Integer projectType; - - @ApiModelProperty("项目总投资(万元)") - private BigDecimal totalMoney; - - @ApiModelProperty("项目年度预算(万元)") - private BigDecimal yearBudget; - - @ApiModelProperty("自有资金,政府投资-本级财政资金,政府投资-上级补助资金") - private String budgetFrom; - - @ApiModelProperty("预算年度 2023") - private String year; - - @ApiModelProperty("财政code 32") - private String financialCode; - - @ApiModelProperty("发改code 23") - private String developCode; - - @ApiModelProperty("开始时间 比如2022-11-18") - private String beginTime; - - @ApiModelProperty("结束时间 比如2022-12-13") - private String endTime; - - @ApiModelProperty("立项依据1111") - private String buildBasis; - - @ApiModelProperty("立项依据材料 [{\"fileId\":\"\"}]") - private String buildBasisFile; - - @ApiModelProperty("项目概述") - private String projectSummary; - - @ApiModelProperty("负责人") - private String responsibleMan; - - @ApiModelProperty("联系人联系方式") - private String responsibleManPhone; - - @ApiModelProperty("联系人") - private String contactName; - - @ApiModelProperty("联系人联系方式") - private String contactPhone; - - @ApiModelProperty("建设单位 比如财政局") - private String buildUnit; - - @ApiModelProperty("建设单位浙政钉code") - private String buildUnitCode; - - @ApiModelProperty("主管单位") - private String superUnit; - - @ApiModelProperty("主管单位浙政钉code") - private String superUnitCode; - - @ApiModelProperty("可研报告文件") - private String researchReport; - - @ApiModelProperty("项目申报书") - private String projectApplyFile; - - @ApiModelProperty("项目总投资测算明细") - private String projectEstimateFile; - - @ApiModelProperty("申报单位主要职责") - private String unitThreePlan; - - @ApiModelProperty("其他附件") - private String otherFile; - - @ApiModelProperty("项目备注111") - private String projectRemark; - - @ApiModelProperty("是否有效 1有效 2无效 3撤回") - private Integer isEffective; - - @ApiModelProperty("是否包含应用 1包含") - private Integer includeApplication; - - @ApiModelProperty("app信息") - private List applicationInfo; - - @ApiModelProperty("审核信息") - private List processComment; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/SjApiResponse.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/SjApiResponse.java deleted file mode 100644 index 8aaac45..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/SjApiResponse.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.ningdatech.pmapi.provincial.model.res; - -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * ApiResponse - 省局统一的接口返回值封装 - *

- * - * @author ZPF - * @since 14:29 2022/9/29 - */ -@Data -@NoArgsConstructor -public class SjApiResponse implements Serializable { - private static final long serialVersionUID = 532384723325394156L; - - public static final int SUCCESS_CODE = 200; - - public static final String SUCCESS_MSG = "success"; - - public static final int ERROR_CODE = 500; - - public static final String ERROR_MSG = "Internal server error"; - - /** - * 状态码 - */ - private Integer code; - - /** - * 返回内容 - */ - private String msg; - - /** - * 返回数据 - */ - private T data; - - /** - * 全参构造函数 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 返回数据 - */ - private SjApiResponse(Integer code, String msg, T data) { - this.code = code; - this.msg = msg; - this.data = data; - } - - /** - * 构造一个自定义的API返回 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 返回数据 - * @return ApiResponse - */ - public static SjApiResponse of(Integer code, String msg, T data) { - return new SjApiResponse(code, msg, data); - } - - /** - * 构造一个成功且不带数据的API返回 - * - * @return ApiResponse - */ - public static SjApiResponse ofSuccess() { - return ofSuccess(null); - } - - /** - * 构造一个成功且带数据的API返回 - * - * @param data 返回数据 - * @return ApiResponse - */ - public static SjApiResponse ofSuccess(T data) { - return ofStatus(Status.OK, data); - } - - /** - * 构造一个成功且自定义消息的API返回 - * - * @param msg 返回内容 - * @return ApiResponse - */ - public static SjApiResponse ofMessage(String msg) { - return of(Status.OK.getCode(), msg, null); - } - - /** - * 构造一个有状态的API返回 - * - * @param status 状态 {@link Status} - * @return ApiResponse - */ - public static SjApiResponse ofStatus(ApiStatus status) { - return ofStatus(status, null); - } - - /** - * 构造一个有状态且带数据的API返回 - * - * @param status 状态 {@link Status} - * @param data 返回数据 - * @return ApiResponse - */ - public static SjApiResponse ofStatus(ApiStatus status, T data) { - return of(status.getCode(), status.getReasonPhrase(), data); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/IJoinReviewProvincialBureauService.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/IJoinReviewProvincialBureauService.java deleted file mode 100644 index 74f405b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/IJoinReviewProvincialBureauService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.provincial.service; - -import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO; -import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; -import com.ningdatech.pmapi.provincial.model.res.SjApiResponse; - -import java.security.NoSuchAlgorithmException; -import java.util.List; - -/** - * @Classname JointReviewProvincialBureauService - * @Description 省局联审接口 - * @Date 2023/3/2 9:29 - * @Author PoffyZhang - */ -public interface IJoinReviewProvincialBureauService { - - /** - * 推送/保存 重大接口到 省局联审 - * @return - */ - Boolean pushImportProject(ProvincialProjectDTO project); - - - /** - * 查看 本区域 省局联审 的项目审核详情 - * @return - */ - SjApiResponse processInfo(String projectId); - - /** - * 查询省级主管单位列表 - * @return - */ - List searchGovUnits(); -} 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 deleted file mode 100644 index 0fae067..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.ningdatech.pmapi.provincial.service.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.crypto.SecureUtil; -import cn.hutool.crypto.digest.MD5; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Maps; -import com.ningdatech.irs.contants.IrsContant; -import com.ningdatech.irs.service.IRefreshTokenService; -import com.ningdatech.pmapi.common.config.ProvincialProperties; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.util.HttpUtil; -import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO; -import com.ningdatech.pmapi.provincial.model.dto.ProvinceApiResponse; -import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; -import com.ningdatech.pmapi.provincial.model.res.SjApiResponse; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -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.MediaType; -import org.springframework.http.RequestEntity; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; -import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname JointReviewProvincialBureauService - * @Description 省局联审接口 - * @Date 2023/3/2 9:29 - * @Author PoffyZhang - */ -@Service -@Slf4j -public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvincialBureauService { - - @Autowired - private ProvincialProperties provincialProperties; - - @Autowired - private RestTemplate restTemplate; - - @Resource - private IRefreshTokenService refreshTokenService; - - @Value("${irs.interface-refresh.request-token-url}") - private String govRequestTokenUrl; - @Value("${irs.interface-refresh.refresh-token-url}") - private String govRefreshTokenUrl; - - @Value("${irs.province-gov.url}") - private String govUrl; - - @Value("${irs.province-gov.appSecret}") - private String govAppSecret; - - @Value("${irs.province-gov.appKey}") - private String govAppKey; - - @Value("${irs.province-gov.interfaceName}") - private String interfaceName; - - /** - * 推送/保存 重大接口到 省局联审 - * @return - */ - @Override - public Boolean pushImportProject(ProvincialProjectDTO project){ - Long timeStamp = System.currentTimeMillis()/1000; - String url = provincialProperties.getHost() + provincialProperties.getPushUrl() - + "?timestamp=" + timeStamp; - log.info("省局推送联审url {}",url); - ResponseEntity responseEntity = null; - - String signature = getSha256(timeStamp,provincialProperties.getPushUrl(), - HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); - - //发送post请求 - RequestEntity requestEntity = RequestEntity - .post(url) - .header("Accept", MediaType.APPLICATION_JSON.toString()) - .header("X-Hmac-Auth-Key",provincialProperties.getKey()) - .header("X-Hmac-Auth-Signature",signature) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON) - .body(project); - - log.info("省局联审 提交 :{}", requestEntity); - log.info("省局联审 提交body :{}", JSON.toJSONString(requestEntity.getBody())); - try { - responseEntity = restTemplate.exchange(requestEntity, ProvinceApiResponse.class); - log.info("省局联审 响应 :{}",responseEntity); - if(responseEntity.getBody().getCode().equals(200)){ - return Boolean.TRUE; - } - } catch (Exception e) { - log.error("[省局联审] http request error", e); - } - - return Boolean.FALSE; - } - - /** - * 获取流程审批详情 - * @param projectId - * @return - */ - @Override - public SjApiResponse processInfo(String projectId) { - Long timeStamp = System.currentTimeMillis()/1000; - String url = provincialProperties.getHost() + provincialProperties.getDetailUrl() - + "?timestamp=" + timeStamp; - - log.info("省局获取审核详情 url {}",url); - ResponseEntity responseEntity = null; - - String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), - HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); - - JSONObject jsonBaby = new JSONObject(); - jsonBaby.put("projectId",projectId); - log.info("请求体 :{}",jsonBaby); - //发送post请求 - RequestEntity requestEntity = RequestEntity - .post(url) - .header("Accept", MediaType.APPLICATION_JSON.toString()) - .header("X-Hmac-Auth-Key",provincialProperties.getKey()) - .header("X-Hmac-Auth-Signature",signature) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON) - .body(jsonBaby); //也可以是DTO - - try { - responseEntity = restTemplate.exchange(requestEntity,SjApiResponse.class); - log.info("获取审批详情 响应 :{}",responseEntity); - } catch (Exception e) { - log.error("[省局获取审核详情] http request error", e); - } - - return responseEntity.getBody(); - } - - @Override - public List searchGovUnits() { - Long timeStamp = System.currentTimeMillis(); - Long timeSeconds = System.currentTimeMillis()/1000; - String appSecret = govAppSecret; - String appKey = govAppKey; - String method = HttpMethod.POST.name(); - String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); - String sign = MD5.create().digestHex(appKey + secret + timeStamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if(Objects.nonNull(factory)){ - restTemplate = new RestTemplate(factory); - }else{ - restTemplate = new RestTemplate(); - } - - String authSignature = getSha256(timeSeconds,provincialProperties.getDomainUrl(), HttpMethod.POST.name(), - provincialProperties.getKey(),provincialProperties.getSecret()); - String url = govUrl + "?appKey=" + appKey + - "×tamp=" + timeSeconds + "&sign=" + sign + - "&authKey=" + provincialProperties.getKey() + "&authSignature=" + authSignature + - "&requestTime=" + timeStamp; - log.info("gov search url :{}",url); - ResponseEntity forEntity = restTemplate.postForEntity(url,null, JSONObject.class, Maps.newHashMap()); - JSONObject body = forEntity.getBody(); - log.info("seach response :{}",body); - if(Objects.isNull(body)){ - return Collections.emptyList(); - } - String code = body.getString(IrsContant.RefreshToken.RESPONSE_KEY_CODE); - if(IrsContant.RefreshToken.SUCESS_CODE.equals(code)){ - JSONObject datas = body.getJSONObject(IrsContant.RefreshToken.RESPONSE_KEY_DATAS); - - if(Objects.isNull(datas)){ - return Collections.emptyList(); - } - JSONArray jsonArray = datas.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isEmpty(jsonArray)){ - return Collections.emptyList(); - } - return jsonArray.stream().map(j -> { - JSONObject json = JSON.parseObject(JSON.toJSONString(j)); - ProvincialGovBusinessStripVO vo = new ProvincialGovBusinessStripVO(); - vo.setBusinessStripCode(json.getString(BizConst.ORG_CODE)); - vo.setBusinessStripName(json.getString(BizConst.ORG_NAME)); - return vo; - }).collect(Collectors.toList()); - } - - return Collections.emptyList(); - } - - private static String getSha256(Long timeStamp,String url,String method,String key,String secret){ - String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key; - log.info("加密message :{}",bytesToSign); - String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); - log.info("加密结果 :{}",res); - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/utils/FileUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/utils/FileUtil.java deleted file mode 100644 index 2cdc99b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/utils/FileUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.provincial.utils; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; - -/** - * @Classname FileUtil - * @Description - * @Date 2023/9/6 9:09 - * @Author PoffyZhang - */ -public class FileUtil { - public static byte[] getBytesByFile(File file) { - try { - FileInputStream fis = new FileInputStream(file); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); - byte[] b = new byte[1000]; - int n; - while ((n = fis.read(b)) != -1) { - bos.write(b, 0, n); - } - fis.close(); - byte[] data = bos.toByteArray(); - bos.close(); - return data; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} 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 deleted file mode 100644 index aa4708c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java +++ /dev/null @@ -1,65 +0,0 @@ -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 deleted file mode 100644 index d1cf1da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java +++ /dev/null @@ -1,243 +0,0 @@ -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.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -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.*; -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; - - private final IProjectApplicationService applicationService; - - /** - * 列表 - * @param req - * @return - */ - public PageVo personMonitorList(ProjectListReq req) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .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())); - } - - List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion, project.getVersion())); - - EqualProtectionVO equalProtectionVO = new EqualProtectionVO(); - - if(CollUtil.isNotEmpty(apps)){ - Integer maxPassWordGrade = 0; - Integer maxSecerecyGrade = 0; - for(ProjectApplication app : apps) { - maxPassWordGrade = Math.max(maxPassWordGrade,app.getPasswordGrade()); - maxSecerecyGrade = Math.max(maxSecerecyGrade,app.getSecrecyGrade()); - } - - equalProtectionVO.setPasswordGrade(maxPassWordGrade); - equalProtectionVO.setSecrecyGrade(maxSecerecyGrade); - } - - vo.setEqualProtection(equalProtectionVO); - - 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 BizConst.SAVE_SUCCESS + 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 BizConst.SAVE_SUCCESS + 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 deleted file mode 100644 index 3316418..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 39e897b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 9f75e7b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java +++ /dev/null @@ -1,45 +0,0 @@ -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; - - @ApiModelProperty("联系方式") - private String contactInfo; - - 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 deleted file mode 100644 index 783edd8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java +++ /dev/null @@ -1,45 +0,0 @@ -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; - - @ApiModelProperty("供应商名称") - private String supplierName; - - @ApiModelProperty("厂商人员名称") - private String username; - - @ApiModelProperty("联系方式") - private String contactInfo; -} 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 deleted file mode 100644 index c2679a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -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; - - @ApiModelProperty("联系方式") - private String contactInfo; - - 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 deleted file mode 100644 index 9593c4b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java +++ /dev/null @@ -1,54 +0,0 @@ -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; - - @ApiModelProperty("供应商名称") - private String supplierName; - - @ApiModelProperty("厂商人员名称") - private String username; - - @ApiModelProperty("联系方式") - private String contactInfo; - - 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/EqualProtectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/EqualProtectionVO.java deleted file mode 100644 index c3be328..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/EqualProtectionVO.java +++ /dev/null @@ -1,29 +0,0 @@ -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 = "等保详情", description = "等保详情") -public class EqualProtectionVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; -} 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 deleted file mode 100644 index 5203112..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java +++ /dev/null @@ -1,46 +0,0 @@ -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; - - @ApiModelProperty("联系方式") - private String contactInfo; - - 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 deleted file mode 100644 index 12419e3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java +++ /dev/null @@ -1,78 +0,0 @@ -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 deleted file mode 100644 index 241f070..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java +++ /dev/null @@ -1,26 +0,0 @@ -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; - - @ApiModelProperty("等保详情") - private EqualProtectionVO equalProtection; -} 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 deleted file mode 100644 index 796c900..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java +++ /dev/null @@ -1,52 +0,0 @@ -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; - - @ApiModelProperty("供应商名称") - private String supplierName; - - @ApiModelProperty("厂商人员名称") - private String username; - - @ApiModelProperty("联系方式") - private String contactInfo; - - 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 deleted file mode 100644 index 885cf5d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index d68cca7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index c0bca50..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index dc3af89..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -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/contants/TaskContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java deleted file mode 100644 index 2316121..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.scheduler.contants; - -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; - -/** - * @author PoffyZhang - * @Classname TaskContant - * @Description - * @Date 2023/1/18 11:00 - */ -public interface TaskContant { - - class Host { - public static final String HOST_ZPF = "LAPTOP-NQGEQP03"; - public static final String HOST_CMM2 = "DESKTOP-KN1L6HL"; - public static final String HOST_CMM = "LAPTOP-PCISPN2O"; - - public static final String HOST_207 = "iZbp13nwyvib53j4j1p2xoZ"; - } - - class Wflow { - public static final String DEFAULT_FORM_NAME = "丽水申报项目表单"; - - public static final String[] DEFAULT_PROCESS_LIST = {"单位内部审批流程","项目预审审批流程","部门联合审批流程","建设方案审批流程","验收申报审批流程"}; - - public static final Integer[] DEFAULT_PROCESS_TYPE_LIST = { - ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.APPLY_DELAY.getCode(), - ProjectProcessStageEnum.APPLY_BORROW.getCode() - }; - - public static final Integer[] APPLY_PROCESS_TYPE_LIST = { - ProjectProcessStageEnum.APPLY_DELAY.getCode(), - ProjectProcessStageEnum.APPLY_BORROW.getCode() - }; - } - - class ProvinceReview{ - public static final String END_NODE_ID = "结束"; - - public static final String END_STEP = "流程结束"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/CcTaskListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/CcTaskListener.java deleted file mode 100644 index 43f9eed..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/CcTaskListener.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ningdatech.pmapi.scheduler.listener; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -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.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.wflow.bean.entity.WflowCcTasks; -import com.wflow.service.WflowCcTasksService; -import com.wflow.workflow.notify.event.CcTaskEvent; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.flowable.engine.HistoryService; -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.Duration; -import java.util.List; -import java.util.Objects; -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.CC_MSG_TEMPLATE; - -/** - * 抄送事件 事件监听 - * - * @author ZPF - * @return - * @since 2023/04/14 14:19 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class CcTaskListener { - private final IProjectInstService projectInstService; - - private final HistoryService historyService; - private final IProjectService projectService; - private final NoticeManage noticeManage; - - private final WflowCcTasksService ccTasksService; - - private final CachePlusOps cachePlusOps; - - private final UserInfoHelper userInfoHelper; - - private static final String DUP_KEY = "ccTasks"; - private static final String NODE = "node:"; - - @Async - @EventListener - public void onApplicationEvent(CcTaskEvent event) throws InterruptedException { - log.info("进入抄送人任务 事件监听!{}", JSON.toJSONString(event)); - String instCode = event.getInstCode(); - String processDefinitionId = event.getProcessDefinitionId(); - String nodeId = event.getNodeId(); - String taskId = event.getTaskId(); - - //这里 redis 处理一下 1分钟处理同一 nodeId 一次 - if (cachePlusOps.get(NODE + nodeId + DUP_KEY) != null) { - log.info("一分钟只能处理该nodeId一次!{}", nodeId); - return; - } - - //1分钟 - CacheKey key = new CacheKey(); - key.setKey(NODE + nodeId + DUP_KEY); - key.setExpire(Duration.ofMinutes(1)); - cachePlusOps.set(key, nodeId); - - //睡3秒 让数据库 生成抄送数据先 - Thread.sleep(3000); - - log.info("instCode :{},nodeId :{}",instCode, nodeId); - //1.去查找 项目实例关系表 - List tasks = ccTasksService.list(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getInstanceId, instCode) - .eq(WflowCcTasks::getNodeId, nodeId)); - - if (Objects.isNull(tasks)) { - return; - } - - log.info("tasks :{}",tasks.size()); - - //有可能 一个节点 有多个用户抄送 - tasks.stream().forEach(task -> { - log.info("cc tasks :{}",JSON.toJSONString(tasks)); - - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instCode) - .singleResult(); - - log.info("instance :{}",JSON.toJSONString(instance)); - - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode) - .last(BizConst.LIMIT_1)); - - log.info("projectInst :{}",JSON.toJSONString(projectInst)); - - if(Objects.isNull(projectInst) || Objects.isNull(instance)){ - return; - } - Long projectId = projectInst.getProjectId(); - Project project = projectService.getNewProject(projectId); - - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(task.getUserId()); - - //发送消息 - noticeManage.sendNotice(task.getUserId(),Objects.nonNull(user)? user.getUserId() : 93L,project,instance.getProcessDefinitionName(), - CC_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_CC); - }); - } -} \ No newline at end of file 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 deleted file mode 100644 index 1e3bde8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java +++ /dev/null @@ -1,132 +0,0 @@ -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.basic.util.StrPool; -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.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; -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; -import java.util.stream.Collectors; - -/** - * 预警规则触发 - * - * @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; - - private final IProjectEarlyWarningService projectEarlyWarningService; - - @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(); - Integer noticeType = event.getNoticeType(); - Integer overTimeout = event.getOverTimeout(); - - //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; - } - - //项目 预警信息 - projectEarlyWarningService.earlyWarning(project, - WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType); - - if(StringUtils.isBlank(noticeMethod) || - (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ - log.info("通知方式为空或者错误!"); - return; - } - - //这一批员工要通知的员工号 - String batchEmployees = hais.stream().map(HistoricActivityInstance::getAssignee) - .collect(Collectors.joining(StrPool.COMMA)); - for(HistoricActivityInstance hai : hais){ - String employeeCode = hai.getAssignee(); - String taskId = hai.getTaskId(); - String path = "toDoCenter/handleDuringExamine?instanceId=" + - instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; - earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,overTimeout, pi.getInstType(), - hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() - ,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, - path,batchEmployees,nodeId); - } - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java deleted file mode 100644 index 7f2c8b1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.ningdatech.pmapi.scheduler.listener; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -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.provincial.service.IJoinReviewProvincialBureauService; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.todocenter.manage.HandlerManage; -import com.wflow.contants.HisProInsEndActId; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.notify.event.ProcessEndEvent; -import com.wflow.workflow.service.ProcessInstanceService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.flowable.engine.HistoryService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.task.api.Task; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE2; - -/** - * 工作流开始 结束监听 自动审批的话 会漏掉 调用状态机 - * - * @author ZPF - * @return - * @since 2023/04/14 14:19 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ProcessEndListener { - private final TaskService taskService; - private final HistoryService historyService; - private final IProjectInstService projectInstService; - - private final IProjectService projectService; - - private final ProcessInstanceService processInstanceService; - - private final HandlerManage handlerManage; - - private final IProjectStagingService projectStagingService; - - private final NoticeManage noticeManage; - - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - private final IProjectApplicationService projectApplicationService; - - private final FileService fileService; - - @Value("${spring.profiles.active}") - private String active; - - @Async - @EventListener - public void onApplicationEvent(ProcessEndEvent event) { - log.info("进入工作流结束的 事件监听!{}", event.getInstCode()); - String instCode = event.getInstCode(); - - log.info("instCode:{}", instCode); - - //休息3秒 - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - - //1.去查找 项目实例关系表 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(projectInst)) { - return; - } - - List tasks = taskService.createTaskQuery() - .processInstanceId(instCode) - .active() - .list(); - - List historyTasks = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(instCode) - .unfinished() - .list(); - - //已经没有任务了 - if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { - List historyTasksFinished = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(instCode) - .finished() - .list(); - - Long projectId = projectInst.getProjectId(); - Project project = projectService.getNewProject(projectId); - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instCode).singleResult(); - //通过审核后 所处理的逻辑 - afterPassTodo(project,instance); - } - } - - /** - * 审核通过后 所处理的逻辑 - * @param declaredProject - * @param instance - */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ - Long userId = 110L; - // 获取流程通过后的流程实例 - HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instance.getId()) - .singleResult(); - // 获取当前流程实例类型 - String instanceId = newInstance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .last(BizConst.LIMIT_1)); - Integer instType = projectInst.getInstType(); - InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); - if (Objects.isNull(instTypeEnum)){ - throw new BizException("当前审批流类型不存在,流程类型code:" + instType); - } - - // 获取流程通过后当前流程详情 - ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); - // 获取流程通过后当前审核人信息,向其发送工作通知 - // 会签/或签会有多个审核人 - List currentEmployeeCodeList = Lists.newArrayList(); - List newProgressInfo = newInstanceDetail.getProgressInfo(); - ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); - - // 说明当前节点是子流程节点 - if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { - List children = currentNode.getChildren(); - // 获取子流程当前审核人节点 - ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); - // 获取节点ID相同地审核节点 - List nodeList = children.stream() - .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); - } else { - List nodeList = newProgressInfo.stream() - .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); - } - - // 流程通过后,判断当前登录用户是不是最后一个审核人 - // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 - // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { - // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ - switch (instTypeEnum) { - case APPLY_DELAY: - // 保存延期申请记录,更新项目建设周期和计划验收时间 - handlerManage.updateProjectDelayApplyInfo(declaredProject,instanceId); - break; - case APPLY_BORROW: - // 更新申请借阅状态为成功 - handlerManage.updateProjectApplyBorrowInfo(declaredProject,instanceId); - break; - default: - throw new BizException("传入实例类型错误: " + instTypeEnum); - } - }else { - switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { - // 当前项目状态是预审中 - case PRE_APPLYING: - //先修改项目状态 - handlerManage.updatePassProjectStatus(userId, declaredProject); - //然后入库暂存库 - projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); - break; - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - //如果是 区县 并且 500万及以上要推送省局重大项目 - if (!StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, - ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { - try { - List applications = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, declaredProject.getId())); - joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); - handlerManage.updatePassProjectStatus(userId, declaredProject); - break; - } catch (Exception e) { - log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); - log.error("区县推送省级联审失败:" + e); - } - } - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - handlerManage.updatePassProjectStatus(userId, declaredProject); - break; - default: - throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); - } - } - //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); - } else { - // 若有下一个审核人(当前节点的用户),会签/或签会有多个 - // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 - // 获取发送浙政钉工作通知必要信息 - for (String currentEmployeeCode : currentEmployeeCodeList) { - if (Objects.isNull(currentEmployeeCode)) { - throw new BizException("审核人信息不存在!"); - } - //发送消息 - noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); - } - } - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessStartListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessStartListener.java deleted file mode 100644 index dc72110..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessStartListener.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ningdatech.pmapi.scheduler.listener; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -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.wflow.workflow.notify.event.ProcessStartEvent; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.flowable.engine.HistoryService; -import org.flowable.engine.TaskService; -import org.flowable.task.api.Task; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * 工作流开始 事件监听 - * - * @author ZPF - * @return - * @since 2023/04/14 14:19 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ProcessStartListener { - private final TaskService taskService; - private final HistoryService historyService; - private final IProjectInstService projectInstService; - - private final IProjectService projectService; - - private final StateMachineUtils stateMachineUtils; - - @Async - @EventListener - public void onApplicationEvent(ProcessStartEvent event) { - log.info("进入工作流开始 事件监听!{}", event.getInstCode()); - String instCode = event.getInstCode(); - - log.info("instCode:{}", instCode); - - //休息3秒 - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - - //1.去查找 项目实例关系表 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(projectInst)) { - return; - } - - List tasks = taskService.createTaskQuery() - .processInstanceId(instCode) - .active() - .list(); - - List historyTasks = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(instCode) - .finished() - .list(); - - //如果 是没有审批任务的话 就需要 去调用状态机 进入下一个阶段 - if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { - //如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机 - Long projectId = projectInst.getProjectId(); - Project project = projectService.getNewProject(projectId); - stateMachineUtils.pass(project); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); - } - } -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java deleted file mode 100644 index 84e5941..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.date.StopWatch; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -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.util.List; - -/** - * @author liuxinxin - * @date 2023/1/12 上午9:53 - * 批量获取/更新部门信息任务 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class BatchUpdateEmployeeTask { - - @Value("${hostname}") - private String HOST_NAME; - - private final EmployeeBatchGetTask employeeBatchGetTask; - private final IDingOrganizationService organizationService; - - @Scheduled(cron = "0 45 1 * * ?") - public void doTask() throws UnknownHostException { - if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - return; - } - - log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务开始"); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - // 1.查出浙政钉 所有单位 - List units = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList( - DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY - ))); - - log.info("需要更新的 单位数量为 {}",units.size()); - - for(DingOrganization organization : units){ - log.info("当前单位是 {}",organization.getOrganizationName()); - employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode()); - } - - stopWatch.stop(); - log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务结束 {}s", stopWatch.getTotalTimeSeconds()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java deleted file mode 100644 index c0de25c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import org.springframework.stereotype.Component; - -/** - * @author liuxinxin - * @date 2023/1/12 上午9:53 - * 批量获取/更新部门信息任务 - */ -@Component -public class BatchUpdateOrganizationTask { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java deleted file mode 100644 index fc5f788..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.http.HttpStatus; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.provincial.model.res.ProcessCommentRes; -import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes; -import com.ningdatech.pmapi.provincial.model.res.SjApiResponse; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -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.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * @Classname CheckProvincialReviewResultTask - * @Description 去获取省级联审结果任务 - * @Date 2023/3/16 10:12 - * @Author PoffyZhang - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class CheckProvincialReviewResultTask { - - private final IJoinReviewProvincialBureauService reviewProvincialBureauService; - - private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; - - @Value("${hostname}") - private String HOST_NAME; - - @Value("${spring.profiles.active}") - private String active; - - @Scheduled(cron = "0 */1 * * * ?") - public void statusFlow() throws UnknownHostException { - if(BizConst.DEV.equals(active)){ - log.info("测试环境 省局 接口 暂时关闭"); - return; - } - // - if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - //1. 定时取 省级部门联审中的项目 去取项目 - List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) - .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) - .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) - .eq(Project::getAreaCode, RegionConst.RC_LS) - .eq(Project::getNewest,Boolean.TRUE) - .orderByAsc(Project::getCreateOn)); - - log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); - if(CollUtil.isEmpty(projectList)){ - log.info("没有正在省级联审中的项目!"); - return; - } - - //遍历 - for(Project project: projectList){ - try{ - SjApiResponse apiResponse = reviewProvincialBureauService.processInfo(project.getProjectCode()); - log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse); - if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){ - log.info("项目 【{}】 去获取省局联审结果失败",project.getId()); - continue; - } - ProvincialProjectRes projectRes = JSON.parseObject(JSON.toJSONString(apiResponse.getData()), - ProvincialProjectRes.class); - - if(CollUtil.isNotEmpty(projectRes.getProcessComment())){ - List processComments = projectRes.getProcessComment(); - log.info("此项目 【{}】 返回了审批信息",projectRes.getProjectId()); - //取到最后一个审批元素 - ProcessCommentRes lastProcessComment = processComments.get(processComments.size() - 1); - //最后一个 节点 nodeId 是结束 说明已经批完 - if(StringUtils.isNotBlank(lastProcessComment.getStepName()) && - TaskContant.ProvinceReview.END_STEP.equals(lastProcessComment.getStepName())){ - //在省级联审 才调状态机 否则 只改变 联审结果 - if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals( - project.getStatus())){ - stateMachineUtils.pass(project); - } - log.info("已经审批完成 进入下一状态"); - } - project.setUpdateOn(LocalDateTime.now()); - //保存审核结果 - project.setSjlsResult(CollUtil.isNotEmpty(projectRes.getProcessComment()) - ? JSON.toJSONString(projectRes.getProcessComment()) : StringUtils.EMPTY); - projectService.updateById(project); - }else{ - log.info("此项目 【{}】 还没有审批信息",projectRes.getProjectId()); - } - }catch (Exception e){ - log.error("项目审核信息获取异常 projectId:【" + project.getId() + "】 异常内容:" + e.getMessage()); - } - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java deleted file mode 100644 index 478695e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java +++ /dev/null @@ -1,975 +0,0 @@ -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.google.common.collect.Lists; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; -import com.ningdatech.pmapi.dashboard.model.po.SecrecyPasswordGradePO; -import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.gov.enumeration.GovProjectStatusEnum; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import com.ningdatech.pmapi.meta.service.IMetaTagService; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; -import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; -import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; -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.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import java.math.BigDecimal; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author ZPF - * @Class CockpitStatsStatisticsTask - * 驾驶舱 统计 每日任务 - * @since 2023/08/31 18:16 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class CockpitStatsStatisticsTask { - - @Value("${hostname}") - public String HOST; - - @Value("${spring.profiles.active}") - public String active; - - @Autowired - private ICockpitStatsService cockpitStatsService; - - @Autowired - private RegionCacheHelper regionCacheHelper; - - @Autowired - private IProjectService projectService; - - @Autowired - private IProjectInstService projectInstService; - - @Autowired - private IExpertUserFullInfoService expertUserFullInfoService; - - @Autowired - private IPerformanceAppraisalProjectService performanceAppraisalProjectService; - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovBizProjectApplyService applyService; - - @Autowired - private HistoryService historyService; - - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IEarlyWarningRecordsService earlyWarningRecordsService; - - @Autowired - private IExpertIntentionWorkRegionService expertIntentionWorkRegionService; - - private List years = Lists.newArrayList(2021,2022,2023,2024,2025); - - private final IMetaTagService metaTagService; - - private final IExpertTagService expertTagService; - - /** - * 定义统计 驾驶舱数据 每天3点开始执行一次 - * - */ - @Scheduled(cron = "0 0 3 * * ?") - public void doTask() throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - return; - } - if(BizConst.PRE.equals(active)){ - log.info("预发环境不用同步!"); - return; - } - - log.info("驾驶舱数据统计任务开始====="); - - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - List res = Lists.newArrayList(); - //1.根据2个维度来统计 区域和分年 - //1.总的 - res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, - DashboardConstant.CockpitStats.TOTAL,DashboardConstant.CockpitStats.NONE_YEAR)); - for(Integer year : years){ - res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, - DashboardConstant.CockpitStats.TOTAL,year)); - } - - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); - for(RegionDTO regionDto : regions){ - res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), - DashboardConstant.CockpitStats.NONE_YEAR)); - for(Integer year : years){ - res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),year)); - } - } - - //如果结果不为空 就删除之前的 插入最新的数据 - if(CollUtil.isNotEmpty(res)){ - //计算增长率 - computeRates(res); - List list = cockpitStatsService.list(); - List ids = list.stream().map(CockpitStats::getId).collect(Collectors.toList()); - cockpitStatsService.removeByIds(ids); - cockpitStatsService.saveBatch(res); - } - - stopWatch.stop(); - log.info("驾驶舱数据统计任务结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - private void computeRates(List res) { - Map map = res.stream().collect(Collectors.toMap(r -> r.getRegionCode() + r.getYear(), r -> r)); - for(CockpitStats cockpitStats : res){ - if(Objects.isNull(cockpitStats.getYear())){ - continue; - } - //算增长率 - //去年的数据 用于算 增长比例 - if(cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)){ - Integer thisYear = LocalDateTime.now().getYear(); - CockpitStats thisYearData = map.get(cockpitStats.getRegionCode() + thisYear); - CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (thisYear - 1)); - buidMonitorRise(cockpitStats,thisYearData,lastYearData); - }else{ - CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (cockpitStats.getYear() - 1)); - buidMonitorRise(cockpitStats,cockpitStats,lastYearData); - } - } - - } - - /** - * 统计的具体逻辑 - * @param regionCode - * @param regionName - * @param year - * @return - */ - private CockpitStats statisticsData(String regionCode, String regionName, Integer year) { - CockpitStats cockpitStats = new CockpitStats(); - cockpitStats.setRegionCode(regionCode); - cockpitStats.setRegionName(regionName); - cockpitStats.setYear(year); - - //申报项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - Project::getAreaCode, regionCode) - .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - Project::getProjectYear, year) - .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - Project::getProjectYear, years)); - - //项目归集 - List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - GovBizProjectApply::getBaseProjSetYear, year) - .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - GovBizProjectApply::getBaseProjSetYear, years)); - List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - - List baseInfos = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearProjIds)){ - baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE) - .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); - } - - List approves = Lists.newArrayList(); - List applies = Lists.newArrayList(); - List procures = Lists.newArrayList(); - List cimplements = Lists.newArrayList(); - if(CollUtil.isNotEmpty(baseInfos)){ - List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId, baseProjIds)); - - applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId, baseProjIds)); - - procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId, baseProjIds)); - - cimplements = cimplementService.list(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .in(GovBizProjectCimplement::getBaseProjId, baseProjIds)); - } - - //1.项目监测 - //1.1 超期在建项目 - Integer overdueConstructionProjectsNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getPlanAcceptanceTime()) && - p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0 && - Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setMonitorOverdueConstructionProjectsNum(overdueConstructionProjectsNum); - //1.2 环节滞后项目 - cockpitStats.setMonitorLaggingProjectsNum(computeLagging(projects)); - - //1.3预审驳回项目 - Integer preFailed = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setMonitorRejectedPreReviewProjectsNum(preFailed); - - //1.4 建设方案评审失败 - Integer constructionFailed = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setMonitorRejectedApproveProjectsNum(constructionFailed); - //1.5 验收不达标 - cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0); - - //1.6 总申报金额 - Double totalDeclaredAmount = projects.stream().mapToDouble(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount().doubleValue() : 0.0).sum(); - cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount)); - //1.7 总安全投入 - Double totalSafytyAmount = projects.stream().mapToDouble(p -> { - if(Objects.nonNull(p.getSafetyInputDescribe())){ - final Double[] total = {0.0}; - try{ - JSONArray array = JSON.parseArray(p.getSafetyInputDescribe()); - array.forEach(j -> { - JSONObject json = JSON.parseObject(JSON.toJSONString(j)); - Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); - total[0] += safetyInputAmount; - }); - }catch (Exception e){ - - } - return total[0]; - } - return 0.0; - }).sum(); - cockpitStats.setMonitorSafetyInputAmount(BigDecimal.valueOf(totalSafytyAmount)); - - //1.8等保密评 - SecrecyPasswordGradePO secrecyPasswordGradePo = cockpitStatsService.getSecrecyPasswordGrade(regionCode, year); - - Integer guijiSecerecyGrade1 = 0; - Integer guijiSecerecyGrade2 = 0; - Integer guijiSecerecyGrade3 = 0; - Integer guijiSecerecyGrade4 = 0; - Integer guijiSecerecyGrade5 = 0; - //项目归集 评审信息 - for (GovBizProjectApprove approve : approves){ - String equalProtectionLevel = approve.getEqualProtectionLevel(); - if(StringUtils.isNotBlank(equalProtectionLevel)){ - switch (equalProtectionLevel){ - case "01": - guijiSecerecyGrade1++; - break; - case "02": - guijiSecerecyGrade2++; - break; - case "03": - guijiSecerecyGrade3++; - break; - case "04": - guijiSecerecyGrade4++; - break; - case "05": - guijiSecerecyGrade5++; - break; - default: - break; - } - } - } - - Integer passwordGradeNumGov = 0; - for (GovBizProjectCimplement cimplement : cimplements){ - if(StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ - passwordGradeNumGov ++; - } - } - - if(Objects.nonNull(secrecyPasswordGradePo)){ - cockpitStats.setMonitorSecrecyGrade1Num(secrecyPasswordGradePo.getMonitorSecrecyGrade1Num() + guijiSecerecyGrade1); - cockpitStats.setMonitorSecrecyGrade2Num(secrecyPasswordGradePo.getMonitorSecrecyGrade2Num() + guijiSecerecyGrade2); - cockpitStats.setMonitorSecrecyGrade3Num(secrecyPasswordGradePo.getMonitorSecrecyGrade3Num() + guijiSecerecyGrade3); - cockpitStats.setMonitorSecrecyGrade4Num(secrecyPasswordGradePo.getMonitorSecrecyGrade4Num() + guijiSecerecyGrade4); - cockpitStats.setMonitorSecrecyGrade5Num(secrecyPasswordGradePo.getMonitorSecrecyGrade5Num() + guijiSecerecyGrade5); - cockpitStats.setMonitorPasswordGrade1Num(secrecyPasswordGradePo.getMonitorPasswordGrade1Num() + passwordGradeNumGov); - cockpitStats.setMonitorPasswordGrade2Num(secrecyPasswordGradePo.getMonitorPasswordGrade2Num()); - cockpitStats.setMonitorPasswordGrade3Num(secrecyPasswordGradePo.getMonitorPasswordGrade3Num()); - cockpitStats.setMonitorPasswordGrade4Num(secrecyPasswordGradePo.getMonitorPasswordGrade4Num()); - cockpitStats.setMonitorPasswordGrade5Num(secrecyPasswordGradePo.getMonitorPasswordGrade5Num()); - }else{ - cockpitStats.setMonitorSecrecyGrade1Num(guijiSecerecyGrade1); - cockpitStats.setMonitorSecrecyGrade2Num(guijiSecerecyGrade2); - cockpitStats.setMonitorSecrecyGrade3Num(guijiSecerecyGrade3); - cockpitStats.setMonitorSecrecyGrade4Num(guijiSecerecyGrade4); - cockpitStats.setMonitorSecrecyGrade5Num(guijiSecerecyGrade5); - cockpitStats.setMonitorPasswordGrade1Num(passwordGradeNumGov); - } - - //2.专家统计 - List lsRegionCodes = RegionConst.LS_ARR; - List intentions = expertIntentionWorkRegionService.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) - .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - ExpertIntentionWorkRegion::getRegionCode, regionCode) - .in(StringUtils.isBlank(regionCode) || DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - ExpertIntentionWorkRegion::getRegionCode, lsRegionCodes)); - - List experts = Lists.newArrayList(); - if(CollUtil.isNotEmpty(intentions)){ - List userIds = intentions.stream().map(ExpertIntentionWorkRegion::getUserId) - .collect(Collectors.toList()); - experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .in(ExpertUserFullInfo::getUserId, userIds) - .eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); - } - - List goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); - Map> tagMap = goodAt.stream() - .collect(Collectors.groupingBy(ExpertTag::getUserId)); - - String networkCode = DashboardConstant.Expert.NETWORK_CODE; - String xinchuangCode = DashboardConstant.Expert.XINCHUANG_CODE; - String fanganCode = DashboardConstant.Expert.FANGAN_CODE; - String jishuCode = DashboardConstant.Expert.JISHU_CODE; - String dangzhengCode = DashboardConstant.Expert.DANGZHENG_CODE; - String ruanyingCode = DashboardConstant.Expert.RUANYING_CODE; - String caiwuCode = DashboardConstant.Expert.CAIWU_CODE; - List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, - dangzhengCode,ruanyingCode,caiwuCode); - - cockpitStats.setExpertTotalNum(experts.size()); - Integer financialNum = 0; - Integer networkSecurityNum = 0; - Integer xinchuangNum = 0; - Integer planRationalityNum = 0; - Integer promotionInfoTechnologyNum = 0; - Integer partyGovInfoNum = 0; - Integer softHardPricingNum = 0; - Integer technicalFeasibilityAssessmentNum = 0; - Integer specialExpertNum = 0; - for(ExpertUserFullInfo e : experts){ - if(tagMap.containsKey(e.getUserId())){ - List expertTags = tagMap.get(e.getUserId()); - Boolean isContain = Boolean.FALSE; - for(ExpertTag expertTag : expertTags){ - if(expertTag.getTagCode().equals(networkCode)){ - networkSecurityNum++; - } - if(expertTag.getTagCode().equals(caiwuCode)){ - financialNum ++; - } - if(expertTag.getTagCode().equals(xinchuangCode)){ - xinchuangNum ++; - } - if(expertTag.getTagCode().equals(fanganCode)){ - planRationalityNum++; - } - if(expertTag.getTagCode().equals(jishuCode)){ - technicalFeasibilityAssessmentNum ++; - } - if(expertTag.getTagCode().equals(dangzhengCode)){ - partyGovInfoNum ++; - } - if(expertTag.getTagCode().equals(ruanyingCode)){ - softHardPricingNum ++; - } - if(specialTags.contains(expertTag.getTagCode())){ - isContain = Boolean.TRUE; - } - } - if(isContain){ - specialExpertNum ++; - } - } - } - //财务专家 - cockpitStats.setExpertFinancialNum(financialNum); - //网络安全 - cockpitStats.setExpertNetworkSecurityNum(networkSecurityNum); - cockpitStats.setExpertXinchuangNum(xinchuangNum); - cockpitStats.setExpertPlanRationalityNum(planRationalityNum); - cockpitStats.setExpertPromotionInfoTechnologyNum(promotionInfoTechnologyNum); - cockpitStats.setExpertPartyGovInfoNum(partyGovInfoNum); - cockpitStats.setExpertSoftHardPricingNum(softHardPricingNum); - cockpitStats.setExpertTechnicalFeasibilityAssessmentNum(technicalFeasibilityAssessmentNum); - cockpitStats.setSpecialExpertNum(specialExpertNum); - - //3.顶部数据 - //3.1 计划项目数(申报项目:完成年度计划的项目总数 - // 项目归集:评审中、待立项、已立项、已采购、已初验、已终验项目总和) - Integer planProjectNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer planProjectNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - //排除 已驳回 已终止 - (!Lists.newArrayList(GovProjectStatusEnum.REJECTED.getCode(), - GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setTopPlanProjectsNum(planProjectNum + planProjectNumGov); - - //3.2 批复项目数(申报项目:完成立项批复流程项目总数 项目归集:已立项、已采购、已初验、已终验项目总和) - Integer approvalNumDeclared = projects.stream().filter(p -> { - if(Objects.nonNull(p.getApprovalAmount())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer approvalNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), - GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode(), - GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - - BigDecimal approvalAmount = projects.stream().filter(p -> { - if(Objects.nonNull(p.getApprovalAmount())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).map(Project::getApprovalAmount).reduce(BigDecimal::add).get(); - - BigDecimal approvalAmountGov = approves.stream().filter(a -> { - if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).map(GovBizProjectApprove::getBaseInitialReviewTotalMoney).reduce(BigDecimal::add).get(); - - cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); - cockpitStats.setTopApprovalProjectsAmount(approvalAmount.add(approvalAmountGov)); - //3.3 平均建设周期 - OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), - applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { - try { - Integer buildCycle = Integer.valueOf(c); - return buildCycle; - } catch (Exception e) { - return 0; - } - }).average(); - Double average = od.isPresent() ? od.getAsDouble() : 0.0; - cockpitStats.setTopAverageConstructionPeriod(average.intValue()); - //3.4 在建项目数 采购备案后的项目 - Integer contructionNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.TO_BE_PURCHASED.getCode()) >= 0 - && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer contructionNumGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setTopOngoingProjectsNum(contructionNum + contructionNumGov); - - //4.地图 只要放总数 取的时候 会有逻辑(也要取项目归集) - cockpitStats.setProjectsTotal(projects.size() + baseInfos.size()); - - //5.下面项目状态数 - //5.1 计划(申报项目:项目预审完成到年度计划未完成 项目归集:评审中) - Integer inPlanNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) > 0 && - p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inPlanNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setProjectsTotalPlan(inPlanNum + inPlanNumGov); - - //5.2 处于申报(申报项目:年度计划完成到建设方案审批第一个节点审批未通过前 项目归集:待立项) - Integer inApplyNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - (ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) || - (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSechmeReviewFlow(p.getProjectCode())))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inApplyNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setProjectsTotalApply(inApplyNum + inApplyNumGov); - - //5.3 处于审批 (申报项目:建设方案审批第一个节点审批通过到立项批复未完成 项目归集:已立项) - Integer inApproveNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(p.getStatus()) || - p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 || - (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSechmeReviewedFlow(p.getProjectCode())))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inApproveNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setProjectsTotalApprove(inApproveNum + inApproveNumGov); - - //5.4 建设 (申报项目:立项批复完成到项目初验未完成 项目归集:已采购) - Integer inConstructionNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - (p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 && - p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) < 0) || - //如果在建设中 那么初验材料为空代表 初验未完成 - (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inConstructionNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setProjectsTotalConstruction(inConstructionNum + inConstructionNumGov); - - //5.5 验收 (申报项目:项目初验完成到项目终验未完成 项目归集:已初验) - List inAccpetProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) > 0 && - p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0 || - //如果在建设中 那么初验材料不为空代表 初验完成 - (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - List inAccpetProjectsGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - cockpitStats.setProjectsTotalAccept(inAccpetProjects.size() + inAccpetProjectsGov.size()); - - //5.6 运维(申报项目:项目验收完成后且项目未注销 项目归集:已终验) - List inOperationProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - Integer inOperationProjectsGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setProjectsTotalOperation(inOperationProjects.size() + inOperationProjectsGov); - - //5.7 绩效(申报项目:项目验收完成后且未完成绩效自评 项目归集:无) - List inAccpetCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - List performances = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(CollUtil.isNotEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, inAccpetCodes) - .in(CollUtil.isEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) - .eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE) - .isNull(PerformanceAppraisalProject::getReAppraisalTotalScore) - ); - cockpitStats.setProjectsTotalPerformance(performances.size()); - cockpitStats.setProjectsTotalLogOff(0); - - //6.项目效益 - cockpitStats.setExcellentBestAppNum(0); - cockpitStats.setExcellentMajorAppNum(0); - cockpitStats.setExcellentCrossLevelSharingNum(0); - cockpitStats.setExcellentMajorAppNum(0); - - //7.2驳回节约资金 - List rejectPreProjects = projects.stream().filter(p -> { - if (Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - BigDecimal rejectPreSum = rejectPreProjects.stream().map(p -> { - if (Objects.nonNull(p.getDeclareAmount())) { - return p.getDeclareAmount(); - } - return BigDecimal.ZERO; - }).reduce(BigDecimal::add).get(); - cockpitStats.setRejectSavingsFunds(rejectPreSum); - - //7.3 柱状图 - //7.3.1 申报状态的3个资金 -// projects.stream() - //首先完成年度计划 并且未注销的项目 - List normalProjects = projects.stream().filter(p -> { - if (Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.BE_SUSPENDED.getCode()) > 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - - //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) - final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? - p.getDeclareAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); - final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; - applies.stream().map(g -> { - BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; - return totalAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); - BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); - cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); - - //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) - final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); - final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; - return expertTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); - BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); - cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); - //申报的差额 - BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); - cockpitStats.setDifferenceApprove(subtractApprove); - - //批复的申报金额(申报项目:建设方案申报金额 项目归集:建议总投资) - cockpitStats.setDeclaredAmountApproval(approvalAmountApproveTotal); - - //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) - final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; - return proposeTotalInvest; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); - final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; - return reviewTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); - BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); - cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); - - //批复的差额 - BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); - cockpitStats.setDifferenceApproval(subtractApproval); - - //合同的申报金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) - cockpitStats.setDeclaredAmountContract(approvalAmountApprovalTotal); - - //合同的批复金额(申报项目:成交金额 项目归集:成交金额) - final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; - return transactionAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); - final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; - procures.stream().map(p -> { - BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? - p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; - return purchaseAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); - BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); - cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); - - //合同的差额 - BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); - cockpitStats.setDifferenceContract(subtractContract); - - //7 核减资金 - cockpitStats.setReduceFundsTotal(subtractApprove.add(subtractApproval).add(subtractContract)); - - //8 产出数据 - cockpitStats.setProduceAppNum(0); - cockpitStats.setProduceDataNum(0); - cockpitStats.setProduceComponentNum(0); - cockpitStats.setProduceBrainElementsNum(0); - - //9.绩效 - List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - Map projectMap = projects.stream().filter(p -> Objects.nonNull(p.getProjectCode())).collect(Collectors.toMap(Project::getProjectCode, Project::getProjectName)); - if(CollUtil.isNotEmpty(projectCodes)){ - List performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getProjectCode, projectCodes)); - List verified = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - - List start5 = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore()) - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) > 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - List start4 = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore()) - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) >= 0 - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) < 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - List start3 = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore()) - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) >= 0 - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) < 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - List start2 = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore()) - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) >= 0 - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) < 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - List start1 = performanceAll.stream().filter(p -> { - if (Objects.nonNull(p.getVerifyTotalScore()) - && p.getVerifyTotalScore().compareTo(BigDecimal.ZERO) >= 0 - && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) < 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) - .collect(Collectors.toList()); - cockpitStats.setPerformanceTotal(performanceAll.size()); - cockpitStats.setPerformanceReviewedTotal(verified.size()); - cockpitStats.setPerformanceTobeReviewTotal(performanceAll.size() - verified.size()); - - cockpitStats.setPerformanceTop1Score(BigDecimal.valueOf(start1.size())); - cockpitStats.setPerformanceTop2Score(BigDecimal.valueOf(start2.size())); - cockpitStats.setPerformanceTop3Score(BigDecimal.valueOf(start3.size())); - cockpitStats.setPerformanceTop4Score(BigDecimal.valueOf(start4.size())); - cockpitStats.setPerformanceTop5Score(BigDecimal.valueOf(start5.size())); - } - - return cockpitStats; - } - - /** - * 建设方案申报了 但未开始审核的项目 - * @param projectCode - * @return - */ - private boolean searchSechmeReviewFlow(String projectCode) { - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - return Boolean.FALSE; - } - List allVersionProjectId = projectService.getAllVersionProjectId(project); - ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectId) - .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(pi)){ - return Boolean.FALSE; - } - String instCode = pi.getInstCode(); - List finished = historyService.createHistoricActivityInstanceQuery() - .finished() - .processInstanceId(instCode) - .orderByHistoricActivityInstanceEndTime() - .asc() - .list(); - List unfinished = historyService.createHistoricActivityInstanceQuery() - .unfinished() - .processInstanceId(instCode) - .orderByHistoricActivityInstanceStartTime() - .asc() - .list(); - //已经完成的没有 未完成的有 则可计算 - if(CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)){ - return Boolean.TRUE; - } - return Boolean.FALSE; - } - //已经开始审批 - private boolean searchSechmeReviewedFlow(String projectCode) { - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - return Boolean.FALSE; - } - List allVersionProjectId = projectService.getAllVersionProjectId(project); - ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, allVersionProjectId) - .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(pi)){ - return Boolean.FALSE; - } - String instCode = pi.getInstCode(); - List finished = historyService.createHistoricActivityInstanceQuery() - .finished() - .processInstanceId(instCode) - .orderByHistoricActivityInstanceEndTime() - .asc() - .list(); - //已经完成的 则可计算 - if(CollUtil.isNotEmpty(finished)){ - return Boolean.TRUE; - } - return Boolean.FALSE; - } - - /** - * 计算环节滞后项目 - * @param projects - * @return - */ - private Integer computeLagging(List projects) { - List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - Map map = projects.stream().collect(Collectors.toMap(p -> p.getProjectCode(), p -> p)); - List records = Lists.newArrayList(); - if(CollUtil.isNotEmpty(projectCodes)){ - records = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .in(WflowEarlyWarningRecords::getProjectCode, projectCodes)); - } - return records.stream().mapToInt(r -> { - if(!map.containsKey(r.getProjectCode())){ - return 0; - } - Project project = map.get(r.getProjectCode()); - //如果状态 相等 说明预警了 但是没处理 +1 - if(Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && - project.getStatus().equals(r.getProjectStatus())){ - return 1; - } - return 0; - }).sum(); - } - - private void buidMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { - if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){ - return; - } - cockpitStats.setMonitorOverdueConstructionProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(), - lastYearData.getMonitorOverdueConstructionProjectsNum())); - cockpitStats.setMonitorLaggingProjectsRise(BizUtils.computeRise(thisYearData.getMonitorLaggingProjectsNum(), - lastYearData.getMonitorLaggingProjectsNum())); - cockpitStats.setMonitorRejectedApproveProjectsRise(BizUtils.computeRise(thisYearData.getMonitorRejectedApproveProjectsNum(), - lastYearData.getMonitorRejectedApproveProjectsNum())); - cockpitStats.setMonitorRejectedPreReviewProjectsRise(BizUtils.computeRise(thisYearData.getMonitorRejectedPreReviewProjectsNum(), - lastYearData.getMonitorRejectedPreReviewProjectsNum())); - cockpitStats.setMonitorAcceptConditionsNotStandardsRise(BizUtils.computeRise(thisYearData.getMonitorAcceptConditionsNotStandardsNum(), - lastYearData.getMonitorAcceptConditionsNotStandardsNum())); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CommonLogTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CommonLogTask.java deleted file mode 100644 index 85aac58..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CommonLogTask.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.io.FileUtil; -import cn.hutool.core.io.file.FileReader; -import cn.hutool.core.io.file.FileWriter; -import cn.hutool.core.lang.UUID; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.log.mapper.OptLogMapper; -import com.ningdatech.log.model.domain.OptLog; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.organization.mapper.DingEmployeeInfoMapper; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.scheduler.task.model.CommonLog; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import lombok.RequiredArgsConstructor; -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.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -/** - * 通用日志写入任务 - * @author liushuai - */ -@Component -@RequiredArgsConstructor -public class CommonLogTask { - private final OptLogMapper optLogMapper; - private final IUserInfoService userInfoService; - private final DingEmployeeInfoMapper dingEmployeeInfoMapper; - /** - * 日志记录文件位置 - */ - private final static String LOG_RECORD_ADDRESS = "/opt/log/"; - private final static String LOG_ID_FILE = "logId.txt"; - private final static String LOG_FILE = "common_log_"; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(fixedDelay = 120000) - public void writeLog() throws UnknownHostException { - // - if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - return; - } - //获取记录ID文件 - boolean idFileExist = FileUtil.exist(LOG_RECORD_ADDRESS + LOG_ID_FILE); - if (!idFileExist){ - FileUtil.touch(LOG_RECORD_ADDRESS + LOG_ID_FILE); - } - FileReader fileReader = new FileReader(LOG_RECORD_ADDRESS + LOG_ID_FILE); - String result = fileReader.readString(); - long startLogId = 0L; - if (StringUtils.isNotBlank(result)){ - startLogId = Long.parseLong(result); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(OptLog.class).gt(OptLog::getId,startLogId); - //查询日志 - List logList = optLogMapper.selectList(query); - DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - if (CollectionUtil.isNotEmpty(logList)){ - for (OptLog optLog : logList){ - CommonLog commonLog = new CommonLog(); - UserInfo userInfo = userInfoService.getById(optLog.getCreateBy()); - if (userInfo == null){ - continue; - } - String employeeCode = userInfo.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)){ - DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper() - .eq(DingEmployeeInfo::getEmployeeCode,employeeCode) - .last(BizConst.LIMIT_1)); - if (dingEmployeeInfo != null){ - commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId())); - } - }else { - commonLog.setUserId(String.valueOf(userInfo.getId())); - } - commonLog.setUserRole("政府工作人员"); - commonLog.setAreaCode(userInfo.getRegionCode() + RegionConst.NINE_CODE_LAST); - String description = optLog.getDescription(); - if ("用户登录".equals(description)){ - commonLog.setActionType(1); - }else if (description.contains("退出登录")){ - commonLog.setActionType(2); - }else { - commonLog.setActionType(3); - } - String actionId = UUID.randomUUID().toString(); - commonLog.setActionId(actionId); - commonLog.setActionTime(df.format(optLog.getStartTime())); - commonLog.setActionDuration(optLog.getConsumingTime()); - commonLog.setActionStatus(0); - commonLog.setAppCode("A331101453557202109017383"); - //判断当天日志文件是否存在 - DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd"); - String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log"; - boolean fileExist = FileUtil.exist(fileName); - if (!fileExist){ - //不存在则创建当天日志文件 - FileUtil.touch(fileName); - } - //写入通用规则 - FileWriter writer = new FileWriter(fileName); - writer.append(JSONUtil.toJsonStr(commonLog)); - writer.append("\n"); - if (commonLog.getActionType() == 3){ - CommonLog commonLogEnd = new CommonLog(); - BeanUtil.copyProperties(commonLog,commonLogEnd); - commonLogEnd.setActionType(4); - writer.append(JSONUtil.toJsonStr(commonLogEnd)); - writer.append("\n"); - } - } - //记录最后一个节点位置 - FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_ID_FILE); - writer.write(String.valueOf(logList.get(logList.size() - 1).getId())); - } - } -} 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 deleted file mode 100644 index 5a76310..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ /dev/null @@ -1,566 +0,0 @@ -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.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -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.*; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; -import com.ningdatech.pmapi.sys.manage.RoleManage; -import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.service.IUserInfoService; -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; - - private final IUserInfoService userInfoService; - - private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; - - private final RoleManage roleManage; - - private final IProjectEarlyWarningService projectEarlyWarningService; - - @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 adventContent = warning.getAdventContent(); - 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"); - String notice = rJson.getString("notice"); - Integer adventTime = rJson.getInteger("adventTime"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ - log.info("规则数据 错误 :{}",rJson); - return; - } - - if(StringUtils.isBlank(notice)){ - log.info("取不到提醒人配置 : " + rJson); - return; - } - - WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); - if(Objects.isNull(flowTypeEnum)){ - log.info("匹配不到 业务类型"); - return; - } - String path = flowTypeEnum.getPath(); - - //得出 对应待提交的项目状态 - 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)); - - Map> noticeMap = Maps.newHashMap(); - //需要发通知的项目 - 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; - } - } - } - - List noticeTypes = Lists.newArrayList(); - if(Objects.nonNull(time) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); - } - if(Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); - } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeMap.put(p.getProjectCode(),noticeTypes); - //项目 填报预警 - projectEarlyWarningService.earlyWarning(p, - WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeTypes); - 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 username = null; - String mobile = null; - //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 - List batchEmployees = Lists.newArrayList(); - if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ - String employeeCode = null; - username = needToWaringProject.getContactName(); - mobile = needToWaringProject.getContactPhone(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ - UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, username) - .eq(UserInfo::getMobile, mobile) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ - employeeCode = user.getEmployeeCode(); - } - if(Objects.nonNull(employeeCode)){ - batchEmployees.add(employeeCode); - } - } - } - if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ - String employeeCode = null; - username = needToWaringProject.getResponsibleMan(); - mobile = needToWaringProject.getResponsibleManMobile(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ - UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, username) - .eq(UserInfo::getMobile, mobile) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ - employeeCode = user.getEmployeeCode(); - } - if(Objects.nonNull(employeeCode)){ - batchEmployees.add(employeeCode); - } - } - } - if(CollUtil.isNotEmpty(batchEmployees)){ - String batchEmployeesStr = batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)); - if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ - List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes) { - for (String employeeCode : batchEmployees) { - earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, - adventTime,time, biz, - needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, - WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr, - null); - } - } - } - } - } - }); - } - } - } - - 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 adventContent = warning.getAdventContent(); - 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 adventTime = rJson.getInteger("adventTime"); - Integer biz = rJson.getInteger("biz"); - String notice = rJson.getString("notice"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ - log.info("规则数据 错误 :{}",rJson); - return; - } - - WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); - if(Objects.isNull(operationTypeEnum)){ - log.info("匹配不到 业务类型"); - return; - } - - //得出 对应待提交的项目状态 - Integer projectStutas = operationTypeEnum.getProjectStutas(); - String path = operationTypeEnum.getPath(); - 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)); - Map> noticeMap = Maps.newHashMap(); - //需要发通知的项目 - 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()); - - List noticeTypes = Lists.newArrayList(); - if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ - //初验 - if(Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); - } - if(Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); - } - }else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ - //终验 - if(Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); - } - if(Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); - } - } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeMap.put(p.getProjectCode(),noticeTypes); - //项目 运维预警 - projectEarlyWarningService.earlyWarning(p, - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); - 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){ - //去预警通知 - List batchEmployees = Lists.newArrayList(); - - if(StringUtils.isBlank(notice)){ - String sponsor = needToWaringProject.getSponsor(); - batchEmployees.add(sponsor); - }else{ - //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 - - if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ - String employeeCode = null; - String username = needToWaringProject.getContactName(); - String mobile = needToWaringProject.getContactPhone(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ - UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, username) - .eq(UserInfo::getMobile, mobile) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ - employeeCode = user.getEmployeeCode(); - } - if(Objects.nonNull(employeeCode)){ - batchEmployees.add(employeeCode); - } - } - } - if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ - String employeeCode = null; - String username = needToWaringProject.getResponsibleMan(); - String mobile = needToWaringProject.getResponsibleManMobile(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ - UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, username) - .eq(UserInfo::getMobile, mobile) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ - employeeCode = user.getEmployeeCode(); - } - if(Objects.nonNull(employeeCode)){ - batchEmployees.add(employeeCode); - } - } - } - } - - if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ - List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes){ - for (String employeeCode : batchEmployees) { - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, - adventTime,time,biz, - needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path, - batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null); - } - } - } - - } - }); - } - } - } - - stopWatch.stop(); - log.info("=========== 预警实施超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - } - - /** - * 续建项目资金 超时未审批定时器 - * @throws UnknownHostException - */ - @Scheduled(cron = "20 0/2 * * * ?") - public void doEarlyWarningRenewalFund() 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.RENEWAL_FUND.getCode())); - for(WflowEarlyWarning warning : warnings){ - //2. 取出rule的数据 - if(!warning.getIsOpen()){ - log.info(warning.getId() + " 此规则关闭了"); - continue; - } - - String noticeMethod = warning.getNoticeMethod(); - String noticeContent = warning.getNoticeContent(); - String adventContent = warning.getAdventContent(); - if(StringUtils.isBlank(noticeMethod) || - (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ - log.info("通知方式为空或者错误!"); - return; - } - - 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 adventTime = rJson.getInteger("adventTime"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)){ - log.info("规则数据 错误 :{}",rJson); - return; - } - - //得出 对应待提交的续建项目区域信息 - String areaCode = warning.getAreaCode(); - //测试先用分钟 - //查询 所有这个区域的项目 未提交的项目 - List needNextProjects = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getRegionCode, areaCode) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); - - Map> noticeTypeMap = Maps.newHashMap(); - //需要发通知的项目 - List needToWaringProjects = needNextProjects.stream() - .filter(p -> { - //超时未审批 - List noticeTypes = Lists.newArrayList(); - if(Objects.nonNull(time) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); - } - if(Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 - noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); - } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeTypeMap.put(p.getProjectCode(),noticeTypes); - //项目 运维预警 - projectEarlyWarningService.earlyWarning(p.getProjectCode(), - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); - 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(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ - String path = "projectStoreManage/renewalProjectAsscess?projectRenewalId=" + needToWaringProject.getId(); - Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); - //去预警通知 发给区管 - List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode()); - String employeesStr = users.stream().map(UserInfo::getEmployeeCode) - .collect(Collectors.joining(StrPool.COMMA)); - for(UserInfo user : users){ - if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){ - List noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes){ - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, - adventTime,time,null, - needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, - WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); - } - } - - } - } - }); - } - } - } - - stopWatch.stop(); - log.info("=========== 预警续建资金项目 超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java deleted file mode 100644 index f003f65..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java +++ /dev/null @@ -1,333 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Sets; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; -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.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; -import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; -import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; -import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; -import com.wflow.enums.WarningRuleTypeEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.TaskService; -import org.flowable.task.api.Task; -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.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author ZPF - * @date 2023/8/3 上午9:53 - * 预警填报 超时任务 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class EarlyWarningProjectTask { - - private final IProjectService projectService; - - private final IProjectEarlyWarningService projectEarlyWarningService; - - private final IEarlyWarningRecordsService earlyWarningRecordsService; - - private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; - - private final TaskService taskService; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(fixedDelay = 6000 * 120) - public void doEarlyWarningDeclared() throws UnknownHostException { - if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - return; - } - - log.info("=========== 预警项目维度任务开始 ========"); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE)); - - if(CollUtil.isEmpty(projects)){ - log.info("系统没有项目 退出任务"); - stopWatch.stop(); - log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - return; - } - - Set projectSet = Sets.newHashSet(); - Map projectMap = projects.stream().filter(p -> projectSet.add(p.getProjectCode())) - .collect(Collectors.toMap(Project::getProjectCode, p -> p)); - List warnings = projectEarlyWarningService.list(); - List warningProjectCodes = warnings.stream().map(ProjectEarlyWarning::getProjectCode) - .collect(Collectors.toList()); - - //1.先补全 异常项目管理中 不存在的项目 - List toAdd = projects.stream() - .filter(p -> { - if(CollUtil.isEmpty(warningProjectCodes)){ - return Boolean.TRUE; - } - if(!warningProjectCodes.contains(p.getProjectCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }) - .map(p -> { - ProjectEarlyWarning earlyWarning = new ProjectEarlyWarning(); - earlyWarning.setAreaCode(p.getAreaCode()); - earlyWarning.setBuildOrgCode(p.getBuildOrgCode()); - earlyWarning.setProjectCode(p.getProjectCode()); - earlyWarning.setCreateOn(LocalDateTime.now()); - earlyWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); - earlyWarning.setRuleType(null); - return earlyWarning; - }) - .collect(Collectors.toList()); - - if(CollUtil.isNotEmpty(toAdd)){ - projectEarlyWarningService.saveBatch(toAdd); - } - - //2.删除 已经不存在的项目 - List toRemove = warnings.stream() - .filter(w -> !projectMap.containsKey(w.getProjectCode())) - .collect(Collectors.toList()); - if(CollUtil.isNotEmpty(toRemove)){ - List removeIds = toRemove.stream().map(ProjectEarlyWarning::getId) - .collect(Collectors.toList()); - projectEarlyWarningService.removeBatchByIds(removeIds); - } - - //3.去查询 各个报警 是否已经正常 - List trueWarnings = warnings.stream().filter(w -> Objects.nonNull(w.getNormal()) && !w.getNormal()).collect(Collectors.toList()); - if(CollUtil.isEmpty(trueWarnings)){ - log.info("没有异常的项目 要去查询"); - stopWatch.stop(); - log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - return; - } - checkNormal(trueWarnings); - - stopWatch.stop(); - log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - } - - //3.去查询 各个报警 是否已经正常 - private void checkNormal(List trueWarnings) { - //3.1 预警预警 如果正常了 要改会正常 - List processWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getProcessWarning()) - && w.getProcessWarning()) - .collect(Collectors.toList()); - checkProcessWarning(processWarning); - - //3.2 填报预警 如果正常了 要改会正常 - List declaredWarning = trueWarnings.stream().filter(w -> - Objects.nonNull(w.getDeclaredWarning()) - && w.getDeclaredWarning()) - .collect(Collectors.toList()); - checkDeclaredWarning(declaredWarning); - - //3.3 实施预警 如果正常了 要改会正常 - List operationWarning = trueWarnings.stream().filter(w -> - Objects.nonNull(w.getOperationWarning()) - && w.getOperationWarning()) - .collect(Collectors.toList()); - checkOperationWarning(operationWarning); - - //3.4 续建资金预警 如果正常了 要改回正常 - List renewalFundWarning = trueWarnings.stream().filter(w -> - Objects.nonNull(w.getRenewalFundWarning()) - && w.getRenewalFundWarning()) - .collect(Collectors.toList()); - checkRenewalFundWarning(renewalFundWarning); - } - - private void checkRenewalFundWarning(List renewalFundWarnings) { - if(CollUtil.isEmpty(renewalFundWarnings)){ - return; - } - - for(ProjectEarlyWarning renewalFundWarning : renewalFundWarnings){ - String projectCode = renewalFundWarning.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - continue; - } - - WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) - .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) - .orderByDesc(WflowEarlyWarningRecords::getWarningTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(record)){ - continue; - } - //借用了NODEID 其实 是续建id - String nodeId = record.getNodeId(); - ProjectRenewalFundDeclaration renewalFund = renewalFundDeclarationService.getById(nodeId); - if(Objects.isNull(renewalFund)){ - continue; - } - String approvalStatus = renewalFund.getApprovalStatus(); - ProjectRenewalApprovalStatusEnum match = ProjectRenewalApprovalStatusEnum - .match(approvalStatus); - if(Objects.nonNull(match)){ - //如果是已经审批 - if(match.name().equals(ProjectRenewalApprovalStatusEnum.PASS.name())){ - renewalFundWarning.setRenewalFundWarning(Boolean.FALSE); - //其它三种 都没有 说明已经正常了 - if(!renewalFundWarning.getProcessWarning() && - !renewalFundWarning.getDeclaredWarning() && - !renewalFundWarning.getOperationWarning()){ - renewalFundWarning.setNormal(Boolean.TRUE); - renewalFundWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); - } - projectEarlyWarningService.updateById(renewalFundWarning); - } - } - } - } - - private void checkOperationWarning(List operationWarnings) { - if(CollUtil.isEmpty(operationWarnings)){ - return; - } - - for( ProjectEarlyWarning operationWarning : operationWarnings){ - String projectCode = operationWarning.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - continue; - } - WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) - .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode()) - .orderByDesc(WflowEarlyWarningRecords::getWarningTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(record)){ - continue; - } - Integer biz = record.getBiz(); - WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); - if(Objects.isNull(operationTypeEnum)){ - continue; - } - Integer projectStutas = operationTypeEnum.getProjectStutas(); - //已经不是这个状态了 说明已经被提交了 - if(!projectStutas.equals(project.getStatus())){ - operationWarning.setOperationWarning(Boolean.FALSE); - //其它三种 都没有 说明已经正常了 - if(!operationWarning.getProcessWarning() && - !operationWarning.getDeclaredWarning() && - !operationWarning.getRenewalFundWarning()){ - operationWarning.setNormal(Boolean.TRUE); - operationWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); - } - projectEarlyWarningService.updateById(operationWarning); - } - } - } - - private void checkDeclaredWarning(List declaredWarnings) { - if(CollUtil.isEmpty(declaredWarnings)){ - return; - } - for( ProjectEarlyWarning declaredWarning : declaredWarnings){ - String projectCode = declaredWarning.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - continue; - } - WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) - .eq(WflowEarlyWarningRecords::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode()) - .orderByDesc(WflowEarlyWarningRecords::getWarningTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(record)){ - continue; - } - Integer biz = record.getBiz(); - WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); - if(Objects.isNull(flowTypeEnum)){ - continue; - } - Integer projectStutas = flowTypeEnum.getProjectStutas(); - //已经不是这个状态了 说明已经被提交了 - if(!projectStutas.equals(project.getStatus())){ - declaredWarning.setDeclaredWarning(Boolean.FALSE); - //其它三种 都没有 说明已经正常了 - if(!declaredWarning.getProcessWarning() && - !declaredWarning.getOperationWarning() && - !declaredWarning.getRenewalFundWarning()){ - declaredWarning.setNormal(Boolean.TRUE); - declaredWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); - } - projectEarlyWarningService.updateById(declaredWarning); - } - } - } - - /** - * 流程 查看 是否已经处理过 - * @param processWarnings - */ - private void checkProcessWarning(List processWarnings) { - if(CollUtil.isEmpty(processWarnings)){ - return; - } - for( ProjectEarlyWarning processWarning : processWarnings){ - String projectCode = processWarning.getProjectCode(); - WflowEarlyWarningRecords record = earlyWarningRecordsService.getOne(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getProjectCode, projectCode) - .orderByDesc(WflowEarlyWarningRecords::getWarningTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(record)){ - continue; - } - String nodeId = record.getNodeId(); - if(StringUtils.isBlank(nodeId)){ - continue; - } - List tasks = taskService.createTaskQuery() - .taskDefinitionKey(nodeId) - .list(); - if(CollUtil.isEmpty(tasks)){ - //说明 已经审批通过了 - processWarning.setProcessWarning(Boolean.FALSE); - //其它三种 都没有 说明已经正常了 - if(!processWarning.getDeclaredWarning() && - !processWarning.getOperationWarning() && - !processWarning.getRenewalFundWarning()){ - processWarning.setNormal(Boolean.TRUE); - processWarning.setStatus(ProjectEarlyWarningStatusEnum.NORMAL.name()); - } - projectEarlyWarningService.updateById(processWarning); - } - } - - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java deleted file mode 100644 index 5cb88f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import cn.hutool.core.util.IdUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Maps; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.wflow.bean.dto.WflowModelHistorysInsertDto; -import com.wflow.bean.entity.WflowForms; -import com.wflow.bean.entity.WflowModels; -import com.wflow.workflow.bean.process.ProcessNode; -import com.wflow.workflow.service.ProcessModelService; -import com.wflow.workflow.service.WflowFormsService; -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.LocalDateTime; -import java.util.*; - -/** - * @author ZPF - * @description - * @since 2023/1/18 08:54 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class InitProcessTask { - - private final IRegionService regionService; - - private final ProcessModelService processModelService; - - private final WflowFormsService formsService; - - private final RegionCacheHelper regionCacheHelper; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(cron = "0 45 18 12 6 ?") - public void doTask() throws UnknownHostException { - if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - // 1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - - if (CollUtil.isEmpty(regions)) { - throw new BizException("丽水地区数据为空 任务结束!"); - } - - for (RegionDTO region : regions) { - log.info("当前初始化的是 【{}】 流程配置", region.getRegionName()); - - Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; - for (Integer processType : processTypeList) { - String formName = ProjectProcessStageEnum.getDesc(processType); - WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); - - models.setGroupId(1); - models.setProcessDefId("pd" + IdUtil.objectId()); - models.setFormName(formName); - models.setProcessType(processType); - models.setRegionCode(region.getRegionCode()); - String process = - "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; - ProcessNode processNode = JSON.parseObject(process, ProcessNode.class); - models.setProcess(processNode); - models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); - models.setFormItems("[]"); - - String formId = processModelService.insertProcess(models); - if (StringUtils.isNotBlank(formId)) { - // 初始的流程在部署表也存一份,用来查询 - if (StringUtils.isNotBlank(processModelService.deployProcess(formId, null))) { - log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功", region.getRegionName(), formName); - } else { - log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败", region.getRegionName(), formName); - } - } else { - log.info("当前区域 【{}】流程名[{}] 流程数据保存失败", region.getRegionName(), formName); - } - } - } - - stopWatch.stop(); - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s", stopWatch.getTotalTimeSeconds()); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java deleted file mode 100644 index 03e2545..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.staging.contants.StagingContant; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -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.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -/** - * @Classname ProjectStatusFlowTask - * @Description - * @Date 2023/2/20 10:12 - * @Author PoffyZhang - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ProjectStatusFlowTask { - - private final IProjectStagingService projectStagingService; - - private final IProjectService projectService; - - private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(cron = "0 */1 * * * ?") - public void statusFlow() throws UnknownHostException { - // - if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - //1. 定时取 项目暂存表的数据 去进行状态继续流转 - List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) - .eq(ProjectStaging::getDead,Boolean.FALSE) - .le(ProjectStaging::getNextTime, LocalDateTime.now()) - .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) - .orderByAsc(ProjectStaging::getProjectId)); - - log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); - if(CollUtil.isEmpty(stagingList)){ - log.info("没有需要状态流转的项目!"); - return; - } - - //遍历 - for(ProjectStaging projectStaging : stagingList){ - try{ - Project project = projectService.getById(projectStaging.getProjectId()); - if(Objects.isNull(project)){ - log.info("此项目 【{}】 不存在",projectStaging.getProjectId()); - continue; - } - - //2. 用函数map 定位到 状态流转的函数 - Map> reStartProcessMap = - projectStatusFlowMapUtil.statusFlowFunctionMap; - - if(!reStartProcessMap.containsKey(project.getStatus())){ - log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数",projectStaging.getProjectId(),project.getStatus()); - continue; - } - - Function functionMap = reStartProcessMap.get(project.getStatus()); - //执行对应的函数 - if(functionMap.apply(project)){ - //执行成功了 删除暂存的数据 - projectStagingService.removeById(projectStaging); - } - }catch (Exception e){ - log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e.getMessage()); - }finally { - //增加重试的次数 和下次扫描时间 - projectStagingService.addRetryTimes(projectStaging); - } - } - } - } - -// @Scheduled(cron = "0 */1 * * * ?") - public void nonUserFinishFlowToNext() throws UnknownHostException { - //测试暂时用自己HOST - if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { - - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java deleted file mode 100644 index 4433989..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ /dev/null @@ -1,490 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO; -import com.ningdatech.pmapi.gov.model.vo.GovBizProjectListVO; -import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectBaseinfoVO; -import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectDetailVO; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.gov.utils.ProjectConvertUtil; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -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.util.List; -import java.util.Objects; -import java.util.StringJoiner; - -/** - * @author ZPF - * @since 2023/08/31 18:16 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class SynProjectCollectionTask { - - @Value("${hostname}") - public String HOST; - - @Value("${spring.profiles.active}") - public String active; - - @Autowired - private GovProjectCollectionManage collectionManage; - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - @Autowired - private IGovBizProjectApplyService applyService; - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IGovBizProjectMimplementService mimplementService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private IProjectService projectService; - - @Autowired - private ProjectLibManage projectLibManage; - - @Autowired - private FileService fileService; - - private final Integer PAGE_NUMBER = 1; - - /** - * 前置机每天晚上10点自动清空,第二天早上6点获取数据 - * 定时同步前置机数据 每天1点开始执行一次 - * - */ - @Scheduled(cron = "0 0 1 * * ?") - public void doTask() throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - return; - } - if(BizConst.PRE.equals(active)){ - log.info("预发环境不用同步!"); - return; - } - - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - log.info("数据同步任务开始之前 先删除前置机上的所有数据"); - collectionManage.deleteAll(); - - //全量项目归集 - ProjectListReq req = new ProjectListReq(); - Long count = collectionManage.count(req) + collectionManage.operationCount(req); - if(count == 0L){ - log.info("本次同步无数据"); - return; - } - req.setPageNumber(PAGE_NUMBER); - req.setPageSize(count.intValue()); - PageVo projectCollectionPage = collectionManage.list(req); - - log.info("projectCollections size :{}",projectCollectionPage.getTotal()); - - for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){ - GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId()); - collectionManage.pushProjectVo(projectDetail); - } - - //2.运维备案项目 - PageVo operationList = collectionManage.operationList(req); - log.info("operation list size :{}",operationList.getTotal()); - for(GovBizProjectListVO vo : operationList.getRecords()){ - GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId()); - GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo(); - if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) || - Boolean.FALSE.equals(baseinfo.getPush())){ - log.info("此运维项目不用推送:" + vo.getBaseProjId()); - } - collectionManage.pushProjectVo(operationDetail); - } - - //3.申报项目 需要推送的项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest,Boolean.TRUE) - .eq(Project::getPush,Boolean.TRUE)); - log.info("projects need push size :{}",projects.size()); - for(Project project : projects){ - ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode()); - GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); - if(Objects.nonNull(vo)){ - collectionManage.pushProjectVo(vo); - } - } - - stopWatch.stop(); - log.info("数据同步任务结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - /** - * 把库存的项目归集里 没有转换PDF文件的 都转换一遍 存入数据库 - */ - public void stagingConvertPdf(String projId) { - log.info("项目归集库存转换PDF任务开始====="); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, projId)); - if(Objects.nonNull(base)){ - //开始转换PDF - convertPdfVo(projId); - } - - stopWatch.stop(); - log.info("项目归集库存转换PDF任务结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - public void stagingConvertPdf2(String projId) { - log.info("项目归集库存转换PDF任务2开始====="); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - ProjectListReq req = new ProjectListReq(); - req.setPageNumber(1); - req.setPageSize(BizConst.MAX_EXPORT_COUNT); - List projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) - .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) - .isNotNull(GovBizProjectApprove::getApprovalFile) - .isNull(GovBizProjectApprove::getApprovalFilePdf)); - - if(CollUtil.isEmpty(projects)){ - log.info("没有项目归集 任务终止"); - return; - } - - for(GovBizProjectApprove project : projects){ - String baseProjId = project.getBaseProjId(); - //开始转换PDF - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(approve)){ - return; - } - if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ - StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); - approve.setApprovalFilePdf(sj.toString()); - } - } - - stopWatch.stop(); - log.info("项目归集库存转换PDF任务2结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - public void stagingConvertPdf3(String projId) { - log.info("项目归集库存转换PDF任务3开始====="); - - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - ProjectListReq req = new ProjectListReq(); - req.setPageNumber(1); - req.setPageSize(BizConst.MAX_EXPORT_COUNT); - List approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) - .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) - .isNotNull(GovBizProjectApprove::getApprovalFile) - .isNull(GovBizProjectApprove::getApprovalFilePdf)); - - if(CollUtil.isEmpty(approves)){ - log.info("没有项目归集 审批信息 立项文件 任务终止"); - return; - } - - for(GovBizProjectApprove approve : approves){ - //开始转换PDF - convertPdfVo(approve.getBaseProjId()); - } - - stopWatch.stop(); - log.info("项目归集库存转换PDF任务3结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - //开始转换PDF - private void convertPdfVo(String baseProjId) { - convertPdfApply(baseProjId); - convertPdfApprove(baseProjId); - convertPdfCimplement(baseProjId); - convertPdfMimplement(baseProjId); - convertPdfAProcure(baseProjId); - } - - private void convertPdfApply(String baseProjId) { - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(apply)){ - return; - } - if(StringUtils.isBlank(apply.getBaseProjApplyFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjApplyFile())){ - StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjApplyFile()); - apply.setBaseProjApplyFilePdf(sj.toString()); - } - if(StringUtils.isBlank(apply.getBaseProjBasisFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjBasisFile())){ - StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjBasisFile()); - apply.setBaseProjBasisFilePdf(sj.toString()); - } - if(StringUtils.isBlank(apply.getBaseProjOtherFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjOtherFile())){ - StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjOtherFile()); - apply.setBaseProjOtherFilePdf(sj.toString()); - } - if(StringUtils.isBlank(apply.getBaseResearchReportFilePdf()) && StringUtils.isNotBlank(apply.getBaseResearchReportFile())){ - StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseResearchReportFile()); - apply.setBaseResearchReportFilePdf(sj.toString()); - } - if(StringUtils.isBlank(apply.getBaseOperatMaintenFilePdf()) && StringUtils.isNotBlank(apply.getBaseOperatMaintenFile())){ - StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseOperatMaintenFile()); - apply.setBaseOperatMaintenFilePdf(sj.toString()); - } - applyService.updateById(apply); - } - - private void convertPdfApprove(String baseProjId) { - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(approve)){ - return; - } - if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ - StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); - approve.setApprovalFilePdf(sj.toString()); - } - if(StringUtils.isBlank(approve.getPreliminaryDesignFilePdf()) && StringUtils.isNotBlank(approve.getPreliminaryDesignFile())){ - StringJoiner sj = collectionManage.convertAndUpload(approve.getPreliminaryDesignFile()); - approve.setPreliminaryDesignFilePdf(sj.toString()); - } - if(StringUtils.isBlank(approve.getBaseReviewCommentsFilePdf()) && StringUtils.isNotBlank(approve.getBaseReviewCommentsFile())){ - StringJoiner sj = collectionManage.convertAndUpload(approve.getBaseReviewCommentsFile()); - approve.setBaseReviewCommentsFilePdf(sj.toString()); - } - approveService.updateById(approve); - } - - private void convertPdfCimplement(String baseProjId) { - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(cimplement)){ - return; - } - if(StringUtils.isBlank(cimplement.getBaseCheckFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseCheckFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseCheckFile()); - cimplement.setBaseCheckFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChanFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChanFile()); - cimplement.setBaseChanFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseChangeFormFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChangeFormFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChangeFormFile()); - cimplement.setBaseChangeFormFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseUserConsFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseUserConsFile()); - cimplement.setBaseUserConsFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEstaSummFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEstaSummFile()); - cimplement.setBaseEstaSummFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEngineerPostpoFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEngineerPostpoFile()); - cimplement.setBaseEngineerPostpoFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(cimplement.getBasePasswAssessFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBasePasswAssessFile()); - cimplement.setBasePasswAssessFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile()); - cimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseFinanlAuditFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinanlAuditFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinanlAuditFile()); - cimplement.setBaseFinanlAuditFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseInitialOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInitialOpinionFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInitialOpinionFile()); - cimplement.setBaseInitialOpinionFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile()); - cimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseSummReportFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseSummReportFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseSummReportFile()); - cimplement.setBaseSummReportFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinalExpertOpinionFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinalExpertOpinionFile()); - cimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseIrsTestRunFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseIrsTestRunFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseIrsTestRunFile()); - cimplement.setBaseIrsTestRunFilePdf(sj.toString()); - } - if(StringUtils.isBlank(cimplement.getBaseInforLevelFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ - StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInforLevelFile()); - cimplement.setBaseInforLevelFilePdf(sj.toString()); - } - cimplementService.updateById(cimplement); - } - - private void convertPdfMimplement(String baseProjId) { - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(mimplement)){ - return; - } - if(StringUtils.isBlank(mimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseChanFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseChanFile()); - mimplement.setBaseChanFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseUserConsFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseUserConsFile()); - mimplement.setBaseUserConsFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEstaSummFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEstaSummFile()); - mimplement.setBaseEstaSummFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerPostpoFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerPostpoFile()); - mimplement.setBaseEngineerPostpoFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(mimplement.getBasePasswAssessFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBasePasswAssessFile()); - mimplement.setBasePasswAssessFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile()); - mimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile()); - mimplement.setBaseThirdAcceptFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseFinalExpertOpinionFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseFinalExpertOpinionFile()); - mimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseEngineerAlterFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerAlterFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerAlterFile()); - mimplement.setBaseEngineerAlterFilePdf(sj.toString()); - } - if(StringUtils.isBlank(mimplement.getBaseOperatMaintenSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseOperatMaintenSummFile())){ - StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseOperatMaintenSummFile()); - mimplement.setBaseOperatMaintenSummFilePdf(sj.toString()); - } - mimplementService.updateById(mimplement); - } - - private void convertPdfAProcure(String baseProjId) { - List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - for(GovBizProjectProcure procure : procures){ - if(StringUtils.isBlank(procure.getPurchaseContractPdf()) && StringUtils.isNotBlank(procure.getPurchaseContract())){ - StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseContract()); - procure.setPurchaseContractPdf(sj.toString()); - } - if(StringUtils.isBlank(procure.getPurchaseFilePdf()) && StringUtils.isNotBlank(procure.getPurchaseFile())){ - StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseFile()); - procure.setPurchaseFilePdf(sj.toString()); - } - if(StringUtils.isBlank(procure.getBiddingFilePdf()) && StringUtils.isNotBlank(procure.getBiddingFile())){ - StringJoiner sj = collectionManage.convertAndUpload(procure.getBiddingFile()); - procure.setBiddingFilePdf(sj.toString()); - } - procureService.updateById(procure); - } - } - - public void doTaskSingle(List projectCodes) { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - log.info("数据同步任务 指定项目编号 :{}",projectCodes); - - if(CollUtil.isEmpty(projectCodes)){ - throw new BizException("不能为空!"); - } - - //全量项目归集 - ProjectListReq req = new ProjectListReq(); - req.setPageNumber(PAGE_NUMBER); - req.setPageSize(1000); - PageVo projectCollectionPage = collectionManage.list(req); - - log.info("projectCollections size :{}",projectCollectionPage.getTotal()); - - for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){ - GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId()); - collectionManage.pushProjectVo(projectDetail); - } - - //2.运维备案项目 - PageVo operationList = collectionManage.operationList(req); - log.info("operation list size :{}",operationList.getTotal()); - for(GovBizProjectListVO vo : operationList.getRecords()){ - GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId()); - GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo(); - if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) || - Boolean.FALSE.equals(baseinfo.getPush())){ - log.info("此运维项目不用推送:" + vo.getBaseProjId()); - } - collectionManage.pushProjectVo(operationDetail); - } - - //3.申报项目 需要推送的项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest,Boolean.TRUE) - .eq(Project::getPush,Boolean.TRUE) - .in(Project::getProjectCode,projectCodes)); - log.info("projects need push size :{}",projects.size()); - for(Project project : projects){ - ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode()); - GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); - if(Objects.nonNull(vo)){ - collectionManage.pushProjectVo(vo); - } - } - - stopWatch.stop(); - log.info("数据同步任务 指定项目编号 结束====={}s",stopWatch.getTotalTimeSeconds()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java deleted file mode 100644 index 7643652..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ /dev/null @@ -1,251 +0,0 @@ -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.google.common.collect.Lists; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; -import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; -import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -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.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author ZPF - * @since 2023/09/13 18:16 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class SynProjectCoreBizTask { - - @Value("${hostname}") - public String HOST; - - @Value("${spring.profiles.active}") - public String active; - - @Autowired - private IProjectCoreBizService projectCoreBizService; - - @Autowired - private IDingOrganizationService organizationService; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private ProjectIrsManage projectIrsManage; - - private final Integer MAX_PAGE_SIZE = 1000; - - /** - * 前置机每天晚上10点自动清空,第二天早上6点获取数据 - * 定时同步前置机数据 每天1点开始执行一次 不按照单位 - * - */ -// @Scheduled(cron = "0 0 2 * * ?") - public void doTask() throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - return; - } - - log.info("同步项目核心业务开始====="); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE - , DingOrganizationContant.GOV_TEMPORARY))); - - log.info("总共需要同步 orgs size :{}",orgs.size()); - - syncCoreBiz(orgs); - stopWatch.stop(); - log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - public void doTask(String orgCode) throws UnknownHostException { - log.info("同步项目核心业务开始====="); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE - , DingOrganizationContant.GOV_TEMPORARY)) - .eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode)); - - log.info("总共需要同步 orgs size :{}",orgs.size()); - - syncCoreBiz(orgs); - - stopWatch.stop(); - log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); - } - - private void syncCoreBiz(List orgs) { - for(DingOrganization organization : orgs){ - GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); - - log.info("core biz result : {}",JSON.toJSONString(dingResult)); - - if(dingResult.isSuccess()){ - DingOrgInfoDTO data = dingResult.getData(); - String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); - if(StringUtils.isNotBlank(unifiedSocialCreditCode)){ - organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); - organizationService.updateById(organization); - } - - //去请求IRS接口 - JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1); - - JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isNotEmpty(jsonArray)){ - jsonArray.forEach(j -> { - JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); - ProjectCoreBiz coreBiz = new ProjectCoreBiz(); - // - Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); - String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); - String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); - String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); - String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); - String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); - ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) - .eq(ProjectCoreBiz::getIrsId, irsId) - .last(BizConst.LIMIT_1)); - - if(Objects.nonNull(old)){ - coreBiz.setId(old.getId()); - }else{ - coreBiz.setCreateOn(LocalDateTime.now()); - } - coreBiz.setUpdateOn(LocalDateTime.now()); - coreBiz.setIrsId(irsId); - coreBiz.setMatterName(matterName); - coreBiz.setOrgCode(dingCode); - coreBiz.setOrgName(orgName); - coreBiz.setUserState(userState); - coreBiz.setAreaName(areaName); - coreBiz.setMatterCode(irsId.toString()); - projectCoreBizService.saveOrUpdate(coreBiz); - coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId())); - projectCoreBizService.updateById(coreBiz); - }); - } - } - } - } - - private void syncCoreBiz() { - Map map = organizationService.list().stream().distinct().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); - - Integer currentSize = MAX_PAGE_SIZE; - Integer page = 1; - while (currentSize.equals(MAX_PAGE_SIZE)) { - //去请求IRS接口 - JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, null, MAX_PAGE_SIZE, page); - - JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); - - if(Objects.isNull(jsonArray)){ - return; - } - - currentSize = jsonArray.size(); - if (CollUtil.isNotEmpty(jsonArray)) { - if (currentSize.equals(MAX_PAGE_SIZE)) { - page++; - } - jsonArray.forEach(j -> { - JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); - ProjectCoreBiz coreBiz = new ProjectCoreBiz(); - // - Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); - String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); - String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); - String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); - String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); - String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); - ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) - .eq(ProjectCoreBiz::getIrsId, irsId) - .last(BizConst.LIMIT_1)); - - if (Objects.nonNull(old)) { - coreBiz.setId(old.getId()); - } else { - coreBiz.setCreateOn(LocalDateTime.now()); - } - - if(map.containsKey(dingCode)){ - DingOrganization organization = map.get(dingCode); - - String unifiedSocialCreditCode = organization.getUnifiedSocialCreditCode(); - if(StringUtils.isBlank(unifiedSocialCreditCode)){ - GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); - - log.info("ding org result : {}",JSON.toJSONString(dingResult)); - - if(dingResult.isSuccess()){ - DingOrgInfoDTO data = dingResult.getData(); - unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); - organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); - organizationService.updateById(organization); - } - } - - coreBiz.setUpdateOn(LocalDateTime.now()); - coreBiz.setIrsId(irsId); - coreBiz.setMatterName(matterName); - coreBiz.setOrgCode(dingCode); - coreBiz.setOrgName(orgName); - coreBiz.setUserState(userState); - coreBiz.setAreaName(areaName); - coreBiz.setMatterCode(irsId.toString()); - projectCoreBizService.saveOrUpdate(coreBiz); - coreBiz.setMatterCode(genirate(unifiedSocialCreditCode, coreBiz.getId())); - projectCoreBizService.updateById(coreBiz); - } - }); - } - } - } - - /** - * 生成 编号 - * @param unifiedSocialCreditCode - * @param id - * @return - */ - private String genirate(String unifiedSocialCreditCode, Long id) { - String formatId = String.format(ProjectCodeContant.SHUZI_4, id); - return unifiedSocialCreditCode + formatId; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProvinceOrgTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProvinceOrgTask.java deleted file mode 100644 index 2f05f34..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProvinceOrgTask.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip; -import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO; -import com.ningdatech.pmapi.organization.service.IProvincialGovBusinessStripService; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -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.util.List; -import java.util.stream.Collectors; - -/** - * @author ZPF - * @since 2023/08/31 18:16 - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class SynProvinceOrgTask { - - @Value("${hostname}") - public String HOST; - - @Value("${spring.profiles.active}") - public String active; - - @Autowired - private IProvincialGovBusinessStripService provincialGovBusinessStripService; - - @Autowired - private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - /** - * - */ - @Scheduled(cron = "0 0 3 * * ?") - public void doTask() throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - return; - } - - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - log.info("同步省局升级单位数据任务开始====={}s",stopWatch.getTotalTimeSeconds()); - - List res = Lists.newArrayList(); - for(int i = 0;i < 10;i++){ - res = joinReviewProvincialBureauService.searchGovUnits(); - if(CollUtil.isNotEmpty(res)){ - log.info("请求到了数据 :{}",res.size()); - break; - } - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - if(CollUtil.isEmpty(res)){ - log.info("一直都没请求到数据 任务结束"); - return; - } - - - log.info("数据同步任务开始之前 先删除前置机上的所有数据"); - provincialGovBusinessStripService.remove(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class)); - - List saves = res.stream().map(r -> { - ProvincialGovBusinessStrip strip = new ProvincialGovBusinessStrip(); - strip.setBusinessStripCode(r.getBusinessStripCode()); - strip.setBusinessStripName(r.getBusinessStripName()); - return strip; - }).collect(Collectors.toList()); - provincialGovBusinessStripService.saveBatch(saves); - - stopWatch.stop(); - log.info("同步省局升级单位数据任务结束====={}s",stopWatch.getTotalTimeSeconds()); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java deleted file mode 100644 index 7a9a673..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.time.LocalDateTime; -import java.util.List; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; -import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.zwdd.client.ZwddClient; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.staging.contants.StagingContant; - -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * 发送工作通知定时任务 - * @return - * @author CMM - * @since 2023/02/28 21:23 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class WorkNoticeFlowTask { - - private final INdWorkNoticeStagingService workNoticeStagingService; - private final ZwddClient zwddClient; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(cron = "0 */1 * * * ?") - public void statusFlow() throws UnknownHostException { - //测试暂时用自己电脑HOST - if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - //1. 定时取 工作通知暂存表的数据进行发送 - List stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) - .eq(WorkNoticeStaging::getDead, Boolean.FALSE) - .le(WorkNoticeStaging::getNextTime, LocalDateTime.now()) - .le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) - .orderByAsc(WorkNoticeStaging::getId)); - - log.info("需要发送的工作通知 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); - if(CollUtil.isEmpty(stagingList)){ - log.info("没有需要发送的工作通知!"); - return; - } - //遍历 - for(WorkNoticeStaging workNoticeStaging : stagingList){ - try{ - WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); - BeanUtils.copyProperties(workNoticeStaging,workNoticeInfo); - String receiverUserId = workNoticeInfo.getReceiverUserId(); - String bizMsgId = workNoticeInfo.getBizMsgId(); - String msg = workNoticeInfo.getMsg(); - GenericResult result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg); - if (result.isSuccess()){ - //执行成功了 删除暂存的数据 - workNoticeStagingService.removeById(workNoticeStaging); - } - }catch (Exception e){ - log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e); - }finally { - //增加重试的次数 和下次扫描时间 - workNoticeStagingService.addRetryTimes(workNoticeStaging); - } - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/model/CommonLog.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/model/CommonLog.java deleted file mode 100644 index 6e58e03..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/model/CommonLog.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.scheduler.task.model; - -import lombok.Data; - -@Data -public class CommonLog { - /** - * 用户id - */ - private String userId; - /** - * 用户角色(群众、企业、政府工作人员、第三方) - */ - private String userRole; - /** - * 地区编码 - */ - private String areaCode; - /** - * 操作类型(1-登录 2-离开 3-办事开始 4-办事结束) - */ - private Integer actionType; - /** - * 操作标识 - */ - private String actionId; - /** - * 操作时间 - */ - private String actionTime; - /** - * 操作时长 - */ - private Long actionDuration; - /** - * 操作状态(0-成功 1-失败) - */ - private Integer actionStatus; - /** - * 应用编码 - */ - private String appCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/utils/DateUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/utils/DateUtil.java deleted file mode 100644 index 1e57b6e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/utils/DateUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.scheduler.utils; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Calendar; -import java.util.Date; -import java.util.Objects; - -/** - * @Classname DateUtil - * @Description - * @Date 2023/8/31 15:36 - * @Author PoffyZhang - */ -public class DateUtil { - - public static Date getTodayTime(int hour){ - // 获取当前日期时间 - Calendar calendar = Calendar.getInstance(); - - // 将时间设置为凌晨 - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - - // 获取凌晨时间 - Date date = calendar.getTime(); - return date; - } - - public static LocalDateTime convertDateToLocal(Date date){ - if(Objects.isNull(date)){ - return null; - } - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/controller/NdCompanySignatureController.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/controller/NdCompanySignatureController.java deleted file mode 100644 index d5269da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/controller/NdCompanySignatureController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.signature.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -@Controller -@RequestMapping("/pmapi.signature/nd-company-signature") -public class NdCompanySignatureController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java deleted file mode 100644 index bc7f756..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.signature.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -@TableName("nd_company_signature") -@Data -@ApiModel(value = "NdCompanySignature对象", description = "") -public class CompanySignature implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private String sealSn; - - private String organizationCode; - - private LocalDateTime createOn; - - private Long createBy; - - private LocalDateTime updateOn; - - private Long updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.java deleted file mode 100644 index c2c0ffd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.signature.mapper; - -import com.ningdatech.pmapi.signature.entity.CompanySignature; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -public interface CompanySignatureMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.xml deleted file mode 100644 index c9daa4f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/mapper/CompanySignatureMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/ICompanySignatureService.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/ICompanySignatureService.java deleted file mode 100644 index ba9ae1d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/ICompanySignatureService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.signature.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.signature.entity.CompanySignature; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -public interface ICompanySignatureService extends IService { - - CompanySignature getByOrganizationCode(String orgCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/impl/CompanySignatureServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/impl/CompanySignatureServiceImpl.java deleted file mode 100644 index d329722..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/service/impl/CompanySignatureServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.signature.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.signature.entity.CompanySignature; -import com.ningdatech.pmapi.signature.mapper.CompanySignatureMapper; -import com.ningdatech.pmapi.signature.service.ICompanySignatureService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-10 - */ -@Service -public class CompanySignatureServiceImpl extends ServiceImpl implements ICompanySignatureService { - - @Override - public CompanySignature getByOrganizationCode(String orgCode) { - if (StringUtils.isBlank(orgCode)) { - return null; - } - return this.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, orgCode)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/DatePattern.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/DatePattern.java deleted file mode 100644 index 0861a36..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/DatePattern.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.sms.constant; - -/** - *

- * DatePattern - *

- * - * @author WendyYang - * @since 09:28 2022/5/10 - */ -public interface DatePattern { - - String TIME_ZONE = "GMT+8"; - - String T = "'T'"; - String GMT = "XXX"; - - String YMD_HMS = "yyyy-MM-dd HH:mm:ss"; - - String YMD_HMS_1 = "yyyyMMddHHmmss"; - - String YMD_HMS_S = "yyyy-MM-dd HH:mm:ss.SSS"; - - String YMD = "yyyy-MM-dd"; - String YMD_0 = "yyyy/MM/dd"; - String YMD_1 = "yyyyMMdd"; - String HMS = "HH:mm:ss"; - String HMS_0 = "HH/mm/ss"; - String HMS_1 = "HHmmss"; - - String YMD_HMS_GMT = YMD + T + HMS + GMT; - - String EEE = "EEE"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java deleted file mode 100644 index 4c4ac97..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.sms.constant; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.stream.Stream; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:50 - */ - -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ApiModel(value = "VerificationCodeType", description = "验证码类型") -public enum VerificationCodeType { - - /** - * 用户登陆 - */ - LOGIN("用户登录", 1, 5, 10), - - /** - * 社会专家注册 - */ - EXPERT_REGISTER("社会专家注册", 1, 5, 10); - - @ApiModelProperty(value = "描述") - private String desc; - - @ApiModelProperty(value = "发送间隔(单位:分钟)") - private Integer sendInterval; - - @ApiModelProperty(value = "过期时间(单位:分钟)") - private Integer expireTime; - - /** - * 小于等于0则不限制次数,超出次数限制则锁定验证码发送 - */ - @ApiModelProperty(value = "每日发送次数") - private Integer sendTimesByDay; - - - public static VerificationCodeType match(String val, VerificationCodeType def) { - return Stream.of(values()).filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); - } - - public static VerificationCodeType get(String val) { - return match(val, null); - } - - public boolean eq(VerificationCodeType val) { - return val != null && this.name().equals(val.name()); - } - - @ApiModelProperty(value = "编码") - public String getCode() { - return this.name(); - } - - public static VerificationCodeType of(String key) { - for (VerificationCodeType statusEnum : VerificationCodeType.values()) { - if (statusEnum.name().equals(key)) { - return statusEnum; - } - } - throw new IllegalArgumentException(String.format("Illegal VerificationCodeType = %s", key)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java deleted file mode 100644 index 030855d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.sms.constant; - -/** - *

- * VoiceSmsTemplateConst - *

- * - * @author WendyYang - * @since 15:10 2023/3/30 - */ -public interface VoiceSmsTemplateConst { - - /** - * 短信登陆验证码 - */ - String SMS_COMMON_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; - - /** - * 社会专家报名 - */ - String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; - - /** - * 专家电话通知语音模版 - */ - String OFFLINE_TEMPLATE = "尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请按 1,拒绝参加请按 2。请您选择"; - - /** - * 专家同意参加短信通知模板 - */ - String EXPERT_AGREE_ATTEND_TEMPLATE = ""; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/controller/VerificationCodeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/controller/VerificationCodeController.java deleted file mode 100644 index 2eed155..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/controller/VerificationCodeController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.sms.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; -import com.ningdatech.pmapi.sms.manage.SmsManage; -import com.ningdatech.pmapi.sms.model.po.ReqVerificationCodePO; -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.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:40 - */ -@Slf4j -@RestController -@RequestMapping("/api/v1/verification") -@Api(tags = "验证码相关接口") -@RequiredArgsConstructor -public class VerificationCodeController { - - - private final SmsManage smsManage; - - /** - * 通用的发送验证码功能 - * 一个系统可能有很多地方需要发送验证码(注册、找回密码等) - * 每增加一个场景{@link VerificationCodeType}就需要增加一个枚举值 - */ - @ApiOperation(value = "发送验证码", notes = "发送验证码") - @PostMapping(value = "/send") - @WebLog("发送验证码") - public void send(@Validated @RequestBody ReqVerificationCodePO request) { - smsManage.sendVerificationCode(request); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/helper/VerifyCodeCheckHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/helper/VerifyCodeCheckHelper.java deleted file mode 100644 index ac26416..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/helper/VerifyCodeCheckHelper.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.sms.helper; - -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; -import com.ningdatech.pmapi.sms.model.dto.VerifyCodeCacheDTO; -import com.ningdatech.pmapi.sms.utils.SmsRedisKeyUtils; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2022/8/16 上午11:43 - */ -@Component -@RequiredArgsConstructor -public class VerifyCodeCheckHelper { - - private final CachePlusOps cachePlusOps; - - /** - * 对某种类型的验证码进行校验 - * @param type - * @param mobile - * @param verificationCode - * @return - */ - public boolean verification(VerificationCodeType type, String mobile, String verificationCode) { - if (StringUtils.isBlank(mobile) || Objects.isNull(type)) { - return false; - } - String key = SmsRedisKeyUtils.smsCodeVerifyKey(type, mobile); - Object cacheObj = cachePlusOps.get(key); - if (Objects.isNull(cacheObj)) { - return false; - } - VerifyCodeCacheDTO cache = (VerifyCodeCacheDTO) cacheObj; - return verificationCode.trim().equals(cache.getCode()); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java deleted file mode 100644 index d32d4f5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ningdatech.pmapi.sms.manage; - -import cn.hutool.core.util.PhoneUtil; -import cn.hutool.core.util.RandomUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; -import com.ningdatech.pmapi.sms.constant.VoiceSmsTemplateConst; -import com.ningdatech.pmapi.sms.model.dto.VerifyCodeCacheDTO; -import com.ningdatech.pmapi.sms.model.po.ReqVerificationCodePO; -import com.ningdatech.pmapi.sms.utils.DateUtil; -import com.ningdatech.pmapi.sms.utils.SmsRedisKeyUtils; -import com.ningdatech.yxt.client.YxtClient; -import com.ningdatech.yxt.constants.YxtSmsSignEnum; -import com.ningdatech.yxt.model.cmd.SendSmsCmd; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:42 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class SmsManage { - - private final YxtClient yxtClient; - private final CachePlusOps cachePlusOps; - - public void sendVerificationCode(ReqVerificationCodePO request) { - Assert.isTrue(PhoneUtil.isMobile(request.getMobile()), "手机号码格式不正确"); - String verificationType = request.getVerificationType(); - VerificationCodeType verificationCodeTypeEnum = VerificationCodeType.of(verificationType); - - // 验证是否被锁定 - String lockKey = SmsRedisKeyUtils.smsSendLockKey(verificationCodeTypeEnum, request.getMobile()); - if (StringUtils.isNotBlank(cachePlusOps.get(lockKey))) { - throw BizException.wrap("今日" + verificationCodeTypeEnum.getDesc() + "的验证码发送次数过多,已被锁定"); - } - // 验证发送间隔 - String cacheKey = SmsRedisKeyUtils.smsCodeVerifyKey(verificationCodeTypeEnum, request.getMobile()); - VerifyCodeCacheDTO preCache = (VerifyCodeCacheDTO) cachePlusOps.get(cacheKey); - if (preCache != null) { - if (LocalDateTime.now().minusMinutes(verificationCodeTypeEnum.getSendInterval()) - .isBefore(preCache.getSendTime())) { - throw BizException.wrap(verificationCodeTypeEnum.getSendInterval() + "分钟之内已发送过验证码,请稍后重试"); - } - } - String code = RandomUtil.randomNumbers(6); - VerifyCodeCacheDTO cache = VerifyCodeCacheDTO.builder() - .code(code) - .sendTime(LocalDateTime.now()) - .mobile(request.getMobile()) - .build(); - - // 创建短信内容 - SendSmsCmd sendSmsCmd = new SendSmsCmd(); - switch (verificationCodeTypeEnum) { - case LOGIN: { - SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); - sendSmsContext.setReceiveNumber(request.getMobile()); - sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_COMMON_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime())); - sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); - sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - } - break; - case EXPERT_REGISTER: { - SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); - sendSmsContext.setReceiveNumber(request.getMobile()); - sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, verificationCodeTypeEnum.getExpireTime())); - sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); - sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - } - break; - default: - throw new IllegalArgumentException("非法的短信发送类型"); - } - - // 发送 短信 - yxtClient.submitSmsTask(sendSmsCmd); - log.info("send verificationCode mobile = {},code = {}", request.getMobile(), code); - - cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache); - String limitKey = SmsRedisKeyUtils.smsSendLimitKey(verificationCodeTypeEnum, request.getMobile()); - if (Objects.nonNull(cachePlusOps.get(limitKey))) { - Integer limitCount = cachePlusOps.get(limitKey); - cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), limitCount++); - // 超出单日发送次数之后直接锁定 - if (limitCount >= verificationCodeTypeEnum.getSendTimesByDay().longValue()) { - cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile()); - } - } else { - cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), 1); - } - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/dto/VerifyCodeCacheDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/dto/VerifyCodeCacheDTO.java deleted file mode 100644 index 68d2fad..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/dto/VerifyCodeCacheDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.sms.model.dto; - -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:42 - */ -@Data -@Builder -public class VerifyCodeCacheDTO { - - @Tolerate - public VerifyCodeCacheDTO() { - } - - private String mobile; - - private LocalDateTime sendTime; - - private String code; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/po/ReqVerificationCodePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/po/ReqVerificationCodePO.java deleted file mode 100644 index 3e41378..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/model/po/ReqVerificationCodePO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.sms.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:40 - */ -@Data -@ApiModel(value = "VerificationCodeRequest", description = "验证码发送验证") -public class ReqVerificationCodePO implements Serializable { - - @ApiModelProperty(value = "手机号") - @NotBlank(message = "手机号不能为空") - private String mobile; - - @ApiModelProperty(value = "短信类型", allowableValues = "LOGIN") - @NotBlank(message = "短信类型不能为空") - private String verificationType; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/task/YxtPollingTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/task/YxtPollingTask.java deleted file mode 100644 index 25c8093..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/task/YxtPollingTask.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.sms.task; - -import com.ningdatech.yxt.client.YxtContext; -import lombok.RequiredArgsConstructor; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * @author liuxinxin - * @date 2022/8/9 下午3:58 - * 音信通定时检查电话结果 - */ -@Component -@RequiredArgsConstructor -public class YxtPollingTask { - - - private final YxtContext yxtContext; - - /** - * 校验音信通结果数据 - * 每5分钟执行一次 - */ - @Scheduled(cron = "0 */1 * * * ?") -// @Scheduled(cron = "${cron-expression.sms-msg-result-check-cron}") - public void smsMsgResultCheck() { - yxtContext.smsMsgResultCheck(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/DateUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/DateUtil.java deleted file mode 100644 index 74ac293..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/DateUtil.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.ningdatech.pmapi.sms.utils; - - -import com.ningdatech.pmapi.sms.constant.DatePattern; - -import java.time.*; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; -import java.util.Date; - -/** - * @author qinxianyun - * JDK 8 新日期类 格式化与字符串转换 工具类 - */ -public class DateUtil { - - public static final DateTimeFormatter DTF_YMD_HMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - - public static final DateTimeFormatter DTF_YMD_HMS_COMPRESS = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); - - public static final DateTimeFormatter DTF_YMD_HM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); - - public static final DateTimeFormatter DTF_YMD = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - - public static final DateTimeFormatter DTF_YMD_SLASH = DateTimeFormatter.ofPattern("yyyy/MM/dd"); - - public static final DateTimeFormatter DTF_HMS = DateTimeFormatter.ofPattern("HH:mm:ss"); - - /** - * 最大时间,三位小数 - */ - public static final LocalTime LOCAL_TIME_3D = LocalTime.of(23, 59, 59, 999_000_00); - - /** - * LocalDateTime 转时间戳 - * - * @param localDateTime / - * @return / - */ - public static Long getTimeStamp(LocalDateTime localDateTime) { - return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond(); - } - - /** - * 时间戳转LocalDateTime - * - * @param timeStamp / - * @return / - */ - public static LocalDateTime fromTimeStamp(Long timeStamp) { - return LocalDateTime.ofEpochSecond(timeStamp, 0, OffsetDateTime.now().getOffset()); - } - - /** - * LocalDateTime 转 Date - * Jdk8 后 不推荐使用 {@link Date} Date - * - * @param localDateTime / - * @return / - */ - public static Date toDate(LocalDateTime localDateTime) { - return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); - } - - /** - * LocalDate 转 Date - * Jdk8 后 不推荐使用 {@link Date} Date - * - * @param localDate / - * @return / - */ - public static Date toDate(LocalDate localDate) { - return toDate(localDate.atTime(LocalTime.now(ZoneId.systemDefault()))); - } - - - /** - * Date转 LocalDateTime - * Jdk8 后 不推荐使用 {@link Date} Date - * - * @param date / - * @return / - */ - public static LocalDateTime toLocalDateTime(Date date) { - return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); - } - - /** - * 日期 格式化 - * - * @param localDateTime / - * @param patten / - * @return / - */ - public static String localDateTimeFormat(LocalDateTime localDateTime, String patten) { - DateTimeFormatter df = DateTimeFormatter.ofPattern(patten); - return df.format(localDateTime); - } - - /** - * 日期 格式化 - * - * @param localDateTime / - * @param df / - * @return / - */ - public static String localDateTimeFormat(LocalDateTime localDateTime, DateTimeFormatter df) { - return df.format(localDateTime); - } - - /** - * 日期格式化 yyyy-MM-dd HH:mm:ss - * - * @param localDateTime / - * @return / - */ - public static String localDateTimeFormatyMdHms(LocalDateTime localDateTime) { - return DTF_YMD_HMS.format(localDateTime); - } - - /** - * 日期格式化 yyyy-MM-dd - * - * @param localDateTime / - * @return / - */ - public String localDateTimeFormatyMd(LocalDateTime localDateTime) { - return DTF_YMD.format(localDateTime); - } - - /** - * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd - * - * @param localDateTime / - * @return / - */ - public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, String pattern) { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern); - return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); - } - - /** - * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd - * - * @param localDateTime / - * @return / - */ - public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, DateTimeFormatter dateTimeFormatter) { - return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); - } - - /** - * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd HH:mm:ss - * - * @param localDateTime / - * @return / - */ - public static LocalDateTime parseLocalDateTimeFormatyMdHms(String localDateTime) { - return LocalDateTime.from(DTF_YMD_HMS.parse(localDateTime)); - } - - public static String weekday(LocalDate date) { - return date.format(DateTimeFormatter.ofPattern(DatePattern.EEE)); - } - - public static String weekdayWithChou(LocalDate date) { - return date.format(DateTimeFormatter.ofPattern(DatePattern.EEE)).replace("星期", "周"); - } - - public static boolean between(LocalDate target, LocalDate start, LocalDate end) { - return !(target.isBefore(start) || target.isAfter(end)); - } - - public static boolean between(LocalDateTime target, LocalDateTime start, LocalDateTime end) { - return !(target.isBefore(start) || target.isAfter(end)); - } - - public static boolean between(LocalTime target, LocalTime start, LocalTime end) { - return !(target.isBefore(start) || target.isAfter(end)); - } - - public static boolean between(Date target, Date start, Date end) { - return !(target.before(start) || target.after(end)); - } - - public static LocalDateTime min(LocalDateTime time1, LocalDateTime time2) { - return time1.isAfter(time2) ? time2 : time1; - } - - public static LocalDateTime max(LocalDateTime time1, LocalDateTime time2) { - return time1.isBefore(time2) ? time2 : time1; - } - - public static long restSecondsFromNowToNoon() { - return ChronoUnit.SECONDS.between(LocalDateTime.now(), LocalDate.now().atTime(LocalTime.MAX)); - } - - public static boolean intersect(LocalDateTime startG1, LocalDateTime endG1, LocalDateTime startG2, LocalDateTime endG2) { - if (!startG1.isBefore(startG2) && !startG1.isAfter(endG2)) { - return Boolean.TRUE; - } - return !endG1.isBefore(startG2) && !endG1.isAfter(endG2); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/SmsRedisKeyUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/SmsRedisKeyUtils.java deleted file mode 100644 index 1a5fa44..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/utils/SmsRedisKeyUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.sms.utils; - -import cn.hutool.core.text.StrPool; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; - -/** - *

- * SmsRedisKeyUtils - *

- * - * @author WendyYang - * @since 11:21 2022/7/25 - */ -public class SmsRedisKeyUtils { - - private SmsRedisKeyUtils() { - } - - private static final String PROJECT_NAME = "ls_pm:"; - - private static final String SMS_CODE_VERIFY_PREFIX = "sms:verify:"; - private static final String SMS_SEND_LIMIT = "sms:limit:"; - private static final String SMS_SEND_LOCK = "sms:lock:"; - - public static String smsCodeVerifyKey(VerificationCodeType type, String mobile) { - return PROJECT_NAME + SMS_CODE_VERIFY_PREFIX + StrPool.COLON + type.name() + StrPool.COLON + mobile; - } - - public static String smsSendLimitKey(VerificationCodeType type, String mobile) { - return PROJECT_NAME + SMS_SEND_LIMIT + StrPool.COLON + type.name() + StrPool.COLON + mobile; - } - - public static String smsSendLockKey(VerificationCodeType type, String mobile) { - return PROJECT_NAME + SMS_SEND_LOCK + StrPool.COLON + type.name() + StrPool.COLON + mobile; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/contants/StagingContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/contants/StagingContant.java deleted file mode 100644 index 173e2c8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/contants/StagingContant.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.ningdatech.pmapi.staging.contants; - -/** - * 项目暂存 静态配置 - */ -public interface StagingContant { - - class Retry { - public static final Integer MAX_RETRY_TIMES = 10; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java deleted file mode 100644 index a6b672c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ningdatech.pmapi.staging.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * 消息类型枚举 - * - * @author CMM - * @since 2023/02/28 17:34 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum MsgTypeEnum { - /** - * 项目待审核 - */ - PROJECT_REVIEW(1, "项目审核"), - /** - * 预警提醒 - */ - WARING(2, "预警提醒"), - /** - * 专家评审 - */ - EXPERT_REVIEW(3, "专家评审"), - /** - * 评审会议 - */ - REVIEW_MEETING(4, "评审会议"), - /** - * 项目审核被退回 - */ - PROJECT_REVIEW_BACK(5, "项目审核"), - /** - * 项目审核通过 - */ - PROJECT_REVIEW_PASS(6, "项目审核"), - /** - * 项目审核驳回 - */ - PROJECT_REVIEW_REJECT(7, "项目审核"), - - PROJECT_REVIEW_CC(8, "项目抄送"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (MsgTypeEnum t : MsgTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static String getDescByName(String name) { - if (StringUtils.isBlank(name)) { - return StringUtils.EMPTY; - } - for (MsgTypeEnum t : MsgTypeEnum.values()) { - if (name.equals(t.name())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public boolean eq(String val) { - return this.name().equals(val); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java deleted file mode 100644 index 9892c4d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.staging.mapper; - -import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; - -/** - *

- * Mapper 接口 - *

- * - * @author CMM - * @since 2023-02-28 - */ -public interface NdWorkNoticeStagingMapper extends BaseMapper { - - Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, - @Param("nextRetryTime") LocalDateTime nextRetryTime, @Param("dead") Boolean dead); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml deleted file mode 100644 index 759f056..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - update nd_work_notice_staging - set retry_times = #{retryTimes}, - next_time = #{nextRetryTime}, - dead = #{dead} - where id = #{id} and retry_times = #{retryTimes} - 1 - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.java deleted file mode 100644 index 5508314..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ningdatech.pmapi.staging.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; - -public interface ProjectStagingMapper extends BaseMapper { - - Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, - @Param("nextRetryTime") LocalDateTime nextRetryTime,@Param("dead") Boolean dead); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml deleted file mode 100644 index 929dbc9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - update nd_project_staging - set retry_times = #{retryTimes}, - next_time = #{nextRetryTime}, - dead = #{dead} - where id = #{id} and retry_times = #{retryTimes} - 1 - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/ProjectStaging.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/ProjectStaging.java deleted file mode 100644 index 583b57e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/ProjectStaging.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ningdatech.pmapi.staging.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.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * @Classname ProjectStaging - * @Description - * @Date 2023/2/20 9:40 - * @Author PoffyZhang - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@TableName("nd_project_staging") -@ApiModel(value = "ProjectStaging", description = "项目暂存表 扫描进行 状态继续流转 做解耦用") -public class ProjectStaging implements Serializable { - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("实例code") - private String instCode; - - @ApiModelProperty("流程状态") - private Integer processStatus; - - @ApiModelProperty("项目阶段") - private Integer stage; - - @ApiModelProperty("项目状态") - private Integer status; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("重试次数") - private Integer retryTimes; - - @ApiModelProperty("是否死信") - private Boolean dead; - - @ApiModelProperty("下次扫描时间") - private LocalDateTime nextTime; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("修改时间") - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java deleted file mode 100644 index 1308633..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.staging.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-02-28 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@TableName("nd_work_notice_staging") -@ApiModel(value = "NdWorkNoticeStaging对象", description = "") -public class WorkNoticeStaging implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("浙政钉用户ID") - private Long accountId; - - @ApiModelProperty("部门编号") - private String organizationCode; - - @ApiModelProperty("部门名称") - private String organizationName; - - @ApiModelProperty("工作通知唯一标识") - private String bizMsgId; - - @ApiModelProperty("接收人浙政钉ID") - private String receiverUserId; - - @ApiModelProperty("工作通知内容") - private String msg; - - @ApiModelProperty("重试次数 最大10次") - private Integer retryTimes; - - @ApiModelProperty("false 可继续扫描 true 死信") - private Boolean dead; - - @ApiModelProperty("下次扫描时间") - private LocalDateTime nextTime; - - @ApiModelProperty("消息类型") - private MsgTypeEnum msgType; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("更新时间") - private LocalDateTime updateOn; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java deleted file mode 100644 index c1d0e2f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.staging.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author CMM - * @since 2023-02-28 - */ -public interface INdWorkNoticeStagingService extends IService { - - Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging); - - Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType); - - /** - * 批量保存工作通知 - * - * @param workNoticeInfos 工作通知内容 - * @param msgType 通知类型 - */ - void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java deleted file mode 100644 index 1d3e2a9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.staging.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; - -/** - * @Classname IProjectStagingService - * @Description - * @Date 2023/2/20 10:08 - * @Author PoffyZhang - */ -public interface IProjectStagingService extends IService { - - Boolean addRetryTimes(ProjectStaging projectStaging); - - public Boolean addByProject(Project project,String remark) ; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java deleted file mode 100644 index 85c380a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ningdatech.pmapi.staging.service.impl; - -import com.ningdatech.pmapi.staging.contants.StagingContant; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; -import com.ningdatech.pmapi.staging.mapper.NdWorkNoticeStagingMapper; -import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.staging.utils.WorkNoticeFlowMapUtil; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author CMM - * @since 2023-02-28 - */ -@Service -@Slf4j -@RequiredArgsConstructor -public class NdWorkNoticeStagingServiceImpl extends ServiceImpl implements INdWorkNoticeStagingService { - - private final NdWorkNoticeStagingMapper mapper; - - private final WorkNoticeFlowMapUtil workNoticeFlowMapUtil; - - /** - * 增加 重试次数 和下次扫描时间 - * - * @param workNoticeStaging - * @return java.lang.Boolean - * @author CMM - * @since 2023/02/28 18:02 - */ - @Override - public Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging) { - Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; - if (!workNoticeFlowMapUtil.intervalTimeMap.containsKey(workNoticeStaging.getRetryTimes())) { - log.info("没有对应重试间隔时间 添加重试信息失败"); - return Boolean.FALSE; - } - Integer addSeconds = workNoticeFlowMapUtil.intervalTimeMap.get(workNoticeStaging.getRetryTimes()); - Boolean dead = Boolean.FALSE; - //超过重试最大次数 dead置为 true - if (retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0) { - dead = Boolean.TRUE; - } - LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); - return mapper.addRetryTimes(workNoticeStaging.getId(), retryTimes, nextRetryTime, dead); - } - - /** - * 在对应的流程处理后,增加一个工作通知到暂存表中 - * - * @param workNoticeInfo - * @param msgType - * @return java.lang.Boolean - * @author CMM - * @since 2023/02/28 20:02 - */ - @Override - public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) { - WorkNoticeStaging workNoticeStaging = WorkNoticeStaging.builder() - .accountId(workNoticeInfo.getAccountId()) - .msg(workNoticeInfo.getMsg()) - .bizMsgId(workNoticeInfo.getBizMsgId()) - .organizationCode(workNoticeInfo.getOrganizationCode()) - .organizationName(workNoticeInfo.getOrganizationName()) - .receiverUserId(workNoticeInfo.getReceiverUserId()) - .msgType(msgType) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .nextTime(LocalDateTime.now()) - .retryTimes(0) - .build(); - return this.save(workNoticeStaging); - } - - /** - * 在对应的流程处理后,增加一个工作通知到暂存表中 - * - * @param workNoticeInfos - * @param msgType - * @return java.lang.Boolean - * @author CMM - * @since 2023/02/28 20:02 - */ - @Override - public void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType) { - LocalDateTime now = LocalDateTime.now(); - List workNoticeInfoList = workNoticeInfos.stream() - .map(workNoticeInfo -> WorkNoticeStaging.builder() - .accountId(workNoticeInfo.getAccountId()) - .msg(workNoticeInfo.getMsg()) - .bizMsgId(workNoticeInfo.getBizMsgId()) - .organizationCode(workNoticeInfo.getOrganizationCode()) - .organizationName(workNoticeInfo.getOrganizationName()) - .receiverUserId(workNoticeInfo.getReceiverUserId()) - .msgType(msgType) - .createOn(now) - .updateOn(now) - .nextTime(now) - .retryTimes(0) - .build()).collect(Collectors.toList()); - saveBatch(workNoticeInfoList); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java deleted file mode 100644 index 25759ee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.staging.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.staging.contants.StagingContant; -import com.ningdatech.pmapi.staging.mapper.ProjectStagingMapper; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-18 - */ -@Service -@Slf4j -@RequiredArgsConstructor -public class ProjectStagingServiceImpl extends ServiceImpl implements IProjectStagingService { - - private final ProjectStagingMapper mapper; - - private final ProjectStatusFlowUtil projectStatusFlowUtil; - - /** - * 在某些状态节点 增加一个项目到状态暂存库 - * @param project - * @return - */ - @Override - public Boolean addByProject(Project project,String remark) { - ProjectStaging projectStaging = ProjectStaging.builder() - .projectId(project.getId()) - .projectName(project.getProjectName()) - .stage(project.getStage()) - .status(project.getStatus()) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .instCode(project.getInstCode()) - .processStatus(project.getProcessStatus()) - .nextTime(LocalDateTime.now()) - .retryTimes(0) - .remark(remark) - .build(); - return this.save(projectStaging); - } - - /** - * 增加 重试次数 和下次扫描时间 - * @param projectStaging - * @return - */ - @Override - public Boolean addRetryTimes(ProjectStaging projectStaging) { - Integer retryTimes = projectStaging.getRetryTimes() + 1; - if(!projectStatusFlowUtil.intervalTimeMap.containsKey(projectStaging.getRetryTimes())){ - log.info("没有对应重试间隔时间 添加重试信息失败"); - return Boolean.FALSE; - } - Integer addSeconds = projectStatusFlowUtil.intervalTimeMap.get(projectStaging.getRetryTimes()); - Boolean dead = Boolean.FALSE; - //超过重试最大次数 dead置为 true - if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ - dead = Boolean.TRUE; - } - LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); - return mapper.addRetryTimes(projectStaging.getId(),retryTimes,nextRetryTime,dead); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowMapUtil.java deleted file mode 100644 index 88d692a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowMapUtil.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.staging.utils; - -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.projectdeclared.manage.*; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.Map; -import java.util.function.Function; - -/** - * @Classname ProjectStatusFlowMapUtil - * @Description 状态流转 事件函数MAP - * @Date 2023/2/15 11:19 - * @Author PoffyZhang - */ -@Component -public class ProjectStatusFlowMapUtil { - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - - @Autowired - private ReviewByDeptJointManage reviewByDeptJointManage; - - public Map> statusFlowFunctionMap = Maps.newHashMap(); - - /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 - */ - public ProjectStatusFlowMapUtil(){ - //省级部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), - project->provincialDeptManage.startTheProcess(project)); - //部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), - project->reviewByDeptJointManage.startTheProcess(project)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowUtil.java deleted file mode 100644 index 293a4e7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.staging.utils; - -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.projectdeclared.manage.ReviewByDeptJointManage; -import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.Map; -import java.util.function.Function; - -/** - * @Classname ProjectStatusFlowMapUtil - * @Description 状态流转 事件函数MAP - * @Date 2023/2/15 11:19 - * @Author PoffyZhang - */ -@Component -public class ProjectStatusFlowUtil { - /** - * key 重试的次数 , value 是增加是描述 - */ - public Map intervalTimeMap = Maps.newHashMap(); - - /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 - */ - public ProjectStatusFlowUtil(){ - intervalTimeMap.put(0,60); - intervalTimeMap.put(1,60 * 2); - intervalTimeMap.put(2,60 * 6); - intervalTimeMap.put(3,60 * 15); - intervalTimeMap.put(4,60 * 30); - intervalTimeMap.put(5,60 * 60); - intervalTimeMap.put(6,60 * 60 * 2); - intervalTimeMap.put(7,60 * 60 * 5); - intervalTimeMap.put(8,60 * 60 * 12); - intervalTimeMap.put(9,60 * 60 * 24); - intervalTimeMap.put(10,60 * 60 * 72); - intervalTimeMap.put(11,60 * 60 * 216); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java deleted file mode 100644 index c5e404e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.staging.utils; - -import java.util.Map; -import javax.annotation.PostConstruct; - -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; -import com.google.common.collect.Maps; -import lombok.RequiredArgsConstructor; - -/** - * 工作通知流转 事件函数MAP - * @return - * @author CMM - * @since 2023/02/28 17:03 - */ -@Component -@AllArgsConstructor -public class WorkNoticeFlowMapUtil { - /** - * key 重试的次数 , value 是增加是描述 - */ - public Map intervalTimeMap = Maps.newHashMap(); - - /** - * 扫描的间隔越来越长 秒数 - */ - public WorkNoticeFlowMapUtil(){ - intervalTimeMap.put(0,60); - intervalTimeMap.put(1,60 * 2); - intervalTimeMap.put(2,60 * 6); - intervalTimeMap.put(3,60 * 15); - intervalTimeMap.put(4,60 * 30); - intervalTimeMap.put(5,60 * 60); - intervalTimeMap.put(6,60 * 60 * 2); - intervalTimeMap.put(7,60 * 60 * 5); - intervalTimeMap.put(8,60 * 60 * 12); - intervalTimeMap.put(9,60 * 60 * 24); - intervalTimeMap.put(10,60 * 60 * 72); - intervalTimeMap.put(11,60 * 60 * 216); - } -} 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 deleted file mode 100644 index 3a775d7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.sys.contants; - -/** - * @Classname UserGuidanceContant - * @Description - * @Date 2023/8/8 14:56 - * @Author PoffyZhang - */ -public interface UserGuidanceContant { - - Integer ALL_FINISHED_NUM = 2; - - 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/CpuController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/CpuController.java deleted file mode 100644 index 68f2cbf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/CpuController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.sys.manage.CpuManage; -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.*; - -/** - * @Classname CpuController - * @Description - * @Date 2023/10/30 11:06 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/cpu") -@Api(value = "CpuController", tags = "CPU提升和关闭提升") -@RequiredArgsConstructor -public class CpuController { - - private final CpuManage cpuManage; - - @ApiOperation(value = "提升cpu 增加一个线程", notes = "提升cpu 增加一个线程") - @PostMapping("/high") - @WebLog("提升cpu") - public String high() { - cpuManage.high(); - return "提高成功"; - } - - @ApiOperation(value = "关闭提升cpu", notes = "关闭提升cpu") - @PostMapping("/close") - @WebLog("关闭提升cpu") - public String close() { - cpuManage.close(); - return "关闭成功"; - } -} 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 deleted file mode 100644 index 9c36213..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java +++ /dev/null @@ -1,56 +0,0 @@ -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/FormController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/FormController.java deleted file mode 100644 index 4ed74e0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/FormController.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.wflow.bean.dto.WflowFormsDto; -import com.wflow.bean.vo.WflowFormVo; -import com.wflow.workflow.service.WflowFormsService; -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.*; - -/** - * @Classname SysProcdefController - * @Description - * @Date 2023/1/18 14:28 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/sys/form") -@Api(value = "SysForm", tags = "系统管理-表单配置") -@RequiredArgsConstructor -public class FormController { - - private final WflowFormsService formService; - - @ApiOperation(value = "获取系统表单", notes = "获取系统表单") - @GetMapping("/{regionCode}") - public WflowFormVo detail(@PathVariable(value = "regionCode") String regionCode) { - return formService.getFormByRegionCode(regionCode); - } - - @ApiOperation(value = "编辑系统表单", notes = "编辑系统表单") - @WebLog("编辑系统表单") - @PostMapping("/modify") - public String modify(@Validated @RequestBody WflowFormsDto dto) { - return formService.modifySysForm(dto); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java deleted file mode 100644 index e6d5251..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -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.ningdatech.basic.util.CollUtils; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.common.util.TreeUtil; -import com.ningdatech.pmapi.sys.manage.MenuManage; -import com.ningdatech.pmapi.sys.model.dto.MenuQueryDTO; -import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; -import com.ningdatech.pmapi.sys.model.vo.MenuVO; -import com.ningdatech.pmapi.sys.service.IMenuService; -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.*; - -import javax.validation.Valid; -import java.util.Collections; -import java.util.List; - -/** - *

- * 前端控制器-菜单 - *

- * - * @author WendyYang - * @since 2022-09-30 - */ -@Slf4j -@Validated -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/menu") -@Api(value = "Menu", tags = "系统管理-菜单") -public class MenuController { - - private final IMenuService menuService; - private final MenuManage menuManage; - - @ApiOperation("查询系统所有的菜单") - @GetMapping("/list") - public List allTree() { - List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); - return TreeUtil.buildTree(list); - } - - @ApiOperation("查询系统所有数据权限的菜单") - @GetMapping("/listByDataScope") - public List allTreeByDataScope() { - LambdaQueryWrapper dsQuery = Wrappers.lambdaQuery(Menu.class) - .eq(Menu::getHasDataScope, Boolean.TRUE) - .orderByAsc(Menu::getSort); - List list = menuService.list(dsQuery); - if (!list.isEmpty()) { - List pidList = CollUtils.fieldList(list, MenuTreeEntity::getPid); - list.addAll(menuService.listByIds(pidList)); - } - return TreeUtil.buildTree(list); - } - - @ApiOperation(value = "查询当前登录用户的菜单", notes = "查询当前登录用户的菜单") - @GetMapping("/myMenu") - public List currentUserMenu() { - List roleIdList = LoginUserUtil.getRoleIdList(); - if (CollUtil.isEmpty(roleIdList)) { - return Collections.emptyList(); - } - String tmpSql = "(" + CollUtils.joinByComma(roleIdList) + ")"; - List list = menuService.list(Wrappers.lambdaQuery(Menu.class) - .exists("select 1 from nd_role_menu nur where nur.menu_id = nd_menu.id and nur.role_id in " + tmpSql) - .orderByAsc(Menu::getSort)); - return menuManage.buildUserMenu(list); - } - - @ApiOperation(value = "查询菜单", notes = "查询菜单") - @GetMapping("/details") - public MenuQueryDTO getDetails(@RequestParam Long id) { - Menu menu = menuService.getById(id); - return BeanUtil.toBean(menu, MenuQueryDTO.class); - } - - @ApiOperation(value = "保存新菜单", notes = "保存新菜单") - @PostMapping("/save") - @WebLog("保存菜单") - public MenuVO handlerSave(@Valid @RequestBody MenuSaveDTO data) { - menuService.save(data, LoginUserUtil.getUserId()); - return BeanUtil.toBean(data, MenuVO.class); - } - - @ApiOperation(value = "编辑菜单", notes = "编辑菜单") - @PostMapping("/modify") - @WebLog("编辑菜单") - public MenuVO handlerUpdate(@RequestBody MenuUpdateDTO data) { - menuService.update(data, LoginUserUtil.getUserId()); - return BeanUtil.toBean(data, MenuVO.class); - } - - @ApiOperation(value = "删除菜单", notes = "删除菜单") - @PostMapping("/remove") - @WebLog("删除菜单") - public Boolean handlerDelete(@RequestBody List ids) { - return menuService.removeByIdWithCache(ids); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java deleted file mode 100644 index 92e42b4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.sys.model.req.NoticeListReq; -import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq; -import com.ningdatech.pmapi.sys.model.req.NoticeStatusModifyReq; -import com.ningdatech.pmapi.sys.model.vo.NoticeDetailVO; -import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - *

- * 系统公告 前端控制器 - *

- * - * @author WendyYang - * @since 2022-07-21 - */ -@RestController -@Api(tags = "公告管理") -@RequiredArgsConstructor -@RequestMapping("/api/v1/notice") -public class NoticeController { - - private final NoticeManage noticeManage; - - @PostMapping("/save") - @ApiOperation("新增公告") - @WebLog("新增公告") - public IdVo save(@Valid @RequestBody NoticeSaveReq req) { - return noticeManage.saveOrModify(req); - } - - @GetMapping("/detail/{id}") - @ApiOperation("公告详情") - public NoticeDetailVO save(@PathVariable Long id) { - return noticeManage.detail(id); - } - - @PostMapping("/enabled") - @ApiOperation("启用/禁用") - @WebLog("启用/禁用") - public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) { - return noticeManage.changeEnabled(req); - } - - @PostMapping("/topped") - @ApiOperation("置顶") - @WebLog("置顶") - public void topped(@RequestBody IdVo id) { - noticeManage.topped(id.getId()); - } - - @GetMapping("/dashboard/list") - @ApiOperation("工作台公告列表") - public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, - @RequestParam(required = false) Integer type) { - return noticeManage.dashboardList(limit, type); - } - - @GetMapping("/manage/list") - @ApiOperation("公告管理列表") - public PageVo listByManager(NoticeListReq req) { - return noticeManage.listByManager(req); - } - - @DeleteMapping("/del") - @ApiOperation("删除公告") - @WebLog("删除公告") - public void delNotice(@RequestBody IdVo req) { - noticeManage.delNotice(req.getId()); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java deleted file mode 100644 index a090537..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.sys.manage.NotifyManage; -import com.ningdatech.pmapi.sys.model.req.NotifyListReq; -import com.ningdatech.pmapi.sys.model.vo.NotifyVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -/** - *

- * 通知消息 前端控制器 - *

- * - * @author ZPF - * @since 2023-03-22 - */ -@RestController -@Api(tags = "通知管理") -@RequiredArgsConstructor -@RequestMapping("/api/v1/notify") -public class NotifyController { - - private final NotifyManage notifyManage; - - @GetMapping("/list") - @ApiOperation("通知列表") - public PageVo page(@ModelAttribute NotifyListReq notifyListReq){ - return notifyManage.page(notifyListReq); - } - - @GetMapping("/detail/{id}") - @ApiOperation("通知详情") - public NotifyVO save(@PathVariable Long id) { - return notifyManage.detail(id); - } - - @PostMapping("/read/{id}") - @ApiOperation("已读") - @WebLog("消息-已读") - public Boolean read(@PathVariable Long id) { - return notifyManage.read(id); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcessStatisticsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcessStatisticsController.java deleted file mode 100644 index dfa1e40..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcessStatisticsController.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.pmapi.sys.manage.ProcessStatisticsManage; -import com.ningdatech.pmapi.sys.model.vo.ProcessDetailStatVO; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -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.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - *

- * ProcessStatisticsController - *

- * - * @author WendyYang - * @since 2023/7/31 - **/ -@Validated -@RestController -@RequestMapping("/api/v1/process/statistics") -@AllArgsConstructor -public class ProcessStatisticsController { - - private final ProcessStatisticsManage processStatisticsManage; - - @GetMapping("/detail") - @ApiOperation("流程统计详情") - public ProcessDetailStatVO processStatDetail(@RequestParam(required = false, defaultValue = "DAYS") TimeUnit unit, - @Valid @NotNull(message = "流程类型不能为空") Integer instType) { - return processStatisticsManage.processStatDetail(unit, instType); - } - - @GetMapping("/list") - @ApiOperation("流程统计详情列表") - public List listProcessStatDetail(@RequestParam(required = false, defaultValue = "DAYS") TimeUnit unit) { - return processStatisticsManage.processStatDetailList(unit); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java deleted file mode 100644 index 5eb16bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.pmapi.sys.manage.RegionManage; -import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; -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.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 前端控制器 - *

- * - * @author LiuXinXin - * @since 2022-10-08 - */ -@Validated -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/region") -@Api(tags = "系统管理-地域管理") -public class RegionController { - - private final RegionManage regionManage; - - @GetMapping("/tree") - @ApiOperation("获取区域编码的树状结构") - public RegionTreeVO getRegionTree(@RequestParam(required = false) String regionCode, - @RequestParam(required = false) Integer regionLevel) { - return regionManage.getRegionTree(regionCode, regionLevel); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java deleted file mode 100644 index 2d59277..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.lang.Assert; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.sys.manage.RoleManage; -import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; -import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.req.RolePageReq; -import com.ningdatech.pmapi.sys.model.vo.RoleVO; -import com.ningdatech.pmapi.sys.service.IRoleService; -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.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器-角色 - *

- * - * @author WendyYang - * @since 2022-09-30 - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/role") -@Api(value = "Role", tags = "系统管理-角色") -@RequiredArgsConstructor -public class RoleController { - - private final IRoleService roleService; - private final RoleManage roleManage; - - - @ApiOperation(value = "角色列表查询", notes = "角色列表查询") - @GetMapping("/list") - public PageVo query(@Valid @ModelAttribute RolePageReq rolePageReq) { - return roleManage.queryList(rolePageReq); - } - - /** - * 查询角色 - * - * @param id 主键id - * @return 查询结果 - */ - @ApiOperation(value = "查询角色", notes = "查询角色") - @GetMapping("/details") - public RoleVO getDetails(@Valid @RequestParam Long id) { - Role role = roleService.getById(id); - Assert.notNull(role, "角色不存在"); - RoleVO query = BeanUtil.toBean(role, RoleVO.class); - query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); - List menuDataScope = roleManage.getMenuDataScope(id); - query.setMenuDataScopeList(menuDataScope); - // 菜单 - roleManage.buildMenu(query); - return query; - } - - @ApiOperation(value = "保存新角色", notes = "保存新角色") - @PostMapping("/save") - @WebLog("保存新角色") - public RoleVO handlerSave(@Valid @RequestBody RoleSaveDTO data) { - roleService.saveRole(data, LoginUserUtil.getUserId()); - return BeanUtil.toBean(data, RoleVO.class); - } - - @ApiOperation(value = "编辑角色", notes = "编辑角色") - @PostMapping("/modify") - @WebLog("编辑角色") - public RoleVO handlerUpdate(@Valid @RequestBody RoleUpdateDTO data) { - roleService.updateRole(data, LoginUserUtil.getUserId()); - return BeanUtil.toBean(data, RoleVO.class); - } - - @ApiOperation(value = "删除角色", notes = "删除角色") - @PostMapping("/remove") - @WebLog("删除角色") - public Boolean handlerDelete(@Valid @RequestBody List ids) { - return roleService.removeByIdWithCache(ids); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java deleted file mode 100644 index 27baa0f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.sys.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.wflow.bean.dto.WflowModelHistorysDto; -import com.wflow.bean.vo.WflowModelVo; -import com.wflow.service.ModelGroupService; -import com.wflow.workflow.service.ProcessModelService; -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.*; - -/** - * @Classname SysProcdefController - * @Description - * @Date 2023/1/18 14:28 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/sys/procdef") -@Api(value = "SysProcdef", tags = "系统管理-流程配置") -@RequiredArgsConstructor -public class SysProcDefController { - - private final ModelGroupService modelGroupService; - - private final ProcessModelService processModelService; - - @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") - @GetMapping("/list") - public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber, - @RequestParam(defaultValue = "10") Integer pageSize) { - return modelGroupService.getModelsPage(regionCode,pageNumber,pageSize); - } - - @ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情") - @GetMapping("/detail/{formId}") - public Object list(@PathVariable String formId) { - return modelGroupService.getModelById(formId); - } - - @ApiOperation(value = "系统流程配置保存", notes = "系统流程配置保存") - @PostMapping("/save") - @WebLog("系统流程配置保存") - public String save(@Validated @RequestBody WflowModelHistorysDto dto) { - return processModelService.saveProcess(dto); - } - - @ApiOperation(value = "系统流程配置启用(停用)", notes = "系统流程配置启用(停用)") - @PutMapping("/{formId}/active/{state}") - public String enOrDisModel(@PathVariable String formId, - @PathVariable Boolean state) { - modelGroupService.enOrDisModel(formId, !state); - return Boolean.TRUE.equals(state) ? "启用流程成功":"停用流程成功"; - } - - @ApiOperation(value = "系统流程配置发布", notes = "系统流程配置发布") - @PostMapping("/deploy/{formId}") - @WebLog("系统流程配置发布") - public String deploy(@Validated @PathVariable String formId) { - return processModelService.deployProcessLs(formId, null); - } -} 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 deleted file mode 100644 index 09aceb1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java +++ /dev/null @@ -1,44 +0,0 @@ -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.*; - -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); - } - - @ApiOperation(value = "删除重复用户", notes = "删除重复用户") - @GetMapping("/remove-repeat/{userId}") - public String removeRepeat(@PathVariable Long userId) { - return userGuidanceManage.removeRepeat(userId); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java deleted file mode 100644 index f1f9908..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ningdatech.pmapi.sys.convert; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; -import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; -import org.apache.commons.collections4.CollectionUtils; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * RegionConverter - *

- * - * @author WendyYang - * @since 10:31 2022/10/12 - */ -public class RegionConverter { - - public static RegionDTO toRegionDTO(Region region) { - RegionDTO dto = new RegionDTO(); - dto.setRegionLevel(region.getRegionLevel()); - dto.setRegionName(region.getRegionName()); - dto.setParentCode(region.getParentCode()); - dto.setRegionCode(region.getRegionCode()); - dto.setId(region.getId()); - dto.setDeleted(region.getDeleted()); - dto.setGovUnit(region.getGovUnit()); - dto.setParentId(region.getParentId()); - dto.setRegionCodePath(region.getRegionCodePath()); - dto.unionCode(); - return dto; - } - - public static List toRegionTreeDTOList(List regionDTOList) { - if (CollectionUtils.isEmpty(regionDTOList)) { - return new ArrayList<>(); - } - return regionDTOList.stream().map(RegionConverter::toRegionTreeDTO).collect(Collectors.toList()); - } - - public static RegionTreeDTO toRegionTreeDTO(RegionDTO regionDTO) { - RegionTreeDTO treeDto = new RegionTreeDTO(); - treeDto.setLevel(regionDTO.getRegionLevel()); - treeDto.setName(regionDTO.getRegionName()); - treeDto.setParentCode(regionDTO.getParentCode()); - treeDto.setRegionCode(regionDTO.getRegionCode()); - treeDto.setUnionCode(regionDTO.getUnionCode()); - treeDto.setId(regionDTO.getId()); - treeDto.setDeleted(regionDTO.getDeleted()); - treeDto.setGovUnit(regionDTO.getGovUnit()); - return treeDto; - } - - public static RegionTreeVO toRegionTreeVO(RegionDTO region) { - RegionTreeVO node = new RegionTreeVO(); - node.setRegionLevel(region.getRegionLevel()); - node.setName(region.getRegionName()); - node.setParentCode(region.getParentCode()); - node.setRegionCode(region.getRegionCode()); - node.setUnionCode(region.getUnionCode()); - node.setId(region.getId()); - node.setUnionCode(region.getUnionCode()); - node.setGovUnit(region.getGovUnit()); - return node; - } - - public static List toRegionTree(Long parentId, Map> regions, - boolean showDeleted) { - List treeList = new ArrayList<>(); - List children = regions.getOrDefault(parentId, Collections.emptyList()); - for (RegionDTO region : children) { - if (!showDeleted && region.getDeleted()) { - continue; - } - RegionTreeVO node = toRegionTreeVO(region); - List regionList = regions.get(region.getId()); - if (CollUtil.isNotEmpty(regionList)) { - node.setChildren(toRegionTree(region.getId(), regions, showDeleted)); - } - treeList.add(node); - } - return treeList; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java deleted file mode 100644 index 058f95f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.sys.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * - * 公告权限枚举 - * @author ZPF - * @since 2023/02/24 16:14 - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum NoticePermissionsEnum { - /** - * 公告权限枚举 - */ - SUPER(0, "所有人可看"), - REGION(1, "区域可看"), - ORG(2, "单位可看"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static String getNameByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { - if (code.equals(t.getCode())) { - return t.name(); - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java deleted file mode 100644 index 78f391f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.sys.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * - * 公告类型枚举 - * @author ZPF - * @since 2023/02/24 16:14 - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum NoticeTypeEnum { - /** - * 公告类型枚举 - */ - ANNOUNCEMENT(1, "公告"), - HELP_DOCUMENTS(2, "帮助文档"), - POLICY_DOCUMENTS(3, "政策文件"); - - private Integer code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (NoticeTypeEnum t : NoticeTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static String getNameByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (NoticeTypeEnum t : NoticeTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t.name(); - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/ProjectEarlyWarningStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/ProjectEarlyWarningStatusEnum.java deleted file mode 100644 index 2bec87c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/ProjectEarlyWarningStatusEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.sys.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * - * 项目预警状态枚举 - * @author ZPF - * @since 2023/02/24 16:14 - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum ProjectEarlyWarningStatusEnum { - /** - * 项目预警状态枚举 - */ - NORMAL(1, "正常"), - OVER_TIME(2, "超期"), - ADVENT_TIME(3, "临期"); - - private Integer code; - private String desc; - - public static String match(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectEarlyWarningStatusEnum t : ProjectEarlyWarningStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static String getNameByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (ProjectEarlyWarningStatusEnum t : ProjectEarlyWarningStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.name(); - } - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/CpuManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/CpuManage.java deleted file mode 100644 index add6771..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/CpuManage.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.*; - -/** - * @Classname CpuManage - * @Description - * @Date 2023/8/7 9:25 - * @Author PoffyZhang - */ -@Component -@Slf4j -public class CpuManage { - private static ExecutorService executorService = Executors.newFixedThreadPool(10); - - private static volatile boolean flag = true; - - public void high() { - flag = true; - executorService.execute(() -> { - while (flag) { - // 一个复杂的计算任务 - long x = 123456789123456789L; - for (int j = 0; j < 10000; j++) { - if(!flag){ - break; - } - x = (x * 123456789123456789L) % 123456789; - } - } - }); - } - - public void close(){ - try{ - executorService.shutdownNow(); - flag = false; - executorService = Executors.newFixedThreadPool(10); - }catch (Exception e){ - log.error(e.getMessage()); - } - } -} 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 deleted file mode 100644 index f18e6f0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java +++ /dev/null @@ -1,373 +0,0 @@ -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.WarningNoticeTypeEnum; -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 adventTimeout - * @param employeeCode - * @param project - */ - public void doEarlyWarning(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, - Integer biz, LocalDateTime startTime,String employeeCode, - Project project,Integer ruleType,Integer noticeType, - String path,String batchEmployees,String nodeId) { - //1.存入 预警记录 - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); - String content = StringUtils.EMPTY; - - switch (WarningRuleTypeEnum.checkByCode(ruleType)){ - case PROCESS_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); - break; - case DECLARED_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); - break; - case OPERATION_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); - break; - case RENEWAL_FUND: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - } - - records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.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); - records.setProjectId(project.getId()); - records.setProjectCode(project.getProjectCode()); - records.setProjectStatus(project.getStatus()); - records.setNoticeType(noticeType); - records.setPath(path); - records.setBatchEmployees(batchEmployees); - records.setBiz(biz); - records.setNodeId(nodeId); - records.setOverTime(overTimeout); - 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 noticeMethod - * @param noticeContent - * @param adventTimeout - * @param employeeCode - * @param project - */ - public void urging(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, - Integer biz, LocalDateTime startTime,String employeeCode, - Project project,Integer ruleType,Integer noticeType, - String path,String batchEmployees,String nodeId) { - //1.存入 预警记录 - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); - String content = StringUtils.EMPTY; - - switch (WarningRuleTypeEnum.checkByCode(ruleType)){ - case PROCESS_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); - break; - case DECLARED_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); - break; - case OPERATION_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - } - records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); - break; - case RENEWAL_FUND: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - } - - records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.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); - records.setProjectId(project.getId()); - records.setProjectCode(project.getProjectCode()); - records.setProjectStatus(project.getStatus()); - records.setNoticeType(noticeType); - records.setPath(path); - records.setBatchEmployees(batchEmployees); - records.setBiz(biz); - records.setNodeId(nodeId); - 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 timeout - * @return - */ - private String convertContent(String noticeContent, String projectName, Integer timeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{time}",String.valueOf(timeout)); - log.info("通知内容 :{}",noticeContent); - return noticeContent; - } - private String convertAdventContent(String noticeContent, String projectName, Integer timeout,Integer overTimeOut) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{time}",String.valueOf(timeout)) - .replace("{time2}",String.valueOf((overTimeOut - timeout))); - log.info("通知内容 :{}",noticeContent); - return noticeContent; - } - - /** - * 转换出 通知的内容 - * @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 convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout,Integer overTimeOut) { - 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)) - .replace("{time2}",String.valueOf((overTimeOut - 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 convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout,Integer overTimeout) { - 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)) - .replace("{time2}",String.valueOf((overTimeout - 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; - } - - private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout,Integer overTimeout) { - 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)) - .replace("{time2}",String.valueOf((overTimeout - timeout))); - log.info("通知内容 :{}",noticeContent); - return noticeContent; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java deleted file mode 100644 index 8f6a694..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import cn.hutool.core.util.IdUtil; -import com.alibaba.fastjson.JSON; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.common.util.TreeUtil; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; -import com.ningdatech.pmapi.sys.service.IMenuService; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.wflow.bean.dto.WflowModelHistorysInsertDto; -import com.wflow.workflow.bean.process.ProcessNode; -import com.wflow.workflow.service.ProcessModelService; -import com.wflow.workflow.service.WflowFormsService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * MenuManage - 菜单管理业务层 - *

- * - * @author WendyYang - * @since 14:23 2023/1/28 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class MenuManage { - - private final IMenuService menuService; - private final ProcessModelService processModelService; - private final RegionCacheHelper regionCacheHelper; - - public List buildUserMenu(List list) { - Set menuIds = new HashSet<>(); - List menuRoles = CollUtils.convert(list, w -> { - menuIds.add(w.getId()); - return BeanUtil.copyProperties(w, MenuRoleVO.class); - }); - List pidList = menuRoles.stream() - .map(MenuTreeEntity::getPid) - .filter(pid -> !menuIds.contains(pid) && pid != BizConst.PARENT_ID) - .collect(Collectors.toList()); - parentMenuCheck(pidList, menuRoles, menuIds); - return TreeUtil.buildUserTree(menuRoles); - } - - public void parentMenuCheck(List pidList, List menuRoles, Set menuIds) { - if (pidList.isEmpty()) { - return; - } - List menus = menuService.listByIds(pidList); - if (menus.isEmpty()) { - return; - } - Set tmpSet = new HashSet<>(); - menus.forEach(w -> { - menuIds.add(w.getId()); - tmpSet.add(w.getPid()); - menuRoles.add(BeanUtil.copyProperties(w, MenuRoleVO.class)); - }); - List tmpPidList = tmpSet.stream() - .filter(pid -> !menuIds.contains(pid) && pid != BizConst.PARENT_ID) - .collect(Collectors.toList()); - parentMenuCheck(tmpPidList, menuRoles, menuIds); - } - - public String init() { - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - - if(CollUtil.isEmpty(regions)){ - throw new BizException("丽水地区数据为空 任务结束!"); - } - - for(RegionDTO region : regions){ - log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); - - Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; - for(Integer processType : processTypeList){ - String formName = ProjectProcessStageEnum.getDesc(processType); - WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); - - models.setGroupId(1); - models.setProcessDefId("pd" + IdUtil.objectId()); - models.setFormName(formName); - models.setProcessType(processType); - models.setRegionCode(region.getRegionCode()); - String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; - ProcessNode processNode = JSON.parseObject(process,ProcessNode.class); - models.setProcess(processNode); - models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); - models.setFormItems("[]"); - - String formId = processModelService.insertProcess(models); - if(StringUtils.isNotBlank(formId)){ - //初始的流程在部署表也存一份,用来查询 - if(StringUtils.isNotBlank(processModelService.deployProcess(formId,null))){ - log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getRegionName(),formName); - }else{ - log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getRegionName(),formName); - } - }else{ - log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getRegionName(),formName); - } - } - } - - stopWatch.stop(); - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); - return "初始化完成"; - } -} 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 deleted file mode 100644 index f8a4d8c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ /dev/null @@ -1,371 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -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.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -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.enumeration.NoticePermissionsEnum; -import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum; -import com.ningdatech.pmapi.sys.model.entity.Notice; -import com.ningdatech.pmapi.sys.model.entity.Notify; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.req.NoticeListReq; -import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq; -import com.ningdatech.pmapi.sys.model.req.NoticeStatusModifyReq; -import com.ningdatech.pmapi.sys.model.vo.NoticeDetailVO; -import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; -import com.ningdatech.pmapi.sys.service.INoticeService; -import com.ningdatech.pmapi.sys.service.INotifyService; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.pmapi.todocenter.model.dto.ProjectAuditMsgExtraDTO; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.runtime.ActivityInstance; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.AUDIT_WORK_TITLE; - -/** - *

- * MsgManage - *

- * - * @author WendyYang - * @since 21:30 2022/7/21 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class NoticeManage { - - private final INoticeService noticeService; - private final FileService fileService; - - private final IUserInfoService userInfoService; - - private final IDingEmployeeInfoService dingEmployeeInfoService; - - private final IDingOrganizationService dingOrganizationService; - - private final INotifyService notifyService; - - private final INdWorkNoticeStagingService workNoticeStagingService; - - private final RuntimeService runtimeService; - - private final UserInfoHelper userInfoHelper; - - @Transactional(rollbackFor = Exception.class) - public IdVo saveOrModify(NoticeSaveReq req) { - Notice notice = BeanUtil.copyProperties(req, Notice.class); - permissionsSave(notice,LoginUserUtil.loginUserDetail()); - noticeService.saveOrUpdate(notice); - return IdVo.of(notice.getId()); - } - - public NoticeDetailVO detail(Long id) { - Notice notice = noticeService.getById(id); - NoticeDetailVO detail = BeanUtil.copyProperties(notice, NoticeDetailVO.class); - List fileIds = BizUtils.splitToLong(notice.getAttachment()); - if (!fileIds.isEmpty()) { - List attachFiles = fileService.getByIds(fileIds); - detail.setAttachments(attachFiles); - } - return detail; - } - - public boolean changeEnabled(NoticeStatusModifyReq req) { - Notice notice = new Notice(); - notice.setId(req.getId()); - notice.setEnabled(req.getStatus()); - return noticeService.updateById(notice); - } - - public void topped(Long id) { - Notice notice = new Notice(); - notice.setId(id); - notice.setToppedTime(LocalDateTime.now()); - noticeService.updateById(notice); - } - - public PageVo dashboardList(Integer limit, Integer type) { - NoticeListReq req = new NoticeListReq(); - req.setPageSize(limit); - req.setEnabled(true); - req.setType(type); - return listByManagerByPermission(req); - } - - public PageVo listByManager(NoticeListReq req) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) - .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) - .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) - .eq(req.getType() != null, Notice::getType, req.getType()) - .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - permissionsWrapperByEdit(wrapper,user); - Page page = noticeService.page(req.page(), wrapper); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO - .builder() - .id(w.getId()) - .type(w.getType()) - .title(w.getTitle()) - .enabled(w.getEnabled()) - .createOn(w.getCreateOn()) - .topped(w.getToppedTime() != null) - .build()); - return PageVo.of(tempDataList, page.getTotal()); - } - - public PageVo listByManagerByPermission(NoticeListReq req) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) - .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) - .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) - .eq(req.getType() != null, Notice::getType, req.getType()) - .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - permissionsWrapper(wrapper,user); - Page page = noticeService.page(req.page(), wrapper); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO - .builder() - .id(w.getId()) - .type(w.getType()) - .title(w.getTitle()) - .enabled(w.getEnabled()) - .createOn(w.getCreateOn()) - .topped(w.getToppedTime() != null) - .build()); - return PageVo.of(tempDataList, page.getTotal()); - } - - public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) - .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) - .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) - .eq(req.getType() != null, Notice::getType, req.getType()) - .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - permissionsWrapper(wrapper,user); - List records = noticeService.list(wrapper); - return CollUtils.convert(records, w -> NoticeListItemVO - .builder() - .id(w.getId()) - .type(w.getType()) - .title(w.getTitle()) - .enabled(w.getEnabled()) - .createOn(w.getCreateOn()) - .topped(w.getToppedTime() != null) - .build()).stream().collect(Collectors.groupingBy(v -> NoticeTypeEnum.getNameByCode(v.getType()))); - } - - public void delNotice(Long id) { - noticeService.removeById(id); - } - - - /** - * 发送消息 - * @param employeeCode 员工号 - * @param userId 用户ID - * @param project 项目 - * @param procDefinitionName 流程定义名 - * @param template 消息模板内容 - * @param msgTypeEnum 枚举 - */ - public void sendNotice(String employeeCode, Long userId, Project project, String procDefinitionName, - String template, MsgTypeEnum msgTypeEnum){ - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); - String passMsg = String.format(template, project.getProjectName(), procDefinitionName); - passWorkNoticeInfo.setMsg(passMsg); - // 放入系统通知表中,保存记录 - Notify notify = assemblyAuditNotify(userId, project, passMsg); - notify.setType(msgTypeEnum.name()); - notifyService.save(notify); - // 放入工作通知暂存表中,通过扫表异步发送 - workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); - } - - /** - * 获取发送浙政钉工作通知的信息 - * - * @param currentEmployeeCode - * @return com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo - * @author CMM - * @since 2023/02/15 14:04 - */ - public WorkNoticeInfo getSendWorkNoticeInfo(String currentEmployeeCode) { - UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode,currentEmployeeCode).last("limit 1")); - if (Objects.isNull(auditUserInfo)) { - throw new BizException("该用户不存在!"); - } - WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); - Long accountId = auditUserInfo.getAccountId(); - if (Objects.isNull(accountId)) { - throw new BizException("该用户没有录入浙政钉信息!"); - } - workNoticeInfo.setAccountId(accountId); - // 根据浙政钉用户ID获取部门code - DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getAccountId, accountId) - .eq(DingEmployeeInfo::getMainJob,String.valueOf(Boolean.TRUE)) - .last("limit 1")); - String organizationCode = employeeInfo.getOrganizationCode(); - workNoticeInfo.setOrganizationCode(organizationCode); - // 根据部门code获取部门名称 - DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, organizationCode)); - String organizationName = dingOrganization.getOrganizationName(); - workNoticeInfo.setOrganizationName(organizationName); - // 构建唯一的消息ID - String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE - + organizationName + accountId + StrUtil.UNDERLINE + System.currentTimeMillis(); - workNoticeInfo.setBizMsgId(bizMsgId); - String receiverUserId = String.valueOf(accountId); - workNoticeInfo.setReceiverUserId(receiverUserId); - return workNoticeInfo; - } - - /** - * 装配项目审核工作通知 - * @param userId - * @param project - * @param msg - */ - public Notify assemblyAuditNotify(Long userId, Project project, String msg) { - Notify notify = new Notify(); - notify.setTitle(AUDIT_WORK_TITLE); - notify.setUserId(userId); - notify.setContent(msg); - notify.setReaded(Boolean.FALSE); - notify.setCreateTime(LocalDateTime.now()); - ProjectAuditMsgExtraDTO msgExtraDto = new ProjectAuditMsgExtraDTO(); - msgExtraDto.setProjectId(project.getId()); - msgExtraDto.setInstanceId(project.getInstCode()); - String extraJson = JSON.toJSONString(msgExtraDto); - notify.setExtraInfo(extraJson); - return notify; - } - - /** - * 找寻第一个审核人 去发消息 - * @param project - * @param formName - * @param template - * @param msgTypeEnum - */ - public void sendFirtUser(Project project, String formName,String instanceId, String template, MsgTypeEnum msgTypeEnum) { - try { - List activityInstances = runtimeService.createActivityInstanceQuery() - .processInstanceId(instanceId) - .activityType("userTask") - .orderByActivityInstanceStartTime() - .asc() - .list(); - - for (ActivityInstance activityInstance : activityInstances) { - if(StringUtils.isNotBlank(activityInstance.getAssignee())){ - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(activityInstance.getAssignee()); - sendNotice(activityInstance.getAssignee(), user.getUserId(), project, formName, - template, msgTypeEnum); - } - } - }catch (Exception e){ - log.error("发送消息失败 :" + e); - } - - } - - /** - * 公告保存 权限控制 - * @param notice - * @param user - */ - private void permissionsSave(Notice notice, UserInfoDetails user) { - List userRoleList = user.getUserRoleList(); - if(CollUtil.isEmpty(userRoleList)){ - //默认 权限是单位 - notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); - return; - } - if(user.getSuperAdmin()){ - notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); - return; - }else if(user.getRegionAdmin()){ - notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); - notice.setPermissionsValue(user.getRegionCode()); - return; - }else if(user.getIsOrgAdmin()){ - notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); - return; - } - notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); - } - - /** - * 列表查询 权限体现 - * @param wrapper - */ - private void permissionsWrapper(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { - wrapper.and(q3 -> q3.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) - .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) - .eq(Notice::getPermissionsValue,user.getRegionCode())) - .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); - } - - private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { - //如果是超管 就能看所有 - if(user.getSuperAdmin()){ - log.info(user.getUsername() + ",超管可以看所有"); - }else if(user.getRegionAdmin()){ - wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) - .eq(Notice::getPermissionsValue,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()); - }else{ - wrapper.eq(Notice::getCreateOn,user.getUserId()); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java deleted file mode 100644 index 0427335..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.alibaba.fastjson.JSON; -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.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.sys.model.entity.Notify; -import com.ningdatech.pmapi.sys.model.req.NotifyListReq; -import com.ningdatech.pmapi.sys.model.vo.NotifyVO; -import com.ningdatech.pmapi.sys.service.INotifyService; -import com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - *

- * NotifyManage - *

- * - * @author ZPF - * @since 21:30 2023/03/21 - */ -@Component -@RequiredArgsConstructor -public class NotifyManage { - - private final INotifyService notifyService; - - public PageVo page(NotifyListReq notifyListReq) { - Long userId = LoginUserUtil.getUserId(); - Page page = notifyListReq.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notify.class) - .eq(Objects.nonNull(notifyListReq.getReaded()), Notify::getReaded, notifyListReq.getReaded()) - .eq(Notify::getUserId, userId) - .like(Objects.nonNull(notifyListReq.getTitle()), Notify::getTitle, notifyListReq.getTitle()) - .eq(Objects.nonNull(notifyListReq.getType()), Notify::getType, notifyListReq.getType()) - .orderByDesc(Notify::getCreateTime); - notifyService.page(page, wrapper); - if (page.getTotal() == 0L) { - return PageVo.empty(); - } - List list = page.getRecords().stream() - .map(n -> { - NotifyVO notifyVo = new NotifyVO(); - BeanUtil.copyProperties(n, notifyVo); - String extraInfo = n.getExtraInfo(); - if (StringUtils.isNotBlank(extraInfo)) { - JSONObject jsonObject = JSON.parseObject(extraInfo); - Long projectId = jsonObject.getLong(WorkNoticeConstant.PROJECT_ID); - String instanceId = jsonObject.getString(WorkNoticeConstant.INSTANCE_ID); - Long meetingId = jsonObject.getLong(WorkNoticeConstant.MEETING_ID); - notifyVo.setProjectId(projectId); - notifyVo.setInstanceId(instanceId); - notifyVo.setMeetingId(meetingId); - } - return notifyVo; - }) - .collect(Collectors.toList()); - return PageVo.of(list, page.getTotal()); - } - - public NotifyVO detail(Long id) { - Notify one = notifyService.getById(id); - return BeanUtil.copyProperties(one, NotifyVO.class); - } - - public Boolean read(Long id) { - Notify one = notifyService.getById(id); - VUtils.isTrue(Objects.isNull(one)).throwMessage("该通知不存在"); - one.setReaded(Boolean.TRUE); - return notifyService.updateById(one); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/ProcessStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/ProcessStatisticsManage.java deleted file mode 100644 index f5eb50a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/ProcessStatisticsManage.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import cn.hutool.core.util.NumberUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.sys.model.vo.ProcessDetailStatVO; -import lombok.AllArgsConstructor; -import org.flowable.engine.HistoryService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - *

- * ProcessStatisticsManage - *

- * - * @author WendyYang - * @since 2023/7/31 - **/ -@Component -@AllArgsConstructor -public class ProcessStatisticsManage { - - private final HistoryService historyService; - private final IProjectInstService projectInstService; - - public ProcessDetailStatVO processStatDetail(TimeUnit unit, Integer instType) { - unitCheck(unit); - ProcessDetailStatVO detailStat = ProcessDetailStatVO.init(); - LambdaQueryWrapper modelQuery = Wrappers.lambdaQuery(ProjectInst.class) - .select(ProjectInst::getInstCode) - .eq(ProjectInst::getInstType, instType); - List projectInsts = projectInstService.list(modelQuery); - if (projectInsts.isEmpty()) { - return detailStat; - } - List instCodeList = CollUtils.fieldList(projectInsts, ProjectInst::getInstCode); - List instances = historyService.createHistoricProcessInstanceQuery() - .processInstanceIds(new HashSet<>(instCodeList)) - .list(); - buildProcessDetailStat(unit, detailStat, instances); - return detailStat; - } - - private static void unitCheck(TimeUnit unit) { - if (!TimeUnit.DAYS.equals(unit) && !TimeUnit.HOURS.equals(unit)) { - throw BizException.wrap("仅支持以天和小时为单位的统计"); - } - } - - private static void buildProcessDetailStat(TimeUnit unit, ProcessDetailStatVO stat, - List instances) { - stat.setTotalInst(instances.size()); - LongSummaryStatistics statistics = instances.stream().filter(w -> { - boolean finished = w.getEndTime() != null; - if (finished) { - stat.incrFinished(); - } else { - stat.incrPending(); - } - return finished; - }).map(HistoricProcessInstance::getDurationInMillis) - .collect(Collectors.summarizingLong(Long::longValue)); - if (stat.getFinishedInst() != 0) { - long unitMillis = unit.toMillis(1); - stat.setAvgTime(NumberUtil.div(statistics.getAverage(), unitMillis, 1)); - stat.setMaxTime(NumberUtil.div(statistics.getMax(), unitMillis, 1)); - stat.setMinTime(NumberUtil.div(statistics.getMin(), unitMillis, 1)); - } - } - - public List processStatDetailList(TimeUnit unit) { - unitCheck(unit); - List projectInsts = projectInstService.list(); - if (projectInsts.isEmpty()) { - return Collections.emptyList(); - } - HashSet instCodes = new HashSet<>(); - Map> mapByInstType = projectInsts.stream() - .filter(w -> InstTypeEnum.getByCode(w.getInstType()) != null) - .collect(Collectors.groupingBy(w -> InstTypeEnum.getByCode(w.getInstType()), - Collectors.mapping(w -> { - instCodes.add(w.getInstCode()); - return w.getInstCode(); - }, Collectors.toList()))); - List instances = historyService.createHistoricProcessInstanceQuery() - .processInstanceIds(new HashSet<>(instCodes)) - .list(); - List res = new ArrayList<>(); - for (Map.Entry> entry : mapByInstType.entrySet()) { - List currInstCodes = entry.getValue(); - List currInsts = new ArrayList<>(); - instances.removeIf(w -> { - boolean contains = currInstCodes.contains(w.getId()); - if (contains) { - currInsts.add(w); - } - return contains; - }); - ProcessDetailStatVO item = ProcessDetailStatVO.init(); - InstTypeEnum instType = entry.getKey(); - item.setInstType(instType.getCode()); - item.setInstTypeName(instType.getDesc()); - buildProcessDetailStat(unit, item, currInsts); - res.add(item); - } - res.sort(Comparator.comparing(ProcessDetailStatVO::getInstType)); - return res; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java deleted file mode 100644 index d53d0a3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; -import com.ningdatech.pmapi.sys.service.IRegionService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - *

- * RegionManage - *

- * - * @author ZPF - * @since 10:39 2023/1/18 - */ -@Component -@RequiredArgsConstructor -public class RegionManage { - - private final IRegionService regionService; - private final RegionCacheHelper regionCache; - - public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { - return regionCache.getRegionTree(regionCode, regionLevel); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java deleted file mode 100644 index 29e765e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.ningdatech.pmapi.sys.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.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; -import com.ningdatech.pmapi.sys.model.entity.*; -import com.ningdatech.pmapi.sys.model.req.RolePageReq; -import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; -import com.ningdatech.pmapi.sys.model.vo.RoleVO; -import com.ningdatech.pmapi.sys.service.*; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - *

- * 角色管理 - *

- * - * @author WendyYang - * @since 12:01 2023/1/28 - */ -@Component -@RequiredArgsConstructor -public class RoleManage { - - private final IRoleService roleService; - private final IMenuService menuService; - private final IRoleMenuService roleMenuService; - private final IRoleMenuDatascopeService roleMenuDatascopeService; - - private final IUserRoleService iUserRoleService; - - private final IUserInfoService userInfoService; - - public PageVo queryList(RolePageReq rolePageReq) { - Page page = rolePageReq.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Role.class); - searchList(page, wrapper, rolePageReq); - List data = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, RoleVO.class)); - return PageVo.of(data, page.getTotal()); - } - - private void searchList(Page page, LambdaQueryWrapper wrapper, RolePageReq req) { - wrapper.like(StringUtils.isNotBlank(req.getName()), Role::getName, req.getName()) - .eq(req.getFixed() != null, Role::getFixed, req.getFixed()) - .orderByDesc(Role::getUpdateOn); - roleService.page(page, wrapper); - } - - - public void buildMenu(RoleVO query) { - //改成直接返回有权限的 - List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); - List roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class) - .eq(RoleMenu::getRoleId, query.getId())); - List menus = list.stream().map(menu -> { - for (RoleMenu roleMenu : roleMenus) { - if (roleMenu.getMenuId().equals(menu.getId())) { - return BeanUtil.copyProperties(menu, MenuRoleVO.class); - } - } - return null; - }).filter(Objects::nonNull).collect(Collectors.toList()); - query.setMenu(menus); - } - - public List getMenuDataScope(Long roleId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(RoleMenuDatascope.class) - .eq(RoleMenuDatascope::getRoleId, roleId); - List menuDataScopes = roleMenuDatascopeService.list(query); - return CollUtils.convert(menuDataScopes, w -> { - MenuDataScopeDTO dto = new MenuDataScopeDTO(); - dto.setDataScope(w.getDatascope()); - dto.setMenuId(w.getMenuId()); - return dto; - }); - } - - public List getUsersByRoleType(String roleType) { - Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) - .eq(Role::getCode, roleType) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(regionRole)){ - return Collections.emptyList(); - } - List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getRoleId, regionRole.getId())); - if(CollUtil.isEmpty(userRoles)){ - return Collections.emptyList(); - } - List userIds = userRoles.stream().map(UserRole::getUserId) - .collect(Collectors.toList()); - return userInfoService.listByIds(userIds); - } - - public List getUsersByRoleType(String roleType,String regionCode) { - Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) - .eq(Role::getCode, roleType) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(regionRole)){ - return Collections.emptyList(); - } - List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getRoleId, regionRole.getId())); - if(CollUtil.isEmpty(userRoles)){ - return Collections.emptyList(); - } - List userIds = userRoles.stream().map(UserRole::getUserId) - .collect(Collectors.toList()); - return userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getId,userIds) - .eq(UserInfo::getRegionCode,regionCode)); - } -} 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 deleted file mode 100644 index 45b3340..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.ningdatech.pmapi.sys.manage; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.ExpertInfoService; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -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.entity.UserRole; -import com.ningdatech.pmapi.sys.model.vo.UserGuidanceDetailVO; -import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.entity.UserAuth; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.service.IUserAuthService; -import com.ningdatech.pmapi.user.service.IUserInfoService; -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; -import java.util.stream.Collectors; - -/** - * @Classname UserGuidanceManage - * @Description - * @Date 2023/8/8 13:49 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class UserGuidanceManage { - - private final OrgProcdefService orgProcdefService; - - private final IUserInfoService userInfoService; - - private final IUserRoleService userRoleService; - - private final IUserAuthService userAuthService; - - private final ICompanySignatureService signatureService; - - private final IExpertUserFullInfoService expertUserFullInfoService; - - /** - * 查询用户引导 详情 - * @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 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; - } - - /** - * 删除重复用户 - * @param userId - * @return - */ - public String removeRepeat(Long userId) { - UserInfo user = userInfoService.getById(userId); - VUtils.isTrue(Objects.isNull(user)).throwMessage("该用户不存在 删除重复失败"); - List repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, user.getUsername()) - .ne(UserInfo::getId, userId) - .isNull(UserInfo::getAccountId)); - if(CollUtil.isNotEmpty(repeatUsers)){ - List repeatIds = repeatUsers.stream().map(UserInfo::getId).collect(Collectors.toList()); - userInfoService.removeBatchByIds(repeatIds); - userAuthService.remove(Wrappers.lambdaQuery(UserAuth.class) - .in(UserAuth::getUserId,repeatIds)); - userRoleService.remove(Wrappers.lambdaQuery(UserRole.class) - .in(UserRole::getUserId,repeatIds)); - for(Long repeatId : repeatIds){ - ExpertUserFullInfo expert = expertUserFullInfoService.getByUserId(repeatId); - expert.setUserId(userId); - expertUserFullInfoService.updateById(expert); - } - return "删除成功"; - } - return "不存在重复的用户"; - } -} 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 deleted file mode 100644 index 5c3174f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -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/mapper/MenuMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/MenuMapper.java deleted file mode 100644 index 36034ee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/MenuMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import org.springframework.stereotype.Repository; - -/** - *

- * Mapper 接口 - * 菜单 - *

- * - * @author PoffyZhang - */ -@Repository -public interface MenuMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/MenuMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/MenuMapper.xml deleted file mode 100644 index f1972d6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/MenuMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.java deleted file mode 100644 index 943f9b6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Notice; - -/** - *

- * 系统通知 Mapper 接口 - *

- * - * @author WendyYang - * @since 2022-07-21 - */ -public interface NoticeMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.xml deleted file mode 100644 index 86b3271..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NoticeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.java deleted file mode 100644 index 2295815..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Notice; -import com.ningdatech.pmapi.sys.model.entity.Notify; - -/** - *

- * 通知 Mapper 接口 - *

- * - * @author zpf - * @since 2023-03-21 - */ -public interface NotifyMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml deleted file mode 100644 index 8fa823e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ProjectEarlyWarningMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ProjectEarlyWarningMapper.java deleted file mode 100644 index db9ff40..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ProjectEarlyWarningMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; -import org.springframework.stereotype.Repository; - -/** - *

- * Mapper 接口 - *

- * - * @author PoffyZhang - */ -@Repository -public interface ProjectEarlyWarningMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.java deleted file mode 100644 index 1dc0d26..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Region; - -/** - *

- * Mapper 接口 - *

- * - * @author ZPF - * @since 2023-1-18 - */ -public interface RegionMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.xml deleted file mode 100644 index 074d142..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RegionMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.java deleted file mode 100644 index 994941a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Resource; -import com.ningdatech.pmapi.sys.model.dto.ResourceQueryDTO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - *

- * Mapper 接口 - * 资源 - *

- * - * @author PoffyZhang - */ -@Repository -public interface ResourceMapper extends BaseMapper { - /** - * 查询 拥有的资源 - * - * @param resource 查询参数 - * @return 可用资源 - */ - List findVisibleResource(ResourceQueryDTO resource); - - /** - * 根据唯一索引 保存或修改资源 - * - * @param resource 资源 - * @return 操作条数 - */ - int saveOrUpdateUnique(Resource resource); - - /** - * 根据资源id查询菜单id - * - * @param resourceIdList 资源id - * @return 菜单id - */ - List findMenuIdByResourceId(@Param("resourceIdList") List resourceIdList); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.xml deleted file mode 100644 index 5731ee5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/ResourceMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - id,created_by,create_time,updated_by,update_time, - code, name, menu_id, describe_, readonly_ - - - - - - - insert into nd_resource ( id, created_by, create_time, updated_by, update_time, - code, name, menu_id, describe_) - values (#{id,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},#{updateUser,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, - #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{menuId,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR} ) - ON DUPLICATE KEY UPDATE - name = #{name,jdbcType=VARCHAR}, - describe_ = #{describe,jdbcType=VARCHAR}, - updated_by = #{updateUser,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=TIMESTAMP} - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.java deleted file mode 100644 index c64ecfc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.Role; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - *

- * Mapper 接口 - * 角色 - *

- * - * @author PoffyZhang - */ -@Repository -public interface RoleMapper extends BaseMapper { - /** - * 查询用户拥有的角色 - * - * @param userId 用户id - * @return 角色 - */ - List findRoleByUserId(@Param("userId") Long userId); - - /** - * 根据角色编码查询用户ID - * - * @param codes 角色编码 - * @return 用户id - */ - List findUserIdByCode(@Param("codes") String[] codes); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.xml deleted file mode 100644 index 69bb2f7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMapper.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.java deleted file mode 100644 index ca57450..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 角色菜单数据权限关联表 Mapper 接口 - *

- * - * @author WendyYang - * @since 2023-01-28 - */ -public interface RoleMenuDatascopeMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.xml deleted file mode 100644 index d292558..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuDatascopeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.java deleted file mode 100644 index 26d30cf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.RoleMenu; - -/** - *

- * Mapper 接口 - *

- * - * @author PoffyZhang - * @since 2022-11-11 - */ -public interface RoleMenuMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.xml deleted file mode 100644 index dff428c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/RoleMenuMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.java deleted file mode 100644 index bede1c0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.sys.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import org.springframework.stereotype.Repository; - -/** - *

- * Mapper 接口 - * 角色分配 - * 账号角色绑定 - *

- * - * @author PoffyZhang - */ -@Repository -public interface UserRoleMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.xml deleted file mode 100644 index 430001c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/UserRoleMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/AbstractMsgExtraDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/AbstractMsgExtraDTO.java deleted file mode 100644 index 7bdb608..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/AbstractMsgExtraDTO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -/** - *

- * AbstractExtraDTO - *

- * - * @author WendyYang - * @since 2023/4/12 - **/ -public abstract class AbstractMsgExtraDTO { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MeetingReviewMsgExtraDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MeetingReviewMsgExtraDTO.java deleted file mode 100644 index bd74fb1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MeetingReviewMsgExtraDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -/** - *

- * MeetingReviewMsgExtraDTO - *

- * - * @author WendyYang - * @since 2023/4/12 - **/ -public class MeetingReviewMsgExtraDTO extends AbstractMsgExtraDTO { - - private Long meetingId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuDataScopeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuDataScopeDTO.java deleted file mode 100644 index 62bd211..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuDataScopeDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * MenuDataScopeDTO - *

- * - * @author WendyYang - * @since 16:06 2023/1/28 - */ -@Data -public class MenuDataScopeDTO { - - @ApiModelProperty("菜单ID") - private Long menuId; - - @ApiModelProperty("数据权限") - private Integer dataScope; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuQueryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuQueryDTO.java deleted file mode 100644 index bb4a49b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuQueryDTO.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "MenuQueryDTO", description = "菜单") -public class MenuQueryDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - /** - * 标题 - */ - @ApiModelProperty(value = "标题") - private String title; - - /** - * 类型 - */ - @ApiModelProperty(value = "类型") - private Integer type; - - /** - * 页面路径 - */ - @ApiModelProperty(value = "页面路径") - private String path; - - /** - * 图标 - */ - @ApiModelProperty(value = "图标") - private String icon; - - /** - * 组件 - */ - @ApiModelProperty(value = "组件") - private String component; - - /** - * 权限 - */ - @ApiModelProperty(value = "权限") - private String permission; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sort; - - /** - * 父菜单ID - */ - @ApiModelProperty(value = "父菜单ID") - private Long pid; - - /** - * activeMenu - */ - @ApiModelProperty(value = "activeMenu") - private String activeMenu; - - /** - * 跳转 - */ - @ApiModelProperty(value = "跳转") - private String redirect; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuSaveDTO.java deleted file mode 100644 index 037032f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuSaveDTO.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author WendyYang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "MenuSaveDTO", description = "菜单") -public class MenuSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - /** - * 标题 - */ - @ApiModelProperty(value = "标题") - @NotEmpty(message = "标题不能为空") - private String title; - - /** - * 页面路径 - */ - @ApiModelProperty(value = "页面路径") - private String path; - - /** - * 图标 - */ - @ApiModelProperty(value = "图标") - private String icon; - - /** - * 组件 - */ - @ApiModelProperty(value = "组件") - private String component; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sort; - - /** - * 父菜单ID - */ - @ApiModelProperty(value = "父菜单ID") - private Long pid; - - /** - * 是否隐藏 0不隐藏 1隐藏 - */ - @ApiModelProperty(value = "是否隐藏") - private Integer hidden; - - /** - * activeMenu - */ - @ApiModelProperty(value = "activeMenu") - private String activeMenu; - - /** - * 跳转 - */ - @ApiModelProperty(value = "跳转") - private String redirect; - - @ApiModelProperty("菜单类型") - @NotNull(message = "菜单类型不能为空") - private MenuTypeEnum menuType; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java deleted file mode 100644 index 49be37e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "MenuUpdateDTO", description = "菜单") -public class MenuUpdateDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id") - @NotNull(message = "请传id") - private Long id; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - /** - * 标题 - */ - @ApiModelProperty(value = "标题") - private String title; - - /** - * 类型 - */ - @ApiModelProperty(value = "类型") - private MenuTypeEnum menuType; - - /** - * 页面路径 - */ - @ApiModelProperty(value = "页面路径") - private String path; - - /** - * 图标 - */ - @ApiModelProperty(value = "图标") - private String icon; - - /** - * 组件 - */ - @ApiModelProperty(value = "组件") - private String component; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sort; - - /** - * 父菜单ID - */ - @ApiModelProperty(value = "父菜单ID") - private Long pid; - - /** - * 是否隐藏 0不隐藏 1隐藏 - */ - @ApiModelProperty(value = "是否隐藏") - private Integer hidden; - - /** - * activeMenu - */ - @ApiModelProperty(value = "activeMenu") - private String activeMenu; - - /** - * 跳转 - */ - @ApiModelProperty(value = "跳转") - private String redirect; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java deleted file mode 100644 index 081aac0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:12 - */ -@Data -@Builder -public class RegionDTO { - - @Tolerate - public RegionDTO() { - } - - /** - * 区域码 - */ - private String regionCode; - - /** - * 地区名 - */ - private String regionName; - - /** - * 地区级别 - */ - private Integer regionLevel; - - /** - * 地区父级code 当parent_code 为 -1 时为顶级区域 - */ - private String parentCode; - - /** - * 唯一编码:regionCode##regionName##regionLevel - */ - private String unionCode; - - private Long id; - - private Boolean deleted; - - private String govUnit; - - private Long parentId; - - private String regionCodePath; - - public void unionCode() { - this.unionCode = String.format("%s##%s##%s", this.regionCode, this.regionName, this.regionLevel); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionTreeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionTreeDTO.java deleted file mode 100644 index e4a63d8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionTreeDTO.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 上午9:08 - */ -@Data -public class RegionTreeDTO { - - /** - * 区域码 - */ - private String regionCode; - - /** - * 地区名 - */ - private String name; - - /** - * 地区级别 - */ - private Integer level; - - /** - * 地区父级code 当parent_code 为 -1 时为顶级区域 - */ - private String parentCode; - - private String unionCode; - - private List children; - - private Long id; - - private String mapData; - - private Boolean deleted; - - private String govUnit; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceQueryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceQueryDTO.java deleted file mode 100644 index 19460f0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceQueryDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 资源 查询DTO - * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@ApiModel(value = "ResourceQueryDTO", description = "资源查询") -public class ResourceQueryDTO { - - /** - * 父资源id, 用于查询按钮 - */ - @ApiModelProperty(value = "菜单id", notes = "指定菜单id") - private Long menuId; - /** - * 登录人用户id - */ - @ApiModelProperty(value = "指定用户id", notes = "指定用户id,前端不传则自动获取") - private Long userId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceSaveDTO.java deleted file mode 100644 index 1f1e542..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceSaveDTO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Size; -import java.io.Serializable; - -/** - *

- * 实体类 - * 资源 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "ResourceSaveDTO", description = "资源") -public class ResourceSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 编码 - */ - @ApiModelProperty(value = "编码") - @Size(max = 500, message = "编码长度不能超过500") - private String code; - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotEmpty(message = "名称不能为空") - @Size(max = 255, message = "名称长度不能超过255") - private String name; - /** - * 菜单ID - * #c_menu - */ - @ApiModelProperty(value = "菜单ID") - private Long menuId; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - @Size(max = 255, message = "描述长度不能超过255") - private String describe; - /** - * 内置 - */ - @ApiModelProperty(value = "内置") - private Boolean readonly; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceUpdateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceUpdateDTO.java deleted file mode 100644 index d0b4a83..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/ResourceUpdateDTO.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import com.baomidou.mybatisplus.core.conditions.update.Update; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.io.Serializable; - -/** - *

- * 实体类 - * 资源 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "ResourceUpdateDTO", description = "资源") -public class ResourceUpdateDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "主键") - @NotNull(message = "id不能为空", groups = Update.class) - private Long id; - - /** - * 编码 - */ - @ApiModelProperty(value = "编码") - @Size(max = 500, message = "编码长度不能超过500") - private String code; - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotEmpty(message = "名称不能为空") - @Size(max = 255, message = "名称长度不能超过255") - private String name; - /** - * 菜单ID - * #c_menu - */ - @ApiModelProperty(value = "菜单ID") - private Long menuId; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - @Size(max = 255, message = "描述长度不能超过255") - private String describe; - /** - * 内置 - */ - @ApiModelProperty(value = "内置") - private Boolean readonly; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleAuthoritySaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleAuthoritySaveDTO.java deleted file mode 100644 index 0a31804..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleAuthoritySaveDTO.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 实体类 - * 角色的资源 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RoleAuthoritySaveDTO", description = "角色的资源") -public class RoleAuthoritySaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 菜单ID - * #c_menu - */ - @ApiModelProperty(value = "资源ID") - private List menuIdList; - - /** - * 资源id - * #c_resource - */ - private List resourceIdList; - - /** - * 角色id - * #c_role - */ - @ApiModelProperty(value = "角色id") - @NotNull(message = "角色id不能为空") - private Long roleId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleQueryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleQueryDTO.java deleted file mode 100644 index 0e4aa72..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleQueryDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RoleQueryDTO", description = "角色") -public class RoleQueryDTO implements Serializable { - - private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "ID") - private Long id; - - /** - * 角色名称 - */ - @ApiModelProperty(value = "角色名称") - private String name; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String describe; - - /** - * 数据范围 - */ - @ApiModelProperty(value = "数据范围") - private Integer dataScope; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleSaveDTO.java deleted file mode 100644 index 1825893..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleSaveDTO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RoleSaveDTO", description = "角色") -public class RoleSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotEmpty(message = "名称不能为空") - @Size(max = 50, message = "名称长度不能超过50") - private String name; - - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - @Size(max = 200, message = "描述长度不能超过200") - private String describe; - - /** - * 数据范围 - */ - @ApiModelProperty(value = "管理角色ID") - private String manageRoleIds; - - /** - * 菜单id - */ - @ApiModelProperty(value = "菜单id") - private List menuIds; - - @ApiModelProperty("菜单数据权限") - private List menuDataScopeList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleUpdateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleUpdateDTO.java deleted file mode 100644 index ab3642b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RoleUpdateDTO.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import com.baomidou.mybatisplus.core.conditions.update.Update; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RoleUpdateDTO", description = "角色") -public class RoleUpdateDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "主键") - @NotNull(message = "id不能为空", groups = Update.class) - private Long id; - - @ApiModelProperty(value = "名称") - @Size(max = 50, message = "名称长度不能超过30") - private String name; - - @ApiModelProperty(value = "描述") - @Size(max = 200, message = "描述长度不能超过200") - private String describe; - - @ApiModelProperty(value = "菜单id") - private List menuIds; - - @ApiModelProperty(value = "管理角色ID") - private String manageRoleIds; - - @ApiModelProperty("菜单数据权限") - private List menuDataScopeList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/UserRoleSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/UserRoleSaveDTO.java deleted file mode 100644 index dddd7dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/UserRoleSaveDTO.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.sys.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 实体类 - * 角色分配 - * 账号角色绑定 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "UserRoleSaveDTO", description = "角色分配 账号角色绑定") -public class UserRoleSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 角色ID - * #c_role - */ - @ApiModelProperty(value = "角色ID") - @NotNull(message = "请选择角色") - private Long roleId; - /** - * 用户ID - * #c_user - */ - @ApiModelProperty(value = "用户ID") - private List userIdList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/BaseEntity.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/BaseEntity.java deleted file mode 100644 index 4605be6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.sys.model.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.Setter; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 通用字段, is_del 根据需求自行添加 - *

- * - * @author WendyYang - * @since 11:01 2023/1/28 - */ -@Getter -@Setter -public class BaseEntity implements Serializable { - - @ApiModelProperty("创建人userId") - @TableField(fill = FieldFill.INSERT) - protected Long createBy; - - @ApiModelProperty("最后修改人userId") - @TableField(fill = FieldFill.INSERT_UPDATE) - protected Long updateBy; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - protected LocalDateTime createOn; - - @ApiModelProperty("修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - protected LocalDateTime updateOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java deleted file mode 100644 index e71c5fd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ningdatech.pmapi.sys.model.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.sys.model.enumeration.DataScopeEnum; -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Size; -import java.time.LocalDateTime; - -import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author PoffyZhang - * @since 2022-9-30 - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@TableName("nd_menu") -@ApiModel(value = "Menu", description = "菜单") -@AllArgsConstructor -public class Menu extends MenuTreeEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "组件") - @Size(max = 255, message = "组件长度不能超过255") - @TableField(value = "component", condition = LIKE) - private String component; - - @ApiModelProperty(value = "菜单图标") - @Size(max = 255, message = "菜单图标长度不能超过255") - @TableField(value = "icon", condition = LIKE) - private String icon; - - @ApiModelProperty(value = "是否隐藏") - @TableField(value = "hidden") - private Integer hidden; - - @ApiModelProperty(value = "activeMenu") - @TableField(value = "active_menu") - private String activeMenu; - - @ApiModelProperty(value = "跳转") - @TableField(value = "redirect") - private String redirect; - - @ApiModelProperty("是否有数据权限") - private Boolean hasDataScope; - - /** - * @see DataScopeEnum - */ - @ApiModelProperty("数据权限选项") - private String dataScopeOption; - - @ApiModelProperty("菜单类型") - private MenuTypeEnum menuType; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java deleted file mode 100644 index 8789660..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.sys.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 WendyYang - * @since 2022-07-21 - */ -@Data -@TableName("nd_notice") -@ApiModel(value = "SysNotice对象", description = "系统通知") -public class Notice implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("消息类型") - private Integer type; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("启用禁用") - private Boolean enabled; - - @ApiModelProperty("附件ID") - private String attachment; - - @ApiModelProperty("创建时间") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @ApiModelProperty("创建人id") - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @ApiModelProperty("最后修改时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @ApiModelProperty("最后修改人") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - - @ApiModelProperty("是否删除") - @TableLogic - private Boolean deleted; - - @ApiModelProperty("置顶时间") - private LocalDateTime toppedTime; - - @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") - private Integer permissions; - - @ApiModelProperty("权限值") - private String permissionsValue; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java deleted file mode 100644 index 420fc28..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.sys.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-03-21 - */ -@Data -@TableName("nd_notifys") -@ApiModel(value = "消息通知", description = "消息通知") -public class Notify implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("消息类型") - private String type; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("是否已读") - private Boolean readed; - - @ApiModelProperty("用户ID") - private Long userId; - - @ApiModelProperty("link") - private String link; - - @ApiModelProperty("创建时间") - private LocalDateTime createTime; - - @ApiModelProperty("其他业务信息") - private String extraInfo; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/ProjectEarlyWarning.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/ProjectEarlyWarning.java deleted file mode 100644 index 564fcc6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/ProjectEarlyWarning.java +++ /dev/null @@ -1,64 +0,0 @@ -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("nd_project_early_warning") -@ApiModel(value = "ProjectEarlyWarning", description = "项目预警") -public class ProjectEarlyWarning implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @ApiModelProperty(value = "项目编码") - private String projectCode; - - @ApiModelProperty(value = "区域") - private String areaCode; - - @ApiModelProperty(value = "建设单位CODE") - private String buildOrgCode; - - @ApiModelProperty(value = "预警状态") - private String status; - - @ApiModelProperty(value = "流程预警是否异常") - private Boolean processWarning; - @ApiModelProperty(value = "填报预警是否异常") - private Boolean declaredWarning; - @ApiModelProperty(value = "运维预警是否异常") - private Boolean operationWarning; - @ApiModelProperty(value = "续建资金预警是否异常") - private Boolean renewalFundWarning; - @ApiModelProperty(value = "是否正常") - private Boolean normal; - - @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") - private Integer ruleType; - @ApiModelProperty(value = "1超期 2临期") - private Integer noticeType; - - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java deleted file mode 100644 index 2dc9afa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java +++ /dev/null @@ -1,44 +0,0 @@ -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 lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * Region - 地域实体 - *

- * - * @author WendyYang - * @since 10:33 2022/10/12 - */ -@Data -@TableName("nd_region") -public class Region implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - private String regionCode; - - private String regionName; - - private Integer regionLevel; - - private String govUnit; - - private String parentCode; - - private Long parentId; - - private String regionCodePath; - - private Boolean deleted; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Resource.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Resource.java deleted file mode 100644 index 90e147b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Resource.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ningdatech.pmapi.sys.model.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Size; -import java.time.LocalDateTime; - -import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; - -/** - *

- * 实体类 - * 资源 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@TableName("c_resource") -@ApiModel(value = "Resource", description = "资源") -@AllArgsConstructor -public class Resource extends BaseEntity { - - private Long id; - - private static final long serialVersionUID = 1L; - - /** - * 编码 - */ - @ApiModelProperty(value = "编码") - @Size(max = 500, message = "编码长度不能超过500") - @TableField(value = "code", condition = LIKE) - private String code; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotEmpty(message = "名称不能为空") - @Size(max = 255, message = "名称长度不能超过255") - @TableField(value = "name", condition = LIKE) - private String name; - - /** - * 菜单ID - * #c_menu - */ - @ApiModelProperty(value = "菜单ID") - @TableField("menu_id") - private Long menuId; - - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - @Size(max = 255, message = "描述长度不能超过255") - @TableField(value = "describe_", condition = LIKE) - private String describe; - - /** - * 内置 - */ - @ApiModelProperty(value = "内置") - @TableField("readonly_") - private Boolean readonly; - - - @Builder - public Resource(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, - String code, String name, Long menuId, String describe, Boolean readonly) { - this.id = id; - this.createBy = createdBy; - this.createOn = createTime; - this.updateBy = updatedBy; - this.updateOn = updateTime; - this.code = code; - this.name = name; - this.menuId = menuId; - this.describe = describe; - this.readonly = readonly; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java deleted file mode 100644 index 42c3dc8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java +++ /dev/null @@ -1,50 +0,0 @@ -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.*; -import lombok.experimental.Accessors; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - * @since 2022-09-30 - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@TableName("nd_role") -@ApiModel(value = "Role", description = "角色") -@AllArgsConstructor -public class Role extends BaseEntity { - - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @ApiModelProperty(value = "名称") - private String name; - - @ApiModelProperty("角色编码") - private String code; - - @ApiModelProperty("是否是内置角色") - private Boolean fixed; - - @ApiModelProperty(value = "描述") - private String describe; - - @ApiModelProperty(value = "管理角色ID") - private String manageRoleIds; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleAuthority.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleAuthority.java deleted file mode 100644 index 68c7567..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleAuthority.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.sys.model.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.ningdatech.pmapi.sys.model.enumeration.AuthorizeTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -/** - *

- * 实体类 - * 角色的资源 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@TableName("nd_role_authority") -@ApiModel(value = "RoleAuthority", description = "角色的资源") -@AllArgsConstructor -public class RoleAuthority extends BaseEntity { - - private static final long serialVersionUID = 1L; - - private Long id; - - /** - * 资源id - */ - @ApiModelProperty(value = "资源id") - @NotNull(message = "资源id不能为空") - @TableField("authority_id") - private Long authorityId; - - /** - * 权限类型 - * #AuthorizeType{MENU:菜单;RESOURCE:资源;} - */ - @ApiModelProperty(value = "权限类型") - @NotNull(message = "权限类型不能为空") - @TableField("authority_type") - private AuthorizeTypeEnum authorityType; - - /** - * 角色id - * #c_role - */ - @ApiModelProperty(value = "角色id") - @NotNull(message = "角色id不能为空") - @TableField("role_id") - private Long roleId; - - - @Builder - public RoleAuthority(Long id, LocalDateTime createTime, Long createdBy, - Long authorityId, AuthorizeTypeEnum authorityType, Long roleId) { - this.id = id; - this.createOn = createTime; - this.createBy = createdBy; - this.authorityId = authorityId; - this.authorityType = authorityType; - this.roleId = roleId; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenu.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenu.java deleted file mode 100644 index 6eadc91..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenu.java +++ /dev/null @@ -1,40 +0,0 @@ -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.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - *

- * - *

- * - * @author PoffyZhang - * @since 2022-11-11 - */ -@TableName("nd_role_menu") -@Data -@ApiModel(value = "RoleMenu对象") -@AllArgsConstructor -@NoArgsConstructor -public class RoleMenu implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("id") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @ApiModelProperty("menu_id") - private Long menuId; - - @ApiModelProperty("role_id") - private Long roleId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenuDatascope.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenuDatascope.java deleted file mode 100644 index 2516d8e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/RoleMenuDatascope.java +++ /dev/null @@ -1,36 +0,0 @@ -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; - -/** - *

- * 角色菜单数据权限关联表 - *

- * - * @author WendyYang - * @since 2023-01-28 - */ -@Data -@TableName("nd_role_menu_datascope") -@ApiModel(value = "NdRoleMenuDatascope对象", description = "角色菜单数据权限关联表") -public class RoleMenuDatascope extends BaseEntity { - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("角色ID") - private Long roleId; - - @ApiModelProperty("菜单ID") - private Long menuId; - - @ApiModelProperty("数据权限") - private Integer datascope; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/UserRole.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/UserRole.java deleted file mode 100644 index 9b0cf0c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/UserRole.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ningdatech.pmapi.sys.model.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.ToString; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 实体类 - * 角色分配 - * 账号角色绑定 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@Accessors(chain = true) -@TableName("nd_user_role") -@ApiModel(value = "UserRole", description = "角色分配") -public class UserRole implements Serializable { - - private static final long serialVersionUID = 2210188203287234336L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 角色ID - */ - @ApiModelProperty(value = "角色ID") - @NotNull(message = "角色ID不能为空") - @TableField("role_id") - private Long roleId; - - /** - * 用户ID - */ - @ApiModelProperty(value = "用户ID") - @NotNull(message = "用户ID不能为空") - @TableField("user_id") - private Long userId; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @Builder - public UserRole(Long roleId, Long userId) { - this.roleId = roleId; - this.userId = userId; - } - -} 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 deleted file mode 100644 index 7d28ab6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java +++ /dev/null @@ -1,130 +0,0 @@ -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 projectCode; - @ApiModelProperty(value = "建设单位") - private String buildOrgCode; - @ApiModelProperty(value = "项目id") - private Long projectId; - @ApiModelProperty(value = "项目名称") - private String projectName; - @ApiModelProperty(value = "项目当时的状态") - private Integer projectStatus; - - /** - * 流程类型 - */ - @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 = "1超期 2临期") - private Integer noticeType; - - @ApiModelProperty(value = "申报单位") - private String buildOrgName; - - /** - * 规则 - */ - @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") - private Integer ruleType; - - @ApiModelProperty(value = "业务biz") - private Integer biz; - - @ApiModelProperty(value = "路径") - private String path; - - @ApiModelProperty(value = "审批节点ID") - private String nodeId; - - @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; - - @ApiModelProperty(value = "临期时要记录下 超期的时间") - private Integer overTime; - - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/AuthorizeTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/AuthorizeTypeEnum.java deleted file mode 100644 index 936f3cc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/AuthorizeTypeEnum.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.sys.model.enumeration; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.stream.Stream; - -/** - *

- * 实体注释中生成的类型枚举 - * 角色的资源 - *

- * - * @author PoffyZhang - * @since 2022-09-30 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "AuthorizeType", description = "权限类型-枚举") -public enum AuthorizeTypeEnum { - - /** - * MENU="菜单" - */ - MENU("菜单"), - DATA("数据"), - /** - * RESOURCE="资源" - */ - RESOURCE("资源"); - - @ApiModelProperty(value = "描述") - private String desc; - - - /** - * 根据当前枚举的name匹配 - */ - public static AuthorizeTypeEnum match(String val, AuthorizeTypeEnum def) { - return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); - } - - public static AuthorizeTypeEnum get(String val) { - return match(val, null); - } - - public boolean eq(AuthorizeTypeEnum val) { - return val != null && getCode().equals(val.name()); - } - - @ApiModelProperty(value = "编码", allowableValues = "MENU,RESOURCE", example = "MENU") - public String getCode() { - return this.name(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/DataScopeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/DataScopeEnum.java deleted file mode 100644 index ee5465e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/DataScopeEnum.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ningdatech.pmapi.sys.model.enumeration; - -import lombok.Getter; - -import java.util.Arrays; - -/** - *

- * 数据权限可见范围枚举 - *

- * - * @author WendyYang - * @since 15:59 2023/1/28 - */ -@Getter -public enum DataScopeEnum { - - /** - * 数据权限可见范围 - */ - CURRENT_ORG("本单位", 1), - CURRENT_AND_SUB_ORG("本单位及下属单位", 2), - CURRENT_REGION("当前区域", 3), - CURRENT_CITY("全市", 4); - - private final String desc; - private final Integer code; - - DataScopeEnum(String desc, Integer code) { - this.code = code; - this.desc = desc; - } - - public boolean eq(Integer code) { - return this.code.equals(code); - } - - /** - * 根据code获取枚举实例 - * - * @param code 编码 - * @return {@link DataScopeEnum} - * @author WendyYang - **/ - public static DataScopeEnum getByCode(Integer code) { - return Arrays.stream(values()) - .filter(w -> w.eq(code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("无效的数据权限可见范围编码")); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/MenuTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/MenuTypeEnum.java deleted file mode 100644 index 96dc4ba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/MenuTypeEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.sys.model.enumeration; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * 资源类型 - * - * @author PoffyZhang - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "MenuTypeEnum", description = "资源类型-枚举") -public enum MenuTypeEnum { - /** - * 菜单 - */ - MENU(0, "菜单"), - - /** - * 按钮 - */ - BUTTON(1, "按钮"); - - /** - * 资源类型 - */ - private Integer code; - - /** - * 资源描述 - */ - private String desc; - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - @ApiModelProperty(value = "编码", allowableValues = "0,1", example = "0") - public Integer getCode() { - return this.code; - } - - - public boolean eq(String val) { - return this.name().equals(val); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeListReq.java deleted file mode 100644 index 7bb3cf1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeListReq.java +++ /dev/null @@ -1,31 +0,0 @@ -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; - -/** - *

- * NoticeListReq - *

- * - * @author WendyYang - * @since 00:32 2022/7/23 - */ -@Data -@ApiModel("公告查询参数类") -@EqualsAndHashCode(callSuper = true) -public class NoticeListReq extends PagePo { - - @ApiModelProperty("消息类型") - private Integer type; - - @ApiModelProperty("公告标题") - private String title; - - @ApiModelProperty("公告状态") - private Boolean enabled; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeSaveReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeSaveReq.java deleted file mode 100644 index 35947d7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeSaveReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.sys.model.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - *

- * MsgUpdatePo - *

- * - * @author WendyYang - * @since 21:35 2022/7/21 - */ -@Data -@ApiModel("消息新增实体") -public class NoticeSaveReq { - - @ApiModelProperty("ID") - private Long id; - - @ApiModelProperty("通知标题") - @NotBlank(message = "通知标题不能为空") - private String title; - - @ApiModelProperty("通知类型") - @NotNull(message = "通知类型不能为空") - private Integer type; - - @ApiModelProperty("通知内容") - @NotBlank(message = "通知内容不能为空") - private String content; - - @ApiModelProperty("附件ID编码") - private String attachment; - - @ApiModelProperty("是否启用") - @NotNull(message = "是否启用不能为空") - private Boolean enabled; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeStatusModifyReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeStatusModifyReq.java deleted file mode 100644 index 21e5d17..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NoticeStatusModifyReq.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.sys.model.req; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - *

- * NoticeStatusUpdatePo - *

- * - * @author WendyYang - * @since 22:32 2022/7/22 - */ -@Data -@ApiModel("消息状态修改") -public class NoticeStatusModifyReq { - - @ApiModelProperty("ID") - @NotNull(message = "ID不能为空") - private Long id; - - @ApiModelProperty("状态:true 启用、false 停用") - @NotNull(message = "状态不能为空") - private Boolean status; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java deleted file mode 100644 index a9b6266..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java +++ /dev/null @@ -1,31 +0,0 @@ -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; - -/** - *

- * NoticeListReq - *

- * - * @author zpf - * @since 00:32 2023/3/23 - */ -@Data -@ApiModel("通知查询参数类") -@EqualsAndHashCode(callSuper = true) -public class NotifyListReq extends PagePo { - - @ApiModelProperty("是否已读") - private Boolean readed; - - @ApiModelProperty("公告标题") - private String title; - - @ApiModelProperty("类型") - private String type; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java deleted file mode 100644 index 03ba905..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java +++ /dev/null @@ -1,40 +0,0 @@ -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.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RolePageQuery", description = "角色") -public class RolePageReq extends PagePo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - @ApiModelProperty("是否是内置角色") - private Boolean fixed; - -} 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 deleted file mode 100644 index db6dbae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java +++ /dev/null @@ -1,44 +0,0 @@ -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("申报单位code") - private String buildOrgCode; - - @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/MenuResourceTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuResourceTreeVO.java deleted file mode 100644 index 76436fc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuResourceTreeVO.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.ningdatech.pmapi.sys.model.enumeration.AuthorizeTypeEnum; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import javax.validation.constraints.Size; - -import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; - -/** - * menuList - * 菜单资源树 - * - * @author PoffyZhang - */ -@Data -@ToString(callSuper = true) -public class MenuResourceTreeVO { - - private AuthorizeTypeEnum type; - private String code; - private String icon; - private Boolean isDef; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - @Size(max = 200, message = "描述长度不能超过200") - @TableField(value = "describe_", condition = LIKE) - private String describe; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuRoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuRoleVO.java deleted file mode 100644 index 7201c9c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuRoleVO.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author PoffyZhang - * @since 2022-9-30 - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@ApiModel(value = "RoleMenuVO", description = "菜单") -@AllArgsConstructor -public class MenuRoleVO extends MenuTreeEntity { - - private static final long serialVersionUID = 1L; - - /** - * 类型;[0-菜单 1-目录 2-按钮] - */ - @ApiModelProperty(value = "类型") - private MenuTypeEnum menuType; - - /** - * 组件 - */ - @ApiModelProperty(value = "组件") - private String component; - - /** - * 菜单图标 - */ - @ApiModelProperty(value = "菜单图标") - private String icon; - - /** - * 是否隐藏 - */ - @ApiModelProperty(value = "是否隐藏") - private Integer hidden; - - /** - * 是否有权限 - */ - @ApiModelProperty(value = "是否有权限 0没有 1有") - private Integer hasPermission = 0; - - /** - * activeMenu - */ - @ApiModelProperty(value = "activeMenu") - private String activeMenu; - - /** - * 跳转 - */ - @ApiModelProperty(value = "跳转") - @TableField(value = "redirect") - private String redirect; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuVO.java deleted file mode 100644 index f9c4532..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/MenuVO.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -/** - *

- * 实体类 - * 菜单 - *

- * - * @author PoffyZhang - * @since 2022-9-30 - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@Accessors(chain = true) -@ApiModel(value = "MenuVO", description = "菜单") -@AllArgsConstructor -@Builder -public class MenuVO { - - private static final long serialVersionUID = 1L; - - /** - * 权限" - */ - @ApiModelProperty(value = "权限") - private String permission; - /** - * 类型;[0-菜单 1按钮] - */ - @ApiModelProperty(value = "类型") - private Integer type; - - /** - * 组件 - */ - @ApiModelProperty(value = "组件") - private String component; - - /** - * 菜单图标 - */ - @ApiModelProperty(value = "菜单图标") - private String icon; - - /** - * 子菜单数目 - */ - @ApiModelProperty(value = "是否隐藏") - private Integer hidden; - - /** - * activeMenu - */ - @ApiModelProperty(value = "activeMenu") - private String activeMenu; - - /** - * 跳转 - */ - @ApiModelProperty(value = "跳转") - @TableField(value = "redirect") - private String redirect; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java deleted file mode 100644 index 8224f37..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - *

- * NoticeDetailVo - *

- * - * @author WendyYang - * @since 16:56 2022/7/22 - */ -@Data -@ApiModel("公告详情") -public class NoticeDetailVO { - - @ApiModelProperty("ID") - private Long id; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("状态") - private Boolean enabled; - - @ApiModelProperty("公告类型") - private Integer type; - - @ApiModelProperty("附件信息") - private List attachments; - - @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") - private Integer permissions; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeListItemVO.java deleted file mode 100644 index b5433d9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeListItemVO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Tolerate; - -import java.time.LocalDateTime; - -/** - *

- * ManageNoticeListItem - *

- * - * @author WendyYang - * @since 00:30 2022/7/23 - */ -@Data -@Builder -public class NoticeListItemVO { - - @Tolerate - public NoticeListItemVO() { - } - - @ApiModelProperty("公告ID") - private Long id; - - @ApiModelProperty("公告类型") - private Integer type; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("创建时间") - private LocalDateTime createOn; - - @ApiModelProperty("是否启用") - private Boolean enabled; - - @ApiModelProperty("是否置顶") - private Boolean topped; - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java deleted file mode 100644 index 21862b7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.apache.commons.lang3.StringUtils; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - *

- * 通知 - *

- * - * @author zpf - * @since 2023-03-21 - */ -@Data -@ApiModel(value = "消息通知VO", description = "消息通知") -public class NotifyVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("ID") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("消息类型") - private String type; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("实例id") - private String instanceId; - - @ApiModelProperty("是否已读") - private Boolean readed; - - @ApiModelProperty("用户ID") - private Long userId; - - @ApiModelProperty("link") - private String link; - - @ApiModelProperty("创建时间") - private LocalDateTime createTime; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("会议ID") - private Long meetingId; - - public String getTypeName(){ - if(Objects.nonNull(this.type)){ - return MsgTypeEnum.getDescByName(this.type); - } - return StringUtils.EMPTY; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProcessDetailStatVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProcessDetailStatVO.java deleted file mode 100644 index 82b4bcb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProcessDetailStatVO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.concurrent.TimeUnit; - -/** - *

- * ProcessDetailStatVO - *

- * - * @author WendyYang - * @since 2023/7/31 - **/ -@Data -public class ProcessDetailStatVO { - - private Integer instType; - - private String instTypeName; - - @ApiModelProperty("流程实例总数") - private Integer totalInst; - - @ApiModelProperty("已完成流程实例数") - private Integer finishedInst; - - @ApiModelProperty("已完成流程实例数") - private Integer pendingInst; - - @ApiModelProperty("平均耗时") - private double avgTime; - - @ApiModelProperty("最长耗时") - private double maxTime; - - @ApiModelProperty("最短耗时") - private double minTime; - - @ApiModelProperty("时间单位") - private TimeUnit timeUnit; - - public static ProcessDetailStatVO init() { - ProcessDetailStatVO stat = new ProcessDetailStatVO(); - stat.setFinishedInst(0); - stat.setTotalInst(0); - stat.setPendingInst(0); - return stat; - } - - public void incrPending() { - this.pendingInst += 1; - } - - public void incrFinished() { - this.finishedInst += 1; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java deleted file mode 100644 index 55aa5d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -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("nd_project_early_warning") -@ApiModel(value = "ProjectEarlyWarning", description = "项目预警") -public class ProjectEarlyWarningVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "id") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @ApiModelProperty(value = "项目编码") - private String projectCode; - - @ApiModelProperty(value = "项目名称") - private String projectName; - - @ApiModelProperty(value = "区域") - private String areaCode; - - @ApiModelProperty(value = "建设单位CODE") - private String buildOrgCode; - - @ApiModelProperty(value = "预警状态") - private String status; - - @ApiModelProperty(value = "流程预警是否异常") - private Boolean processWarning; - @ApiModelProperty(value = "填报预警是否异常") - private Boolean declaredWarning; - @ApiModelProperty(value = "运维预警是否异常") - private Boolean operationWarning; - @ApiModelProperty(value = "续建资金预警是否异常") - private Boolean renewalFundWarning; - @ApiModelProperty(value = "是否正常") - private Boolean normal; - - @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督 4.续建资金项目") - private Integer ruleType; - @ApiModelProperty(value = "1超期 2临期") - private Integer noticeType; - - /** - * 最新的一条预警记录 - */ - @ApiModelProperty(value = "预警ID") - private Long recordId; - @ApiModelProperty(value = "预警员工号") - private String warningEmployeecode; - @ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔") - private String noticeMethod; - @ApiModelProperty(value = "通知内容") - private String noticeContent; - @ApiModelProperty(value = "任务开始时间") - private LocalDateTime instStart; - @ApiModelProperty(value = "预警时间") - private LocalDateTime warningTime; - @ApiModelProperty(value = "路径") - private String path; - @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; - - - private LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RegionTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RegionTreeVO.java deleted file mode 100644 index fb14771..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RegionTreeVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - *

- * RegionTreeVO - *

- * - * @author WendyYang - * @since 10:35 2022/10/12 - */ -@Data -@ToString(callSuper = true) -@ApiModel(value = "RegionTreeVO", description = "区域树状结构VO") -public class RegionTreeVO { - - private Long id; - - @ApiModelProperty("区域码") - @NotBlank(message = "地区编码不能为空") - private String regionCode; - - @ApiModelProperty("地区名") - @NotBlank(message = "地区名称不能为空") - private String name; - - @ApiModelProperty("级别") - @NotNull(message = "级别不能为空") - private Integer regionLevel; - - @ApiModelProperty("区域级别") - @NotBlank(message = "区域级别不能为空") - private String govUnit; - - @ApiModelProperty("地区父级编码:-1为顶级区域") - @NotBlank(message = "地区父级编码不能为空") - private String parentCode; - - @ApiModelProperty("子区域") - private List children; - - @ApiModelProperty("唯一编码:regionCode##name##level") - private String unionCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleUserSaveVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleUserSaveVO.java deleted file mode 100644 index 4843994..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleUserSaveVO.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.List; - -/** - *

- * 实体类 - * 角色下的员工 - *

- * - * @author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -@Builder -@ApiModel(value = "RoleUserSaveVO", description = "给角色分配员工") -public class RoleUserSaveVO implements Serializable { - - private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "绑定或取消") - @NotNull(message = "请填写绑定或取消参数") - private Boolean flag; - /** - * 角色;#c_role - */ - @ApiModelProperty(value = "角色") - @NotNull(message = "请选择角色") - private Long roleId; - /** - * 用户;#c_user - */ - @ApiModelProperty(value = "用户") - @Size(min = 1, message = "请选择用户") - private List userIdList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java deleted file mode 100644 index 570d5ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ningdatech.pmapi.sys.model.vo; - -import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; -import com.ningdatech.pmapi.sys.model.entity.BaseEntity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; - -import java.util.List; - -/** - *

- * 实体类 - * 角色 - *

- * - * @author PoffyZhang - * @since 2022-09-30 - */ -@Data -@NoArgsConstructor -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@ApiModel(value = "Role", description = "角色") -@AllArgsConstructor -@Builder -public class RoleVO extends BaseEntity { - - private Long id; - - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - @ApiModelProperty("管理角色ID") - private List manageRoleIdList; - - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String describe; - - @ApiModelProperty("是否是内置角色:true 是、false 否") - private Boolean fixed; - - @ApiModelProperty("菜单数据权限") - private List menuDataScopeList; - - /** - * 菜单 - */ - @ApiModelProperty(value = "菜单") - private List menu; -} 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 deleted file mode 100644 index f4819d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java +++ /dev/null @@ -1,46 +0,0 @@ -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 deleted file mode 100644 index da3ff89..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100644 index bbbc1ec..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java +++ /dev/null @@ -1,157 +0,0 @@ -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 = "1超期 2临期") - private Integer noticeType; - - - /** - * 申报单位 - */ - @ApiModelProperty(value = "申报单位CODE") - private String buildOrgCode; - @ApiModelProperty(value = "申报单位") - private String buildOrgName; - - /** - * 规则 - */ - @ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督4.续建") - private Integer ruleType; - - @ApiModelProperty(value = "路径") - private String path; - @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; - - private LocalDateTime createOn; - private String createBy; - private LocalDateTime updateOn; - private String updateBy; - @ApiModelProperty(value = "业务biz") - private Integer biz; - @ApiModelProperty(value = "临期时要记录下 超期的时间") - private Integer overTime; - - 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 deleted file mode 100644 index 8ebc57c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java +++ /dev/null @@ -1,15 +0,0 @@ -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/IMenuService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IMenuService.java deleted file mode 100644 index 7ca17db..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IMenuService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO; - -import java.util.List; - -/** - *

- * 业务接口 - * 菜单 - *

- * - * @author WendyYang - * @since 2022-09-30 - */ -public interface IMenuService extends IService { - - /** - * 根据ID删除 - * - * @param ids id - * @return 是否成功 - */ - boolean removeByIdWithCache(List ids); - - /** - * 修改菜单 - * - * @param menu 菜单 - * @param userId / - * @return 是否成功 - */ - boolean update(MenuUpdateDTO menu, Long userId); - - /** - * 保存菜单 - * - * @param menu 菜单 - * @param userId / - * @return 是否成功 - */ - boolean save(MenuSaveDTO menu, Long userId); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INoticeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INoticeService.java deleted file mode 100644 index 1a79566..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INoticeService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.entity.Notice; - -/** - *

- * 系统通知 服务类 - *

- * - * @author WendyYang - * @since 2022-07-21 - */ -public interface INoticeService extends IService { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INotifyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INotifyService.java deleted file mode 100644 index 72f52e0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INotifyService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.entity.Notify; - -/** - *

- * 系统通知 服务类 - *

- * - * @author zpf - * @since 2023-03-21 - */ -public interface INotifyService extends IService { - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IProjectEarlyWarningService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IProjectEarlyWarningService.java deleted file mode 100644 index 8394613..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IProjectEarlyWarningService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; - -import java.util.List; - -/** - * @author PoffyZhang - */ -public interface IProjectEarlyWarningService extends IService { - - Boolean earlyWarning(Project project, Integer ruleType, Integer noticeType); - - Boolean earlyWarning(Project project, Integer ruleType, List noticeTypes); - - Boolean earlyWarning(String projectCode, Integer code, List noticeTypes); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java deleted file mode 100644 index 2aca320..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.entity.Region; - -import java.util.List; - -/** - *

- * 地域管理 服务类 - *

- * - * @author zpf - * @since 2023-1-18 - */ -public interface IRegionService extends IService { - - /** - * 查询所有区域 - * - * @return 所有区域 - */ - List all(); - - /** - * 查询区域 - * - * @param regionCode 区域编码 - * @param regionLevel 区域层级 - * @return {@link Region} - */ - Region getOne(String regionCode, int regionLevel); - - /** - * 查询大于等与该级别的所有区域 - * - * @param regionLevel - * @return 区域集合 - */ - List listGeLevel(int regionLevel); - - /** - * 是否为父节点 - * - * @param regionId 区域ID - * @return boolean - **/ - boolean isParentRegion(Long regionId); - - /** - * 获取当前区域的本级 - * - * @param parentId 区域ID - * @param regionCode 区域code - * @return 区域ID - **/ - Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode); - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuDatascopeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuDatascopeService.java deleted file mode 100644 index 79ed6ca..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuDatascopeService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 角色菜单数据权限关联表 服务类 - *

- * - * @author WendyYang - * @since 2023-01-28 - */ -public interface IRoleMenuDatascopeService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuService.java deleted file mode 100644 index 5b6ef02..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleMenuService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.entity.RoleMenu; - -/** - *

- * 服务类 - *

- * - * @author PoffyZhang - * @since 2022-11-11 - */ -public interface IRoleMenuService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java deleted file mode 100644 index c7bf23e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; - -import java.util.List; - -/** - *

- * 业务接口 - * 角色 - *

- * - * @author PoffyZhang - * @since 2022-09-30 - */ -public interface IRoleService extends IService { - - - /** - * 根据ID删除 - * - * @param ids id - * @return 是否成功 - */ - boolean removeByIdWithCache(List ids); - - /** - * 查询用户拥有的角色 - * - * @param userId 用户id - * @return 角色 - */ - List findRoleByUserId(Long userId); - - /** - * 保存角色 - * - * @param data 角色 - * @param userId 用户id - */ - void saveRole(RoleSaveDTO data, Long userId); - - /** - * 修改 - * - * @param role 角色 - * @param userId 用户id - */ - void updateRole(RoleUpdateDTO role, Long userId); - - /** - * 根据角色编码查询用户ID - * - * @param codes 角色编码 - * @return 用户id - */ - List findUserIdByCode(String[] codes); - - /** - * 检测角色名重复 - * - * @param name / - * @return 存在返回真 - */ - Boolean check(String name); - - /** - * 校验角色名 - * - * @param name / - * @param id / - * @return boolean - */ - Boolean check(String name, Long id); - - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java deleted file mode 100644 index 09e308c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.sys.model.entity.UserRole; - -import java.util.List; - -/** - *

- * 业务接口 - * 角色分配 - * 账号角色绑定 - *

- * - * @author PoffyZhang - */ -public interface IUserRoleService extends IService { - /** - * 初始化超级管理员角色 权限 - * - * @param userId 用户id - * @return 是否正确 - */ - boolean initAdmin(Long userId); - - /** - * 查询角色关联的用户ID - * - * @param roleId 角色ID - * @return 用户ID集合 - * @author WendyYang - **/ - List listUserIdByRoleId(Long roleId); - - default UserRole getOne(Long userId, Long roleId) { - LambdaQueryWrapper eq = Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId) - .eq(UserRole::getRoleId, roleId) - .last(BizConst.LIMIT_1); - return getOne(eq); - } - -} 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 deleted file mode 100644 index 1a402eb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -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.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()) - .eq(StringUtils.isNotBlank(req.getBuildOrgCode()), WflowEarlyWarningRecords::getBuildOrgCode, req.getBuildOrgCode()) - .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(CollUtil.isEmpty(page.getRecords())){ - 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/sys/service/impl/MenuServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java deleted file mode 100644 index ac9fb3a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpStatus; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BaseUncheckedException; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.ValidatorUtil; -import com.ningdatech.pmapi.common.constant.DefValConst; -import com.ningdatech.pmapi.sys.mapper.MenuMapper; -import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; -import com.ningdatech.pmapi.sys.service.IMenuService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import static com.ningdatech.basic.util.StrPool.DEF_PARENT_ID; - - -/** - *

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

- * - * @author WendyYang - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class MenuServiceImpl extends ServiceImpl implements IMenuService { - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean removeByIdWithCache(List ids) { - if (ids.isEmpty()) { - return true; - } - - List lastIds = Lists.newArrayList(); - lastIds.addAll(ids); - - //子菜单id - subMenus(ids, lastIds); - - return this.removeByIds(lastIds); - } - - private void subMenus(List ids, List lastIds) { - if (CollUtil.isEmpty(ids)) { - return; - } - ids.forEach(id -> { - List subMenus = list(Wrappers.lambdaQuery(Menu.class).eq(Menu::getPid, id)); - if (CollUtil.isNotEmpty(subMenus)) { - //添加子菜单ID - List subIds = subMenus.stream().map(Menu::getId).collect(Collectors.toList()); - lastIds.addAll(subIds); - //递归 - subMenus(subIds, lastIds); - } - }); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean update(MenuUpdateDTO data, Long userId) { - if (MenuTypeEnum.MENU.equals(data.getMenuType())) { - if (StrUtil.isBlank(data.getPath())) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空"); - } - if (StrUtil.isBlank(data.getComponent())) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【页面路径】不能为空"); - } - if (!ValidatorUtil.isUrl(data.getPath())) { - if (checkPath(data.getId(), data.getPath())) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】:{}重复", data.getPath()); - } - } - } - Menu old = getById(data); - if (Objects.isNull(old)) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "您修改的菜单已不存在"); - } - Menu menu = BeanUtil.toBean(data, Menu.class); - menu.setUpdateBy(userId); - return this.updateById(menu); - } - - public Boolean checkPath(Long id, String path) { - return baseMapper.selectCount(Wrappers.lambdaQuery(Menu.class).ne(Menu::getId, id).eq(Menu::getPath, path)) > 0; - } - - public Boolean checkTitle(Long id, String title) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Menu.class) - .ne(Menu::getId, id).eq(Menu::getTitle, title); - return baseMapper.selectCount(wrapper) > 0; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean save(MenuSaveDTO data, Long userId) { - data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); - if (data.getMenuType().equals(MenuTypeEnum.MENU)) { - if (StrUtil.isBlank(data.getPath())) { - throw BizException.wrap("【地址栏路径】不能为空"); - } - if (StrUtil.isBlank(data.getComponent())) { - throw BizException.wrap("【页面路径】不能为空"); - } - if (!ValidatorUtil.isUrl(data.getPath())) { - if (checkPath(null, data.getPath())) { - throw BizException.wrap("【地址栏路径】:{}重复", data.getPath()); - } - } - } - data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); - Menu menu = BeanUtil.toBean(data, Menu.class); - menu.setCreateBy(userId); - menu.setUpdateBy(userId); - save(menu); - return Boolean.TRUE; - } - - private void checkButtonUnique(Long pid, String path, Long menuId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(Menu.class) - .eq(Menu::getPid, pid).eq(Menu::getPath, path) - .ne(menuId != null, Menu::getId, menuId); - if (count(query) > 1) { - throw BizException.wrap("【按钮路径】:{}重复", path); - } - } - - public List findChildrenByParentId(Long pid) { - if (Objects.isNull(pid)) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空"); - } - return list(Wrappers.lambdaQuery(Menu.class).in(Menu::getPid, pid).orderByAsc(Menu::getSort)); - } - - private void fill(Menu resource) { - if (resource.getPid() == null || resource.getPid() <= 0) { - resource.setPid(DefValConst.PARENT_ID); - } else { - Menu parent = getById(resource.getPid()); - if (Objects.isNull(parent)) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "请正确填写父级"); - } - } - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NoticeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NoticeServiceImpl.java deleted file mode 100644 index d514d1e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NoticeServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.sys.model.entity.Notice; -import com.ningdatech.pmapi.sys.mapper.NoticeMapper; -import com.ningdatech.pmapi.sys.service.INoticeService; -import org.springframework.stereotype.Service; - -/** - *

- * 系统通知 服务实现类 - *

- * - * @author WendyYang - * @since 2022-07-21 - */ -@Service -public class NoticeServiceImpl extends ServiceImpl implements INoticeService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NotifyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NotifyServiceImpl.java deleted file mode 100644 index c981cb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NotifyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.sys.mapper.NotifyMapper; -import com.ningdatech.pmapi.sys.model.entity.Notify; -import com.ningdatech.pmapi.sys.service.INotifyService; -import org.springframework.stereotype.Service; - -/** - *

- * 系统通知 服务实现类 - *

- * - * @author zof - * @since 2023-03-21 - */ -@Service -public class NotifyServiceImpl extends ServiceImpl implements INotifyService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/ProjectEarlyWarningServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/ProjectEarlyWarningServiceImpl.java deleted file mode 100644 index 470f25d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/ProjectEarlyWarningServiceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; -import com.ningdatech.pmapi.sys.mapper.ProjectEarlyWarningMapper; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; -import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; -import com.wflow.enums.WarningNoticeTypeEnum; -import com.wflow.enums.WarningRuleTypeEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - - -/** - *

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

- * - * @author ZPF - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class ProjectEarlyWarningServiceImpl extends ServiceImpl - implements IProjectEarlyWarningService { - - private final IProjectService projectService; - - @Override - public Boolean earlyWarning(Project project, Integer ruleType, Integer noticeType) { - return doEarlyWarning(project, ruleType, noticeType); - } - - @Override - public Boolean earlyWarning(Project project, Integer ruleType, List noticeTypes) { - if(CollUtil.isNotEmpty(noticeTypes)){ - if(noticeTypes.contains(WarningNoticeTypeEnum.OVER.getCode())){ - return doEarlyWarning(project, ruleType,WarningNoticeTypeEnum.OVER.getCode()); - }else{ - return doEarlyWarning(project, ruleType,WarningNoticeTypeEnum.ADVENT.getCode()); - } - } - return doEarlyWarning(project, ruleType, null); - } - - @Override - public Boolean earlyWarning(String projectCode, Integer ruleType, List noticeTypes) { - Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ - return Boolean.FALSE; - } - return earlyWarning(project,ruleType,noticeTypes); - } - - private Boolean doEarlyWarning(Project project, Integer ruleType, Integer noticeType) { - if(Objects.isNull(project) || Objects.isNull(ruleType)){ - return Boolean.FALSE; - } - String projectCode = project.getProjectCode(); - ProjectEarlyWarning old = getOne(Wrappers.lambdaQuery(ProjectEarlyWarning.class) - .eq(ProjectEarlyWarning::getProjectCode, projectCode) - .last(BizConst.LIMIT_1)); - ProjectEarlyWarning warning = new ProjectEarlyWarning(); - if(Objects.nonNull(old)){ - warning.setId(old.getId()); - }else{ - warning.setBuildOrgCode(project.getBuildOrgCode()); - warning.setAreaCode(project.getAreaCode()); - } - - switch (WarningRuleTypeEnum.checkByCode(ruleType)){ - case PROCESS_WARNING: - warning.setProcessWarning(Boolean.TRUE); - break; - case DECLARED_WARNING: - warning.setDeclaredWarning(Boolean.TRUE); - break; - case OPERATION_WARNING: - warning.setOperationWarning(Boolean.TRUE); - break; - case RENEWAL_FUND: - warning.setRenewalFundWarning(Boolean.TRUE); - break; - default: - return Boolean.FALSE; - } - - warning.setRuleType(ruleType); - if(Objects.isNull(noticeType)){ - warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); - }else{ - switch (WarningNoticeTypeEnum.match(noticeType)){ - case OVER: - warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); - break; - case ADVENT: - warning.setStatus(ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); - break; - default: - warning.setStatus(ProjectEarlyWarningStatusEnum.OVER_TIME.name()); - break; - } - } - - warning.setNoticeType(noticeType); - warning.setNormal(Boolean.FALSE); - return saveOrUpdate(warning); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java deleted file mode 100644 index 7b5f4bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.mapper.RegionMapper; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-1-18 - */ -@Service -public class RegionServiceImpl extends ServiceImpl implements IRegionService { - - @Override - public List all() { - return CollUtils.convert(list(), RegionConverter::toRegionDTO); - } - - @Override - public Region getOne(String regionCode, int regionLevel) { - return getOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, regionCode) - .eq(Region::getRegionLevel, regionLevel)); - } - - @Override - public List listGeLevel(int regionLevel) { - List regionsByLevel = lambdaQuery().ne(Region::getId, -1) - .le(Region::getRegionLevel, regionLevel).list(); - return CollUtils.convert(regionsByLevel, RegionConverter::toRegionDTO); - } - - @Override - public boolean isParentRegion(Long regionId) { - return baseMapper.exists(Wrappers.lambdaQuery(Region.class) - .eq(Region::getParentId, regionId) - .eq(Region::getDeleted, false)); - } - - @Override - public Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode) { - return baseMapper.selectOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getParentId, parentId) - .eq(Region::getRegionCode, regionCode) - .eq(Region::getDeleted, false)) - .getId(); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuDatascopeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuDatascopeServiceImpl.java deleted file mode 100644 index 74ca544..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuDatascopeServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope; -import com.ningdatech.pmapi.sys.mapper.RoleMenuDatascopeMapper; -import com.ningdatech.pmapi.sys.service.IRoleMenuDatascopeService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 角色菜单数据权限关联表 服务实现类 - *

- * - * @author WendyYang - * @since 2023-01-28 - */ -@Service -public class RoleMenuDatascopeServiceImpl extends ServiceImpl implements IRoleMenuDatascopeService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuServiceImpl.java deleted file mode 100644 index c58c643..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleMenuServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.sys.model.entity.RoleMenu; -import com.ningdatech.pmapi.sys.mapper.RoleMenuMapper; -import com.ningdatech.pmapi.sys.service.IRoleMenuService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author PoffyZhang - * @since 2022-11-11 - */ -@Service -public class RoleMenuServiceImpl extends ServiceImpl implements IRoleMenuService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java deleted file mode 100644 index b94cd34..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpStatus; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.exception.BaseUncheckedException; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.exception.code.ExceptionCode; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.sys.mapper.RoleMapper; -import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; -import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; -import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; -import com.ningdatech.pmapi.sys.model.entity.*; -import com.ningdatech.pmapi.sys.service.*; -import com.ningdatech.pmapi.sys.utils.AuthCacheKeyUtils; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.manage.UserAuthManage; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * 业务实现类 - * 角色 - *

- * - * @author PoffyZhang - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class RoleServiceImpl extends ServiceImpl implements IRoleService { - - private final IUserRoleService userRoleService; - private final RoleMapper roleMapper; - private final IRoleMenuDatascopeService roleMenuDatascopeService; - private final CachePlusOps cachePlusOps; - private final IRoleMenuService roleMenuService; - private final IMenuService menuService; - private final UserAuthManage userAuthManage; - - /** - * 删除角色时,需要级联删除跟角色相关的一切资源: - * 1,角色本身 - * 2,角色-组织: - * 3,角色-权限(菜单和按钮): - * 4,角色-用户:角色拥有的用户 - * 5,用户-权限: - */ - @Override - @Transactional(rollbackFor = Exception.class) - public boolean removeByIdWithCache(List ids) { - if (ids.isEmpty()) { - return true; - } - - if (userRoleService.count(Wrappers.lambdaQuery(UserRole.class).select(UserRole::getUserId) - .in(UserRole::getRoleId, ids)) > 0) { - throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "该角色下还有用户 不能随意删除!"); - } - - // 角色 - boolean removeFlag = removeByIds(ids); - - //角色拥有的用户 - userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId, ids)); - if (removeFlag) { - // 角色绑定了那些用户 - if (roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).in(RoleMenu::getRoleId, ids))) { - return Boolean.TRUE; - } - } - return removeFlag; - } - - /** - * 1、根据 USER_ROLE:{userId} 查询用户拥有的角色ID集合 - * 2、缓存中有,则根据角色ID集合查询 角色集合 - * 3、缓存中有查不到,则从DB查询,并写入缓存, 立即返回 - * - * @param userId 用户id - */ - @Override - public List findRoleByUserId(Long userId) { - String cacheKey = AuthCacheKeyUtils.userRoleCacheKey(userId); - List roleList = new ArrayList<>(); - List list = cachePlusOps.get(cacheKey); - if (list == null) { - roleList.addAll(baseMapper.findRoleByUserId(userId)); - list = roleList.stream().map(Role::getId).collect(Collectors.toList()); - } - if (roleList.isEmpty()) { - return listByIds(list); - } - return roleList; - } - - /** - * 1,保存角色 - * 2,保存 与组织的关系 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveRole(RoleSaveDTO data, Long userId) { - if (StrUtil.isNotBlank(data.getName()) && check(data.getName())) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, "角色名称{} 已存在", data.getName()); - } - Role role = BeanUtil.toBean(data, Role.class); - role.setCreateBy(userId); - role.setUpdateBy(userId); - role.setCode(RoleEnum.NORMAL_MEMBER.name()); - save(role); - saveRoleMenu(data.getMenuIds(), role.getId()); - saveRoleMenuDatascope(data.getMenuDataScopeList(), role.getId()); - } - - private void saveRoleMenuDatascope(List menuDataScopeList, Long roleId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(RoleMenuDatascope.class) - .eq(RoleMenuDatascope::getRoleId, roleId); - roleMenuDatascopeService.remove(query); - if (menuDataScopeList == null || menuDataScopeList.isEmpty()) { - return; - } - List datascopeList = CollUtils.convert(menuDataScopeList, w -> { - RoleMenuDatascope roleMenuDatascope = new RoleMenuDatascope(); - roleMenuDatascope.setMenuId(w.getMenuId()); - roleMenuDatascope.setDatascope(w.getDataScope()); - roleMenuDatascope.setRoleId(roleId); - return roleMenuDatascope; - }); - roleMenuDatascopeService.saveBatch(datascopeList); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void updateRole(RoleUpdateDTO data, Long userId) { - Role roleOld = roleMapper.selectById(data.getId()); - if (Objects.isNull(roleOld)) { - throw BizException.wrap("修改用户 %d 为空", data.getId()); - } - - if (StrUtil.isNotBlank(data.getName()) && check(data.getName(), roleOld.getId())) { - throw BizException.wrap("角色名 %s 已经存在", data.getName()); - } - Role role = BeanUtil.toBean(data, Role.class); - role.setUpdateOn(LocalDateTime.now()); - role.setUpdateBy(userId); - updateById(role); - saveRoleMenu(data.getMenuIds(), role.getId()); - saveRoleMenuDatascope(data.getMenuDataScopeList(), role.getId()); - List userIdList = userRoleService.listUserIdByRoleId(role.getId()); - userIdList.forEach(w -> { - cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(w)); - userAuthManage.refreshSession(w); - }); - } - - @Override - public List findUserIdByCode(String[] codes) { - return baseMapper.findUserIdByCode(codes); - } - - @Override - public Boolean check(String name) { - return super.count(Wrappers.lambdaQuery(Role.class).eq(Role::getName, name)) > 0; - } - - @Override - public Boolean check(String name, Long id) { - return super.count(Wrappers.lambdaQuery(Role.class).ne(Role::getId, id) - .eq(Role::getName, name)) > 0; - } - - private void saveRoleMenu(List menuIds, Long roleId) { - roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)); - if (CollUtil.isNotEmpty(menuIds)) { - Set toAddMenus = new HashSet<>(); - // Set addParentIds = new HashSet<>(); - for (Long menuId : menuIds) { - Menu menu = menuService.getById(menuId); - if (Objects.isNull(menu)) { - continue; - } - RoleMenu roleMenu = new RoleMenu(null, menuId, roleId); - toAddMenus.add(roleMenu); - // 父级菜单 - // addParent(toAddMenus, menu, roleId, addParentIds); - } - if (CollUtil.isNotEmpty(toAddMenus)) { - roleMenuService.saveBatch(toAddMenus); - } - } - } - - private void addParent(Set toAddMenus, Menu menu, Long roleId, Set addParentIds) { - if (Objects.isNull(menu.getPid()) || menu.getPid().equals(0L)) { - return; - } - if (addParentIds.contains(menu.getPid())) { - return; - } - Menu parent = menuService.getById(menu.getPid()); - if (Objects.isNull(parent)) { - return; - } - addParentIds.add(menu.getPid()); - RoleMenu roleMenu = new RoleMenu(null, parent.getId(), roleId); - toAddMenus.add(roleMenu); - addParent(toAddMenus, parent, roleId, addParentIds); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/UserRoleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/UserRoleServiceImpl.java deleted file mode 100644 index d2697ae..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/UserRoleServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.sys.service.impl; - -import cn.hutool.http.HttpStatus; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.exception.BaseUncheckedException; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.sys.mapper.RoleMapper; -import com.ningdatech.pmapi.sys.mapper.UserRoleMapper; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -/** - *

- * 业务实现类 - * 角色分配 - * 账号角色绑定 - *

- * - * @author PoffyZhang - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class UserRoleServiceImpl extends ServiceImpl implements IUserRoleService { - - private static final String INIT_ROLE_CODE = "SUPER_ADMIN"; - - private final RoleMapper roleMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean initAdmin(Long userId) { - Role role = roleMapper.selectOne(Wrappers.lambdaQuery(Role.class) - .eq(Role::getName, INIT_ROLE_CODE)); - if (role == null) { - throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("初始化用户角色失败, 无法查询到内置角色:%s", INIT_ROLE_CODE)); - } - UserRole userRole = UserRole.builder() - .userId(userId).roleId(role.getId()) - .build(); - - return super.save(userRole); - } - - @Override - public List listUserIdByRoleId(Long roleId) { - List userRoles = this.list(Wrappers.lambdaQuery() - .eq(UserRole::getRoleId, roleId)); - return CollUtils.fieldList(userRoles, UserRole::getUserId); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/AuthCacheKeyUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/AuthCacheKeyUtils.java deleted file mode 100644 index 407f275..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/AuthCacheKeyUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.sys.utils; - -/** - *

- * AuthCacheKeyUtils - *

- * - * @author WendyYang - */ -public class AuthCacheKeyUtils { - - private static final String USER_RESOURCE_CKP = "user_resource:"; - private static final String USER_MENU_CKP = "user_menu:"; - private static final String USER_ROLE_CKP = "user_role:"; - private static final String ROLE_RESOURCE_CKP = "role_resource:"; - private static final String ROLE_MENU_CKP = "role_menu:"; - - public static String roleResourceCacheKey(Long roleId) { - return ROLE_RESOURCE_CKP + roleId; - } - - public static String roleMenuCacheKey(Long roleId) { - return ROLE_MENU_CKP + roleId; - } - - public static String userResourceCacheKey(Long userId) { - return USER_RESOURCE_CKP + userId; - } - - public static String userMenuCacheKey(Long userId) { - return USER_MENU_CKP + userId; - } - - public static String userRoleCacheKey(Long userId) { - return USER_ROLE_CKP + userId; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/EarlyWarningUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/EarlyWarningUtil.java deleted file mode 100644 index 3e22e94..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/utils/EarlyWarningUtil.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.sys.utils; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; - -/** - * @Classname EarlyWarningUtil - * @Description - * @Date 2023/12/7 14:14 - * @Author PoffyZhang - */ -public class EarlyWarningUtil { - - public static void buildPermissonWrapper(LambdaQueryWrapper wrapper, - UserInfoDetails user) { - //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ - //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - } - } - - public static void buildPermissonFullWrapper(LambdaQueryWrapper wrapper, - UserFullInfoDTO user) { - //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ - //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - } - } - - public static void buildPermissonProjectWrapper(LambdaQueryWrapper wrapper, - UserFullInfoDTO user) { - //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(Project::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ - //否则都只能看自己单位的 - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java deleted file mode 100644 index 761e051..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.todocenter.bean.entity; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 发送工作通知所需信息 - * - * @author CMM - * @since 2023/02/15 13:57 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class WorkNoticeInfo { - private String msg; - private Long accountId; - private String organizationCode; - private String organizationName; - private String bizMsgId; - private String receiverUserId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java deleted file mode 100644 index 5e90ab5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.todocenter.constant; -/** - * @author ZPF - * @since 2023/04/02 14:56 - */ -public interface TodoCenterConstant { - - class Handler { - - public static final String ACTIVITY_APPROVAL = "userTask"; - - public static final String OR_SIGN_FLAG = "MI_END"; - - public static final String TASKID_ERROR = "TASKID_ERROR"; - } - - class Declared { - - public static final String NULL_INST_CODE = "EMPTY"; - - } - - class SealTemplate{ - public static final String CITY_TEMPLATE = "市级-预审申请单"; - public static final String COUNTRY_TEMPLATE = "区县-预审申请单"; - public static final String CONSTRUCT_TEMPLATE = "建设方案申请单"; - - public static final String COUNTRY_SEAL_POS_PAGE = "6"; - public static final Float COUNTRY_SEAL_POS_X = 487F; - public static final Float COUNTRY_SEAL_POS_Y = 380F; - public static final Integer COUNTRY_SEAL_SIGN_TYPE = 1; - - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/WorkNoticeConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/WorkNoticeConstant.java deleted file mode 100644 index ececc27..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/WorkNoticeConstant.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.todocenter.constant; -/** - * 工作通知格式常量 - * @author CMM - * @since 2023/02/01 14:56 - */ -public interface WorkNoticeConstant { - public final String PASS_MSG_TEMPLATE = "【%s】的【%s】需要您审核。"; - public final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; - public final String BACK_MSG_TEMPLATE = "【%s】的【%s】被退回,请及时处理。"; - public final String REJECT_MSG_TEMPLATE = "【%s】的【%s】被驳回,请及时处理。"; - - public final String CC_MSG_TEMPLATE = "【%s】的【%s】有消息抄送您,请查看详情"; - - public final String AUDIT_WORK_TITLE = "审核任务"; - - public final String EXPERT_REVIEW_TEMPLATE = "【%s】的【%s】待您评审,请及时处理。"; - public final String REVIEW_MEETING_TEMPLATE = "【%s】已完成专家抽取,请及时处理。"; - public final String WARNING_ALERT_TEMPLATE = "【%s】的【%s】待您审核,已停留2小时,请及时处理。"; - - public final String PROJECT_ID = "projectId"; - public final String INSTANCE_ID = "instanceId"; - public final String MEETING_ID = "meetingId"; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java deleted file mode 100644 index 61f0a5a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.ningdatech.pmapi.todocenter.controller; - - -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.todocenter.model.vo.NotSealedInfoVO; -import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO; -import com.wflow.workflow.bean.dto.ReqAuditOpinionSaveDTO; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; -import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; -import com.ningdatech.pmapi.todocenter.model.dto.SealInfoDTO; -import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; -import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; -import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; - -/** - *

- * 待办中心 前端控制器 - *

- * - * @author CMM - * @since 2023-01-12 - */ -@RestController -@AllArgsConstructor -@Api(tags = "待办中心控制器") -@RequestMapping("/api/v1/todo-center") -public class TodoCenterController { - - private final TodoCenterManage todoCenterManage; - - /** - * 实时取当前操作人 某个工作流的下一个操作taskId - */ - @GetMapping("/todo/taskId/{instanceId}") - public String todoTaskId(@PathVariable String instanceId){ - return todoCenterManage.todoTaskId(instanceId); - } - - /** - * 待办中心-待我处理项目列表查询 - * @param param - * @return - */ - @GetMapping("/todo-list") - public PageVo todoList(@Valid @ModelAttribute ToBeProcessedReq param){ - return todoCenterManage.todoProjectList(param); - } - - /** - * 待办中心-待我处理项目列表导出 - * - * @param param - * @param response - * @return void - */ - @PostMapping("/todo-list/export") - @WebLog("待办中心-待我处理项目列表导出") - public void exportPendingProjectList(@Valid @RequestBody ToBeProcessedExportReq param, - HttpServletResponse response){ - todoCenterManage.exportTodoList(response,param); - } - - /** - * 查询流程表单数据及审批的进度步骤 - * @param request 请求参数 - * @return 流程进度及表单详情 - */ - @GetMapping("/progress/detail") - public ProcessProgressDetailVo getProcessDetail(@Valid @ModelAttribute ProcessDetailReq request) { - return todoCenterManage.getProcessDetail(request); - } - - /** - * 审核通过,盖章并通过、退回、撤回、驳回等操作 - * @param param 操作参数 - * @return 操作结果 - */ - @PostMapping("/handler") - @WebLog("审核通过,盖章并通过、退回、撤回、驳回等操作") - public Object handler(@Valid @RequestBody ReqProcessHandlerDTO param) { - String nextTaskId = todoCenterManage.handler(param); - return nextTaskId; - } - - /** - * 保存盖章审核提交的审核意见 - * @param param 操作参数 - * @return 操作结果 - */ - @PostMapping("/saveAuditOpinion") - @WebLog("保存盖章审核提交的审核意见") - public Object saveAuditOpinion(@Valid @RequestBody ReqAuditOpinionSaveDTO param) { - return todoCenterManage.saveAuditOpinion(param); - } - - - - /** - * 待办中心-我已处理项目列表查询 - * @param param - * @return - */ - @GetMapping("/ido-list") - public PageVo idoList(@ModelAttribute ToBeProcessedReq param){ - return todoCenterManage.idoList(param); - } - /** - * 待办中心-我已处理项目列表导出 - * - * @param param - * @param response - * @return void - */ - @PostMapping("/ido-list/export") - public void exportHandledProjectList(@RequestBody ToBeProcessedExportReq param, - HttpServletResponse response){ - todoCenterManage.idoExport(response,param); - } - - /** - * 待办中心-我发起的项目列表查询 - * @param param - * @return - */ - @GetMapping("/my-submitted-list") - public PageVo mySubmittedList(@ModelAttribute ToBeProcessedReq param){ - return todoCenterManage.mySubmittedList(param); - } - - /** - * 待办中心-我发起的项目列表导出 - * - * @param param - * @param response - * @return void - */ - @PostMapping("/my-submitted-list/export") - public void exportMySubmittedList(@RequestBody ToBeProcessedExportReq param, - HttpServletResponse response){ - todoCenterManage.exportMySubmittedList(response,param); - } - - /** - * 待办中心-抄送我的项目列表查询 - * @param param - * @return - */ - @GetMapping("/ccme-list") - public PageVo ccmeList(@Valid @ModelAttribute ToBeProcessedReq param){ - return todoCenterManage.ccmeList(param); - } - - /** - * 待办中心-抄送我的项目列表导出 - * - * @param param - * @param response - * @return void - */ - @PostMapping("/ccme-list/export") - public void exportCcMeProjectList(@Valid @RequestBody ToBeProcessedExportReq param, HttpServletResponse response){ - todoCenterManage.exportCcMeProjectList(response,param); - } - - @ApiOperation(value = "被退回项目内容调整并通过", notes = "被退回项目内容调整并通过") - @PostMapping("/adjustAndHandle") - @WebLog("被退回项目内容调整并通过") - public String startTheProcess(@Validated @RequestBody AdjustHandleDTO dto) { - String instanceId = todoCenterManage.adjustmentAndHandle(dto); - return "退回项目内容调整并且重新通过 【" + instanceId + "】 成功"; - } - - @ApiOperation("获取未签章的pdf文件") - @WebLog("获取未签章的pdf文件") - @PostMapping("/getNotSealedPdf") - public NotSealedInfoVO getNotSealedPdf (@Valid @RequestBody SealInfoDTO req){ - return todoCenterManage.getNotSealedPdf(req); - } - - @ApiOperation("获取签章后的pdf文件") - @WebLog("获取签章后的pdf文件") - @PostMapping("/getSealedPdf") - public Long getSealedPdf(@Valid @RequestBody SealInfoDTO req){ - return todoCenterManage.getSealedPdf(req); - } - - @ApiOperation("待办中心待我处理数量统计") - @GetMapping("/getTodoNums") - public TodoNumVO getTodoNums(@Valid @ModelAttribute ToBeProcessedReq param){ - return todoCenterManage.getTodoNums(param); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java deleted file mode 100644 index d0d5ba1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ningdatech.pmapi.todocenter.enumeration; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * 是否增补项目枚举 - * - * @author CMM - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "IsAppendProjectEnum", description = "是否增补项目-枚举") -public enum IsAppendProjectEnum { - /** - * 非增补项目 - */ - NOT_APPEND_PROJECT(0, "非增补项目"), - - /** - * 增补项目 - */ - APPEND_PROJECT(1, "增补项目"); - - - private Integer code; - private String desc; - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static IsAppendProjectEnum getEnumByValue(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } - - public boolean eq(String val) { - return this.name().equals(val); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsOrNotEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsOrNotEnum.java deleted file mode 100644 index 99b4dba..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsOrNotEnum.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ningdatech.pmapi.todocenter.enumeration; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * 是否增补项目枚举 - * - * @author CMM - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "IsOrNotEnum", description = "是否-枚举") -public enum IsOrNotEnum { - /** - * 否 - */ - NOT(0, "否"), - - /** - * 是 - */ - IS(1, "是"); - - - private Integer code; - private String desc; - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (IsOrNotEnum t : IsOrNotEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static IsOrNotEnum getEnumByValue(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (IsOrNotEnum t : IsOrNotEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } - - public boolean eq(String val) { - return this.name().equals(val); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/PassHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/PassHandle.java deleted file mode 100644 index 5b71af7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/PassHandle.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.todocenter.handle; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.runtime.ActivityInstance; -import org.springframework.stereotype.Component; -import java.util.List; - -/** - * @Classname PassHandle - * @Description - * @Date 2023/5/5 14:46 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class PassHandle { - - private final RuntimeService runtimeService; - - /** - * 判断节点类型 - * @param instanceId - * @param employeeCode - * @return - */ - public void checkCanPassOrSeal(String instanceId,String taskId,String employeeCode, ProcessProgressDetailVo res) { - - List activities = runtimeService.createActivityInstanceQuery() - .taskAssignee(employeeCode) - .processInstanceId(instanceId) - .unfinished() - .orderByActivityInstanceStartTime() - .asc() - .list(); - - if(CollUtil.isEmpty(activities)){ - res.setCanPass(Boolean.FALSE); - res.setCanReject(Boolean.FALSE); - res.setCanSeal(Boolean.FALSE); - return; - } - - for(ActivityInstance activity : activities){ - if(StringUtils.isNotBlank(taskId)){ - if(taskId.equals(activity.getTaskId())){ - if(StringUtils.isNotBlank(activity.getActivityId())){ - res.setCanReject(Boolean.TRUE); - if(activity.getActivityId().startsWith("node")){ - res.setCanPass(Boolean.TRUE); - }else if(activity.getActivityId().startsWith("seal")){ - res.setCanSeal(Boolean.TRUE); - } - break; - } - } - } - - if(StringUtils.isNotBlank(activity.getActivityId())){ - res.setCanReject(Boolean.TRUE); - if(activity.getActivityId().startsWith("node")){ - res.setCanPass(Boolean.TRUE); - }else if(activity.getActivityId().startsWith("seal")){ - res.setCanSeal(Boolean.TRUE); - } - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java deleted file mode 100644 index e62d91d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java +++ /dev/null @@ -1,343 +0,0 @@ -package com.ningdatech.pmapi.todocenter.handle; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; -import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -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 com.wflow.contants.HisProInsEndActId; -import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessStatusEnum; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.assertj.core.util.Lists; -import org.flowable.bpmn.model.*; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RepositoryService; -import org.flowable.engine.history.HistoricActivityInstance; -import org.flowable.engine.history.HistoricProcessInstance; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname WithDrawHandle - * @Description - * @Date 2023/4/2 14:46 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class WithDrawHandle { - - private final UserInfoHelper userInfoHelper; - - private final HistoryService historyService; - private final RepositoryService repositoryService; - private final IProjectInstService projectInstService; - - /** - * 判断 当前流程 可否被当前登录人 所撤回 - * @param instanceId - * @param progressInstanceDetail - * @return - */ - public Boolean checkCanWithdraw(String instanceId, ProcessProgressVo progressInstanceDetail,String taskId) { - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instanceId).singleResult(); - UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - String employeeCode = userInfoDetails.getEmployeeCode(); - //如果不是审核中 - if(!ProcessStatusEnum.UNDER_REVIEW.getDesc() - .equals(progressInstanceDetail.getStatus())){ - return Boolean.FALSE; - } - // 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回 - Boolean userIsRoot = checkUserIsRoot(instanceId, null); - if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)){ - return Boolean.TRUE; - } - ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO(); - dto.setTaskId(taskId); - dto.setInstanceId(instanceId); - return checkUserIsBefore(progressInstanceDetail.getProgressInfo(),dto); - } - - // 判断当前操作人 是上一个节点的审批人 - public Boolean checkUserIsBefore(List currentProgressInfo, ReqProcessHandlerDTO param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - - // 先排除掉抄送任务节点 - currentProgressInfo = currentProgressInfo.stream() - .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) - .collect(Collectors.toList()); - - if (CollUtil.isEmpty(currentProgressInfo)){ - return Boolean.FALSE; - } - - String taskId = param.getTaskId(); - - //1.判断出 当前审批人和上一个审批人 如果传了taskid - ProgressNode progressNode = StringUtils.isBlank(taskId) ? - currentProgressInfo.get(currentProgressInfo.size() - 1) - : findSubNodeByTaskId(taskId,currentProgressInfo); - - if (Objects.isNull(progressNode)){ - return Boolean.FALSE; - } - - ProgressNode beforeProgressNode = null; - ProgressNode currentProgressNode = null; - - // 说明当前节点是子流程节点 - // 如果是会签 或签 当前和上个 - List thisAndOr = Lists.newArrayList(); - List beforeAndOr = Lists.newArrayList(); - if (progressNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { - List children = progressNode.getChildren(); - // 先排除掉子流程中抄送的节点,避免塞入错误的taskId - children = children.stream() - .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(children)){ - return Boolean.FALSE; - } - currentProgressNode = children.get(children.size() - 1); - - //把当前和上一个节点和 会签或签的情况 都check出来 - beforeProgressNode = checkBeforeNodeAndOr(children,currentProgressNode,thisAndOr,beforeAndOr); - } else { - currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); - - // 把当前和上一个节点和 会签或签的情况 都check出来 - beforeProgressNode = checkBeforeNodeAndOr(currentProgressInfo,currentProgressNode,thisAndOr,beforeAndOr); - } - // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 - // 获取当前当前工作流任务当前审核人信息 - UserFullInfoDTO currentUserInfo = userInfoHelper.getUserFullInfoByEmployeeCode(currentProgressNode.getUserId()); - if(Objects.isNull(currentUserInfo) || !currentUserInfo.getEmpPosUnitCode().equals(user.getEmpPosUnitCode())){ - return Boolean.FALSE; - } - - Boolean isAndOr = Boolean.FALSE; - - //判断当前子流程是否结束 如果结束了 必不能撤回 - Boolean thisSubNodeOver = Boolean.FALSE; - //当前节点是 会签|或签的情况 - if(CollUtil.isNotEmpty(thisAndOr)){ - Integer finishNodes = 0; - for(ProgressNode n : thisAndOr){ - if(Objects.nonNull(n.getFinishTime())){ - //当前会签 有审批过的 那么上个会签|或签 无论如何 就不可能可以撤回了 - beforeAndOr = Collections.emptyList(); - finishNodes ++; - } - //找到了 当前的操作人 在当前的 会签|或签 中 并且已经审批了 - if(n.getUserId().equals(user.getEmployeeCode()) && - Objects.nonNull(n.getFinishTime())){ - beforeProgressNode = n; - //说明当前操作人 在上个会签或者或签节点 - isAndOr = Boolean.TRUE; - } - } - //如果都审批过了 结束了 那说明此子流程已经结束了 不能再撤回了 - if(finishNodes.equals(thisAndOr.size())){ - return Boolean.FALSE; - } - }else{ - //如果当前不是会签|或签 就判断 当前最后一个节点 结束了没 - //如果结束了 也同样 直接不能撤回 - if(Objects.nonNull(currentProgressNode.getFinishTime())){ - return Boolean.FALSE; - } - } - - //如果上个会签没取到 还有种情况是 会签 或签 并且在上个节点 - if(!isAndOr && CollUtil.isNotEmpty(beforeAndOr)) { - for (ProgressNode n : beforeAndOr) { - if (n.getUserId().equals(user.getEmployeeCode()) - && !TodoCenterConstant.Handler.OR_SIGN_FLAG.equals(n.getWithdrawFlag())) { - beforeProgressNode = n; - //说明当前操作人 在上个会签或者或签节点 - isAndOr = Boolean.TRUE; - break; - } - } - } - - if(!isAndOr && (Objects.isNull(beforeProgressNode) - || !user.getEmployeeCode().equals(beforeProgressNode.getUserId()))){ - return Boolean.FALSE; - } - - //如果是true 把对应操作人 在上个审批节点的task 也传入 - if(Objects.nonNull(param)){ - // 获取bpmn文件中节点的连线关系,如果前一个节点的下一个节点是抄送节点, - // 获取抄送节点传入param中,在执行撤回操作时,将抄送信息从抄送表中删除 - HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(param.getInstanceId()) - .singleResult(); - BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); - // 传节点定义key 获取撤回操作人在流程配置中所在的节点 - FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(beforeProgressNode.getNodeId()); - List outgoingFlows = flowNode.getOutgoingFlows(); - for (SequenceFlow outgoingFlow : outgoingFlows) { - //获取输出节点元素 - FlowElement targetFlowElement = outgoingFlow.getTargetFlowElement(); - // 获取下一个抄送任务的节点 - if(targetFlowElement instanceof ServiceTask){ - param.setCcNodeId(targetFlowElement.getId()); - break; - } - } - param.setTaskId(beforeProgressNode.getTaskId()); - } - return Boolean.TRUE; - } - - /** - * 找到其 所在的子流程父节点 - * @param taskId - * @return - */ - private ProgressNode findSubNodeByTaskId(String taskId,List currentProgressInfos) { - for(ProgressNode progressNode : currentProgressInfos){ - if(progressNode.getNodeType().equals(NodeTypeEnum.SUB)){ - List children = progressNode.getChildren(); - for(ProgressNode c : children){ - if(taskId.equals(c.getTaskId())){ - //如果任务ID对得上 返回其 所在的子流程 - return progressNode; - } - } - } - } - return null; - } - - /** - * 判断撤回用户 是不是发起人 - * @param processInstanceId - * @param task - * @return - */ - public Boolean checkUserIsRoot(String processInstanceId,String task){ - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - // 获取当前要处理的流程实例 - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(processInstanceId) - .singleResult(); - if (user.getEmployeeCode().equals(instance.getStartUserId()) && - (Objects.isNull(task) || user.getEmployeeCode().equals(instance.getStartUserId()))) { - return Boolean.TRUE; - } - return Boolean.FALSE; - } - - - /** - * 把上一个节点 和 或签 会签情况都check出来 - * @param progressNodes andOr - * @param thisAndOr beforeAndOr - * @return - */ - public ProgressNode checkBeforeNodeAndOr(List progressNodes,ProgressNode curr, - List thisAndOr,List beforeAndOr) { - ProgressNode beforeNode = null; - if(progressNodes.size() == 1){ - return null; - } - //进入上一个节点的标识 - Boolean enterBefore = Boolean.FALSE; - //假设 作为当前会签的第一个点 - String thisAndOrNodeId = curr.getNodeId(); - //假设 作为上一个会签/或签的第一个点 - ProgressNode beforeAndOrNode = null; - for(int i = progressNodes.size() - 2;i >= 0;i--){ - //说明有会签 或签 - if(progressNodes.get(i).getNodeId().equals(thisAndOrNodeId)){ - //还在当前节点 - if(!enterBefore){ - if(thisAndOr.isEmpty()){ - //放入当前的那个点 - thisAndOr.add(curr); - } - thisAndOr.add(progressNodes.get(i)); - } - //如果在上个节点了 - else{ - if(beforeAndOr.isEmpty()){ - //放入假设的那个点 - beforeAndOr.add(beforeAndOrNode); - //如果 上个节点也是 会签|或签 那么就置为null - beforeNode = null; - } - beforeAndOr.add(progressNodes.get(i)); - } - }else{ - thisAndOrNodeId = progressNodes.get(i).getNodeId(); - //存在假设可能 - beforeAndOrNode = progressNodes.get(i); - if(!enterBefore){ - beforeNode = progressNodes.get(i); - enterBefore = Boolean.TRUE; - continue; - } - break; - } - } - return beforeNode; - } - - /** - * 1.判断 当前 撤回人 是否是 发起人 - * 2.并且流程 尚未开始审批 - * @return - */ - public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { - String startUserId = instance.getStartUserId(); - // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false - String instanceId = instance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); - Integer instType = projectInst.getInstType(); - - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || - InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ - return Boolean.FALSE; - } - //如果流程发起人 不是 当前登录人 直接返回false - if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) - || !employeeCode.equals(startUserId)){ - return Boolean.FALSE; - } - - List finished = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(instance.getId()).finished() - .activityType(TodoCenterConstant.Handler.ACTIVITY_APPROVAL) - .orderByHistoricActivityInstanceEndTime().asc().list(); - List instances = finished.stream() - .filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) - .collect(Collectors.toList()); - //如果有已经被审核过的 节点 返回false - if(CollUtil.isNotEmpty(instances)){ - return Boolean.FALSE; - } - - return Boolean.TRUE; - } -} 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 deleted file mode 100644 index 3d63e72..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ /dev/null @@ -1,540 +0,0 @@ -package com.ningdatech.pmapi.todocenter.manage; - -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.*; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.date.DatePattern; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; -import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; -import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.ningdatech.pmapi.projectdeclared.service.IConstrctionSuggestionsService; -import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; -import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.task.Comment; -import org.flowable.variable.api.history.HistoricVariableInstance; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -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.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.wflow.contants.HisProInsEndActId; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.ProcessHandlerEnum; -import com.wflow.workflow.service.ProcessInstanceService; - -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -/** - * @Classname HandlerManage - * @Description - * @Date 2023/4/2 14:25 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class HandlerManage { - - private final RuntimeService runtimeService; - - private final TaskService taskService; - private final HistoryService historyService; - private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; - private final ProcessInstanceService processInstanceService; - private final IProjectApplicationService projectApplicationService; - private final IProjectStagingService projectStagingService; - private final IProjectInstService projectInstService; - private final NoticeManage noticeManage; - private final DeclaredProjectManage declaredProjectManage; - private final FileService fileService; - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - private final INdProjectDelayApplyService projectDelayApplyService; - private final INdProjectApplyBorrowService projectApplyBorrowService; - - private final IConstrctionSuggestionsService constrctionSuggestionsService; - - @Value("${spring.profiles.active}") - private String active; - - - /** - * 审核通过后 所处理的逻辑 - * @param declaredProject - * @param instance - */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ - Long userId = LoginUserUtil.getUserId(); - // 获取流程通过后的流程实例 - HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instance.getId()) - .singleResult(); - // 获取当前流程实例类型 - String instanceId = newInstance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .last(BizConst.LIMIT_1)); - Integer instType = projectInst.getInstType(); - InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); - if (Objects.isNull(instTypeEnum)){ - throw new BizException("当前审批流类型不存在,流程类型code:" + instType); - } - - // 获取流程通过后当前流程详情 - ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); - // 获取流程通过后当前审核人信息,向其发送工作通知 - // 会签/或签会有多个审核人 - List currentEmployeeCodeList = Lists.newArrayList(); - List newProgressInfo = newInstanceDetail.getProgressInfo(); - ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); - - // 说明当前节点是子流程节点 - if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { - List children = currentNode.getChildren(); - // 获取子流程当前审核人节点 - ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); - // 获取节点ID相同地审核节点 - List nodeList = children.stream() - .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); - } else { - List nodeList = newProgressInfo.stream() - .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); - } - - // 流程通过后,判断当前登录用户是不是最后一个审核人 - // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 - // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { - // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ - switch (instTypeEnum) { - case APPLY_DELAY: - // 保存延期申请记录,更新项目建设周期和计划验收时间 - updateProjectDelayApplyInfo(declaredProject,instanceId); - break; - case APPLY_BORROW: - // 更新申请借阅状态为成功 - updateProjectApplyBorrowInfo(declaredProject,instanceId); - break; - default: - throw new BizException("传入实例类型错误: " + instTypeEnum); - } - }else { - switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { - // 当前项目状态是预审中 - case PRE_APPLYING: - //先修改项目状态 - updatePassProjectStatus(userId, declaredProject); - //然后入库暂存库 - projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); - break; - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - log.info("部门联审成功后 要判断是否是 区县重大项目"); - - Boolean isImport = !StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, - ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); - log.info("isImport :{}",isImport); - //如果是 区县 并且 500万及以上要推送省局重大项目 - if (isImport) { - try { - List applications = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); - joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); - updatePassProjectStatus(userId, declaredProject); - break; - } catch (Exception e) { - log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); - log.error("区县推送省级联审失败:" + e); - } - break; - } - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 当前项目状态是方案评审中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updatePassProjectStatus(userId, declaredProject); - break; - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - updatePassProjectStatus(userId, declaredProject); - // 判断是否 保存建设建议信息 - saveContructionSuggestionInfo(instance.getId(),declaredProject); - break; - default: - throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); - } - } - //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS); - } else { - // 若有下一个审核人(当前节点的用户),会签/或签会有多个 - // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 - // 获取发送浙政钉工作通知必要信息 - for (String currentEmployeeCode : currentEmployeeCodeList) { - if (Objects.isNull(currentEmployeeCode)) { - throw new BizException("审核人信息不存在!"); - } - //发送消息 - noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); - } - } - } - - /** - * 去保存 建设建议信息 - * @param instanceId - * @param project - */ - private void saveContructionSuggestionInfo(String instanceId, Project project) { - ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) - .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) - .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(pcs)){ - log.info("没有该流程的 建设 建议信息"); - return; - } - - project.setProposeTotalInvest(pcs.getProposeTotalInvest()); - project.setProposeAnnualBudget(pcs.getProposeAnnualBudget()); - project.setProposeAttachFiles(pcs.getProposeAttachFiles()); - projectService.updateById(project); - } - - public void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { - // 获取申请借阅信息 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) - .eq(ProjectApplyBorrow::getInstanceId, instanceId)); - // 更新项目借阅信息为成功 - projectApplyBorrow.setIsSuccess(Boolean.TRUE); - projectApplyBorrow.setUpdateOn(LocalDateTime.now()); - projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); - projectApplyBorrowService.updateById(projectApplyBorrow); - } - - public void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { - // 获取延期申请填写的相关信息 - 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(); - // 重新计算建设周期、验收时间 - String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); - declaredProject.setBuildCycle(constructCycle); - Long constructMonth = Long.valueOf(constructCycle); - String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); - LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); - declaredProject.setPlanAcceptanceTime(time); - 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); - } - - - /** - * 驳回后 所处理的逻辑 - * @param declaredProject - * @param instance - */ - public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { - Long userId = LoginUserUtil.getUserId(); - // 获取当前流程实例类型 - String instanceId = declaredProject.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); - Integer instType = projectInst.getInstType(); - // 审批流程不是申请延期和申请借阅,需调用状态机 - if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { - // 更新项目状态和流程状态 - updateRejectProjectStatus(userId, declaredProject, instType); - } - //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); - } - - /** - * 发起人 撤回逻辑 - */ - public void rootWithDraw(Project declaredProject) { - Long userId = LoginUserUtil.getUserId(); - // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 - switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 更新项目状态为待申报 - updateWithdrawProjectStatus(userId, declaredProject); - // 保存到草稿箱中 - saveToDraft(declaredProject); - //删除所有项目相关的信息 - deleteProjectRelated(declaredProject); - break; - // 当前项目状态是预审中 - case PRE_APPLYING: - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updateWithdrawProjectStatus(userId, declaredProject); - break; - default: - throw new IllegalStateException("Unexpected value: " + declaredProject.getStatus()); - } - } - - // 保存到草稿箱中 - private void saveToDraft(Project declaredProject) { - ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO(); - ProjectDTO projectInfo = new ProjectDTO(); - BeanUtils.copyProperties(declaredProject,projectInfo); - // 查询出项目关联的应用信息 - List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, declaredProject.getId())); - List applicationDTOList = applicationList.stream().map(a -> { - ProjectApplicationDTO applicationDTO = new ProjectApplicationDTO(); - BeanUtils.copyProperties(a, applicationDTO); - return applicationDTO; - }).collect(Collectors.toList()); - projectInfo.setApplicationList(applicationDTOList); - HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); - projectInfo.setDynamicForm(dynamicMap); - draftSaveDto.setProjectInfo(projectInfo); - declaredProjectManage.saveToDraft(draftSaveDto); - } - - /** - * 删除项目的所有信息 - * @param declaredProject - */ - public void deleteProjectRelated(Project declaredProject) { - //删除项目库中该项目信息 - projectService.removeById(declaredProject); - //删除app信息 - projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,declaredProject.getId())); - } - - /** - * 退回审核后 所处理的逻辑 - * @param declaredProject - * @param instance - */ - public void afterBackTodo(Project declaredProject, HistoricProcessInstance instance) { - Long userId = LoginUserUtil.getUserId(); - // 获取当前流程实例类型 - String instanceId = declaredProject.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); - Integer instType = projectInst.getInstType(); - LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); - // 如果是预审审批或建设方案退回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); - projectService.update(updateWrapper); - } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); - projectService.update(updateWrapper); - } - // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 - //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - BACK_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_BACK); - } - - - /** - * 当为通过操作时,更新项目表中项目状态 - * - * @param userId - * @param declaredProject - * @return void - * @author CMM - * @since 2023/02/08 - */ - public void updatePassProjectStatus(Long userId, Project declaredProject) { - try { - stateMachineUtils.pass(declaredProject); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); - } catch (Exception e) { - log.error("状态机执行失败",e); - throw new BizException("状态机执行失败!"); - } - } - - /** - * 当为驳回操作时,更新项目表中的项目状态 - * - * @param userId - * @param declaredProject - * @param instType - * @return void - * @author CMM - * @since 2023/02/08 - */ - private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { - stateMachineUtils.reject(declaredProject); - LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); - // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); - projectService.update(updateWrapper); - }else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); - projectService.update(updateWrapper); - } - } - - /** - * 当为撤回操作时,更新项目表中的项目状态为前一个状态 - * - * @param userId - * @param declaredProject - * @return void - * @author CMM - * @since 2023/02/08 - */ - @Transactional(rollbackFor = Exception.class) - public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { - // 删除关联表信息 - projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId,declaredProject.getId()) - .eq(ProjectInst::getInstCode,declaredProject.getInstCode())); - //删除项目的实例信息 - historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); - - stateMachineUtils.withDraw(declaredProject); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - declaredProject.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); - projectService.updateById(declaredProject); - } - - public void deleteBackComments(List approves) { - if(CollUtil.isNotEmpty(approves)){ - for(HistoricVariableInstance approve : approves){ - if(approve.getValue() instanceof ProcessHandlerEnum){ - if(ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))){ - runtimeService.removeVariable(approve.getProcessInstanceId(),approve.getVariableName()); - - Comment comment; - Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) - .stream() - .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) - .findFirst(); - if (first.isPresent()){ - comment = first.get(); - taskService.deleteComment(comment.getId()); - } - - break; - } - } - } - } - } - - /** - * 判断是否包含 此任务 - * @param progressNodes - * @param taskId - * @return - */ - public static Boolean checkIsContainsTask(List progressNodes, String taskId) { - if(CollUtil.isEmpty(progressNodes)){ - return Boolean.FALSE; - } - - final Boolean[] res = {Boolean.FALSE}; - progressNodes.forEach(p -> { - if(p.getTaskId().equals(taskId)){ - res[0] = Boolean.TRUE; - return; - } - if(CollUtil.isNotEmpty(p.getChildren()) && - (checkIsContainsTask(p.getChildren(),taskId))){ - res[0] = Boolean.TRUE; - return; - } - }); - return res[0]; - } -} 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 deleted file mode 100644 index 0e3a983..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ /dev/null @@ -1,1868 +0,0 @@ -package com.ningdatech.pmapi.todocenter.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.codec.Base64; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -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.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.file.entity.File; -import com.ningdatech.file.entity.vo.result.FileResultVO; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.irs.sign.IRSAPIRequest; -import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; -import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; -import com.ningdatech.pmapi.projectlib.enumeration.*; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -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.model.req.ProjectListReq; -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.signature.entity.CompanySignature; -import com.ningdatech.pmapi.signature.service.ICompanySignatureService; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; -import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; -import com.ningdatech.pmapi.todocenter.enumeration.IsOrNotEnum; -import com.ningdatech.pmapi.todocenter.handle.PassHandle; -import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; -import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; -import com.ningdatech.pmapi.todocenter.model.dto.PdfGenerateDTO; -import com.ningdatech.pmapi.todocenter.model.dto.SealInfoDTO; -import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO; -import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; -import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.*; -import com.ningdatech.pmapi.todocenter.service.ITodoService; -import com.ningdatech.pmapi.todocenter.service.StatisticsService; -import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; -import com.ningdatech.pmapi.todocenter.utils.PdfUtils; -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.contants.HisProInsEndActId; -import com.wflow.contants.ProcessConstant; -import com.wflow.exception.BusinessException; -import com.wflow.workflow.bean.dto.ReqAuditOpinionSaveDTO; -import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; -import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; -import com.wflow.workflow.bean.process.ProgressNode; -import com.wflow.workflow.bean.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessInstanceVo; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.bean.vo.ProcessTaskVo; -import com.wflow.workflow.service.ProcessInstanceService; -import com.wflow.workflow.service.ProcessTaskService; -import com.wflow.workflow.utils.ProcessTaskUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.flowable.bpmn.model.BpmnModel; -import org.flowable.bpmn.model.FlowElement; -import org.flowable.bpmn.model.FlowElementsContainer; -import org.flowable.bpmn.model.SubProcess; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RepositoryService; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.task.api.Task; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.flowable.variable.api.history.HistoricVariableInstance; -import org.springframework.beans.BeanUtils; -import org.springframework.mock.web.MockMultipartFile; -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; -import java.io.InputStream; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author ZPF - * @since 2023/02/19 16:09 - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class TodoCenterManage { - - private final ProcessTaskService processTaskService; - private final HistoryService historyService; - private final TaskService taskService; - private final IProjectService projectService; - private final ProjectLibManage projectLibManage; - private final ProcessInstanceService processInstanceService; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - private final IProjectApplicationService projectApplicationService; - private final UserInfoHelper userInfoHelper; - private final BuildUserUtils buildUserUtils; - private final IProjectInstService projectInstService; - private final PdfUtils pdfUtils; - private final FileService fileService; - private final ICompanySignatureService companySignatureService; - private final StatisticsService statisticsService; - private final HandlerManage handlerManage; - private final WithDrawHandle withDrawHandle; - private final PassHandle passHandle; - private final RepositoryService repositoryService; - private final IRegionService regionService; - private final ITodoService todoService; - - /** - * 待办中心待我处理项目列表查询 - * - * @param param - * @author zpf - * @since 2023/02/18 - */ - public PageVo todoProjectList(ToBeProcessedReq param) { - String employeeCode = param.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - // 获取登录用户ID - Long userId = Optional.ofNullable(param.getLoginUserId()).orElseGet(LoginUserUtil::getUserId); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取员工浙政钉code - if (Objects.nonNull(userFullInfo)) { - employeeCode = userFullInfo.getEmployeeCode(); - } - if (StringUtils.isBlank(employeeCode)) { - return PageVo.empty(); - } - } - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - if (CollUtil.isEmpty(projects)) { - return PageVo.empty(); - } - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - if (CollUtil.isEmpty(instCodes)) { - return PageVo.empty(); - } - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setInstCodes(instCodes); - Integer pageNumber = param.getPageNumber(); - Integer pageSize = param.getPageSize(); - req.setProcessDefId(param.getProcessDefId()); - req.setEmployeeCode(employeeCode); - //有待办节点的(不包含退回) - List todoList = processTaskService.getUserTodoList(req); - //有退回待办的 - List backList = processTaskService.getBackTodoList(req); - //合并 并且排序 - List list = Stream.concat(todoList.stream(), backList.stream()) - .filter(Objects::nonNull) - .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()) - .collect(Collectors.toList()); - - if (CollUtil.isEmpty(list)) { - return PageVo.empty(); - } - - List userTodoList = list.stream() - .skip((long) (pageNumber - 1) * pageSize) - .limit(pageSize) - .collect(Collectors.toList()); - - Set processSet = Sets.newHashSet(); - Map taskMap = userTodoList.stream() - .sorted((t1, t2) -> t2.getTaskCreateTime().compareTo(t1.getTaskCreateTime())) - .collect(Collectors.toList()).stream() - .filter(v -> processSet.add(v.getNodeId())) - .collect(Collectors.toMap(ProcessTaskVo::getNodeId, v -> v)); - - - List resVos = userTodoList.stream().map(d -> { - Project projectInfo = projectInfoMap.get(d.getInstanceId()); - ResToBeProcessedVO res = new ResToBeProcessedVO(); - BeanUtils.copyProperties(projectInfo, res); - res.setInstCode(d.getInstanceId()); - res.setProjectId(projectInfo.getId()); - res.setBuildOrg(projectInfo.getBuildOrgName()); - res.setDeclaredAmount(projectInfo.getDeclareAmount()); - ProcessTaskVo taskVo = taskMap.get(d.getNodeId()); - res.setNodeId(d.getNodeId()); - res.setProcessStatusName(taskVo.getStatus()); - res.setProcessLaunchTime(d.getTaskCreateTime()); - res.setProcessDefName(d.getProcessDefName()); - res.setTaskId(d.getTaskId()); - res.setNodeName(findSubProcessName(d)); - res.setPretrialFileId(projectInfo.getPretrialFileId()); - return res; - }).collect(Collectors.toList()); - return PageVo.of(resVos, list.size()); - } - - private String findSubProcessName(ProcessTaskVo d) { - if (StringUtils.isBlank(d.getProcessDefId())) { - return null; - } - BpmnModel bpmnModel = repositoryService.getBpmnModel(d.getProcessDefId()); - - if (Objects.nonNull(bpmnModel)) { - FlowElement flowElement = bpmnModel.getFlowElement(d.getTaskDefKey()); - FlowElementsContainer parentContainer = flowElement.getParentContainer(); - if (parentContainer instanceof SubProcess) { - return ((SubProcess) parentContainer).getName(); - } - } - return null; - } - - /** - * 待办中心列表导出 - * - * @param response \ - * @param param \ - * @author CMM - * @since 2023/02/01 - */ - public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { - - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取用户全量用户信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - List userTodoList = Lists.newArrayList(); - Map projectInfoMap = MapUtil.newHashMap(); - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - if(StringUtils.isBlank(employeeCode)){ - projects = Collections.emptyList(); - } - if (CollUtil.isNotEmpty(projects)) { - Map projectsMap = CollUtils.listToMap(projects, Project::getId); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList).orderByDesc(ProjectInst::getProjectId)); - projectInstList.forEach(p -> projectInfoMap.put(p.getInstCode(), projectsMap.get(p.getProjectId()))); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setInstCodes(instCodes); - req.setProcessDefId(param.getProcessDefId()); - req.setEmployeeCode(employeeCode); - - // 有待办节点的(不包含退回) - List todoList = processTaskService.getUserTodoList(req); - // 有退回待办的 - List backList = processTaskService.getBackTodoList(req); - // 合并 并且排序 - Stream.of(todoList, backList) - .flatMap(Collection::stream) - .filter(Objects::nonNull) - .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()) - .forEach(userTodoList::add); - } - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_待我处理_增补项目列表"; - } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_待我处理_非增补项目列表"; - } - excelExportWriter.setFileName(fileName); - List sheetsNames = Lists.newArrayList(fileName); - List> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userTodoList, projectInfoMap); - // sheet列表集合 - List>> sheets = Lists.newArrayList(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - } - - /** - * 流程处理相关操作 - * - * @param param - * @return void - * @author CMM - * @since 2023/02/01 - */ - public String handler(ReqProcessHandlerDTO param) { - // 获取登录用户ID - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - // 获取登录用户浙政钉code - String employeeCode = user.getEmployeeCode(); - // 获取入参 - String processInstanceId = param.getInstanceId(); - Long projectId = param.getProjectId(); - VUtils.isTrue(Objects.isNull(processInstanceId)).throwMessage("获取流程实例ID失败!"); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("获取项目ID失败!"); - - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, processInstanceId) - .eq(Project::getId, projectId)); - VUtils.isTrue(Objects.isNull(declaredProject)).throwMessage("获取项目失败!"); - - // 获取当前未处理流程详情 - ProcessProgressVo currentInstanceDetail = processInstanceService.getProgressInstanceDetail(null, processInstanceId); - - // 获取当前要处理的流程实例 - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(processInstanceId) - .singleResult(); - - //提前判断下 是不是 已经被退回了 - checkIsBack(instance); - - //进入处理逻辑 - switch (param.getAction()) { - // 通过 - case PASS: - // 盖章并通过 - case SEAL_PASS: { - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 - Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); - if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; - } - String nodeId = task.getTaskDefinitionKey(); - // 通过该任务,流程到下一审核人处 - processTaskService.handleTask(param, employeeCode); - //通过审核后 所处理的逻辑 - handlerManage.afterPassTodo(declaredProject, instance); - - return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); - } - // 驳回 - case REJECT: { - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 - Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); - if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; - } - // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: - // 【项目名称】的【流程名称】被驳回,请及时处理。 - processTaskService.handleTask(param, employeeCode); - //驳回审核后 所处理的逻辑 - handlerManage.afterRejectTodo(declaredProject, instance); - } - break; - // 退回 - case BACK: { - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 - Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); - if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; - } - // 退回该任务 - processTaskService.handleTaskLs(param, employeeCode); - //退回审核后 所处理的逻辑 - handlerManage.afterBackTodo(declaredProject, instance); - } - break; - // 撤回(流程发起人和当前流程审核人的前一个审核人操作) - case WITHDRAW: { - /** - * 新逻辑 - * 不判断前端传的taskId - * 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批 - */ - if (withDrawHandle.canRootWithDraw(instance, employeeCode)) { - // 登录用户是流程发起人,且是流程发起人撤回 - processTaskService.rootWithdrawTask(param, employeeCode); - //发起人撤回 - handlerManage.rootWithDraw(declaredProject); - } else { - // 2.如果用户不是ROOT发起人 或者 不满足root撤回 那么必定要判断 他是不是上个节点审批人 或者 当前会签已审批的审批人 - // 这里有个小操作 check的同时 把对应的操作人的taskId 也塞入 - VUtils.isTrue(!withDrawHandle.checkUserIsBefore(currentInstanceDetail.getProgressInfo(), param)) - .throwMessage("当前登录用户不是发起人,也不是上一个节点审批人或者当前会签已批审批人 无法进行撤回操作!"); - - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 - HistoricTaskInstance taskInst = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).finished().singleResult(); - if (ObjectUtil.isNull(taskInst)) { - return TodoCenterConstant.Handler.TASKID_ERROR; - } - String nodeId = taskInst.getTaskDefinitionKey(); - //上个审批人处理逻辑 - processTaskService.lastWithdrawTask(param); - - return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); - } - } - break; - default: - throw new IllegalStateException("Unexpected value: " + param.getAction()); - } - return "操作成功"; - } - - private void checkIsBack(HistoricProcessInstance instance) { - VUtils.isTrue(Objects.nonNull(instance.getBusinessStatus()) && - HisProInsEndActId.BACK.equals(instance.getBusinessStatus())) - .throwMessage("该审核流程已被退回 暂时无法操作!"); - } - - /** - * 调用IRS接口,获取盖章后的pdf文件,上传到OSS,并保存文件ID到项目库中 - * - * @param req - * @param declaredProject - * @param templateName - * @param notSealedFileId - * @return void - * @author CMM - * @since 2023/03/16 21:34 - */ - private Long generateSealedPdf(SealInfoDTO req, Project declaredProject, String templateName, Long notSealedFileId) { - // 获取预审申请单文件,并转换为Base64 - File pdfFile = fileService.getById(notSealedFileId); - InputStream fileInputStream = fileService.getFileInputStream(pdfFile); - String pdfEncode64 = Base64.encode(fileInputStream); - // 装配盖章接口请求参数信息 - SignReqDTO signReq = new SignReqDTO(); - signReq.setPdfEncode64(pdfEncode64); - String originalFileName = pdfFile.getOriginalFileName(); - signReq.setFileName(originalFileName); - Float posX = req.getPosX(); - Float posY = req.getPosY(); - signReq.setPosX(posX); - signReq.setPosY(posY); - String sealSn; - if (Objects.isNull(req.getSealSn())) { - // 获取当前登录签章用户信息 - Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取印章编号 - CompanySignature companySignature = companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, userFullInfo.getEmpPosUnitCode())); - sealSn = companySignature.getSealSn(); - } else { - // 区县预审时,对有上级条线主管单位并进行了盖章的情况,需要根据上次的印章编号再次盖章 - sealSn = req.getSealSn(); - } - signReq.setSealSn(sealSn); - String posPage = req.getPosPage(); - signReq.setPosPage(posPage); - Integer signType = req.getSignType(); - signReq.setSignType(signType); - // 调用盖章接口,获取盖章后返回的pdf文件字符数组 - String signPdf = IRSAPIRequest.createSignPdf(signReq); - ByteArrayInputStream inputStream = null; - if (Objects.nonNull(signPdf)) { - BASE64Decoder decoder = new BASE64Decoder(); - try { - //转码 - byte[] b = decoder.decodeBuffer(signPdf); - for (int i = 0; i < b.length; ++i) { - if (b[i] < 0) {//调整异常数据 - b[i] += 256; - } - } - inputStream = new ByteArrayInputStream(b); - } catch (Exception e) { - log.error("获取盖章后的pdf文件异常:", e); - } - } - // 转换成MultipartFile - MultipartFile multipartFile; - try { - multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", inputStream); - } catch (IOException e) { - throw new BizException("生成盖章pdf文件失败!"); - } - // 上传OSS - FileResultVO resultVo = fileService.upload(multipartFile, "default"); - // 将返回的文件ID更新到项目库中对应的项目下 - // 根据模版名称判断是预审申请单还是建设方案申请单 - if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { - //放到项目申报书字段 - declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); - declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { - declaredProject.setConstructFileId(resultVo.getId()); - declaredProject.setConstructFileName(resultVo.getOriginalFileName()); - declaredProject.setUpdateOn(LocalDateTime.now()); - } - projectService.updateById(declaredProject); - return resultVo.getId(); - } - - /** - * 查询流程表单数据及审批的进度步骤 - * - * @param request 请求参数 - * @return 流程进度及表单详情 - */ - public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { - String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); - String instanceId = request.getInstanceId(); - String nodeId = request.getNodeId(); - Long projectId = request.getProjectId(); - String taskId = request.getTaskId(); - ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId, taskId); - - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .last(BizConst.LIMIT_1)); - - if (Objects.isNull(progressInstanceDetail)) { - return null; - } - - List progressInfo = progressInstanceDetail.getProgressInfo(); - Boolean isHighLine = Boolean.FALSE; - if (CollUtil.isNotEmpty(progressInfo)) { - buildUserUtils.buildUserByProcessInfo(progressInfo); - isHighLine = checkHighLine(progressInfo, taskId, LoginUserUtil.loginUserDetail()); - } - ProcessProgressDetailVo res = new ProcessProgressDetailVo(); - if(Objects.nonNull(projectInst)){ - Long projectIdThis = projectInst.getProjectId(); - Project project = projectService.getById(projectIdThis); - res.setProjectCode(project.getProjectCode()); - res.setProjectId(projectInst.getProjectId()); - }else{ - res.setProjectId(request.getProjectId()); - } - res.setProcessProgressVo(progressInstanceDetail); - res.setStatus(progressInstanceDetail.getStatus()); - res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId, progressInstanceDetail, request.getTaskId())); - res.setIsHighLine(isHighLine); - res.setConstructionSuggestions(checkConstructionSuggestionsByNodeId(taskId)); - passHandle.checkCanPassOrSeal(request.getInstanceId(), request.getTaskId(), employeeCode, res); - //是不是被 驳回|退回 - res.setIsChange(todoService.isChangeRecord(projectId)); - return res; - } - - private Boolean checkConstructionSuggestionsByNodeId(String taskId) { - if(StringUtils.isNotBlank(taskId)){ - List tasks = taskService.createTaskQuery() - .taskId(taskId) - .orderByTaskId().desc().list(); - if(CollUtil.isNotEmpty(tasks)){ - return tasks.get(0).getTaskDefinitionKey() - .endsWith(StrPool.DASH + ProcessConstant.Field.CONSTRUCTION); - } - } - return Boolean.FALSE; - } - - /** - * 筛选 当前登录人 是不是 上级条线单位的审批 - * - * @param progressInfo - * @param taskId - * @param user - * @return - */ - private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { - if (CollUtil.isEmpty(progressInfo)) { - return Boolean.FALSE; - } - - final Boolean[] res = {Boolean.FALSE}; - progressInfo.forEach(p -> { - //如果是 子流程 - if (Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())) { - //如果不是上级条线单位 根本不用理 - if (!p.getIsHighLine()) { - return; - } - List children = p.getChildren(); - ProgressNode progressNode = children.get(0); - String userId = progressNode.getUserId(); - if (StringUtils.isBlank(userId)) { - return; - } - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); - if (Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() - .equals(userFullInfoDTO.getEmpPosUnitCode())) { - //说明是此单位的人 - //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); - if (isContainsTask) { - res[0] = Boolean.TRUE; - } - } - } - }); - return res[0]; - } - - - /** - * 待办中心我已处理项目列表查询 - * - * @param param - * @author CMM - * @since 2023/02/03 - */ - public PageVo idoList(ToBeProcessedReq param) { - - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectIdList)) { - return PageVo.empty(); - } - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - Integer pageNumber = param.getPageNumber(); - Integer pageSize = param.getPageSize(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - List iDoList = processTaskService.getUserIdoList(req); - if (CollUtil.isEmpty(iDoList)) { - return PageVo.empty(); - } - - List userIdoList = iDoList.stream() - .skip((long) (pageNumber - 1) * pageSize) - .limit(pageSize) - .collect(Collectors.toList()); - - List resVos = userIdoList.stream().map(d -> { - ResToBeProcessedVO res = new ResToBeProcessedVO(); - Project projectInfo = projectInfoMap.get(d.getInstanceId()); - BeanUtils.copyProperties(projectInfo, res); - res.setInstCode(d.getInstanceId()); - res.setBuildOrg(projectInfo.getBuildOrgName()); - res.setDeclaredAmount(projectInfo.getDeclareAmount()); - res.setProjectId(projectInfo.getId()); - res.setProcessStatusName(d.getStatus()); - res.setProcessLaunchTime(d.getCreateTime()); - res.setProcessHandleTime(d.getTaskEndTime()); - res.setTaskId(d.getTaskId()); - res.setNodeName(findSubProcessName(d)); - return res; - }).collect(Collectors.toList()); - return PageVo.of(resVos, iDoList.size()); - } - - /** - * 导出我已处理项目列表 - * - * @param response 返回数据流 - * @param param 请求参数 - * @return void - * @author CMM - * @since 2023/02/06 - */ - public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - //因为要解耦 不能把项目和工作流一起查 - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - List userIdoList = Lists.newArrayList(); - Map projectInfoMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projects)) { - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - userIdoList = processTaskService.getUserIdoList(req); - } - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - - String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_我已处理_增补项目列表"; - } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_我已处理_非增补项目列表"; - } - excelExportWriter.setFileName(fileName); - - List sheetsNames = new ArrayList<>(); - sheetsNames.add(fileName); - - List> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userIdoList, projectInfoMap); - // sheet列表集合 - List>> sheets = new ArrayList<>(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - - } - - /** - * 查询我提交的项目列表 - * - * @param param - * @return com.ningdatech.basic.model.PageVo - * @author CMM - * @since 2023/02/06 - */ - public PageVo mySubmittedList(ToBeProcessedReq param) { - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - if(StringUtils.isBlank(employeeCode)){ - return PageVo.empty(); - } - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - - if (CollUtil.isEmpty(projectIdList)) { - return PageVo.empty(); - } - - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - Integer pageNumber = param.getPageNumber(); - Integer pageSize = param.getPageSize(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - List submittedList = processInstanceService.getUserSubmittedList(req); - - if (CollUtil.isEmpty(submittedList)) { - return PageVo.empty(); - } - - List userSubmittedList = submittedList.stream() - .skip((long) (pageNumber - 1) * pageSize) - .limit(pageSize) - .collect(Collectors.toList()); - - List resVos = userSubmittedList.stream().map(d -> { - ResToBeProcessedVO res = new ResToBeProcessedVO(); - Project project = projectInfoMap.get(d.getInstanceId()); - BeanUtils.copyProperties(project, res); - res.setInstCode(d.getInstanceId()); - res.setBuildOrg(project.getBuildOrgName()); - res.setDeclaredAmount(project.getDeclareAmount()); - res.setProjectId(project.getId()); - res.setProcessStatusName(d.getStatus()); - res.setProcessLaunchTime(d.getStartTime()); - return res; - }).collect(Collectors.toList()); - return PageVo.of(resVos, submittedList.size()); - } - - /** - * 待办中心-我发起的项目列表导出 - * - * @param response - * @param param - * @return void - * @author CMM - * @since 2023/02/11 - */ - public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) { - - // 获取登录用户ID - long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - - List userSubmittedList = Lists.newArrayList(); - Map projectInfoMap = Maps.newHashMap(); - - if(StringUtils.isBlank(employeeCode)){ - projects = Collections.emptyList(); - } - - if (CollUtil.isNotEmpty(projects)) { - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - userSubmittedList = processInstanceService.getUserSubmittedList(req); - } - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - - String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_我发起的_增补项目列表"; - } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_我发起的_非增补项目列表"; - } - excelExportWriter.setFileName(fileName); - - List sheetsNames = new ArrayList<>(); - sheetsNames.add(fileName); - // 表体行数据集合 - List> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), userSubmittedList, projectInfoMap); - // sheet列表集合 - List>> sheets = new ArrayList<>(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - - } - - /** - * 待办中心-抄送我的项目列表查询 - * - * @param param - * @return com.ningdatech.basic.model.PageVo - * @author CMM - * @since 2023/02/11 - */ - public PageVo ccmeList(ToBeProcessedReq param) { - - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - - if (CollUtil.isEmpty(projects)) { - return PageVo.empty(); - } - - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - Integer pageNumber = param.getPageNumber(); - Integer pageSize = param.getPageSize(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - List ccMeList = processInstanceService.getCcMeList(req); - - if (CollUtil.isEmpty(ccMeList)) { - return PageVo.empty(); - } - - List ccMeInstList = ccMeList.stream() - .skip((long) (pageNumber - 1) * pageSize) - .limit(pageSize) - .collect(Collectors.toList()); - - List resVos = ccMeInstList.stream().map(d -> { - ResToBeProcessedVO res = new ResToBeProcessedVO(); - Project project = projectInfoMap.get(d.getInstanceId()); - BeanUtils.copyProperties(project, res); - res.setInstCode(d.getInstanceId()); - res.setNodeId(d.getNodeId()); - res.setProjectId(project.getId()); - res.setBuildOrg(project.getBuildOrgName()); - res.setDeclaredAmount(project.getDeclareAmount()); - res.setProcessStatusName(d.getStatus()); - res.setProcessLaunchTime(d.getStartTime()); - return res; - }).collect(Collectors.toList()); - return PageVo.of(resVos, ccMeList.size()); - } - - /** - * 待办中心-抄送我的项目列表导出 - * - * @param response - * @param param - * @return void - * @author CMM - * @since 2023/02/11 - */ - public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) { - - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - - List ccMeList = Lists.newArrayList(); - Map projectInfoMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projects)) { - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::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()); - - // 分页查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - ccMeList = processInstanceService.getCcMeList(req); - } - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); - - String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_抄送我的_增补项目列表"; - } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { - fileName = "待办中心_抄送我的_非增补项目列表"; - } - excelExportWriter.setFileName(fileName); - - List sheetsNames = new ArrayList<>(); - sheetsNames.add(fileName); - // 表体行数据集合 - List> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), ccMeList, projectInfoMap); - // sheet列表集合 - List>> sheets = new ArrayList<>(); - sheets.add(exportDatas); - excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(exportDatas); - excelExportWriter.setSheets(sheetsNames); - excelExportWriter.setHeadPropertyClass(List.class); - excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response, excelExportWriter); - - } - - /** - * 被退回项目内容调整并重新通过 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String adjustmentAndHandle(AdjustHandleDTO dto) { - ProjectDTO projectDto = dto.getProjectInfo(); - Project projectInfo = projectService.getById(projectDto.getId()); - - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); - - //项目名称去重 - //项目名称去重 - if (StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())) { - defaultDeclaredProjectManage.checkDuplication(projectDto); - } - projectDto.setProjectCode(projectInfo.getProjectCode()); - defaultDeclaredProjectManage.checkAmount(projectDto); - - //修改项目内容 - if (!modifyProject(projectDto, projectInfo)) { - throw new BusinessException("调整项目失败!"); - } - - //设置 节点的状态 为null 代表继续审核 - List approves = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(dto.getInstanceId()) - .variableNameLike("approve_%") - .list(); - //删除 退回的评论和意见 - handlerManage.deleteBackComments(approves); - - // 更新当前流程状态为审核中 - processTaskService.updateProInstStatus(dto.getInstanceId()); - - return dto.getInstanceId(); - } - - /** - * 要改成 生成新版本号 - * - * @param projectDto - * @return - */ - private Boolean modifyProject(ProjectDTO projectDto, Project oldProject) { - //先修改项目信息 - Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projectDto, project, CopyOptions.create() - .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - project.setVersion(oldProject.getVersion() + 1); - project.setId(null); - project.setCreateOn(LocalDateTime.now()); - project.setUpdateOn(LocalDateTime.now()); - projectService.save(project); - - oldProject.setIsBackReject(Boolean.TRUE); - projectService.updateById(oldProject); - - ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class) - .eq(ProjectInst::getProjectId, oldProject.getId()) - .eq(ProjectInst::getInstCode, oldProject.getInstCode())); - - String instCode = oldProject.getInstCode(); - oldInst.setInstCode("EMPTY"); - projectInstService.updateById(oldInst); - - ProjectInst newPi = new ProjectInst(); - newPi.setProjectId(project.getId()); - newPi.setInstType(oldInst.getInstType()); - newPi.setInstCode(instCode); - newPi.setCreatOn(LocalDateTime.now()); - newPi.setUpdateOn(LocalDateTime.now()); - projectInstService.save(newPi); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - //再修改应用信息 - Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() - ? Boolean.TRUE : Boolean.FALSE; - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); - Integer instType = projectInst.getInstType(); - - //批量删除 - List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion, project.getVersion()) - .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); - if (CollUtil.isNotEmpty(applicationList)) { - projectApplicationService.removeBatchByIds(applicationList); - List applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList()); -// projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) -// .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); - } - - List applications = projectDto.getApplicationList(); - if (isApp && CollUtil.isNotEmpty(applications)) { - // 添加应用关联的核心业务 - for (ProjectApplicationDTO application : applications) { - ProjectApplication projectApplication = new ProjectApplication(); - BeanUtils.copyProperties(application, projectApplication); - projectApplication.setId(null); - projectApplication.setProjectId(project.getId()); - projectApplication.setProjectCode(project.getProjectCode()); - projectApplication.setProjectVersion(project.getVersion()); - if (!InstTypeEnum.UNIT_INNER_AUDIT.getCode().equals(instType) && - !InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType) && - !InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) { - projectApplication.setIsConstruct(Boolean.TRUE); - } - projectApplication.setProjectVersion(project.getVersion()); - boolean result = projectApplicationService.save(projectApplication); -// // 保存应用关联的核心业务 -// List coreBusinessList = application.getCoreBusinessList(); -// Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; -// if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ -// for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { -// ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); -// BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); -// projectCoreBusinessIndicators.setApplicationId(application.getId()); -// projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); -// } -// } - } - } - return Boolean.TRUE; - } - - /** - * 获取未盖章的预审申请单/建设方案申请单pdf文件 - * - * @param req - * @return java.lang.Long - * @author CMM - * @since 2023/03/16 22:46 - */ - public NotSealedInfoVO getNotSealedPdf(SealInfoDTO req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = user.getEmpPosUnitCode(); - Long projectId = req.getProjectId(); - String auditOpinion = req.getAuditOpinion(); - String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); - NotSealedInfoVO notSealedInfoVo = new NotSealedInfoVO(); - // 判断项目盖章审批类型 - Project project = projectService.getById(projectId); - String buildOrgCode = project.getBuildOrgCode(); - String instanceId = project.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); - Integer instType = projectInst.getInstType(); - // 如果为预审申报审批 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { - // 再根据项目所属区域判断是市级预审还是区县预审 - String areaCode = project.getAreaCode(); - String areaName = project.getArea(); - Long pretrialFileId = project.getPretrialFileId(); - Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, areaCode) - .eq(Region::getRegionName, areaName)); - VUtils.isTrue(Objects.isNull(region)).throwMessage("项目所属区域不存在!"); - Integer regionLevel = region.getRegionLevel(); - if (CommonEnum.LS_SBJ.getDesc().equals(areaName)) { - regionLevel = RegionConst.RL_CITY; - } - // 获取项目申报时是否选择了主管单位和上级条线主管单位 - // 主管单位信息 - Integer isSuperOrg = project.getIsSuperOrg(); - String superOrgCode = project.getSuperOrgCode(); - // 上级条线主管单位信息 - Integer isHigherSuperOrg = project.getIsHigherSuperOrg(); - String higherSuperOrgCode = project.getHigherSuperOrgCode(); - switch (regionLevel) { - // 市级预审(市本级) - case RegionConst.RL_CITY: - // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { - return notSealedInfoVo; - } - String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; - // 设置pdf模板参数 - JSONObject cityParamsMap = assemblyPdfParams(project, cityTemplateName); - // 盖章审核为主管单位审核 - if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 有主管单位信息且登录用户所在单位是主管单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, cityParamsMap); - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, cityParamsMap); - } - Long cityPdfId = generateNotSealedPdf(projectId, cityTemplateName, cityParamsMap); - notSealedInfoVo.setFileId(cityPdfId); - checkAuditOpinion(auditOpinion, notSealedInfoVo); - return notSealedInfoVo; - // 区县预审 - case RegionConst.RL_COUNTY: - String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; - String sealNo = null; - Long notSealedId = null; - // 设置pdf模板参数 - JSONObject countryParamsMap = assemblyPdfParams(project, countryTemplateName); - // 以是否有上级主管单位的维度判断(有上级条线主管单位,才有可能需要盖两次章) - if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) { - // 盖章审核登录用户所在单位为上级条线主管单位,此时为区县预审盖章流程第一个章 - if (empPosUnitCode.equals(higherSuperOrgCode)) { - // 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位, - // 如果项目关联的预审文件ID和上级条线审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryHigherNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion()))) { - return notSealedInfoVo; - } - countryParamsMap.put("higherOrgOpinion", auditOpinion); - countryParamsMap.put("higherOrgAuditDate", auditDate); - // 获取上级条线主管单位印章编号 - CompanySignature companySignature = - companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, higherSuperOrgCode)); - if (Objects.nonNull(companySignature)) { - sealNo = companySignature.getSealSn(); - } - // 保存区县预审上级条线主管单位盖章审核意见、审核日期和盖章编号 - project.setCountryHigherSealNo(sealNo); - project.setCountryHigherSealAuditOpinion(auditOpinion); - project.setCountryHigherSealAuditDate(auditDate); - projectService.updateById(project); - countryParamsMap.put("superOrgOpinion", null); - countryParamsMap.put("superOrgAuditDate", null); - // 直接返回装填了上级条线主管单位意见的未盖章文件 - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - // 盖章审核登录用户所在单位不为上级条线主管单位(可能为选择的主管单位、项目建设单位、其他单位), - // 此时为区县预审盖章流程第二个章 - else if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 有上级条线主管单位信息且有本级主管单位信息 - // 有主管单位信息且登录用户所在单位是主管单位 - // 装配本级主管单位审核意见 - // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { - return notSealedInfoVo; - } - // 保存区县本级主管单位盖章审核意见、审核日期 - project.setCountrySealAuditOpinion(auditOpinion); - project.setCountrySealAuditDate(auditDate); - projectService.updateById(project); - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); - // 装配上级条线主管单位意见,调用盖章接口, - // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 - SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); - Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 有上级条线主管单位信息,没有本级主管单位信息 - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { - return notSealedInfoVo; - } - // 保存区县本级主管单位盖章审核意见、审核日期 - project.setCountrySealAuditOpinion(auditOpinion); - project.setCountrySealAuditDate(auditDate); - projectService.updateById(project); - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); - // 装配上级条线主管单位意见,调用盖章接口, - // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 - SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); - Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); - } - } - // 没有上级主管条线单位 - else if (CommonEnum.NO.getCode().equals(isHigherSuperOrg)) { - // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { - return notSealedInfoVo; - } - // 有本级主管单位信息 - if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 登录用户所在单位是本级主管单位,装配本级主管单位审核意见 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); - // 直接返回装配了本级主管单位审核意见的未盖章文件 - countryParamsMap.put("higherOrgOpinion", null); - countryParamsMap.put("higherOrgAuditDate", null); - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - // 没有选主管单位,默认为项目建设单位 - else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 登录用户所在单位为项目建设单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); - // 直接返回装配了项目建设单位审核意见的未盖章文件 - countryParamsMap.put("higherOrgOpinion", null); - countryParamsMap.put("higherOrgAuditDate", null); - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - } - notSealedInfoVo.setFileId(notSealedId); - checkAuditOpinion(auditOpinion, notSealedInfoVo); - return notSealedInfoVo; - default: - throw new IllegalStateException("Unexpected value: " + regionLevel); - } - } - // 如果为建设方案申报审批 - else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - Long constructFileId = project.getConstructFileId(); - // 如果项目关联的建设方案文件ID不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCityNotSealedInfoVO(constructFileId, notSealedInfoVo))) { - return notSealedInfoVo; - } - // 设置pdf模板参数 - String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; - JSONObject constructParamsMap = assemblyPdfParams(project, constructTemplateName); - // 审核为指定大数据局盖章 - // 获取流程配置的指定单位信息 - constructParamsMap.put("bigDataBureauOpinion", auditOpinion); - constructParamsMap.put("bigDataBureauAuditDate", auditDate); - Long constructNotFileId = generateNotSealedPdf(projectId, constructTemplateName, constructParamsMap); - notSealedInfoVo.setFileId(constructNotFileId); - checkAuditOpinion(auditOpinion, notSealedInfoVo); - return notSealedInfoVo; - } - return notSealedInfoVo; - } - - private void checkAuditOpinion(String auditOpinion, NotSealedInfoVO notSealedInfoVo) { - if (StringUtils.isNotBlank(auditOpinion)) { - notSealedInfoVo.setIsCommit(Boolean.TRUE); - } - } - - private Boolean getCityNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo) { - if (Objects.nonNull(fileId)) { - notSealedInfoVo.setFileId(fileId); - notSealedInfoVo.setIsCommit(Boolean.TRUE); - return true; - } - return false; - } - - private Boolean getCountryHigherNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String auditOpinion) { - if (Objects.nonNull(fileId) && StringUtils.isNotBlank(auditOpinion)) { - notSealedInfoVo.setFileId(fileId); - notSealedInfoVo.setIsCommit(Boolean.TRUE); - return true; - } - return false; - } - - private Boolean getCountryNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String higherAuditOpinion, - String auditOpinion) { - if (Objects.nonNull(fileId) && StringUtils.isNotBlank(higherAuditOpinion) - && StringUtils.isNotBlank(auditOpinion)) { - notSealedInfoVo.setFileId(fileId); - notSealedInfoVo.setIsCommit(Boolean.TRUE); - return true; - } - return false; - } - - private SealInfoDTO getHigherSealInfoDTO(Project project, JSONObject countryParamsMap) { - String countrySealAuditOpinion = project.getCountryHigherSealAuditOpinion(); - String countrySealAuditDate = project.getCountryHigherSealAuditDate(); - countryParamsMap.put("higherOrgOpinion", countrySealAuditOpinion); - countryParamsMap.put("higherOrgAuditDate", countrySealAuditDate); - SealInfoDTO sealInfoDTO = new SealInfoDTO(); - sealInfoDTO.setPosPage(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_PAGE); - sealInfoDTO.setProjectId(project.getId()); - sealInfoDTO.setPosX(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_X); - sealInfoDTO.setPosY(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_Y); - sealInfoDTO.setSignType(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_SIGN_TYPE); - sealInfoDTO.setSealSn(project.getCountryHigherSealNo()); - return sealInfoDTO; - } - - private void checkEmpPosUnitCode(String empPosUnitCode, String auditOpinion, String auditDate, String orgCode, JSONObject cityParamsMap) { - if (empPosUnitCode.equals(orgCode)) { - cityParamsMap.put("superOrgOpinion", auditOpinion); - cityParamsMap.put("superOrgAuditDate", auditDate); - } else { - cityParamsMap.put("superOrgOpinion", null); - cityParamsMap.put("superOrgAuditDate", null); - } - } - - private Long generateNotSealedPdf(Long projectId, String templateName, JSONObject paramsMap) { - // 获取本地目录的pdf模板 - String fileName; - if (templateName.contains(StrPool.DASH)) { - int index = templateName.indexOf(StrPool.DASH); - fileName = templateName.substring(index + 1); - } else { - fileName = templateName; - } - InputStream htmlInputStream = - this.getClass().getClassLoader().getResourceAsStream("template" + java.io.File.separator + templateName + ".html"); - // 生成pdf字节数组 - byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); - - // 转换成MultipartFile - MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); - - // 上传OSS - FileResultVO resultVo = fileService.upload(multipartFile, "default"); - - // 将带审核意见的返回的文件ID更新到项目库中对应的项目下 - Project declaredProject = projectService.getById(projectId); - // 根据模版名称判断是预审申请单还是建设方案申请单 - String superOrgOpinion = paramsMap.getString("superOrgOpinion"); - String higherOrgOpinion = paramsMap.getString("higherOrgOpinion"); - if (StringUtils.isNotBlank(superOrgOpinion) || StringUtils.isNotBlank(higherOrgOpinion)) { - if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { - //放到项目申报书字段 - declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); - declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { - declaredProject.setConstructFileId(resultVo.getId()); - declaredProject.setConstructFileName(resultVo.getOriginalFileName()); - declaredProject.setUpdateOn(LocalDateTime.now()); - } - projectService.updateById(declaredProject); - } - try { - if (null != htmlInputStream) { - htmlInputStream.close(); - } - - // 删除输出文件夹下的临时文件 - java.io.File directory = new java.io.File(""); - //pdf输出路径 - String filePath = directory.getAbsolutePath() + java.io.File.separator + "fileout"; - java.io.File directoryPath = new java.io.File(filePath); - FileUtils.cleanDirectory(directoryPath); - } catch (IOException e) { - log.error(e.getMessage()); - } - - // 返回文件id供前端下载 - return resultVo.getId(); - } - - /** - * 装配pdf模板参数 - * - * @param project - * @param templateName - * @return com.alibaba.fastjson.JSONObject - * @author CMM - * @since 2023/03/16 22:28 - */ - private JSONObject assemblyPdfParams(Project project, String templateName) { - // 获取本地目录的pdf模板 - String fileName; - if (templateName.contains(StrPool.DASH)) { - int index = templateName.indexOf(StrPool.DASH); - fileName = templateName.substring(index + 1); - } else { - fileName = templateName; - } - Long projectId = project.getId(); - // 获取表单数据 - PdfGenerateDTO pdfGenerateDTO = new PdfGenerateDTO(); - BeanUtils.copyProperties(project, pdfGenerateDTO); - - JSONObject paramsMap = JSONObject.parseObject(JSONObject.toJSONString(pdfGenerateDTO)); - // 设置title - String title = "【" + project.getProjectName() + "】" + fileName; - paramsMap.put("title", title); - // 获取预审申报的开始时间 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, projectId) - .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) - .orderByDesc(ProjectInst::getCreatOn) - .last("limit 1")); - LocalDateTime time = null; - if (Objects.nonNull(projectInst)) { - time = projectInst.getCreatOn(); - paramsMap.put("time", NdDateUtils.format(time, "yyyy-MM-dd HH:mm")); - } else { - paramsMap.put("time", null); - } - // 获取是否临时增补项目 - String isTemporaryAugment = IsOrNotEnum.getDescByCode(project.getIsTemporaryAugment()); - paramsMap.put("isTemporaryAugment", isTemporaryAugment); - // 获取项目类型 - String projectType = project.getProjectType(); - paramsMap.put("projectType", ProjectTypeNewEnum.getDesc(projectType)); - // 获取是否首次新建 - String isFirst = IsOrNotEnum.getDescByCode(project.getIsFirst()); - paramsMap.put("isFirst", isFirst); - // 获取是否一地创新全省共享项目 - Boolean isInnovateWholeProvinceShare = project.getIsInnovateWholeProvinceShare(); - paramsMap.put("isInnovateWholeProvinceShare", Boolean.TRUE.equals(isInnovateWholeProvinceShare) ? - IsOrNotEnum.IS.getDesc() : IsOrNotEnum.NOT.getDesc()); - // 获取项目建设起始时间 - String beginTime = project.getBeginTime(); - String endTime = project.getEndTime(); - String beginAndEndTime = beginTime + StrUtil.DASHED + endTime; - paramsMap.put("beginAndEndTime", beginAndEndTime); - // 获取四大体系 - String fourSystem = FourSystemEnum.getDescByCode(project.getFourSystems()); - paramsMap.put("fourSystems", fourSystem); - // 获取是否数字化改革项目 - String isDigitalReform = IsOrNotEnum.getDescByCode(project.getIsDigitalReform()); - paramsMap.put("isDigitalReform", isDigitalReform); - if (IsOrNotEnum.NOT.getDesc().equals(isDigitalReform)) { - paramsMap.put("bizDomain", null); - } else { - paramsMap.put("bizDomain", BizDomainEnum.getDescByCode(project.getBizDomain())); - } - // 获取是否上云 - String isCloud = IsOrNotEnum.getDescByCode(project.getIsCloud()); - paramsMap.put("isCloud", isCloud); - if (IsOrNotEnum.NOT.getDesc().equals(isCloud)) { - paramsMap.put("cloudType", null); - } else { - String cloudType = project.getCloudType(); - String cloudTypeName; - // 云类型为多选 - if (cloudType.contains(StrPool.COMMA)) { - cloudTypeName = Arrays.stream(cloudType.split(StrPool.COMMA)) - .map(s -> CloudTypeEnum.getDescByCode(Integer.valueOf(s))) - .collect(Collectors.joining(StrPool.COMMA)); - - } else { - cloudTypeName = CloudTypeEnum.getDescByCode(Integer.valueOf(cloudType)); - } - paramsMap.put("cloudType", cloudTypeName); - } - // 获取本年计划投资金额 - BigDecimal yearPlanInvest = project.getAnnualPlanAmount(); - paramsMap.put("yearPlanInvest", yearPlanInvest); - // 根据地区编码获取当地大数据局(中心)的名称 - paramsMap.put("bigDataBureauName", null); - // 备注模块如果为空 - if (Objects.isNull(pdfGenerateDTO.getProjectRemarks())) { - paramsMap.put("projectRemarks", null); - } - - // 获取立项依据 - String buildBasis = project.getBuildBasis(); - StringBuilder builder = new StringBuilder(); - List fileArray = JSON.parseArray(buildBasis, JSONObject.class); - for (JSONObject jsonObject : fileArray) { - String titleStr = jsonObject.getString(CommonConst.TITLE); - builder.append(CommonConst.ITEM_BASED); - builder.append(titleStr); - builder.append(StrPool.SPACE); - String fileNameStr = jsonObject.getString(CommonConst.FILE_NAME_STR); - builder.append(CommonConst.ITEM_BASED_FILE_NAME); - builder.append(fileNameStr); - builder.append(StrPool.SPACE); - String fileInfo = jsonObject.getString(CommonConst.FILE_LIST); - List fileInfoArray = JSON.parseArray(fileInfo, JSONObject.class); - List nameList = CollUtils.fieldList(fileInfoArray, w -> w.getString(CommonConst.FILE_NAME)); - String appendixStr = String.join(StrPool.COMMA, nameList); - builder.append(CommonConst.APPENDIX); - builder.append(appendixStr); - builder.append(StrPool.SEMICOLON); - builder.append(StrPool.NEWLINE); - } - String buildBasisList = builder.toString(); - paramsMap.put("buildBasisList", buildBasisList); - - return paramsMap; - } - - public Long getSealedPdf(SealInfoDTO req) { - Long projectId = req.getProjectId(); - Long notSealedFileId = req.getNotSealedFileId(); - Project declaredProject = projectService.getById(projectId); - String instanceId = declaredProject.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); - Integer instType = projectInst.getInstType(); - // 如果为预审申报审批 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { - // 再根据项目所属区域判断是市级预审还是区县预审 - String areaCode = declaredProject.getAreaCode(); - String areaName = declaredProject.getArea(); - Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, areaCode) - .eq(Region::getRegionName, areaName)); - if (Objects.isNull(region)) { - throw new BizException("项目所属区域不存在!"); - } - Integer regionLevel = region.getRegionLevel(); - if (CommonEnum.LS_SBJ.getDesc().equals(areaName)) { - regionLevel = RegionConst.RL_CITY; - } - switch (regionLevel) { - // 市级预审(市本级) - case RegionConst.RL_CITY: - String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; - return generateSealedPdf(req, declaredProject, cityTemplateName, notSealedFileId); - // 区县预审 - case RegionConst.RL_COUNTY: - String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; - return generateSealedPdf(req, declaredProject, countryTemplateName, notSealedFileId); - default: - throw new IllegalStateException("Unexpected value: " + regionLevel); - } - } - // 如果为建设方案申报审批 - else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - // 设置pdf模板参数 - String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; - return generateSealedPdf(req, declaredProject, constructTemplateName, notSealedFileId); - } - return null; - } - - //获取当前登录人的 待办中心统计数据 - public TodoCenterStatisticsVO todoCenterStatistics(String employeeCode) { - //为了查询效率 还是自己去写统计接口 - TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); - return BeanUtil.copyProperties(statistics, TodoCenterStatisticsVO.class); - } - - public TodoNumVO getTodoNums(ToBeProcessedReq param) { - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取员工浙政钉code - TodoNumVO todoNumVo = new TodoNumVO(); - String employeeCode = userFullInfo.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - return todoNumVo; - } - - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); - if (CollUtil.isEmpty(projects)) { - return todoNumVo; - } - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::getProjectId)); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setInstCodes(instCodes); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); - //有待办节点的(不包含退回) - List todoList = processTaskService.getUserTodoList(req); - //有退回待办的 - List backList = processTaskService.getBackTodoList(req); - //合并 并且排序 - List list = Stream.concat(todoList.stream(), backList.stream()) - .filter(Objects::nonNull) - .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime) - .reversed()) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(list)) { - return todoNumVo; - } - - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - 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 projectList = list.stream() - .map(d -> projectInfoMap.get(d.getInstanceId())) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(projectList)) { - todoNumVo.setTotalNum(projectList.size()); - } - // 筛选出增补项目和非增补项目 - List appendProjects = projectList.stream() - .filter(p -> IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(appendProjects)) { - todoNumVo.setAppendNum(appendProjects.size()); - } - List notAppendProjects = projectList.stream() - .filter(p -> IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(notAppendProjects)) { - todoNumVo.setNotAppendNum(notAppendProjects.size()); - } - return todoNumVo; - } - - /** - * 寻找下一个审核task - * - * @param instance - * @return - */ - private String findNextTaskId(HistoricProcessInstance instance, String employeeCode, String nodeId, String taskId) { - BpmnModel bpmnModel = repositoryService.getBpmnModel(instance.getProcessDefinitionId()); - Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); - String subProcessId = subNodeMap.get(nodeId); - Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); - List nodeIds = allSubNodeMap.get(subProcessId); - - List tasks = taskService.createTaskQuery() - .processInstanceId(instance.getId()) - .taskAssignee(employeeCode) - .taskDefinitionKeys(nodeIds) - .orderByTaskCreateTime() - .asc() - .list(); - if (CollUtil.isEmpty(tasks)) { - //如果此子单位为空 那就直接再查下 他的其它任务 - List currentTasks = taskService.createTaskQuery() - .processInstanceId(instance.getId()) - .taskAssignee(employeeCode) - .orderByTaskCreateTime() - .asc() - .list(); - if (CollUtil.isNotEmpty(currentTasks)) { - return currentTasks.get(0).getId(); - } - return taskId; - } - return tasks.get(0).getId(); - } - - /** - * 取当前用户的下一个taskId - * - * @param instanceId - * @return - */ - public String todoTaskId(String instanceId) { - String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); - List tasks = taskService.createTaskQuery() - .processInstanceId(instanceId) - .taskAssignee(employeeCode) - .orderByTaskCreateTime() - .asc() - .list(); - if (CollUtil.isEmpty(tasks)) { - return null; - } - return tasks.get(0).getId(); - } - - public Object saveAuditOpinion(ReqAuditOpinionSaveDTO param) { - // 获取登录用户ID - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - // 获取登录用户浙政钉code - String employeeCode = user.getEmployeeCode(); - - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 - Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); - if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; - } - return processTaskService.saveAuditOpinion(param, employeeCode); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java deleted file mode 100644 index ec8c77a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.todocenter.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; -import org.apache.ibatis.annotations.Param; - -public interface StatisticsMapper extends BaseMapper { - - - TodoCenterStatisticsPO getStatistics(@Param("employeeCode") String employeeCode); - - TodoCenterStatisticsPO getTodoOrIdo(@Param("employeeCode") String employeeCode); - - TodoCenterStatisticsPO mysubmitNum(@Param("employeeCode") String employeeCode); - - TodoCenterStatisticsPO ccNums(@Param("employeeCode") String employeeCode); - - TodoCenterStatisticsPO getIdo(@Param("employeeCode") String employeeCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml deleted file mode 100644 index 7f95a16..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java deleted file mode 100644 index 51e4164..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import java.io.Serializable; -import java.util.Map; - -import javax.validation.constraints.NotNull; - -import com.google.common.collect.Maps; -import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; - -import cn.hutool.core.collection.CollUtil; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @Classname DefaultDeclaredDTO - * @Description - * @Date 2023/2/14 17:16 - * @Author PoffyZhang - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class AdjustHandleDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @NotNull - @ApiModelProperty("项目信息") - private ProjectDTO projectInfo; - - @ApiModelProperty("表单信息 新增模块") - private Map formData; - - public Map getFormData(){ - if(CollUtil.isEmpty(this.formData)){ - this.formData = Maps.newHashMap(); - return this.formData; - } - return this.formData; - } - @ApiModelProperty("项目ID") - @NotNull(message = "要处理的项目ID不能为空!") - private Long projectId; - - @NotNull(message = "流程实例ID不能为空!") - private String instanceId; - - @ApiModelProperty("任务ID") - @NotNull(message = "任务ID不能为空!") - private String taskId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/PdfGenerateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/PdfGenerateDTO.java deleted file mode 100644 index 0adc4a4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/PdfGenerateDTO.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.math.BigDecimal; - -/** - * pdf生成实体 - * - * @author CMM - * @since 2023/03/13 14:24 - */ -@Data -public class PdfGenerateDTO { - @ApiModelProperty("应用ID") - private Long id; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("是否临时增补 0:否 1:是") - private String isTemporaryAugment; - - @ApiModelProperty("项目负责人") - private String responsibleMan; - - @ApiModelProperty("负责人手机号码") - private String responsibleManMobile; - - @ApiModelProperty("项目联系人") - private String contactName; - - @ApiModelProperty("项目联系人手机号码") - private String contactPhone; - - @ApiModelProperty("建设单位名称") - private String buildOrgName; - - @ApiModelProperty("建设单位统一社会信用代码") - private String orgCreditCode; - - @ApiModelProperty("项目类型 1:建设 2:运维") - private String projectType; - - @ApiModelProperty("是否首次新建 0:否 1:是") - private String isFirst; - - @ApiModelProperty("项目预算年度") - private Integer projectYear; - - @ApiModelProperty("项目建设起止时间") - private String beginAndEndTime; - - @ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施") - private String fourSystems; - - @ApiModelProperty("是否数字化改革项目 0:否 1:是") - private String isDigitalReform; - - @ApiModelProperty("综合业务领域") - private String bizDomain; - - @ApiModelProperty("立项依据") - private String buildBasisList; - - - @ApiModelProperty("是否上云 0:否 1:是") - private String isCloud; - - private String cloudType; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Integer isSecretComments; - - @ApiModelProperty("项目简介") - private String projectIntroduction; - - @ApiModelProperty("资金申报情况-申报金额(万元)") - private BigDecimal declareAmount; - - @ApiModelProperty("资金申报情况-自有金额(万元)") - private BigDecimal declareHaveAmount; - - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") - private BigDecimal declareGovOwnFinanceAmount; - - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") - private BigDecimal declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private BigDecimal declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private BigDecimal declareOtherAmount; - - @ApiModelProperty("资金分配情况-软件开发(万元)") - private BigDecimal softwareDevelopmentAmount; - - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") - private BigDecimal cloudHardwarePurchaseAmount; - - @ApiModelProperty("资金分配情况-第三方服务(万元)") - private BigDecimal thirdPartyAmount; - - @ApiModelProperty("年度支付计划-年度支付计划(万元)") - private BigDecimal annualPlanAmount; - - @ApiModelProperty("年度支付计划-自有金额(万元)") - private BigDecimal annualPlanHaveAmount; - - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") - private BigDecimal annualPlanGovOwnFinanceAmount; - - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") - private BigDecimal annualPlanGovSuperiorFinanceAmount; - - @ApiModelProperty("年度支付计划-银行贷款(万元)") - private BigDecimal annualPlanBankLendingAmount; - - @ApiModelProperty("年度支付计划-其它资金(万元)") - private BigDecimal annualPlanOtherAmount; - - @ApiModelProperty("备注") - private String projectRemarks; - - @ApiModelProperty("附件-是否开启 false:关闭 true:开启") - private Boolean isAccessories; - - @ApiModelProperty("备注-是否开启 false:关闭 true:开启") - private Boolean isRemarks; - - @ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启") - private Boolean isAnnualPlanAmount; - - @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") - private Boolean isInnovateWholeProvinceShare; - - @ApiModelProperty("本地区大数据局名称") - private String bidDataBureauName; - - @ApiModelProperty("年度计划投资") - private BigDecimal yearPlanInvest; - - @ApiModelProperty("21位项目编号") - private String projectCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ProjectAuditMsgExtraDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ProjectAuditMsgExtraDTO.java deleted file mode 100644 index 3abb96b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ProjectAuditMsgExtraDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import com.ningdatech.pmapi.sys.model.dto.AbstractMsgExtraDTO; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 项目审核工作通知信息实体 - * - * @author CMM - * @since 2023/04/12 16:13 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ProjectAuditMsgExtraDTO extends AbstractMsgExtraDTO { - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("流程实例ID") - private String instanceId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java deleted file mode 100644 index 248657d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 待办中心抄送我的项目列表导出实体 - * - * @author CMM - * @since 2023/01/19 16:42 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ResCcMeExportDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("申报单位") - private String reportUnitName; - - @ExcelProperty("申报金额") - private Integer reportAmount; - - @ExcelProperty("预算年度") - private Integer budgetYear; - - @ExcelProperty("流程状态") - private String processStatusName; - - @ExcelProperty("发起时间") - private LocalDateTime processLaunchTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java deleted file mode 100644 index 40f68da..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 待办中心我已处理项目列表导出实体 - * - * @author CMM - * @since 2023/01/19 16:42 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ResHandledExportDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("申报单位") - private String reportUnitName; - - @ExcelProperty("申报金额") - private Integer reportAmount; - - @ExcelProperty("预算年度") - private Integer budgetYear; - - @ExcelProperty("流程状态") - private String processStatusName; - - @ExcelProperty("发起时间") - private LocalDateTime processLaunchTime; - - @ExcelProperty("处理时间") - private LocalDateTime processHandleTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java deleted file mode 100644 index f3f2329..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 待办中心我发起的项目列表导出实体 - * - * @author CMM - * @since 2023/01/19 16:42 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ResMySubmittedExportDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @ExcelProperty("项目名称") - private String projectName; - - @ExcelProperty("申报单位") - private String reportUnitName; - - @ExcelProperty("申报金额") - private Integer reportAmount; - - @ExcelProperty("预算年度") - private Integer budgetYear; - - @ExcelProperty("流程状态") - private String processStatusName; - - @ExcelProperty("发起时间") - private LocalDateTime processLaunchTime; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java deleted file mode 100644 index 26165be..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import lombok.Data; - -/** - * 调用天印外部接口签章所需信息 - * - * @author CMM - * @since 2023/03/16 17:01 - */ -@Data -public class SealInfoDTO { - - /** - * 项目ID - */ - private Long projectId; - /** - * 印章x坐标 - */ - private Float posX; - /** - * 印章y坐标 - */ - private Float posY; - - /** - * 页码 - */ - private String posPage; - - /** - * 签署类型 - */ - private Integer signType; - - /** - * 印章编号 - */ - private String sealSn; - - /** - * 盖章审核意见 - */ - private String auditOpinion; - - /** - * 未盖章文件ID - */ - private Long notSealedFileId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SignReqDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SignReqDTO.java deleted file mode 100644 index 0c5c737..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SignReqDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto; - -import lombok.Data; - -/** - * 印章信息及位置坐标 - * - * @author CMM - * @since 2023/03/16 11:56 - */ -@Data -public class SignReqDTO { - - private String pdfEncode64; - - private Float posX; - - private Float posY; - - private String sealSn; - - private String fileName; - - private String posPage; - - private Integer signType; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/po/TodoCenterStatisticsPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/po/TodoCenterStatisticsPO.java deleted file mode 100644 index 4c3ecc4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/po/TodoCenterStatisticsPO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.po; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname TodoCenterStatisticsPO - * @Description - * @Date 2023/3/20 11:51 - * @Author PoffyZhang - */ -@Data -public class TodoCenterStatisticsPO { - - @ApiModelProperty("待处理数") - private Integer todoNum = 0; - @ApiModelProperty("已处理数") - private Integer idoNum = 0; - @ApiModelProperty("我发起数") - private Integer mysubmitNum = 0; - @ApiModelProperty("抄送我数") - private Integer ccmeNum = 0; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java deleted file mode 100644 index a3aeece..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; - -/** - * 流程处理进度详情请求参数 - * - * @author CMM - * @since 2023/02/24 10:15 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ProcessDetailReq { - - @ApiModelProperty("流程实例ID") - @NotNull(message = "流程实例不能为空") - private String instanceId; - - @ApiModelProperty("流程节点ID") - private String nodeId; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("任务ID") - private String taskId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java deleted file mode 100644 index 7e1eb1e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.req; - -import java.util.List; - -import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 待办中心-导出查询实体信息 - * - * @author zpf - * @since 2023/02/18 16:01 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ToBeProcessedExportReq extends ToBeProcessedReq { - - @ApiModelProperty("导出选项") - private List exportOptionList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java deleted file mode 100644 index 588362f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.req; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.ningdatech.basic.model.PagePo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.format.annotation.DateTimeFormat; - -/** - * 待办中心-列表查询实体信息 - * - * @author zpf - * @since 2023/02/19 16:01 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ToBeProcessedReq extends PagePo implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("申报单位名称") - private String buildOrgName; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; - - @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; - - @ApiModelProperty(value = "是否增补项目") - private Integer isTemporaryAugment; - - @ApiModelProperty("流程配置ID") - private String processDefId; - - @ApiModelProperty("登录人员工号") - private String employeeCode; - - private Long loginUserId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java deleted file mode 100644 index d7a44db..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 获取未盖章pdf文件接口返回信息 - * @return - * @author CMM - * @since 2023/07/15 16:53 - */ -@Data -public class NotSealedInfoVO { - - @ApiModelProperty("未盖章PDF文件ID") - private Long fileId; - - @ApiModelProperty("是否提交了审核意见") - private Boolean isCommit = Boolean.FALSE; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java deleted file mode 100644 index d3c22fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - - -import com.wflow.workflow.bean.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessProgressVo; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 流程进展详情实体 - * - * @author CMM - * @since 2023/01/30 17:21 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class ProcessProgressDetailVo { - - /** - * 流程处理详情 - */ - private ProcessProgressVo processProgressVo; - /** - * 流程状态 - */ - private String status; - /** - * 项目ID - */ - private Long projectId; - - /** - * 项目编号 - */ - private String projectCode; - - /** - * 能否撤回 - */ - private Boolean canWithdraw = Boolean.FALSE; - - /** - * 能否通过 - */ - private Boolean canPass = Boolean.FALSE; - - /** - * 能否盖章 - */ - private Boolean canSeal = Boolean.FALSE; - - /** - * 能否驳回 - */ - private Boolean canReject = Boolean.FALSE; - - /** - * 当前审批人 是不是流程配置里的 上级条线主管 - */ - private Boolean isHighLine = Boolean.FALSE; - - /** - * 当前项目 是不是被 驳回|退回过 - */ - private Boolean isChange = Boolean.FALSE; - - private Boolean constructionSuggestions = Boolean.FALSE; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java deleted file mode 100644 index 5e1e771..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** - * 待办中心-待我处理返回实体信息 - * - * @author CMM - * @since 2023/01/12 14:57 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@ExcelIgnoreUnannotated -public class ResToBeProcessedVO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("流程实例编号") - private String instCode; - - @ApiModelProperty("待处理节点ID") - private String nodeId; - - @ApiModelProperty("任务ID") - private String taskId; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("大节点名称(单位配置的名字)") - private String nodeName; - - @ApiModelProperty("建设单位名称") - private String buildOrg; - - @ApiModelProperty("建设单位统一社会信用代码") - private String buildOrgCode; - - @ApiModelProperty("申报金额") - private BigDecimal declaredAmount; - - @ApiModelProperty("预算年度") - private Integer projectYear; - - @ApiModelProperty("流程状态") - private Integer processStatus; - - @ApiModelProperty("流程状态名称") - private String processStatusName; - - @ApiModelProperty("流程发起时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private Date processLaunchTime; - - @ApiModelProperty("流程处理时间") - @JSONField(format = "yyyy-MM-dd HH:mm") - private Date processHandleTime; - - @ApiModelProperty("流程定义名称") - private String processDefName; - - @ApiModelProperty("项目预审申请单文件ID") - private Long pretrialFileId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoCenterStatisticsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoCenterStatisticsVO.java deleted file mode 100644 index ce86b82..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoCenterStatisticsVO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @Classname TodoCenterStatistics - * @Description - * @Date 2023/3/20 11:02 - * @Author PoffyZhang - */ -@Data -public class TodoCenterStatisticsVO { - - @ApiModelProperty("待处理数") - private Integer todoNum; - @ApiModelProperty("已处理数") - private Integer idoNum; - @ApiModelProperty("我发起数") - private Integer mysubmitNum; - @ApiModelProperty("抄送我数") - private Integer ccmeNum; - - @ApiModelProperty("待我处理列表 5个") - private List todoList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoNumVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoNumVO.java deleted file mode 100644 index ae03f91..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoNumVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 待办中心待我处理数量统计 - * - * @author CMM - * @since 2023/04/12 16:51 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class TodoNumVO { - - @ApiModelProperty("待我处理总数量") - private Integer totalNum = 0; - - @ApiModelProperty("待我处理非增补项目总数量") - private Integer notAppendNum = 0; - - @ApiModelProperty("待我处理非增补项目总数量") - private Integer appendNum = 0; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoVO.java deleted file mode 100644 index 4d99ce4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @Classname TodoVO - * @Description - * @Date 2023/3/20 11:04 - * @Author PoffyZhang - */ -@Data -public class TodoVO { - - @ApiModelProperty("项目工作流nodeId") - private String nodeId; - @ApiModelProperty("项目ID") - private Long projectId; - @ApiModelProperty("项目名称") - private String projectName; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java deleted file mode 100644 index 0ad5270..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.todocenter.service; - -import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; - -/** - * @Classname ITodoService - * @Description - * @Date 2023/7/25 15:41 - * @Author PoffyZhang - */ -public interface ITodoService { - /** - * 获取事例详情 - * @param request - * @return - */ - ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) ; - - Boolean isChangeRecord(Long projectId) ; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java deleted file mode 100644 index 40401e1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ningdatech.pmapi.todocenter.service; - -import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; - -/** - * @Classname StatisticsService - * @Description - * @Date 2023/3/20 11:20 - * @Author PoffyZhang - */ -public interface StatisticsService { - - //根据用户id 去查询 一些统计数据 - TodoCenterStatisticsPO getStatistics(String employeeCode); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java deleted file mode 100644 index e2ce259..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.todocenter.service.impl; - -import com.ningdatech.pmapi.todocenter.mapper.StatisticsMapper; -import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; -import com.ningdatech.pmapi.todocenter.service.StatisticsService; -import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; -import com.wflow.workflow.service.ProcessTaskService; -import lombok.AllArgsConstructor; -import org.flowable.engine.TaskService; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -/** - * @Classname StatisticsService - * @Description - * @Date 2023/3/20 11:20 - * @Author PoffyZhang - */ -@Service -@AllArgsConstructor -public class StatisticsServiceImpl implements StatisticsService { - - private final StatisticsMapper mapper; - - private final ProcessTaskService processTaskService; - - private final TaskService taskService; - - @Override - public TodoCenterStatisticsPO getStatistics(String employeeCode) { - TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); - - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setEmployeeCode(employeeCode); - Integer todoCount = processTaskService.getTodoCount(req); - res.setTodoNum(todoCount); - - Integer idoCount = processTaskService.getUserIdoCount(req); - res.setIdoNum(idoCount); - - TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); - if(Objects.nonNull(submit)){ - res.setMysubmitNum(submit.getMysubmitNum()); - } - - TodoCenterStatisticsPO ccMe = mapper.ccNums(employeeCode); - if(Objects.nonNull(ccMe)){ - res.setCcmeNum(ccMe.getCcmeNum()); - } - - return res; - } -} 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 deleted file mode 100644 index a597584..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.ningdatech.pmapi.todocenter.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -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.todocenter.handle.PassHandle; -import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; -import com.ningdatech.pmapi.todocenter.manage.HandlerManage; -import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; -import com.ningdatech.pmapi.todocenter.service.ITodoService; -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.process.enums.NodeTypeEnum; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.service.ProcessInstanceService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -/** - * @Classname TodoService - * @Description - * @Date 2023/7/25 15:41 - * @Author PoffyZhang - */ -@Service -@AllArgsConstructor -@Slf4j -public class TodoServiceImpl implements ITodoService { - - private final ProcessInstanceService processInstanceService; - - private final BuildUserUtils buildUserUtils; - - private final UserInfoHelper userInfoHelper; - - private final WithDrawHandle withDrawHandle; - - private final PassHandle passHandle; - - private final IProjectService projectService; - - private final IProjectInstService projectInstService; - - /** - * 查询流程表单数据及审批的进度步骤 - * - * @param request 请求参数 - * @return 流程进度及表单详情 - */ - @Override - public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { - String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); - String instanceId = request.getInstanceId(); - String nodeId = request.getNodeId(); - Long projectId = request.getProjectId(); - String taskId = request.getTaskId(); - ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId,taskId); - - if(Objects.isNull(progressInstanceDetail)){ - return null; - } - - List progressInfo = progressInstanceDetail.getProgressInfo(); - Boolean isHighLine = Boolean.FALSE; - if (CollUtil.isNotEmpty(progressInfo)){ - buildUserUtils.buildUserByProcessInfo(progressInfo); - isHighLine = checkHighLine(progressInfo,taskId,LoginUserUtil.loginUserDetail()); - } - ProcessProgressDetailVo res = new ProcessProgressDetailVo(); - res.setProcessProgressVo(progressInstanceDetail); - res.setStatus(progressInstanceDetail.getStatus()); - res.setProjectId(projectId); - res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId,progressInstanceDetail,request.getTaskId())); - res.setIsHighLine(isHighLine); - passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); - //是不是被 驳回|退回 - res.setIsChange(isChangeRecord(projectId)); - return res; - } - - /** - * 筛选 当前登录人 是不是 上级条线单位的审批 - * @param progressInfo - * @param taskId - * @param user - * @return - */ - private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { - if(CollUtil.isEmpty(progressInfo)){ - return Boolean.FALSE; - } - - final Boolean[] res = {Boolean.FALSE}; - progressInfo.forEach(p -> { - //如果是 子流程 - if(Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())){ - //如果不是上级条线单位 根本不用理 - if(!p.getIsHighLine()){ - return; - } - List children = p.getChildren(); - ProgressNode progressNode = children.get(0); - String userId = progressNode.getUserId(); - if(StringUtils.isBlank(userId)){ - return; - } - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); - if(Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() - .equals(userFullInfoDTO.getEmpPosUnitCode())){ - //说明是此单位的人 - //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); - if(isContainsTask){ - res[0] = Boolean.TRUE; - return; - } - } - } - }); - return res[0]; - } - - /** - * 判断 当前项目是不是被驳回 或者 退回过 - * @param projectId - * @return - */ - @Override - public Boolean isChangeRecord(Long projectId) { - //1.先判断下 项目存不存在 - Project project = projectService.getById(projectId); - if(Objects.isNull(project)){ - return Boolean.FALSE; - } - - List projectIds = projectService.getAllVersionProjectId(project); - //2.要判断 项目在当前状态 有没有被驳回和退回过 - //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 - List pis = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIds) - .orderByDesc(ProjectInst::getInstType) - .last("limit 2")); - 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; - } - - return Boolean.TRUE; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java deleted file mode 100644 index bf1d439..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ningdatech.pmapi.todocenter.utils; - -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Sets; -import com.ningdatech.pmapi.user.manage.UserInfoManage; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import com.wflow.workflow.bean.process.ProgressNode; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 装配节点用户信息工具类 - * - * @author CMM - * @since 2023/03/08 11:52 - */ -@Slf4j -@RequiredArgsConstructor -@Component -public class BuildUserUtils { - - private final UserInfoManage userInfoManage; - - public void buildUserByProcessInfo(List progressInfo) { - Set userSet = Sets.newHashSet(); - progressInfo.forEach(node -> { - if (CollUtil.isNotEmpty(node.getChildren())) { - for (ProgressNode innerNode : node.getChildren()) { - userSet.add(innerNode.getUserId()); - } - } else { - userSet.add(node.getUserId()); - } - }); - Map userMap = userInfoManage.getUserMapByEmployeeCode(userSet); - buildUser(progressInfo,userMap); - } - private void buildUser(List progressInfo, Map userMap) { - for (ProgressNode progressNode : progressInfo) { - progressNode.setUser(userMap.get(progressNode.getUserId())); - if (CollUtil.isNotEmpty(progressNode.getChildren())) { - buildUser(progressNode.getChildren(), userMap); - } - } - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java deleted file mode 100644 index e00e1d3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.ningdatech.pmapi.todocenter.utils; - - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; -import java.util.UUID; - -import org.springframework.stereotype.Component; -import org.xhtmlrenderer.pdf.ITextFontResolver; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.BaseFont; -import com.ningdatech.basic.exception.BizException; - -import lombok.extern.slf4j.Slf4j; - -/** - * pdf生成工具类 - * - * @author CMM - * @since 2023/03/13 17:01 - */ -@Slf4j -@Component -public class PdfUtils { - /** - * 生成PDF文件 - * - * @return int - * @author CMM - * @since 2023/03/13 17:07 - */ - public byte[] generatePdf(InputStream templateHtmlInputStream, Map paramsMap){ - FileInputStream inputStream = null; - - try { - File directory = new File(""); - //临时文件输出路径 - String filePath = directory.getAbsolutePath() + File.separator + "fileout"; - //字体格式 - String fontPath = directory.getAbsolutePath() + File.separator + "font" + File.separator + "simsun.ttc"; - if(!new File(filePath).exists()){ - new File(filePath).mkdir(); - } - StringBuilder stringBuilder = new StringBuilder(); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8)); - String line; - while ((line = bufferedReader.readLine()) != null) { - stringBuilder.append(line); - } - String htmlInfo = stringBuilder.toString(); - - //替换参数、多个参数多次替换 - for (String fieldName : paramsMap.keySet()) { - if (paramsMap.get(fieldName) == null) { - // 没有值的字段使用-覆盖 - htmlInfo = htmlInfo.replace("#" + fieldName + "#", ""); - }else { - // 设置占位字段 - htmlInfo = htmlInfo.replace("#" + fieldName + "#", paramsMap.get(fieldName).toString()); - } - } - - //生成临时文件 - String htmlFileName = UUID.randomUUID().toString().replace("-","") + ".html"; - String htmlFilePath = filePath + File.separator + htmlFileName; - File file = new File(htmlFilePath); - FileOutputStream fop = new FileOutputStream(file); - if (!file.exists()) { - file.createNewFile(); - } - byte[] contentInBytes = htmlInfo.getBytes(); - fop.write(contentInBytes); - fop.flush(); - fop.close(); - - //生成pdf - String fileName = UUID.randomUUID().toString().replace("-","") + ".pdf"; - String pdfFilePath = filePath + File.separator + fileName; - String url = new File(htmlFilePath).toURI().toURL().toString(); - OutputStream os = Files.newOutputStream(Paths.get(pdfFilePath)); - - ITextRenderer renderer = new ITextRenderer(); - renderer.setDocument(url); - ITextFontResolver fontResolver = renderer.getFontResolver(); - fontResolver.addFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); - renderer.layout(); - renderer.createPDF(os); - os.flush(); - os.close(); - - inputStream = new FileInputStream(pdfFilePath); - - // 返回生成的pdf文件字节数组 - return readBytes(inputStream); - } catch (IOException e) { - throw new BizException("生成pdf文件失败!" + e.getMessage()); - } catch (DocumentException e) { - throw new BizException("生成pdf文件失败!" +e.getMessage()); - } finally { - try { - if (null != inputStream) { - - inputStream.close(); - } - } catch (IOException e) { - log.error("close resource error", e.getMessage()); - } - } - } - - - /** - * 读取输入流到字节数组 - * - * @param in - * @return - * @throws IOException - */ - private byte[] readBytes(InputStream in) throws IOException { - //读取字节的缓冲 - byte[] buffer = new byte[1024]; - //最终的数据 - byte[] result = new byte[0]; - int size = 0; - while ((size = in.read(buffer)) != -1) { - int oldLen = result.length; - byte[] tmp = new byte[oldLen + size]; - if (oldLen > 0) {//copy 旧字节 - System.arraycopy(result, 0, tmp, 0, oldLen); - } - //copy 新字节 - System.arraycopy(buffer, 0, tmp, oldLen, size); - - result = tmp; - } - return result; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java deleted file mode 100644 index fd9fec6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.user.constant; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/8/17 下午5:55 - */ -@AllArgsConstructor -@Getter -@ApiModel("登陆类型") -public enum LoginTypeEnum { - /** - * 浙政钉扫码登陆 - */ - DING_QR_LOGIN, - - DING_MD_LOGIN, - - /** - * 手机号验证码登陆 - */ - PHONE_VERIFICATION_CODE_LOGIN, - - /** - * 账号密码登陆 - */ - USERNAME_PASSWORD_LOGIN; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/UserAvailableEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/UserAvailableEnum.java deleted file mode 100644 index 70e15c3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/UserAvailableEnum.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.user.constant; - -/** - * @author liuxinxin - * @date 2023/2/15 下午5:13 - */ - -public enum UserAvailableEnum { - /** - * 启用 - */ - ENABLE, - - /** - * 禁用 - */ - DISABLE -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java deleted file mode 100644 index aaff21c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.user.controller; - - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - *

- * 用户鉴权表 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-01-04 - */ - -@RestController -@RequestMapping("/api/v1/user/auth") -@Api(tags = {"用户鉴权-相关接口"}) -@RequiredArgsConstructor -public class UserAuthController { - - private final ObjectMapper objectMapper; - - @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) - @ApiOperation(value = "登陆") - @ApiImplicitParams({ - @ApiImplicitParam(name = "identifier", value = "账号", required = true, paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆" - , required = true, paramType = "form", dataType = "String")}) - public void credentialLogin(@RequestParam(value = "identifier", required = false) String identifier, - @RequestParam(value = "credential", required = false) String credential, - @RequestParam("loginType") String loginType) { - // 不实现任何内容,只是为了出api文档 - } - - @PostMapping(value = "/logout") - @ApiOperation(value = "退出登陆") - public void logout() { - // 不实现任何内容,具体实现交由Spring Security进行管理 - } - - /** - * 当需要身份认证时,跳转到这里 - */ - @GetMapping("/auth-require") - @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) - public void requireAuthentication(HttpServletResponse response) throws IOException { - response.setContentType(StrPool.CONTENT_TYPE); - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); - } - - /** - * 设置session失效 - */ - @GetMapping("/invalid-session") - @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) - public void invalidSession(HttpServletRequest request, HttpServletResponse response) throws IOException { - response.setContentType(StrPool.CONTENT_TYPE); - Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null); - cookie.setPath(request.getContextPath() + "/"); - cookie.setMaxAge(SessionTimeConstant.SESSION_EXPIRED); - response.addCookie(cookie); - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); - } - - @PostMapping(value = "/agent-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) - @ApiOperation(value = "代登陆") - @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "账号", required = true, paramType = "form", dataType = "String")}) - public void agentLogin(@RequestParam(value = "userId", required = true) String userId) { - // 不实现任何内容,只是为了出api文档 - } - - @PostMapping(value = "/common-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) - @ApiOperation(value = "公共登陆接口,目前适用于省局跳转登陆") - @ApiImplicitParams({ - @ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "platform", value = "平台 PROVINCIAL_BUREAU,省局", required = true, paramType = "form", dataType = "String") - }) - public void commonLogin(@RequestParam(value = "credential", required = true) String credential - , @RequestParam(value = "platform", required = true) String platform) { - // 不实现任何内容,只是为了出api文档 - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java deleted file mode 100644 index 04eda16..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.user.controller; - - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.user.manage.UserInfoManage; -import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; -import com.ningdatech.pmapi.user.model.po.ReqUserDetailPO; -import com.ningdatech.pmapi.user.model.po.ReqUserDisableOrEnablePO; -import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; -import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; -import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; -import com.ningdatech.pmapi.user.model.vo.UserRoleVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -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; -import java.util.List; - -/** - * @author Liuxinxin - * @since 2023-01-04 - */ -@RestController -@RequestMapping("/api/v1/user-info") -@RequiredArgsConstructor -@Api(value = "UserInfoController", tags = "用户管理") -public class UserInfoController { - - private final UserInfoManage userInfoManage; - - @ApiOperation(value = "用户列表搜索", notes = "用户列表搜索") - @PostMapping("/list") - public PageVo userInfoList(@Valid @RequestBody ReqUserInfoListPO req) { - return userInfoManage.list(req); - } - - @ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") - @PostMapping("/disable-enable") - public void disableOrEnable(@Valid @RequestBody ReqUserDisableOrEnablePO req) { - userInfoManage.disableOrEnable(req); - } - - @ApiOperation(value = "用户详情", notes = "用户详情") - @PostMapping("/detail") - public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO req) { - return userInfoManage.userInfoDetail(req); - } - - @ApiOperation(value = "用户详情编辑", notes = "用户详情编辑") - @PostMapping("/detail/edit") - @WebLog("用户详情编辑") - public void userInfoDetailEdit(@Valid @RequestBody ReqUserDetailEditPO req) { - userInfoManage.userInfoDetailEdit(req); - } - - @ApiOperation(value = "获取当前登陆用户详情信息", notes = "用户详情") - @PostMapping("/current-user-info") - public ResUserDetailVO currentUserInfo() { - return userInfoManage.currentUserInfo(); - } - - @ApiOperation(value = "获取当前用户可控角色列表") - @PostMapping("/controlled/role-list") - public List getControlledRoleList() { - return userInfoManage.getControlledRoleList(); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java deleted file mode 100644 index 4fc4e59..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.user.convert; - -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; - -/** - *

- * UserInfoConvertor - *

- * - * @author WendyYang - * @since 2023/5/5 - **/ -public class UserInfoConvertor { - - private UserInfoConvertor() { - - } - - public static UserInfoDetails toUserInfoDetails(UserFullInfoDTO userFullInfo) { - UserInfoDetails userInfoDetails = new UserInfoDetails(); - userInfoDetails.setUserId(userFullInfo.getUserId()); - userInfoDetails.setUsername(userFullInfo.getUsername()); - userInfoDetails.setRealName(userFullInfo.getRealName()); - userInfoDetails.setUserRoleList(userFullInfo.getUserRoleList()); - userInfoDetails.setRegionCode(userFullInfo.getRegionCode()); - userInfoDetails.setRegionLevel(userFullInfo.getRegionLevel()); - userInfoDetails.setIdentifier(userFullInfo.getIdentifier()); - userInfoDetails.setPassword(userFullInfo.getCredential()); - userInfoDetails.setEmployeeCode(userFullInfo.getEmployeeCode()); - userInfoDetails.setOrganizationCode(userFullInfo.getOrganizationCode()); - userInfoDetails.setOrganizationName(userFullInfo.getOrganizationName()); - userInfoDetails.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); - userInfoDetails.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); - userInfoDetails.setMobile(userFullInfo.getMobile()); - return userInfoDetails; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserAuth.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserAuth.java deleted file mode 100644 index baa2d16..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserAuth.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.user.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@TableName("nd_user_auth") -@Data -@ApiModel(value = "NdUserAuth对象") -public class UserAuth implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String authType; - - private String identifier; - - private String credential; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java deleted file mode 100644 index 88baedc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ningdatech.pmapi.user.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@TableName("nd_user_info") -@Builder -@Data -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "NdUserInfo对象") -public class UserInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private String username; - - private String mobile; - - private String realName; - - private Long accountId; - - private String available; - - private String employeeCode; - - private String regionCode; - - private String empPosUnitCode; - private String empPosUnitName; - - @ApiModelProperty("头像") - private String avatar; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/enumeration/RoleEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/enumeration/RoleEnum.java deleted file mode 100644 index 06f9885..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/enumeration/RoleEnum.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ningdatech.pmapi.user.entity.enumeration; - -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; -import java.util.Objects; - -/** - *

- * 系统角色枚举(内置角色) - *

- * - * @author WendyYang - * @since 14:15 2023/1/13 - */ -@Getter -public enum RoleEnum { - - /** - * 系统角色枚举 - */ - NORMAL_MEMBER("普通用户", 8), - HIGH_MEMBER("高级用户", 7), - - EXPERT("专家", 6), - - COMPANY_MANAGER("单位管理员", 5), - - EXPERT_ADMIN("专家管理员", 3), - - REGION_MANAGER("区域管理员", 4), - - SUPER_ADMIN("超级管理员", 1), - - VISITOR("访客", 2), - - DASHBOARD("工作台", 9); - - private final String desc; - - /** - * 角色优先级 - */ - private final Integer level; - - RoleEnum(String desc, Integer level) { - this.desc = desc; - this.level = level; - } - - public boolean eq(String name) { - return this.name().equals(name); - } - - public static RoleEnum mathByName(String name) { - if (StringUtils.isBlank(name)) { - return null; - } - for (RoleEnum roleEnum : RoleEnum.values()) { - if (roleEnum.name().equals(name)) { - return roleEnum; - } - } - return null; - } - - public static RoleEnum checkHigherRole(List roleCodes) { - RoleEnum res = null; - for (String roleCode : roleCodes) { - RoleEnum roleEnum = mathByName(roleCode); - if (Objects.isNull(res) || - (Objects.nonNull(roleEnum) && roleEnum.getLevel() < res.getLevel())) { - res = roleEnum; - } - } - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthManage.java deleted file mode 100644 index a34675c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthManage.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ningdatech.pmapi.user.manage; - -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.user.convert.UserInfoConvertor; -import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthToken; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import lombok.AllArgsConstructor; -import org.springframework.security.core.context.SecurityContextImpl; -import org.springframework.session.Session; -import org.springframework.session.SessionRepository; -import org.springframework.session.data.redis.RedisIndexedSessionRepository; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; - -/** - *

- * UserAuthHelper - *

- * - * @author WendyYang - * @since 2023/5/5 - **/ -@Component -@AllArgsConstructor -public class UserAuthManage { - - private final UserInfoHelper userInfoHelper; - private final RedisIndexedSessionRepository redisSessionRepository; - - @SuppressWarnings({"rawtypes", "unchecked"}) - public void refreshSession(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - if (userFullInfo == null) { - return; - } - List sessionIds = getSessionIds(userFullInfo.getUsername()); - if (sessionIds.isEmpty()) { - return; - } - SessionRepository sessionRepository = redisSessionRepository; - UserInfoDetails details = UserInfoConvertor.toUserInfoDetails(userFullInfo); - CredentialAuthToken cat = new CredentialAuthToken(details, details.getPassword(), details.getAuthorities()); - sessionIds.forEach(sessionId -> { - Session session = redisSessionRepository.findById(sessionId); - SecurityContextImpl context = session.getAttribute("SPRING_SECURITY_CONTEXT"); - context.setAuthentication(cat); - session.setAttribute("SPRING_SECURITY_CONTEXT", context); - sessionRepository.save(session); - }); - } - - private List getSessionIds(String username) { - return new ArrayList<>(redisSessionRepository.findByPrincipalName(username).keySet()); - } - - public void kickOff(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - List sessionIds = getSessionIds(userFullInfo.getUsername()); - sessionIds.forEach(redisSessionRepository::deleteById); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java deleted file mode 100644 index acf6b4d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ /dev/null @@ -1,627 +0,0 @@ -package com.ningdatech.pmapi.user.manage; - -import cn.hutool.core.collection.CollUtil; -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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.StrUtils; -import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.UserRole; -import com.ningdatech.pmapi.sys.service.IRoleService; -import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; -import com.ningdatech.pmapi.user.model.po.ReqUserDetailPO; -import com.ningdatech.pmapi.user.model.po.ReqUserDisableOrEnablePO; -import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; -import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; -import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; -import com.ningdatech.pmapi.user.model.vo.UserRoleVO; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddClient; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import lombok.RequiredArgsConstructor; -import org.springframework.aop.framework.AopContext; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/13 上午9:09 - */ -@Component -@RequiredArgsConstructor -public class UserInfoManage { - - private final UserAuthManage userAuthManage; - private final IUserInfoService iUserInfoService; - private final IRoleService iRoleService; - private final IDingOrganizationService iDingOrganizationService; - private final IDingEmployeeInfoService iDingEmployeeInfoService; - private final IUserRoleService iUserRoleService; - private final UserInfoHelper userInfoHelper; - private final RegionCacheHelper regionCacheHelper; - - private final ZwddIntegrationProperties zwddIntegrationProperties; - - private final ZwddClient zwddClient; - - public PageVo list(ReqUserInfoListPO req) { - PageVo pageVo = new PageVo<>(); - - String phoneNo = req.getPhoneNo(); - String orgCode = req.getOrgCode(); - String name = req.getName(); - String orgName = req.getOrgName(); - Long regionId = req.getRegionId(); - - List userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); - if (userIdList != null && userIdList.size() == 0) { - pageVo.setRecords(new ArrayList<>()); - pageVo.setTotal(0L); - return pageVo; - } - - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserInfo.class) - .like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) - .like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) - .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) - .eq(Objects.nonNull(regionId), UserInfo::getRegionCode, regionId) - .like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) - .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) - .orderByDesc(UserInfo::getUpdateOn); - - Page page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper); - List records = page.getRecords(); - long total = page.getTotal(); - List result = new ArrayList<>(); - if (records != null && records.size() > 0) { - List employeeCodeList = records.stream().map(UserInfo::getEmployeeCode) - .distinct().collect(Collectors.toList()); - - List employeeInfoList = iDingEmployeeInfoService.getEmployeeList(employeeCodeList); - Map empCodeOrgMap = iDingOrganizationService.getEmpCodeOrgMap(employeeInfoList); - - records.forEach(r -> { - ResUserInfoListVO item = new ResUserInfoListVO(); - item.setName(r.getRealName()); - String employeeCode = r.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)) { - DingOrganization dingOrganization = empCodeOrgMap.get(employeeCode); - if (Objects.nonNull(dingOrganization)) { - item.setOrgName(dingOrganization.getOrganizationName()); - item.setOrgCode(dingOrganization.getOrganizationCode()); - String regionCode = dingOrganization.getDivisionCode(); - item.setRegionCode(regionCode); - if (Objects.nonNull(regionCode)) { - item.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); - } - } - - } - userStatusAssembler(item, r); - item.setUpdateTime(r.getUpdateOn()); - item.setEmployeeCode(r.getEmployeeCode()); - item.setUserRoleList(getUserRoleVOList(item.getUserId())); - result.add(item); - }); - } - pageVo.setTotal(total); - pageVo.setRecords(result); - return pageVo; - } - - private List getCompliantOrgEmpCodeList(String orgName, String orgCode) { - if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode)) { - return null; - } - List compliantOrgCodeList = new ArrayList<>(); - - // 查重符合筛选条件的组织列表 - if (StringUtils.isNotBlank(orgName)) { - List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .like(DingOrganization::getOrganizationName, orgName) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) - ); - - List compliantOrgNameCodeList = dingOrganizationList.stream() - .map(DingOrganization::getOrganizationCode) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(compliantOrgNameCodeList)) { - return new ArrayList<>(); - } - - // 取交集 - List tempCompliantOrgCodeList = new ArrayList<>(); - for (String compliantOrgNameCode : compliantOrgNameCodeList) { - if (compliantOrgCodeList.contains(compliantOrgNameCode)) { - tempCompliantOrgCodeList.add(compliantOrgNameCode); - } - } - compliantOrgCodeList = tempCompliantOrgCodeList; - if (CollUtil.isEmpty(compliantOrgCodeList)) { - return new ArrayList<>(); - } - } - - if (StringUtils.isNotBlank(orgCode)) { - compliantOrgCodeList.add(orgCode); - } - if (CollUtil.isEmpty(compliantOrgCodeList)) { - return new ArrayList<>(); - } - - // 查重符合筛选条件的用户code列表 - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .in(DingEmployeeInfo::getEmpPosUnitCode, compliantOrgCodeList)); - - List compliantOrgEmpCodeList = dingEmployeeInfoList.stream() - .map(DingEmployeeInfo::getEmployeeCode).distinct().collect(Collectors.toList()); -// if (compliantOrgEmpCodeList.size() > 500) { -// throw new BizException("搜索结果过多请缩小搜索范围"); -// } - return compliantOrgEmpCodeList; - } - - /** - * 获取符合查询条件的 用户 userId - * - * @param userRoleList - */ - private List getRoleCompliantUserIdList(List userRoleList) { - if (CollUtil.isNotEmpty(userRoleList)) { - userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); - } - if (CollUtil.isEmpty(userRoleList)) { - return null; - } - List roleIdList = userRoleList.stream().map(UserRoleVO::getId).collect(Collectors.toList()); - - List compliantUserIdList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .in(UserRole::getRoleId, roleIdList)).stream().map(UserRole::getUserId).distinct().collect(Collectors.toList()); - if (CollUtil.isEmpty(compliantUserIdList)) { - return new ArrayList<>(); - } - return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getId, compliantUserIdList)) - .stream().map(UserInfo::getId).collect(Collectors.toList()); - - } - - /** - * 装配用户状态 及 userId - * - * @param resListVO - * @param userInfo - */ - private void userStatusAssembler(ResUserInfoListVO resListVO, UserInfo userInfo) { - if (Objects.nonNull(userInfo)) { - resListVO.setPhoneNo(userInfo.getMobile()); - if (StringUtils.isNotBlank(userInfo.getAvailable()) - && UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { - resListVO.setStatus(UserAvailableEnum.ENABLE.name()); - } else { - resListVO.setStatus(UserAvailableEnum.DISABLE.name()); - } - resListVO.setUserId(userInfo.getId()); - } else { - resListVO.setStatus(UserAvailableEnum.DISABLE.name()); - } - } - - - private List getUserRoleVOList(Long userId) { - List userRoleInfoList = new ArrayList<>(); - if (Objects.isNull(userId)) { - return userRoleInfoList; - } - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId).orderByAsc(UserRole::getCreateOn)); - if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.listByIds(roleIdList); - roleList.forEach(r -> { - UserRoleVO userRoleVO = new UserRoleVO(); - userRoleVO.setId(r.getId()); - userRoleVO.setName(r.getName()); - userRoleVO.setCreateOn(r.getCreateOn()); - userRoleInfoList.add(userRoleVO); - }); - } - return userRoleInfoList; - } - - @Transactional(rollbackFor = Exception.class) - public void disableOrEnable(ReqUserDisableOrEnablePO req) { - Long userId; - if (req.getUserId() != null) { - userId = req.getUserId(); - } else if (StrUtils.isNotBlank(req.getEmployeeCode())) { - UserInfoManage proxy = (UserInfoManage) AopContext.currentProxy(); - userId = proxy.generateUserId(req.getEmployeeCode()); - } else { - throw BizException.wrap("用户参数缺失"); - } - UserInfo userInfo = iUserInfoService.getById(userId); - userInfo.setAvailable(req.getOperation()); - iUserInfoService.updateById(userInfo); - if ("DISABLE".equals(userInfo.getAvailable())) { - userAuthManage.kickOff(userId); - } - - } - - public ResUserDetailVO userInfoDetail(ReqUserDetailPO reqUserDetailPO) { - Long userId = reqUserDetailPO.getUserId(); - String employeeCode = reqUserDetailPO.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode) && Objects.isNull(userId)) { - throw new BizException("employeeCode and userId can't not be null"); - } - if (Objects.isNull(userId)) { - userId = generateUserId(reqUserDetailPO.getEmployeeCode()); - } - - UserInfo userInfo = iUserInfoService.getById(userId); - if (Objects.isNull(userInfo)) { - return null; - } - ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); - resUserDetailVO.setRealName(userInfo.getRealName()); - resUserDetailVO.setUserId(userInfo.getId()); - resUserDetailVO.setPhoneNo(userInfo.getMobile()); - resUserDetailVO.setStatus(userInfo.getAvailable()); - - // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId)); - List userRoleInfoList = new ArrayList<>(); - if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); - userRoleInfoList = roleList.stream().map(r -> { - UserRoleVO userRoleVO = new UserRoleVO(); - userRoleVO.setId(r.getId()); - userRoleVO.setName(r.getName()); - return userRoleVO; - }).collect(Collectors.toList()); - } - resUserDetailVO.setUserRoleInfoList(userRoleInfoList); - return resUserDetailVO; - } - - @Transactional(rollbackFor = Exception.class) - public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) { - Long userId = reqUserDetailEditPO.getUserId(); - if (Objects.isNull(userId)) { - String employeeCode = reqUserDetailEditPO.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - throw new IllegalArgumentException("employeeCode can't be null"); - } - userId = generateUserId(employeeCode); - } - UserInfo userInfo = iUserInfoService.getById(userId); - String oldUserStatus = userInfo.getAvailable(); - // 绑定用户手机号 - bandUserMobile(userInfo, reqUserDetailEditPO); - - userInfo.setAvailable(reqUserDetailEditPO.getStatus()); - userInfo.setUpdateOn(LocalDateTime.now()); - userInfo.setUpdateBy(LoginUserUtil.getUserId()); - iUserInfoService.updateById(userInfo); - - List userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList(); - iUserRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); - if (CollUtil.isNotEmpty(userRoleInfoList)) { - Long finalUserId = userId; - List userRoleList = userRoleInfoList.stream().map(r -> { - UserRole saveRecord = new UserRole(); - saveRecord.setRoleId(r.getId()); - saveRecord.setUserId(finalUserId); - return saveRecord; - }).collect(Collectors.toList()); - iUserRoleService.saveBatch(userRoleList); - } - // 刷新用户权限 仅原状态为正常才需要刷新session - if ("ENABLE".equals(oldUserStatus)) { - if (oldUserStatus.equals(userInfo.getAvailable())) { - userAuthManage.refreshSession(userId); - } else { - userAuthManage.kickOff(userId); - } - } - } - - /** - * 绑定用户手机号 - * - * @param userInfo - * @param reqUserDetailEditPO - */ - @Transactional(rollbackFor = Exception.class) - public void bandUserMobile(UserInfo userInfo, ReqUserDetailEditPO reqUserDetailEditPO) { - String employeeCode = reqUserDetailEditPO.getEmployeeCode(); - String mobile = userInfo.getMobile(); - Long userId = userInfo.getId(); -// if (StringUtils.isBlank(mobile)) { - // 校验手机号是否重复 - UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); - if (Objects.nonNull(repeatMobileUserInfo)) { - throw new BizException("该手机号码已被绑定,请问重复绑定"); - } - - String phoneNo = reqUserDetailEditPO.getPhoneNo(); - userInfo.setMobile(phoneNo); - // 更新浙政钉相关数据 - if (StringUtils.isNotBlank(phoneNo)) { - iDingEmployeeInfoService - .update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .set(DingEmployeeInfo::getBindUserMobile, phoneNo)); - iUserInfoService.updateById(userInfo); - } -// } - - } - - @Transactional(rollbackFor = Exception.class) - public Long generateUserId(String employeeCode) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode)); - if (Objects.isNull(userInfo)) { - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .eq(DingEmployeeInfo::getMainJob, "true")); - if (CollUtil.isEmpty(dingEmployeeInfoList)) { - throw new BizException("员工账号不存在"); - } - DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); - userInfo = UserInfo.builder() - .accountId(dingEmployeeInfo.getAccountId()) - .username(dingEmployeeInfo.getEmployeeName()) - .realName(dingEmployeeInfo.getEmployeeName()) - .employeeCode(dingEmployeeInfo.getEmployeeCode()) - .available(UserAvailableEnum.DISABLE.name()) - .createBy(-1L) - .updateBy(-1L) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .build(); - iUserInfoService.save(userInfo); - } - return userInfo.getId(); - } - - - public ResUserDetailVO currentUserInfo() { - Long userId = LoginUserUtil.getUserId(); - UserInfo userInfo = iUserInfoService.getById(userId); - if (Objects.isNull(userInfo)) { - return null; - } - ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); - resUserDetailVO.setRealName(userInfo.getRealName()); - resUserDetailVO.setUserId(userInfo.getId()); - resUserDetailVO.setPhoneNo(userInfo.getMobile()); - resUserDetailVO.setStatus(userInfo.getAvailable()); - resUserDetailVO.setEmployeeCode(userInfo.getEmployeeCode()); - resUserDetailVO.setAvatar(makeAvatar(userInfo.getAvatar())); - - // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId)); - List userRoleInfoList = new ArrayList<>(); - if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); - userRoleInfoList = roleList.stream().map(r -> { - UserRoleVO userRoleVO = new UserRoleVO(); - userRoleVO.setId(r.getId()); - userRoleVO.setName(r.getName()); - userRoleVO.setCode(r.getCode()); - return userRoleVO; - }).collect(Collectors.toList()); - } - resUserDetailVO.setUserRoleInfoList(userRoleInfoList); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - if (Objects.nonNull(userFullInfo)) { - resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); - resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); - resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); - resUserDetailVO.setRegionLevel(userFullInfo.getRegionLevel()); - resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() - , RegionConst.RL_COUNTY)); - resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); - resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); - } - return resUserDetailVO; - } - - //生成头像 链接 - private String makeAvatar(String avatar) { - try { - GenericResult accessToken = zwddClient.getAccessToken(); - String token = accessToken.getData(); - String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + - "access_token=" + token + "&media_id=" + avatar; - return res; - } catch (Exception e) { - } - return org.apache.commons.lang3.StringUtils.EMPTY; - } - - public Map getUserMapByIds(Set staterUsers) { - List userInfos = iUserInfoService.listByIds(staterUsers); - return userInfos.stream().map(u -> { - ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); - userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if (Objects.nonNull(userFullInfo)) { - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return userInfo; - }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); - } - - public Map getUserMapByEmployeeCode(Set staterUsers) { - if (CollUtil.isEmpty(staterUsers)) { - return Collections.emptyMap(); - } - List userInfos = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode, staterUsers)); - if (CollUtil.isEmpty(userInfos)) { - return Collections.emptyMap(); - } - return userInfos.stream().map(u -> { - ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); - userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if (Objects.nonNull(userFullInfo)) { - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return userInfo; - }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); - } - - public ProcessInstanceUserDto getUserInfo(String userId) { - UserInfo userInfo = iUserInfoService.getById(userId); - ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto(); - processInstanceUserDto.setUserId(String.valueOf(userInfo.getId())); - processInstanceUserDto.setUserName(userInfo.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); - if (Objects.nonNull(userFullInfo)) { - processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); - processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return processInstanceUserDto; - } - - /** - * 获取当前用户可控角色列表 - * - * @return - */ - public List getControlledRoleList() { - Long userId = LoginUserUtil.getUserId(); - // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId)); - - List controlledRoleVOList = new ArrayList<>(); - List controlledRoleIdList = new ArrayList<>(); - if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList()); - - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); - - for (Role role : roleList) { - List manageRoleIdList = BizUtils.splitToLong(role.getManageRoleIds()); - if (CollUtil.isNotEmpty(manageRoleIdList)) { - controlledRoleIdList.addAll(manageRoleIdList); - } - } - controlledRoleIdList = controlledRoleIdList.stream().distinct().collect(Collectors.toList()); - List controlledRoleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, controlledRoleIdList)); - - controlledRoleVOList = controlledRoleList.stream().map(r -> { - UserRoleVO userRoleVO = new UserRoleVO(); - userRoleVO.setId(r.getId()); - userRoleVO.setName(r.getName()); - userRoleVO.setCode(r.getCode()); - return userRoleVO; - }).collect(Collectors.toList()); - } - return controlledRoleVOList; - } - - /** - * 根据用户名获取 - * - * @param username / - * @return / - */ - public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) { - // TODO 目前账号密码登陆测试使用 强制用户登录 userId 1L - UserInfo userInfo = iUserInfoService.getById(username); - if (Objects.isNull(userInfo)) { - return null; - } - // 返回用户全量信息 - return userInfoHelper.getUserFullInfo(userInfo); - } - - /** - * 根据手机号获取 - * - * @param phoneNo / - * @return / - */ - public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getMobile, phoneNo)); - if (Objects.isNull(userInfo)) { - return null; - } - // 返回用户全量信息 - return userInfoHelper.getUserFullInfo(userInfo); - } - - /** - * 根据accountId(浙政钉扫码登陆) - * - * @param accountId / - * @return / - */ - public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) { - - // 获取用户信息 - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getAccountId, accountId)); - if (Objects.isNull(userInfo)) { - return null; - } - // 返回用户全量信息 - return userInfoHelper.getUserFullInfo(userInfo); - } - - public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode).last("limit 1")); - if (Objects.isNull(userInfo)) { - return null; - } - // 返回用户全量信息 - return userInfoHelper.getUserFullInfo(userInfo); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.java deleted file mode 100644 index 41cab02..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.user.mapper; - -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -public interface NdUserInfoMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.xml deleted file mode 100644 index dd9f3df..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/NdUserInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.java deleted file mode 100644 index 5660e77..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.user.mapper; - -import com.ningdatech.pmapi.user.entity.UserAuth; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -public interface UserAuthMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.xml deleted file mode 100644 index bf07038..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/UserAuthMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqGenerationLoginPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqGenerationLoginPO.java deleted file mode 100644 index 91ab08b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqGenerationLoginPO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.user.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - * @author liuxinxin - * @date 2023/2/21 下午3:39 - */ -@Data -@ApiModel("代登陆请求PO") -public class ReqGenerationLoginPO { - - @NotNull(message = "用户id 不能为空") - @ApiModelProperty("用户id") - private Long userId; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java deleted file mode 100644 index 11837ee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.user.model.po; - -import com.ningdatech.pmapi.user.model.vo.UserRoleVO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/2/15 上午8:43 - */ -@Data -@ApiModel("用户详情编辑请求") -public class ReqUserDetailEditPO { - - @NotNull(message = "用户id 不能为空") - @ApiModelProperty("userId") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @NotBlank(message = "用户手机号不能为空") - @ApiModelProperty("手机号") - private String phoneNo; - - @NotBlank(message = "状态不能为空") - @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") - private String status; - - @ApiModelProperty("用户角色信息列表") - private List userRoleInfoList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java deleted file mode 100644 index 5eb4433..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.user.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/2/15 上午8:43 - */ -@Data -@ApiModel("获取用户详情请求") -public class ReqUserDetailPO { - - @ApiModelProperty("用户id") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisableOrEnablePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisableOrEnablePO.java deleted file mode 100644 index a66e706..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisableOrEnablePO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ningdatech.pmapi.user.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2023/2/13 上午9:31 - */ - -@Data -@ApiModel("用户禁用/启用 PO") -public class ReqUserDisableOrEnablePO { - - @ApiModelProperty("用户id") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @NotBlank(message = "操作 不能为空") - @ApiModelProperty("操作 启用 ENABLE/禁用 DISABLE") - private String operation; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserInfoListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserInfoListPO.java deleted file mode 100644 index d6381aa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserInfoListPO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.user.model.po; - -import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.user.model.vo.UserRoleVO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/2/13 上午9:10 - */ -@Data -@ApiModel("用户管理查询 请求入参") -public class ReqUserInfoListPO extends PagePo { - - @ApiModelProperty("姓名") - private String name; - - @ApiModelProperty("手机号码") - private String phoneNo; - - @ApiModelProperty("所在单位(主职)") - private String orgName; - - @ApiModelProperty("所在单位Code(主职)") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - - @ApiModelProperty("所属区域名称") - private Long regionName; - - @ApiModelProperty("用户角色") - private List userRoleList; - - @ApiModelProperty("状态") - private String status; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java deleted file mode 100644 index a4cf4b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.user.model.vo; - -import com.ningdatech.pmapi.common.constant.RegionConst; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.apache.commons.lang3.StringUtils; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/2/15 上午8:43 - */ -@Data -@ApiModel("获取用户详情请求") -public class ResUserDetailVO { - - @ApiModelProperty("userId") - private Long userId; - - @ApiModelProperty("用户姓名") - private String realName; - - @ApiModelProperty("手机号") - private String phoneNo; - - @ApiModelProperty("用户角色信息列表") - private List userRoleInfoList; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @ApiModelProperty("所在单位(主职)") - private String orgName; - - @ApiModelProperty("所在单位(主职)code") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - private String regionCode; - private Integer regionLevel; - private String regionName; - - @ApiModelProperty("用户任职所在单位code") - private String empPosUnitCode; - - @ApiModelProperty("用户任职所在单位") - private String empPosUnitName; - - @ApiModelProperty("用户角色") - private List userRoleList; - - @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") - private String status; - - @ApiModelProperty("更新时间") - private LocalDateTime updateTime; - - @ApiModelProperty("头像") - private String avatar; - - //是否是市级单位 - public Boolean getIsMunicipalOrg(){ - //如果是丽水市本级的code 就是 - if(RegionConst.RC_LS.equals(this.regionCode)){ - return Boolean.TRUE; - } - return Boolean.FALSE; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java deleted file mode 100644 index 9bf6341..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.user.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/2/13 上午9:10 - */ -@Data -@ApiModel("用户管理查询 请求response") -public class ResUserInfoListVO { - - @ApiModelProperty("用户id") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @ApiModelProperty("姓名") - private String name; - - @ApiModelProperty("手机号码") - private String phoneNo; - - @ApiModelProperty("所在单位(主职)") - private String orgName; - - @ApiModelProperty("所在单位(主职)code") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - private Integer regionLevel; - private String regionCode; - private String regionName; - - @ApiModelProperty("用户角色") - private List userRoleList; - - @ApiModelProperty("状态") - private String status; - - @ApiModelProperty("更新时间") - private LocalDateTime updateTime; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java deleted file mode 100644 index 3596a7b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.user.model.vo; - -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2023/2/15 下午5:47 - */ - -@Data -@ApiModel("用户角色VO") -public class UserRoleVO { - - @ApiModelProperty(value = "角色id") - private Long id; - - @ApiModelProperty(value = "名称") - private String name; - - @ApiModelProperty(value = "角色code") - private String code; - - private transient LocalDateTime createOn; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthProperties.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthProperties.java deleted file mode 100644 index 6e3b4dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth; - -import cn.hutool.core.collection.CollectionUtil; -import com.ningdatech.basic.factory.PropertySourceFactory; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.stereotype.Component; - -import java.util.*; - -/** - * @Author LiuXinXin - * @Date 2020/8/1 6:06 下午 - * @Version 1.0 - **/ -@Configuration -@PropertySource(value = "classpath:security/auth-${spring.profiles.active}.yml" - , encoding = "utf-8", factory = PropertySourceFactory.class) -@ConfigurationProperties(prefix = "security.auth") -@Component -@Data -public class AuthProperties { - - private String authRequireUrl; - - private String invalidSessionUrl; - - private String passwordLoginUrl; - - /** - * 代登陆接口 - */ - private String agentLoginUrl; - - /** - * 跳转登陆接口(目前只有省局跳转) - */ - private String commonLoginUrl; - - private String logoutUrl; - - private List ignoreAuthUrls; - - private List ignoreCsrfUrls; - - private Map> roleMap = new HashMap<>(); - - public String[] getIgnoreAuthUrlsArray() { - String[] stringArray = new String[ignoreAuthUrls.size()]; - return ignoreAuthUrls.toArray(stringArray); - } - - public String[] getIgnoreCsrfUrlsArray() { - String[] stringArray = new String[ignoreCsrfUrls.size()]; - return ignoreCsrfUrls.toArray(stringArray); - } - - public Map getRoleArrayMap() { - Map roleArrayMap = new HashMap<>(); - if (Objects.nonNull(roleMap)) { - Set keySet = roleMap.keySet(); - for (String key : keySet) { - List urls = roleMap.get(key); - if (CollectionUtil.isNotEmpty(urls)) { - String[] stringArray = new String[urls.size()]; - roleArrayMap.put(key, urls.toArray(stringArray)); - } - } - } - return roleArrayMap; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthenticationBeanConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthenticationBeanConfig.java deleted file mode 100644 index 944ae5b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthenticationBeanConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.core.session.SessionRegistry; -import org.springframework.security.core.session.SessionRegistryImpl; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; - -/** - * @Author LiuXinXin - * @Date 2020/7/28 1:00 下午 - * @Version 1.0 - **/ -@Configuration -public class AuthenticationBeanConfig { - - @Bean - public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } - - @Bean - public SessionRegistry sessionRegistry() { - return new SessionRegistryImpl(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java deleted file mode 100644 index b353bee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth; - -import com.ningdatech.basic.util.NdJsonUtil; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.user.security.auth.agent.AgentAuthSecurityConfig; -import com.ningdatech.pmapi.user.security.auth.common.CommonAuthSecurityConfig; -import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthSecurityConfig; -import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy; -import com.ningdatech.pmapi.user.security.auth.handler.DefaultLogoutSuccessHandler; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; -import org.springframework.security.web.csrf.CookieCsrfTokenRepository; - -import java.io.PrintWriter; -import java.util.Map; -import java.util.Set; - -/** - * @Author LiuXinXin - * @Date 2020/7/28 4:14 下午 - * @Version 1.0 - */ -@Configuration -@RequiredArgsConstructor -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - - private final AuthProperties authProperties; - private final CredentialAuthSecurityConfig credentialAuthSecurityConfig; - private final DefaultLogoutSuccessHandler logoutSuccessHandler; - private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; - private final AgentAuthSecurityConfig agentAuthSecurityConfig; - private final CommonAuthSecurityConfig commonAuthSecurityConfig; - - @Override - protected void configure(HttpSecurity http) throws Exception { - assemblerPreAuthUrls(http); - http.formLogin() - .loginPage(authProperties.getAuthRequireUrl()) - .and().apply(credentialAuthSecurityConfig) - .and().apply(agentAuthSecurityConfig) - .and().apply(commonAuthSecurityConfig) - .and() - .authorizeRequests() - .antMatchers(authProperties.getIgnoreAuthUrlsArray()) - .permitAll() - .anyRequest() - .authenticated().and() - // 防止固定会话攻击,Spring security的默认配置就是如此: - // 登陆成功之后会创建一个新的会话,然后将旧的session信息复制到新的session中(客户端的sessionId变了) - .sessionManagement() - .invalidSessionUrl(authProperties.getInvalidSessionUrl()) - .sessionFixation() - .migrateSession() - .maximumSessions(10) - .maxSessionsPreventsLogin(true) - .expiredSessionStrategy(defaultExpiredSessionStrategy) - .and().and() - .logout() - .logoutUrl(authProperties.getLogoutUrl()) - .logoutSuccessHandler(logoutSuccessHandler) - .deleteCookies(CommonConst.COOKIE_KEY) - .and() - // 开启csrf验证,需要前端同步传入token - .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) - .ignoringAntMatchers(authProperties.getIgnoreCsrfUrlsArray()); - } - - private AuthenticationEntryPoint authenticationEntryPoint() { - return (request, response, authException) -> { - response.setContentType(StrPool.CONTENT_TYPE); - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - PrintWriter writer = response.getWriter(); - writer.write(NdJsonUtil.getInstance().writeValueAsString(BizConst.UNAUTHENTICATED)); - writer.flush(); - writer.close(); - }; - } - - private void assemblerPreAuthUrls(HttpSecurity http) throws Exception { - Map roleArrayMap = authProperties.getRoleArrayMap(); - Set roleSet = roleArrayMap.keySet(); - for (String role : roleSet) { - String[] urlsArray = roleArrayMap.get(role); - if (urlsArray != null && urlsArray.length > 0) { - http.authorizeRequests().antMatchers(urlsArray).hasAuthority(role); - } - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthFilter.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthFilter.java deleted file mode 100644 index e1300ff..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.agent; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.user.security.auth.model.WebRequestDetails; -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.InternalAuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.time.LocalDateTime; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:46 下午 - * @Version 1.0 - **/ -public class AgentAuthFilter extends AbstractAuthenticationProcessingFilter { - - private boolean postOnly = true; - - private static final String USER_ID_PARAMETER = "userId"; - - // ~ Constructors - // =================================================================================================== - - public AgentAuthFilter(String processingUrl) { - super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); - } - - // ~ Methods - // ======================================================================================================== - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) - throws AuthenticationException { - if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { - throw new AuthenticationServiceException("请求方法错误"); - } - String userId = request.getParameter(USER_ID_PARAMETER); - if (StringUtils.isBlank(userId)) { - throw new BadCredentialsException("用户id 不能为空"); - } - - userId = trim(userId); - try { - AgentAuthToken authRequest = new AgentAuthToken(userId, userId); - authRequest.setDetails(new WebRequestDetails(request)); - return this.getAuthenticationManager().authenticate(authRequest); - } catch (AuthenticationException e) { - throw new BadCredentialsException("用户id 不能为空"); - } catch (BizException e) { - throw new BadCredentialsException(e.getMessage()); - } catch (Exception e) { - throw new InternalAuthenticationServiceException("授权失败:", e); - } - } - - private String trim(String trimStr) { - if (StringUtils.isNotBlank(trimStr)) { - return trimStr.trim(); - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthProvider.java deleted file mode 100644 index f1f3376..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.agent; - -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:55 下午 - * @Version 1.0 - **/ -public class AgentAuthProvider implements AuthenticationProvider { - - private UserDetailsService userDetailsService; - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - if (!(authentication instanceof AgentAuthToken)) { - throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); - } - AgentAuthToken authenticationToken = (AgentAuthToken) authentication; - String principal = (String) authenticationToken.getPrincipal(); - - UserDetails user = userDetailsService.loadUserByUsername(principal); - // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 - return new AgentAuthToken(user, user.getPassword(), user.getAuthorities()); - } - - @Override - public boolean supports(Class authentication) { - return AgentAuthToken.class.isAssignableFrom(authentication); - } - - public void setUserDetailsService(UserDetailsService userDetailsService) { - this.userDetailsService = userDetailsService; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthSecurityConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthSecurityConfig.java deleted file mode 100644 index 802a349..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthSecurityConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.agent; - -import com.ningdatech.pmapi.user.security.auth.AuthProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.SecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.web.DefaultSecurityFilterChain; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.stereotype.Component; - -/** - * 账号密码登陆的认证配置 - */ -@Component -public class AgentAuthSecurityConfig - extends SecurityConfigurerAdapter { - - @Autowired - @Qualifier(value = "defaultLoginSuccessHandler") - protected AuthenticationSuccessHandler defaultLoginSuccessHandler; - - @Autowired - @Qualifier(value = "defaultLoginFailureHandler") - protected AuthenticationFailureHandler defaultLoginFailureHandler; - - @Autowired - @Qualifier(value = "agentLoginUserDetailService") - private UserDetailsService agentLoginUserDetailService; - - @Autowired - private AuthProperties authProperties; - - private AuthenticationManager authenticationManager; - - @Override - public void configure(HttpSecurity http) throws Exception { - AgentAuthFilter agentAuthFilter = - new AgentAuthFilter(authProperties.getAgentLoginUrl()); - authenticationManager = http.getSharedObject(AuthenticationManager.class); - agentAuthFilter.setAuthenticationManager(authenticationManager); - agentAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); - agentAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); - - AgentAuthProvider authenticationProvider = new AgentAuthProvider(); - authenticationProvider.setUserDetailsService(agentLoginUserDetailService); - - http.authenticationProvider(authenticationProvider).addFilterAfter(agentAuthFilter, - UsernamePasswordAuthenticationFilter.class); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthToken.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthToken.java deleted file mode 100644 index 3f0c3c2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentAuthToken.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.agent; - -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.SpringSecurityCoreVersion; - -import java.util.Collection; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:52 下午 - * @Version 1.0 - **/ -public class AgentAuthToken extends AbstractAuthenticationToken { - - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; - - private final Object principal; - - private final Object credentials; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return - * false. - */ - public AgentAuthToken(String principal, String credentials) { - super(null); - this.principal = principal; - this.credentials = credentials; - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or AuthenticationProvider - * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal - * @param authorities - */ - public AgentAuthToken(Object principal, Object credentials, - Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - // must use super, as we override - super.setAuthenticated(true); - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException( - "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java deleted file mode 100644 index d3234b2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.agent; - - -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import lombok.RequiredArgsConstructor; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -/** - * @author LiuXinXin - * @date 2022/9/30 上午9:49 - */ - -@Service("agentLoginUserDetailService") -@RequiredArgsConstructor -public class AgentLoginUserDetailService implements UserDetailsService { - - private final UserInfoHelper userInfoHelper; - - @Override - public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { - - final Long userId = Long.parseLong(username); - - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfo(userId); - - if (Objects.isNull(userFullInfoDTO)) { - throw new UsernameNotFoundException(String.format("%s user not exist", username)); - } - if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { - throw new CommonLoginException("该账号已被禁用"); - } - - UserInfoDetails userInfoDetails = new UserInfoDetails(); - userInfoDetails.setUserId(userFullInfoDTO.getUserId()); - userInfoDetails.setUsername(userFullInfoDTO.getUsername()); - userInfoDetails.setRealName(userFullInfoDTO.getRealName()); - userInfoDetails.setUserRoleList(userFullInfoDTO.getUserRoleList()); - userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode()); - userInfoDetails.setRegionLevel(userFullInfoDTO.getRegionLevel()); - userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); - userInfoDetails.setPassword(userFullInfoDTO.getCredential()); - userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); - userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); - userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); - userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); - userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName()); - return userInfoDetails; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthFilter.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthFilter.java deleted file mode 100644 index e06fbe9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthFilter.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.common; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.user.security.auth.model.WebRequestDetails; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.InternalAuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:46 下午 - * @Version 1.0 - **/ -public class CommonAuthFilter extends AbstractAuthenticationProcessingFilter { - - private boolean postOnly = true; - - private static final String CREDENTIAL_PARAMETER = "credential"; - private static final String PLATFORM_PARAMETER = "platform"; - - // ~ Constructors - // =================================================================================================== - - public CommonAuthFilter(String processingUrl) { - super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); - } - - // ~ Methods - // ======================================================================================================== - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) - throws AuthenticationException { - if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { - throw new AuthenticationServiceException("请求方法错误"); - } - String credential = request.getParameter(CREDENTIAL_PARAMETER); - String platform = request.getParameter(PLATFORM_PARAMETER); - if (StringUtils.isBlank(credential)) { - throw new CommonLoginException("凭证 不能为空"); - } - if (StringUtils.isBlank(platform)) { - throw new CommonLoginException("平台 不能为空"); - } - - platform = trim(platform); - credential = trim(credential); - try { - CommonAuthToken authRequest = new CommonAuthToken(platform, credential); - authRequest.setDetails(new WebRequestDetails(request)); - return this.getAuthenticationManager().authenticate(authRequest); - } catch (AuthenticationException e) { - throw new BadCredentialsException("用户状态"); - } catch (BizException e) { - throw new BadCredentialsException(e.getMessage()); - } catch (Exception e) { - throw new InternalAuthenticationServiceException("授权失败:", e); - } - } - - private String trim(String trimStr) { - if (StringUtils.isNotBlank(trimStr)) { - return trimStr.trim(); - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthProvider.java deleted file mode 100644 index 8b17cfa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.common; - -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.ningdatech.pmapi.common.model.ZwddTokenUser; -import com.ningdatech.pmapi.common.util.JwtTokenUtil; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; - -import java.util.Objects; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:55 下午 - * @Version 1.0 - **/ -public class CommonAuthProvider implements AuthenticationProvider { - - private UserDetailsService userDetailsService; - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - if (!(authentication instanceof CommonAuthToken)) { - throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); - } - CommonAuthToken authenticationToken = (CommonAuthToken) authentication; - // 平台 目前只有省局项管跳转 - String platform = (String) authenticationToken.getPrincipal(); - // 密钥 - String credential = (String) authenticationToken.getCredentials(); - - ZwddTokenUser zwddTokenUser = JwtTokenUtil.parseJwt(credential); - if (Objects.isNull(zwddTokenUser)) { - throw new CommonLoginException("用户信息校验失败"); - } - String employeeCode = zwddTokenUser.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - throw new CommonLoginException("当前用户尚未创建应用账号,请联系管理员创建账号"); - } - UserDetails user = userDetailsService.loadUserByUsername(zwddTokenUser.getEmployeeCode()); - - // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 - return new CommonAuthToken(user, user.getPassword(), user.getAuthorities()); - } - - @Override - public boolean supports(Class authentication) { - return CommonAuthToken.class.isAssignableFrom(authentication); - } - - public void setUserDetailsService(UserDetailsService userDetailsService) { - this.userDetailsService = userDetailsService; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthSecurityConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthSecurityConfig.java deleted file mode 100644 index 42b536c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthSecurityConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.common; - -import com.ningdatech.pmapi.user.security.auth.AuthProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.SecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.web.DefaultSecurityFilterChain; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.stereotype.Component; - -/** - * 账号密码登陆的认证配置 - */ -@Component -public class CommonAuthSecurityConfig - extends SecurityConfigurerAdapter { - - @Autowired - @Qualifier(value = "defaultLoginSuccessHandler") - protected AuthenticationSuccessHandler defaultLoginSuccessHandler; - - @Autowired - @Qualifier(value = "defaultLoginFailureHandler") - protected AuthenticationFailureHandler defaultLoginFailureHandler; - - @Autowired - @Qualifier(value = "commonLoginUserDetailService") - private UserDetailsService commonLoginUserDetailService; - - @Autowired - private AuthProperties authProperties; - - private AuthenticationManager authenticationManager; - - @Override - public void configure(HttpSecurity http) throws Exception { - CommonAuthFilter commonAuthFilter = - new CommonAuthFilter(authProperties.getCommonLoginUrl()); - authenticationManager = http.getSharedObject(AuthenticationManager.class); - commonAuthFilter.setAuthenticationManager(authenticationManager); - commonAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); - commonAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); - - CommonAuthProvider authenticationProvider = new CommonAuthProvider(); - authenticationProvider.setUserDetailsService(commonLoginUserDetailService); - - http.authenticationProvider(authenticationProvider).addFilterAfter(commonAuthFilter, - UsernamePasswordAuthenticationFilter.class); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthToken.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthToken.java deleted file mode 100644 index 5a041f9..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonAuthToken.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.common; - -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.SpringSecurityCoreVersion; - -import java.util.Collection; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:52 下午 - * @Version 1.0 - **/ -public class CommonAuthToken extends AbstractAuthenticationToken { - - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; - - private final Object principal; - - private final Object credentials; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return - * false. - */ - public CommonAuthToken(String principal, String credentials) { - super(null); - this.principal = principal; - this.credentials = credentials; - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or AuthenticationProvider - * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal - * @param authorities - */ - public CommonAuthToken(Object principal, Object credentials, - Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - // must use super, as we override - super.setAuthenticated(true); - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException( - "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java deleted file mode 100644 index 6679760..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.common; - - -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.manage.UserInfoManage; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import lombok.RequiredArgsConstructor; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -/** - * @author LiuXinXin - * @date 2022/9/30 上午9:49 - */ - -@Service("commonLoginUserDetailService") -@RequiredArgsConstructor -public class CommonLoginUserDetailService implements UserDetailsService { - - private final UserInfoManage userInfoManage; - - @Override - public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { - final String employeeCode = username; - UserFullInfoDTO userFullInfoDTO = userInfoManage.getUserFullInfoByEmployeeCode(employeeCode); - - if (Objects.isNull(userFullInfoDTO)) { - throw new UsernameNotFoundException(String.format("%s user not exist", username)); - } - if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { - throw new CommonLoginException("该账号已被禁用"); - } - UserInfoDetails userInfoDetails = new UserInfoDetails(); - userInfoDetails.setUserId(userFullInfoDTO.getUserId()); - userInfoDetails.setUsername(userFullInfoDTO.getUsername()); - userInfoDetails.setRealName(userFullInfoDTO.getRealName()); - userInfoDetails.setUserRoleList(userFullInfoDTO.getUserRoleList()); - userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode()); - userInfoDetails.setRegionLevel(userFullInfoDTO.getRegionLevel()); - userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); - userInfoDetails.setPassword(userFullInfoDTO.getCredential()); - userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); - userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); - userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); - userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); - userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName()); - return userInfoDetails; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java deleted file mode 100644 index 1eaec87..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.config;//package com.ningdatech.pmapi.user.security.auth.config; - -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.session.web.http.CookieHttpSessionIdResolver; -import org.springframework.session.web.http.DefaultCookieSerializer; - -/** - *

- * 设置session的过期时间为一天 - *

- * - * @Author LiuXinXin - * @Date 2020/7/29 9:46 上午 - * @Version 1.0 - **/ -@Configuration -@EnableRedisHttpSession -public class RedisSessionConfig { - - @Bean - public CookieHttpSessionIdResolver sessionIdResolver() { - // 创建 CookieHttpSessionIdResolver 对象 - CookieHttpSessionIdResolver sessionIdResolver = new CookieHttpSessionIdResolver(); - - // 创建 DefaultCookieSerializer 对象 - DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); - sessionIdResolver.setCookieSerializer(cookieSerializer); - // 设置到 sessionIdResolver 中 - cookieSerializer.setCookieName(BizConst.COOKIE_KEY); - cookieSerializer.setCookieMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); - return sessionIdResolver; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java deleted file mode 100644 index bbf7bd5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.config; - -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.RedisIndexedSessionRepository; -import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; - -import javax.annotation.PostConstruct; - -/** - *

- * 设置session的过期时间为一天 - *

- * - * @Author LiuXinXin - * @Date 2020/7/29 9:46 上午 - * @Version 1.0 - **/ -@Configuration -@RequiredArgsConstructor -@AutoConfigureAfter(RedisHttpSessionConfiguration.class) -public class SessionTimeoutConfig { - - @Value("${spring.session.timeout:14400}") - private Integer springSessionTimeout; - - private final RedisHttpSessionConfiguration redisHttpSessionConfiguration; - private final RedisIndexedSessionRepository redisIndexedSessionRepository; - - @PostConstruct - public void sessionTimeoutTime() { - redisHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(springSessionTimeout); - redisIndexedSessionRepository.setDefaultMaxInactiveInterval(springSessionTimeout); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/AuthTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/AuthTypeEnum.java deleted file mode 100644 index 927b5bd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/AuthTypeEnum.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.constants; - -/** - * @author Liuxinxin - * @date 2021/7/30 下午2:10 - */ - -public enum AuthTypeEnum { - - /** - * 手机 + 密码的认证方式 - */ - PHONE_PASSWORD("phone_password"), - - /** - * 子账号 账号 + 密码的认证方式 - */ - ACCOUNT_PASSWORD("account_password"); - - private final String key; - - AuthTypeEnum(String key) { - this.key = key; - } - - public static boolean contains(String key) { - for (AuthTypeEnum value : AuthTypeEnum.values()) { - if (key.equals(value.getKey())) { - return true; - } - } - return false; - } - - public String getKey() { - return key; - } - - public static AuthTypeEnum of(String key) { - for (AuthTypeEnum value : AuthTypeEnum.values()) { - if (key.equals(value.getKey())) { - return value; - } - } - throw new RuntimeException(String.format("invalid AuthTypeEnum = %s", key)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/PlatformTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/PlatformTypeEnum.java deleted file mode 100644 index 692c80d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/PlatformTypeEnum.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.constants; - -/** - * @author liuxinxin - * @date 2023/5/4 上午10:53 - */ - -public enum PlatformTypeEnum { - - /** - * 省局 - */ - PROVINCIAL_BUREAU - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java deleted file mode 100644 index 712df4c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.constants; - -/** - * @Author LiuXinXin - * @Date 2022/2/17 12:59 上午 - * @Version 1.0 - **/ -public class SessionTimeConstant { - - public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; - public static final Integer SESSION_EXPIRED = 0; - - public static final String UNIVERSAL_VERIFICATION_CODE = "9527"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/UserDeatilsServiceConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/UserDeatilsServiceConstant.java deleted file mode 100644 index 576153b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/UserDeatilsServiceConstant.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.constants; - -/** - * @author liuxinxin - * @date 2023/2/14 上午11:29 - */ - -public class UserDeatilsServiceConstant { - - public static final String USER_DETAILS_SERVICE_SEPARATOR = "@###@"; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthFilter.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthFilter.java deleted file mode 100644 index 05c1dde..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthFilter.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.credential; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; -import com.ningdatech.pmapi.user.security.auth.model.WebRequestDetails; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.InternalAuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:46 下午 - * @Version 1.0 - **/ -public class CredentialAuthFilter extends AbstractAuthenticationProcessingFilter { - - private boolean postOnly = true; - - private static final String IDENTIFIER_PARAMETER = "identifier"; - private static final String CREDENTIAL_PARAMETER = "credential"; - private static final String LOGIN_TYPE_PARAMETER = "loginType"; - - - // ~ Constructors - // =================================================================================================== - - public CredentialAuthFilter(String processingUrl) { - super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); - } - - // ~ Methods - // ======================================================================================================== - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) - throws AuthenticationException { - if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { - throw new AuthenticationServiceException("请求方法错误"); - } - String identifier = request.getParameter(IDENTIFIER_PARAMETER); - String credential = request.getParameter(CREDENTIAL_PARAMETER); - String loginType = request.getParameter(LOGIN_TYPE_PARAMETER); - if (StringUtils.isBlank(loginType)) { - throw new BadCredentialsException("登陆类型不能为空"); - } - paramValid(identifier, credential, loginType); - - identifier = trim(identifier); - credential = trim(credential); - loginType = trim(loginType); - try { - CredentialAuthToken authRequest = new CredentialAuthToken(identifier, credential, loginType); - authRequest.setDetails(new WebRequestDetails(request)); - return this.getAuthenticationManager().authenticate(authRequest); - } catch (CommonLoginException e) { - throw new CommonLoginException(e.getMessage()); - } catch (BadCredentialsException | BizException e) { - throw new BadCredentialsException(e.getMessage()); - } catch (AuthenticationException e) { - throw new BadCredentialsException("账号或密码错误"); - } catch (Exception e) { - throw new InternalAuthenticationServiceException("授权失败:", e); - } - } - - protected void setDetails(HttpServletRequest request, CredentialAuthToken authRequest) { - authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); - } - - private void paramValid(String identifier, String credential, String loginType) { - LoginTypeEnum loginTypeEnum = LoginTypeEnum.valueOf(loginType); - switch (loginTypeEnum) { - case DING_QR_LOGIN: { - if (StringUtils.isBlank(credential)) { - throw new CommonLoginException("浙政钉扫码登陆 授权码 不能为空 credential"); - } - } - break; - case USERNAME_PASSWORD_LOGIN: { - if (StringUtils.isBlank(identifier) || StringUtils.isBlank(credential)) { - throw new CommonLoginException("账号密码登陆 账号密码不能为空 identifier credential"); - } - } - break; - case PHONE_VERIFICATION_CODE_LOGIN: { - if (StringUtils.isBlank(identifier) || StringUtils.isBlank(credential)) { - throw new CommonLoginException("手机号验证码登陆 手机号或验证码不能为空 identifier credential"); - } - } - break; - } - } - - private String trim(String trimStr) { - if (StringUtils.isNotBlank(trimStr)) { - return trimStr.trim(); - } - return null; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java deleted file mode 100644 index a6197f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.credential; - -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.sms.constant.VerificationCodeType; -import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper; -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; -import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; -import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import com.ningdatech.zwdd.client.ZwddAuthClient; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.password.PasswordEncoder; - -import java.util.Objects; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:55 下午 - * @Version 1.0 - **/ -public class CredentialAuthProvider implements AuthenticationProvider { - - private UserDetailsService userDetailsService; - - private PasswordEncoder passwordEncoder; - - private ZwddAuthClient zwddAuthClient; - - private Boolean phoneVerifyCodeSkip; - - private VerifyCodeCheckHelper verifyCodeCheckHelper; - - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - if (!(authentication instanceof CredentialAuthToken)) { - throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); - } - CredentialAuthToken authenticationToken = (CredentialAuthToken) authentication; - String principal = (String) authenticationToken.getPrincipal(); - - UserDetails user = null; - LoginTypeEnum loginTypeEnum = authenticationToken.getLoginTypeEnum(); - String credentials = (String) authenticationToken.getCredentials(); - switch (loginTypeEnum) { - case DING_QR_LOGIN: { - String code = (String) authenticationToken.getCredentials(); - GenericResult accountResult = zwddAuthClient.getAccountId(code); - if (!accountResult.isSuccess()) { - throw new BadCredentialsException("login fail! 浙政钉校验失败"); - } - String accountId = accountResult.getData(); - if (Objects.isNull(accountId)) { - throw new BadCredentialsException("login fail! 浙政钉校验失败"); - } - user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); - } - break; - case DING_MD_LOGIN: { - String code = (String) authenticationToken.getCredentials(); - GenericResult accountResult = zwddAuthClient.getMobileAccountId(code); - if (!accountResult.isSuccess()) { - throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); - } - String accountId = accountResult.getData(); - if (Objects.isNull(accountId)) { - throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); - } - user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); - } - break; - case PHONE_VERIFICATION_CODE_LOGIN: { - if (!phoneVerifyCodeSkip) { - // 校验短信验证码 - boolean verificationResult = verifyCodeCheckHelper.verification(VerificationCodeType.LOGIN, principal, credentials); - if (!verificationResult && !SessionTimeConstant.UNIVERSAL_VERIFICATION_CODE.equals(credentials)) { - throw new CommonLoginException("验证码错误"); - } - } - user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); - } - break; - case USERNAME_PASSWORD_LOGIN: { - user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); - } - break; - } - // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 - return new CredentialAuthToken(user, user.getPassword(), user.getAuthorities()); - } - - protected void additionalAuthenticationChecks(UserDetails userDetails, CredentialAuthToken authentication) - throws AuthenticationException { - if (authentication.getCredentials() == null) { - throw new BadCredentialsException("login fail! password is null"); - } - String presentedPassword = authentication.getCredentials().toString(); - if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { - throw new BadCredentialsException("login fail! password is error"); - } - } - - - @Override - public boolean supports(Class authentication) { - return CredentialAuthToken.class.isAssignableFrom(authentication); - } - - public void setUserDetailsService(UserDetailsService userDetailsService) { - this.userDetailsService = userDetailsService; - } - - public void setPasswordEncoder(PasswordEncoder passwordEncoder) { - this.passwordEncoder = passwordEncoder; - } - - public void setZwddAuthClient(ZwddAuthClient zwddAuthClient) { - this.zwddAuthClient = zwddAuthClient; - } - - public void setVerifyCodeCheckHelper(VerifyCodeCheckHelper verifyCodeCheckHelper) { - this.verifyCodeCheckHelper = verifyCodeCheckHelper; - } - - public void setPhoneVerifyCodeSkip(Boolean phoneVerifyCodeSkip) { - this.phoneVerifyCodeSkip = phoneVerifyCodeSkip; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthSecurityConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthSecurityConfig.java deleted file mode 100644 index c8a442c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthSecurityConfig.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.credential; - -import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper; -import com.ningdatech.pmapi.user.security.auth.AuthProperties; -import com.ningdatech.zwdd.client.ZwddAuthClient; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.SecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.web.DefaultSecurityFilterChain; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.stereotype.Component; - -/** - * 账号密码登陆的认证配置 - */ -@Component -public class CredentialAuthSecurityConfig - extends SecurityConfigurerAdapter { - @Value("${login.phone-verify-code.skip:false}") - private Boolean skipLoginVerifyCodeCheck; - - @Autowired - @Qualifier(value = "defaultLoginSuccessHandler") - protected AuthenticationSuccessHandler defaultLoginSuccessHandler; - - @Autowired - @Qualifier(value = "defaultLoginFailureHandler") - protected AuthenticationFailureHandler defaultLoginFailureHandler; - - @Autowired - @Qualifier(value = "credentialLoginUserDetailService") - private UserDetailsService credentialLoginUserDetailService; - - @Autowired - private PasswordEncoder passwordEncoder; - - @Autowired - private AuthProperties authProperties; - - private AuthenticationManager authenticationManager; - - @Autowired - private ZwddAuthClient zwddAuthClient; - - @Autowired - private VerifyCodeCheckHelper verifyCodeCheckHelper; - - @Override - public void configure(HttpSecurity http) throws Exception { - CredentialAuthFilter credentialAuthFilter = - new CredentialAuthFilter(authProperties.getPasswordLoginUrl()); - authenticationManager = http.getSharedObject(AuthenticationManager.class); - credentialAuthFilter.setAuthenticationManager(authenticationManager); - credentialAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); - credentialAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); - - CredentialAuthProvider authenticationProvider = new CredentialAuthProvider(); - authenticationProvider.setPhoneVerifyCodeSkip(skipLoginVerifyCodeCheck); - authenticationProvider.setUserDetailsService(credentialLoginUserDetailService); - // 确保对密码进行加密的encoder和解密的encoder相同 - authenticationProvider.setPasswordEncoder(passwordEncoder); - // 传入浙政钉client - authenticationProvider.setZwddAuthClient(zwddAuthClient); - authenticationProvider.setVerifyCodeCheckHelper(verifyCodeCheckHelper); - - http.authenticationProvider(authenticationProvider).addFilterAfter(credentialAuthFilter, - UsernamePasswordAuthenticationFilter.class); - } - - public AuthenticationManager getAuthenticationManager() { - return authenticationManager; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthToken.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthToken.java deleted file mode 100644 index 96d37bb..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthToken.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.credential; - -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.SpringSecurityCoreVersion; - -import java.util.Collection; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:52 下午 - * @Version 1.0 - **/ -public class CredentialAuthToken extends AbstractAuthenticationToken { - - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; - - private final Object principal; - - private final Object credentials; - - private final LoginTypeEnum loginTypeEnum; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return - * false. - */ - public CredentialAuthToken(String principal, String credentials, String loginTypeEnum) { - super(null); - this.principal = principal; - this.credentials = credentials; - this.loginTypeEnum = LoginTypeEnum.valueOf(loginTypeEnum); - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or AuthenticationProvider - * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal - * @param authorities - */ - public CredentialAuthToken(Object principal, Object credentials, - Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - this.loginTypeEnum = null; - // must use super, as we override - super.setAuthenticated(true); - } - - public LoginTypeEnum getLoginTypeEnum() { - return this.loginTypeEnum; - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException( - "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java deleted file mode 100644 index 6a6c301..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.credential; - - -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.convert.UserInfoConvertor; -import com.ningdatech.pmapi.user.manage.UserInfoManage; -import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import lombok.RequiredArgsConstructor; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -/** - * @author LiuXinXin - * @date 2022/9/30 上午9:49 - */ - -@Service("credentialLoginUserDetailService") -@RequiredArgsConstructor -public class CredentialLoginUserDetailService implements UserDetailsService { - - private final UserInfoManage userInfoManage; - - @Override - public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { - String[] split = username.split(UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR); - username = split[0]; - String loginTypeStr = split[1]; - LoginTypeEnum loginTypeEnum = LoginTypeEnum.valueOf(loginTypeStr); - - UserFullInfoDTO userFullInfo; - switch (loginTypeEnum) { - case PHONE_VERIFICATION_CODE_LOGIN: { - userFullInfo = userInfoManage.queryUserInfoInPhoneNoAuth(username); - if (Objects.isNull(userFullInfo)) { - throw new CommonLoginException("该手机号未绑定用户"); - } - } - break; - case USERNAME_PASSWORD_LOGIN: { - userFullInfo = userInfoManage.queryUserInfoInPasswordAuth(username); - if (Objects.isNull(userFullInfo)) { - throw new UsernameNotFoundException(String.format("%s user not exist", username)); - } - } - break; - case DING_MD_LOGIN: - case DING_QR_LOGIN: { - userFullInfo = userInfoManage.queryUserInfoInAccountIdAuth(username); - if (Objects.isNull(userFullInfo)) { - throw new CommonLoginException("浙政钉账号无法登陆"); - } - } - break; - default: { - throw new UsernameNotFoundException(String.format("%s user not exist", username)); - } - } - - if (UserAvailableEnum.DISABLE.equals(userFullInfo.getAvailable())) { - throw new CommonLoginException("该账号已被禁用"); - } - return UserInfoConvertor.toUserInfoDetails(userFullInfo); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/errorcode/AuthErrorCodeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/errorcode/AuthErrorCodeEnum.java deleted file mode 100644 index 5812ab1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/errorcode/AuthErrorCodeEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.errorcode; - - -import com.ningdatech.pmapi.common.errorcode.AppErrorCode; -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author LiuXinXin - * @date 2021/7/30 上午10:59 - */ - -@AllArgsConstructor -@Getter -public enum AuthErrorCodeEnum { - - USERNAME_OR_PASSWORD_ERROR(AppErrorCode.AUTH.getCode() + "100000" - , "登陆时用户名或者密码错误"), - - ACCOUNT_ALREADY_EXIST_WHEN_REGISTER(AppErrorCode.AUTH.getCode() + "100001" - , "账号已经存在"), - - SESSION_EXPIRED(AppErrorCode.AUTH.getCode() + "100002" - , "用户session过期,登陆状态失效"); - - - private final String code; - - private final String msg; - - public Integer getCode() { - return Integer.valueOf(code); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java deleted file mode 100644 index ecbb68a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.handler; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ningdatech.basic.model.ApiResponse; -import com.ningdatech.pmapi.user.security.auth.errorcode.AuthErrorCodeEnum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.security.web.session.SessionInformationExpiredEvent; -import org.springframework.security.web.session.SessionInformationExpiredStrategy; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @Author LiuXinXin - * @Date 2020/8/20 11:15 上午 - * @Version 1.0 - **/ -@Component -public class DefaultExpiredSessionStrategy implements SessionInformationExpiredStrategy { - - public static final Logger LOG = LoggerFactory.getLogger(DefaultExpiredSessionStrategy.class); - - @Autowired - private ObjectMapper objectMapper; - - @Override - public void onExpiredSessionDetected(SessionInformationExpiredEvent sessionInformationExpiredEvent) - throws IOException { - HttpServletResponse response = sessionInformationExpiredEvent.getResponse(); - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().write(objectMapper.writeValueAsString( - ApiResponse.of(AuthErrorCodeEnum.SESSION_EXPIRED.getCode(), AuthErrorCodeEnum.SESSION_EXPIRED.getMsg(), null))); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginFailureHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginFailureHandler.java deleted file mode 100644 index 8b5d8fa..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginFailureHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.handler; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ningdatech.basic.model.ApiResponse; -import com.ningdatech.pmapi.user.security.auth.errorcode.AuthErrorCodeEnum; -import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:32 下午 - * @Version 1.0 - **/ -@Component("defaultLoginFailureHandler") -public class DefaultLoginFailureHandler extends SimpleUrlAuthenticationFailureHandler { - - private final ObjectMapper objectMapper = new ObjectMapper(); - - @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, - AuthenticationException exception) throws IOException, ServletException { - response.setContentType("application/json;charset=UTF-8"); - int errorCode; - String errorMsg; - // 所有的认证异常都可以在这里添加,目前只支持用户名密码错误异常 - - if (exception instanceof CommonLoginException) { - errorCode = 400; - errorMsg = exception.getMessage(); - } else if (exception instanceof BadCredentialsException || exception instanceof UsernameNotFoundException) { - errorCode = AuthErrorCodeEnum.USERNAME_OR_PASSWORD_ERROR.getCode(); - errorMsg = exception.getMessage(); - } else { - errorCode = ApiResponse.ERROR_CODE; - errorMsg = ApiResponse.ERROR_MSG; - } - response.setStatus(400); - response.getWriter() - .write(objectMapper.writeValueAsString(ApiResponse.of(errorCode, errorMsg, null))); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginSuccessHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginSuccessHandler.java deleted file mode 100644 index d2e15b4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLoginSuccessHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.handler; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ningdatech.basic.model.ApiResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; -import org.springframework.http.MediaType; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:32 下午 - * @Version 1.0 - **/ -@Component("defaultLoginSuccessHandler") -@Primary -public class DefaultLoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { - - @Autowired - private ObjectMapper objectMapper; - - @Override - public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, - Authentication authentication) throws IOException { - response.setContentType(MediaType.APPLICATION_JSON_VALUE); - response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofMessage(ApiResponse.SUCCESS_MSG))); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java deleted file mode 100644 index b7e3a45..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.handler; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ningdatech.basic.model.ApiResponse; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * 默认的退出成功处理器 - */ -@Component("defaultLogoutSuccessHandler") -public class DefaultLogoutSuccessHandler implements LogoutSuccessHandler { - - private final ObjectMapper objectMapper = new ObjectMapper(); - - @Override - public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) - throws IOException { - // 退出成功后返回 和前端约定的Json - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofSuccess())); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/lisenter/AuthorizationEventListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/lisenter/AuthorizationEventListener.java deleted file mode 100644 index 200add7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/lisenter/AuthorizationEventListener.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.lisenter; - -import cn.hutool.core.date.LocalDateTimeUtil; -import com.ningdatech.log.model.OptLogDTO; -import com.ningdatech.log.model.enumeration.LogType; -import com.ningdatech.log.service.OptLogService; -import com.ningdatech.log.util.AddressUtil; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import com.ningdatech.pmapi.user.security.auth.model.WebRequestDetails; -import lombok.RequiredArgsConstructor; -import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; -import org.springframework.security.authentication.event.AbstractAuthenticationEvent; -import org.springframework.security.authentication.event.AuthenticationSuccessEvent; -import org.springframework.security.authentication.event.LogoutSuccessEvent; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; - -/** - *

- * AuthorizationEventListener - *

- * - * @author WendyYang - * @since 2023/6/7 - **/ -@Component -@RequiredArgsConstructor -public class AuthorizationEventListener { - - private final OptLogService optLogService; - - @Async - @EventListener(AuthenticationSuccessEvent.class) - public void loginSuccessListener(AuthenticationSuccessEvent event) { - optLogService.save(buildOptLog("用户登录", event)); - } - - @Async - @EventListener(LogoutSuccessEvent.class) - public void logoutSuccessListener(LogoutSuccessEvent event) { - optLogService.save(buildOptLog("退出登录", event)); - } - - private OptLogDTO buildOptLog(String description, AbstractAuthenticationEvent event) { - Authentication authentication = event.getAuthentication(); - UserInfoDetails userDetails = (UserInfoDetails) authentication.getPrincipal(); - WebRequestDetails webDetails = (WebRequestDetails) authentication.getDetails(); - LocalDateTime now = LocalDateTime.now(); - OptLogDTO optLog = new OptLogDTO(); - optLog.setActionMethod(webDetails.getServletPath()); - optLog.setDescription(description); - optLog.setStartTime(LocalDateTimeUtil.of(event.getTimestamp())); - optLog.setFinishTime(now); - optLog.setCreateOn(now); - long consumingTime = System.currentTimeMillis() - event.getTimestamp(); - optLog.setConsumingTime(consumingTime); - optLog.setHttpMethod(webDetails.getMethod()); - optLog.setUserName(userDetails.getUsername()); - optLog.setCreateBy(userDetails.getUserId()); - optLog.setRequestIp(webDetails.getRequestIp()); - optLog.setRequestUri(webDetails.getRequestUri()); - optLog.setRegionByIp(AddressUtil.getRegion(optLog.getRequestIp())); - optLog.setUa(webDetails.getUserAgent()); - optLog.setType(LogType.OPT.name()); - return optLog; - } - -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java deleted file mode 100644 index e240077..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.model; - -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import lombok.Data; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/1/4 下午5:07 - */ - -@Data -public class UserFullInfoDTO { - - private Long userId; - - private String realName; - - private String username; - - private String identifier; - - private String credential; - - /** - * 所属区域编码 - */ - private String regionCode; - /** - * 所属区域编码 - */ - private Integer regionLevel; - - /** - * 浙政钉扫码 员工code - */ - private String employeeCode; - - /** - * 浙政钉组织code - */ - private String organizationCode; - - /** - * 手机号码 - */ - private String mobile; - - /** - * 浙政钉组织名称 - */ - private String organizationName; - - /** - * 任职所在单位code - */ - private String empPosUnitCode; - - /** - * 任职所在单位 - */ - private String empPosUnitName; - - /** - * 用户角色 - */ - private List userRoleList; - - private Long accountId; - - /** - * 用户是否可用 - */ - private UserAvailableEnum available; - - - /** - * 取最高的权限 - * - * @return - */ - public RoleEnum getRoleCode() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - return RoleEnum.checkHigherRole(this.userRoleList.stream() - .map(Role::getCode).collect(Collectors.toList())); - } - return null; - } - - public Boolean getIsOrgAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; - } - - public Boolean getSuperAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { - return Boolean.TRUE; - } - } - } - 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 notAdmin() { - if(!getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin()){ - return Boolean.TRUE; - } - 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 deleted file mode 100644 index 792d364..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.model; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -import com.ningdatech.basic.auth.AbstractLoginUser; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author LiuXinXin - * @date 2022/8/1 下午3:32 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class UserInfoDetails extends AbstractLoginUser implements UserDetails { - - private static final long serialVersionUID = -8219907690673456440L; - - private String realName; - - private String password; - - /** - * 所属区域编码 - */ - private String regionCode; - - /** - * 所属区域层级 - */ - private Integer regionLevel; - - /** - * 浙政钉扫码 员工code - */ - private String employeeCode; - - /** - * 浙政钉组织code - */ - private String organizationCode; - - /** - * 浙政钉组织名称 - */ - private String organizationName; - - /** - * 用户角色 - */ - private List userRoleList; - - /** - * 任职所在单位code - */ - private String empPosUnitCode; - - /** - * 任职所在单位 - */ - private String empPosUnitName; - - - private String mobile; - - - /** - * 获取用户权限 - * - * @return - */ - @Override - public Collection getAuthorities() { - if (CollectionUtil.isNotEmpty(this.userRoleList)) { - List authorities = new ArrayList<>(); - for (Role role : this.userRoleList) { - authorities.add(new SimpleGrantedAuthority(role.getCode())); - } - return authorities; - } - return new ArrayList<>(); - } - - @Override - public String getPassword() { - return password; - } - - @Override - public String getUsername() { - return getIdentifier(); - } - - @Override - public boolean isAccountNonExpired() { - return true; - } - - @Override - public boolean isAccountNonLocked() { - return true; - } - - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - @Override - public boolean isEnabled() { - return true; - } - - /** - * 取最高的权限 - * - * @return - */ - public RoleEnum getRoleCode() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - return RoleEnum.checkHigherRole(this.userRoleList.stream() - .map(Role::getCode).collect(Collectors.toList())); - } - return null; - } - - public Boolean getIsOrgAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; - } - - public Boolean getSuperAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { - return Boolean.TRUE; - } - } - } - 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)) { - return Boolean.TRUE; - } - return Boolean.FALSE; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/WebRequestDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/WebRequestDetails.java deleted file mode 100644 index 9c73060..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/WebRequestDetails.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.model; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.servlet.ServletUtil; -import org.springframework.security.web.authentication.WebAuthenticationDetails; - -import javax.servlet.http.HttpServletRequest; - -/** - *

- * WebRequestDetails - *

- * - * @author WendyYang - * @since 2023/6/7 - **/ -public class WebRequestDetails extends WebAuthenticationDetails { - - private static final long serialVersionUID = -4466339683132696235L; - - private final String requestIp; - - private final String requestUri; - - private final String method; - - private final String servletPath; - - private final String requestUrl; - - private final String userAgent; - - /** - * Records the remote address and will also set the session Id if a session already - * exists (it won't create one). - * - * @param request that the authentication request was received from - */ - public WebRequestDetails(HttpServletRequest request) { - super(request); - this.requestUri = request.getRequestURI(); - this.method = request.getMethod(); - this.servletPath = request.getServletPath(); - this.requestUrl = request.getRequestURL().toString(); - this.requestIp = ServletUtil.getClientIP(request); - this.userAgent = StrUtil.sub(request.getHeader("user-agent"), 0, 500); - } - - public String getRequestIp() { - return requestIp; - } - - public String getRequestUri() { - return requestUri; - } - - public String getMethod() { - return method; - } - - public String getServletPath() { - return servletPath; - } - - public String getRequestUrl() { - return requestUrl; - } - - public String getUserAgent() { - return userAgent; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/CommonLoginException.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/CommonLoginException.java deleted file mode 100644 index a399f2e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/CommonLoginException.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.validate; - -import org.springframework.security.core.AuthenticationException; - -/** - * @author liuxinxin - * @date 2023/3/24 上午11:47 - * 通用登陆错误 - */ -public class CommonLoginException extends AuthenticationException { - - public CommonLoginException(String message) { - super(message); - } - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/DingQrLoginException.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/DingQrLoginException.java deleted file mode 100644 index a7616ea..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/validate/DingQrLoginException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.validate; - -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/3/24 上午11:47 - * 浙政钉扫码登陆错误 - */ - -@Data -public class DingQrLoginException extends RuntimeException { - - private Integer code; - - private String message; - - public DingQrLoginException(int code, String message) { - this.code = code; - this.message = message; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserAuthService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserAuthService.java deleted file mode 100644 index 16590f3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserAuthService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.pmapi.user.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.user.entity.UserAuth; -import com.ningdatech.pmapi.user.entity.UserInfo; - -import java.util.Map; -import java.util.Set; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -public interface IUserAuthService extends IService { - - Map getUserMapByIds(Set staterUsers); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java deleted file mode 100644 index 7be2c12..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.user.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.user.entity.UserInfo; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -public interface IUserInfoService extends IService { - - UserInfo getUserInfoByPhoneNo(String phoneNo); - - UserInfo getUserInfoByEmployeeCode(String employeeCode); - - UserInfo getUserInfoByAccountId(Long accountId); - - List getUserInfoByEmployeeCodes(Collection employeeCodes); -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java deleted file mode 100644 index c71f49b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.user.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.user.entity.UserAuth; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; -import com.ningdatech.pmapi.user.mapper.UserAuthMapper; -import com.ningdatech.pmapi.user.service.IUserAuthService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@Service -@RequiredArgsConstructor -public class UserAuthServiceImpl extends ServiceImpl implements IUserAuthService { - - private final NdUserInfoMapper userInfoMapper; - - @Override - public Map getUserMapByIds(Set staterUsers) { - List userInfos = userInfoMapper.selectBatchIds(staterUsers); - return userInfos.stream().collect(Collectors.toMap(UserInfo::getId, u -> u)); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java deleted file mode 100644 index bd27052..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.user.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; - -/** - *

- * 服务实现类 - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@Service -@RequiredArgsConstructor -public class UserInfoServiceImpl extends ServiceImpl implements IUserInfoService { - - @Override - public UserInfo getUserInfoByPhoneNo(String phoneNo) { - if (StringUtils.isEmpty(phoneNo)) { - return null; - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getMobile, phoneNo); - return getOne(query); - } - - @Override - public UserInfo getUserInfoByAccountId(Long accountId) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getAccountId, accountId); - return getOne(query); - } - - @Override - public UserInfo getUserInfoByEmployeeCode(String employeeCode) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode); - return getOne(query); - } - - @Override - public List getUserInfoByEmployeeCodes(Collection employeeCodes) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode, employeeCodes); - return list(query); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java deleted file mode 100644 index ef62af4..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.user.util; - -import com.ningdatech.basic.auth.AbstractLoginUserUtil; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; - -import java.util.List; -import java.util.stream.Collectors; - - -/** - * @Author liuxinxin - * @Date 2022/9/30 12:26 下午 - * @Version 1.0 - **/ -public class LoginUserUtil extends AbstractLoginUserUtil { - - public static UserInfoDetails loginUserDetail() { - return getLoginUserPrincipal(); - } - - public static List getRoleIdList() { - UserInfoDetails userInfoDetails = loginUserDetail(); - List userRoleList = userInfoDetails.getUserRoleList(); - return userRoleList.stream().map(Role::getId).collect(Collectors.toList()); - } - - public static boolean isExpert() { - UserInfoDetails detail = loginUserDetail(); - return detail.getUserRoleList().stream().anyMatch(w -> RoleEnum.EXPERT.eq(w.getCode())); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/controller/WorkbenchController.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/controller/WorkbenchController.java deleted file mode 100644 index 26d82e2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/controller/WorkbenchController.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.workbench.controller; - -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.workbench.manage.WorkbenchManage; -import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -/** - * 工作台前端控制器 - * @author ZPF - * @since 2023/03/17 15:35 - */ -@RestController -@AllArgsConstructor -@Api(tags = "工作台控制器") -@RequestMapping("/api/v1/workbench") -public class WorkbenchController { - - private WorkbenchManage workbenchManage; - - /** - * @param year - * @return - */ - @GetMapping - public WorkbenchVO workbench(@RequestParam(defaultValue = "2023") Integer year){ - return workbenchManage.getWorkbenchData(year); - } - - @ApiOperation(value = "催办", notes = "催办") - @PostMapping("/urging/{recordId}") - @WebLog("催办") - public String urging(@PathVariable Long recordId){ - return workbenchManage.urging(recordId); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/converter/WorkbenchConverter.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/converter/WorkbenchConverter.java deleted file mode 100644 index 8f507b0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/converter/WorkbenchConverter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ningdatech.pmapi.workbench.converter; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; -import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; -import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; -import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -/** - * @Classname WorkbenchConverter - * @Description - * @Date 2023/3/20 17:23 - * @Author PoffyZhang - */ -public class WorkbenchConverter { - - public static WorkbenchVO.DeclaredStatistics convert(DeclaredProjectStatisticsPO po,DeclaredProjectStatisticsPO lastYearPo) { - WorkbenchVO.DeclaredStatistics res = BeanUtil.copyProperties(po,WorkbenchVO.DeclaredStatistics.class); - if(Objects.nonNull(lastYearPo)){ - res.setDeclaredAmountLastYear(lastYearPo.getDeclaredAmount()); - res.setApprovalAmountLastYear(lastYearPo.getApprovalAmount()); - } - return res; - } - - public static TodoVO convert(ResToBeProcessedVO vo) { - TodoVO res = new TodoVO(); - res.setNodeId(vo.getNodeId()); - res.setProjectId(vo.getProjectId()); - res.setProjectName(vo.getProjectName()); - return res; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java deleted file mode 100644 index 4b5c792..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java +++ /dev/null @@ -1,355 +0,0 @@ -package com.ningdatech.pmapi.workbench.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -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.google.common.collect.Sets; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -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.sys.enumeration.ProjectEarlyWarningStatusEnum; -import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; -import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; -import com.ningdatech.pmapi.sys.model.req.NoticeListReq; -import com.ningdatech.pmapi.sys.model.vo.ProjectEarlyWarningVO; -import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; -import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; -import com.ningdatech.pmapi.sys.utils.EarlyWarningUtil; -import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; -import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; -import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; -import com.wflow.bean.entity.WflowEarlyWarning; -import com.wflow.enums.WarningNoticeTypeEnum; -import com.wflow.enums.WarningRuleTypeEnum; -import com.wflow.service.IEarlyWarningService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.record.DVALRecord; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; - -/** - * @Classname WorkbenchManage - * @Description - * @Date 2023/3/20 10:56 - * @Author PoffyZhang - */ -@Component -@AllArgsConstructor -@Slf4j -public class WorkbenchManage { - - private final TodoCenterManage todoCenterManage; - - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - - private final IEarlyWarningRecordsService earlyWarningRecordsService; - - private final IEarlyWarningService earlyWarningService; - - private final IProjectEarlyWarningService projectEarlyWarningService; - - private final NoticeManage noticeManage; - - private final UserInfoHelper userInfoHelper; - - private final ProjectLibManage projectLibManage; - - private final EarlyWarningManage earlyWarningManage; - - private final IProjectService projectService; - - public WorkbenchVO getWorkbenchData(Integer year) { - WorkbenchVO res = new WorkbenchVO(); - Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); - - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - //1.待办中心数据 - TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); - ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); - toBeProcessedReq.setPageNumber(1); - toBeProcessedReq.setPageSize(5); - toBeProcessedReq.setLoginUserId(userId); - toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); - statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() - .stream().map(WorkbenchConverter::convert).collect(Collectors.toList())); - res.setTodoCerter(statisticsVO); - stopWatch.stop(); - log.info("待办中心数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - //2.项目统计数据 - res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage - .declaredProjectOrgStatistics(year, user),defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); - if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { - res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage - .declaredProjectRegionStatistics(year, user),defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); - }else{ - res.setRegionDeclared(new WorkbenchVO.DeclaredStatistics()); - } - stopWatch.stop(); - log.info("项目统计数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - //3.所有公告按类型分 - NoticeListReq noticeListReq = new NoticeListReq(); - noticeListReq.setPageNumber(1); - noticeListReq.setPageSize(1000); - res.setNoticeList(noticeManage.listToMapByManager(noticeListReq,user)); - stopWatch.stop(); - log.info("公告 耗时,{} s",stopWatch.getTotalTimeSeconds()); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - //4.项目预警记录 - res.setProjectEarlyWarning(getProjectEarlyWarning(user)); - log.info("项目预警记录 耗时,{} s",stopWatch.getTotalTimeSeconds()); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - // 项目列表 - ProjectListReq projectListReq = new ProjectListReq(); - projectListReq.setPageNumber(1); - projectListReq.setPageSize(2000); - projectListReq.setProjectYear(year); - res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); - log.info("工作台 项目列表 耗时,{} s",stopWatch.getTotalTimeSeconds()); - }, ForkJoinPool.commonPool()) - ).join(); - - return res; - } - - private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) { - WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); - LambdaQueryWrapper projectWrapper = Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE); - EarlyWarningUtil.buildPermissonProjectWrapper(projectWrapper,user); - List projects = projectService.list(projectWrapper); - Set projectCodeS = Sets.newHashSet(); - Map projectNameMap = projects.stream() - .filter(p -> projectCodeS.add(p.getProjectCode())) - .collect(Collectors.toMap(Project::getProjectCode,Project::getProjectName)); - - //4.1 - //累积预警统计 - WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); - LambdaQueryWrapper overWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) - .or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)); - EarlyWarningUtil.buildPermissonFullWrapper(overWrapper,user); - Long overCount = earlyWarningRecordsService.count(overWrapper); - accumulate.setOver(overCount.intValue()); - LambdaQueryWrapper adventWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode()); - EarlyWarningUtil.buildPermissonFullWrapper(adventWrapper,user); - Long adventCount = earlyWarningRecordsService.count(adventWrapper); - accumulate.setAdvent(adventCount.intValue()); - projectEarlyWarning.setAccumulate(accumulate); - - //4.2 - //当前 - //4.2.1 超期 - Page overPage = Page.of(1,1000); - Page adventPage = Page.of(1,1000); - Page normalPage = Page.of(1,1000); - LambdaQueryWrapper overPWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) - .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()) - .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) - .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); - projectEarlyWarningService.page(overPage,overPWrapper); - LambdaQueryWrapper adventPWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) - .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()) - .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) - .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); - projectEarlyWarningService.page(adventPage,adventPWrapper); - LambdaQueryWrapper normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) - .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) - .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) - .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); - projectEarlyWarningService.page(normalPage,normalWrapper); - - WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); - Long overTotal = overPage.getTotal(); - Long adventTotal = adventPage.getTotal(); - Long normalTotal = normalPage.getTotal(); - cuurent.setAdvent(adventTotal.intValue()); - cuurent.setOver(overTotal.intValue()); - cuurent.setNormal(normalTotal.intValue()); - projectEarlyWarning.setCurrent(cuurent); - - List warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(user.getRegionAdmin()&&!user.getSuperAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) - .eq((user.getIsOrgAdmin()&&!user.getSuperAdmin()) || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()) - .orderByDesc(WflowEarlyWarningRecords::getWarningTime)); - Set projectCodeSet = Sets.newHashSet(); - Map warningMap = warningRecords.stream() - .filter(w -> projectCodeSet.add(w.getProjectCode())) - .collect(Collectors.toMap(WflowEarlyWarningRecords::getProjectCode, w -> w)); - - if(CollUtil.isNotEmpty(overPage.getRecords())){ - List overVos = overPage.getRecords().stream().map(o -> { - ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); - //取最新一条预警信息 - if(warningMap.containsKey(vo.getProjectCode())){ - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); - vo.setRecordId(record.getId()); - } - vo.setProjectName(projectNameMap.get(o.getProjectCode())); - return vo; - }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getWarningTime).reversed()) - .collect(Collectors.toList()); - projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); - }else{ - projectEarlyWarning.setOvers(PageVo.empty()); - } - - if(CollUtil.isNotEmpty(adventPage.getRecords())){ - List adventVos = adventPage.getRecords().stream().map(o -> { - ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); - //取最新一条预警信息 - if(warningMap.containsKey(vo.getProjectCode())){ - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); - vo.setRecordId(record.getId()); - } - vo.setProjectName(projectNameMap.get(o.getProjectCode())); - return vo; - }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getWarningTime).reversed()) - .collect(Collectors.toList()); - projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); - }else{ - projectEarlyWarning.setAdvents(PageVo.empty()); - } - - if(CollUtil.isNotEmpty(normalPage.getRecords())){ - List normalVos = normalPage.getRecords().stream().map(o -> { - ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); - //取最新一条预警信息 - if(warningMap.containsKey(vo.getProjectCode())){ - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); - vo.setRecordId(record.getId()); - } - vo.setProjectName(projectNameMap.get(o.getProjectCode())); - return vo; - }).sorted(Comparator.comparing(ProjectEarlyWarningVO::getId).reversed()) - .collect(Collectors.toList()); - projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); - }else{ - projectEarlyWarning.setNormals(PageVo.empty()); - } - return projectEarlyWarning; - } - - /** - * 催办 - * @param recordId - * @return - */ - public String urging(Long recordId) { - WflowEarlyWarningRecords record = earlyWarningRecordsService.getById(recordId); - - VUtils.isTrue(Objects.isNull(record)) - .throwMessage("催办失败,id不存在!"); - String noticeMethod = record.getNoticeMethod(); - Integer noticeType = record.getNoticeType(); - String projectCode = record.getProjectCode(); - Project project = projectService.getProjectByCode(projectCode); - String batchEmployees = record.getBatchEmployees(); - Integer ruleType = record.getRuleType(); - String areaCode = record.getAreaCode(); - //如果是临期 可以取到 超期的小时数 - Integer overTime = record.getOverTime(); - String path = record.getPath(); - LocalDateTime instStart = record.getInstStart(); - Integer biz = record.getBiz(); - VUtils.isTrue(Objects.isNull(project)).throwMessage("催办失败,项目不存在!"); - if(StringUtils.isBlank(batchEmployees)){ - //如果批次员工号不存在 就取当前 - batchEmployees = record.getWarningEmployeecode(); - } - String noticeContent = record.getNoticeContent(); - //查出配置的模板 - WflowEarlyWarning config = earlyWarningService.getOne(Wrappers.lambdaQuery(WflowEarlyWarning.class) - .eq(WflowEarlyWarning::getAreaCode, areaCode) - .eq(WflowEarlyWarning::getRuleType, ruleType) - .last(BizConst.LIMIT_1)); - //如果配置能取到 就取模板的 - if(Objects.nonNull(config)){ - noticeContent = config.getNoticeContent(); - } - - VUtils.isTrue(StringUtils.isBlank(batchEmployees)) - .throwMessage("催办失败,员工为空!"); - String[] employees = batchEmployees.split(StrPool.COMMA); - //算出 当前和他的 小时差 临期 - Long adventBetween = ChronoUnit.HOURS.between(instStart,LocalDateTime.now()); - Integer times = 0; - for(String employee : employees){ - earlyWarningManage.urging(noticeMethod,noticeContent,adventBetween.intValue() - ,adventBetween.intValue(),biz, - instStart,employee,project, - ruleType,noticeType,path,batchEmployees,record.getNodeId()); - times++; - } - - return "催办成功了" + times + "个人"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java deleted file mode 100644 index 7ddf896..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.ningdatech.pmapi.workbench.model.vo; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; -import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; -import com.ningdatech.pmapi.sys.model.vo.ProjectEarlyWarningVO; -import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO; -import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname WorkbenchVO - * @Description - * @Date 2023/3/20 9:33 - * @Author PoffyZhang - */ -@Data -public class WorkbenchVO implements Serializable { - - @ApiModelProperty("待办中心统计数据 以及代办处理") - public TodoCenterStatisticsVO todoCerter; - - @ApiModelProperty("单位申报管理统计数据") - public DeclaredStatistics orgDeclared; - - @ApiModelProperty("区域申报管理统计数据 只有区域管理员才有数据") - public DeclaredStatistics regionDeclared; - - @ApiModelProperty("项目动态") - public List projects; - - @ApiModelProperty("公告列表") - public Map> noticeList; - - @ApiModelProperty("预警记录") - public List earlyWarning; - - @ApiModelProperty("项目预警记录") - public ProjectEarlyWarning projectEarlyWarning; - - @Data - public static class ProjectEarlyWarning { - @ApiModelProperty("统计数据-累积") - private WarningStatistics accumulate; - - @ApiModelProperty("统计数据-当前") - private WarningStatistics current; - - @ApiModelProperty("超期项目预警") - private PageVo overs; - - @ApiModelProperty("临期项目预警") - private PageVo advents; - - @ApiModelProperty("正常项目") - private PageVo normals; - } - - @Data - public static class WarningStatistics { - @ApiModelProperty("正常") - private Integer normal = 0; - - @ApiModelProperty("临期") - private Integer advent = 0; - - @ApiModelProperty("超期") - private Integer over = 0; - } - - @Data - public static class EarlyWarning { - @ApiModelProperty("类型") - private Integer type; - - @ApiModelProperty("类型名称") - private String typeName; - - @ApiModelProperty("总数") - private Integer total; - - @ApiModelProperty("预警记录") - private List records; - } - - @Data - public static class DeclaredStatistics { - @ApiModelProperty("总项目数") - private Integer totalNum = 0; - @ApiModelProperty("建设项目数") - private Integer buildNum = 0; - @ApiModelProperty("运维项目数") - private Integer operationNum = 0; - - @ApiModelProperty("待立项数") - private Integer notApprovedNum = 0; - @ApiModelProperty("已立项数") - private Integer approvedNum = 0; - @ApiModelProperty("建设中数") - private Integer constructionNum = 0; - @ApiModelProperty("待验收数") - private Integer tobeInspectedNum = 0; - @ApiModelProperty("已归档数") - private Integer archivedNum = 0; - - @ApiModelProperty("申报总金额") - private BigDecimal declaredAmount = BigDecimal.ZERO; - @ApiModelProperty("立项总金额") - private BigDecimal approvalAmount = BigDecimal.ZERO; - - - @ApiModelProperty("申报总金额-去年") - private BigDecimal declaredAmountLastYear = BigDecimal.ZERO; - @ApiModelProperty("立项总金额-去年") - private BigDecimal approvalAmountLastYear = BigDecimal.ZERO; - @ApiModelProperty("申报总金额-较去年 增长") - private BigDecimal declaredAmountGrowthRate = BigDecimal.ZERO; - @ApiModelProperty("立项总金额-较去年 增长") - private BigDecimal approvalAmountGrowthRate = BigDecimal.ZERO; - - public BigDecimal getDeclaredAmountGrowthRate(){ - if(Objects.isNull(declaredAmount)){ - this.declaredAmount = BigDecimal.ZERO; - } - -// if((Objects.nonNull(declaredAmount)&&declaredAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(declaredAmountLastYear) || -// declaredAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ -// return BigDecimal.valueOf(100); -// } - - if(Objects.nonNull(declaredAmountLastYear) && declaredAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ - return declaredAmount.subtract(declaredAmountLastYear).multiply(BigDecimal.valueOf(100)) - .divide(declaredAmountLastYear,BigDecimal.ROUND_CEILING) - .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); - } - return BigDecimal.ZERO; - } - - public BigDecimal getApprovalAmountGrowthRate(){ - if(Objects.isNull(approvalAmount)){ - this.approvalAmount = BigDecimal.ZERO; - } -// if((Objects.nonNull(approvalAmount)&&approvalAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(approvalAmountLastYear) || -// approvalAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ -// return BigDecimal.valueOf(100); -// } - - if(Objects.nonNull(declaredAmountLastYear) && approvalAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ - return approvalAmount.subtract(approvalAmountLastYear).multiply(BigDecimal.valueOf(100)) - .divide(approvalAmountLastYear,BigDecimal.ROUND_CEILING) - .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); - } - return BigDecimal.ZERO; - } - } -} 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 deleted file mode 100644 index ad581dd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 2fc9e02..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java +++ /dev/null @@ -1,81 +0,0 @@ -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, 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 deleted file mode 100644 index c5de710..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java +++ /dev/null @@ -1,213 +0,0 @@ -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.gov.contants.BizProjectContant; -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.stereotype.Component; -import javax.annotation.Resource; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.net.URLEncoder; -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; - - //2、定义方法实现 多个文件合并转为1个pdf文件 - public String offs2Pdf() { - AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE); - - try { - //2-1、传参文件对象转换输出PDF文件 - //1)、定义集合,存储待转换的原文件 - List fileList =new ArrayList(); - //2)、定义转换后的pdf文件输出流 - OutputStream out = null; - //3)、添加原文件到集合 - fileList.add(new File("/temp/111.xlsx")); - //4)、赋值转换后的pdf文件输出流 - out=new FileOutputStream(new File("/temp/offices2_pdf.pdf")); - //5)、调用方法,执行将多个文件转为pdf文件 - ha.OFDToPDF(fileList, 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); - } - - public byte[] downloadToPdfStream(Long fileId) { - com.ningdatech.file.entity.File file = fileService.getById(fileId); - return downloadAndToPdf(file); - } - - 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转换服务器 - // 或者 已经是PDF文件 也不用转PDF - if(BizConst.DEV.equals(active) || - file.getOriginalFileName().endsWith(BizProjectContant.ProjectCollection.PDF_SUFFIX)){ - 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(); - } - }else{ - log.info("都不满足条件 并且 没有转换文件!"); - } - outputStream.flush(); - }catch (Exception e){ - log.error(e.getMessage()); - }finally { - oss.shutdown(); - try { - ha.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - } - - private byte[] downloadAndToPdf(com.ningdatech.file.entity.File file) { - 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();) { - int read; - //测试环境 转不了PDF 请求不了 WPS转换服务器 - if(BizConst.DEV.equals(active)){ - byte[] byt = new byte[stream.available()]; - stream.read(byt); - return byt; - }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); - for(File f : fileList){ - //用完就删 - f.deleteOnExit(); - } - byte[] byt = new byte[fileInputStream.available()]; - fileInputStream.read(byt); - return byt; - } - }catch (Exception e){ - log.error(e.getMessage()); - }finally { - oss.shutdown(); - try { - ha.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - return null; - } - - 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 deleted file mode 100644 index 31ae6a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index aef699a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index beed60d..0000000 --- a/pmapi/src/main/resources/application-dev.yml +++ /dev/null @@ -1,248 +0,0 @@ -server: - port: 38888 - servlet: - context-path: /pm - -spring: - mvc: - pathmatch: - matching-strategy: ant_path_matcher - session: - store-type: redis - redis: - namespace: "spring:session" - timeout: 864000 - redis: - timeout: 5000 - host: 47.98.125.47 - port: 26379 - database: 4 - password: Ndkj1234 - jedis: - pool: - max-active: 200 - max-idle: 500 - min-idle: 8 - max-wait: 10000 - application: - name: pm - jackson: - default-property-inclusion: non_null - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - jpa: - properties: - hibernate: - default_schema: PUBLIC - hbm2ddl: - auto: update - show_sql: true - show-sql: true - hibernate: - ddl-auto: update - datasource: - type: com.zaxxer.hikari.HikariDataSource - driverClassName: com.kingbase8.Driver - url: jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 - username: SYSTEM - password: Ndkj1234 - # 数据源 - hikari: - # 是客户端等待连接池连接的最大毫秒数 - connection-timeout: 30000 - # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 5 - # 配置最大池大小 - maximum-pool-size: 300 - # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) - idle-timeout: 60000 - # 池中连接关闭后的最长生命周期(以毫秒为单位) - max-lifetime: 600000 - # 配置从池返回的连接的默认自动提交行为。默认值为true。 - auto-commit: true - # 开启连接监测泄露 - leak-detection-threshold: 5000 - # 测试连接数据库 - connection-test-query: SELECT 1 - #设置上传 单个文件的大小 - servlet: - multipart: - max-file-size: 100MB - max-request-size: 150MB -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - logic-delete-value: true - logic-not-delete-value: false -logging: - config: classpath:logback-spring.xml - #日志配置 - level: - root: info - file: - path: logs -nd: - cache: - type: REDIS - serializerType: ProtoStuff - cacheNullVal: true - def: - keyPrefix: pm - log: - enabled: true - type: DB - # 文件存储 - file: - storage-type: ALI_OSS - ali: - protocol: https:// - bucket: devplat - urlPrefix: oss-cn-hangzhou.aliyuncs.com - endpoint: oss-cn-hangzhou.aliyuncs.com - accessKeyId: LTAI4GL7uypycnBjiRn55rMG - accessKeySecret: qwYC7bW9bkStsko7qkLVnToAzj0Y98 -# 日志文件配置 -log: - path: ./logs - info: - file-size: 50MB - max-size: 5 - total-size: 200MB - error: - file-size: 10MB - max-size: 5 - total-size: 50MB - -swagger: - enabled: true - -flowable: - async-executor-activate: true - #关闭一些不需要的功能服务 - rest-api-enabled: false - idm: - enabled: false - common: - enabled: false - dmn: - enabled: false - form: - enabled: false - app: - enabled: false - -wflow: - file: - max-size: 20 #最大文件上传大小,MB - -sa-token: - # token 名称 (同时也是cookie名称) - token-name: wflowToken - # token 有效期,单位s 默认30天, -1代表永不过期 - timeout: 172800 - # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 - activity-timeout: -1 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # token风格 - token-style: uuid - # 是否输出操作日志 - is-log: false -#浙政钉公司顶级organizationCode -organization: - dept-visible-scopes: - - GO_ff70e47bae684fdba0d64f4acab85661 - -yxt: -# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl - wsdl-url: classpath:/wsdl.xml - #账号 - user-code: hzndkj - #密码 - password: hzndkj@2021 - #音信通开关 - sms-enable: true - tel-enable: true - -#省局联审 请求信息 -provincial: -# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign - host: http://223.4.72.75/prometheus-zhejiang_foreign - pushUrl: /api/v1/foreign/importantPro - detailUrl: /api/v1/foreign/importantProView - domainUrl: /api/v1/foreign/dominantUnit - key: 7fb48b518c6044a5a44deddd11b445e3 - secret: ced8fff70018413c9516c58f95885624 - - -#天印服务器接口信息 -irs: - is-search-app: false - digital-resource-indicators: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm - interface-name: 99E2bic31KdXzaa7 - app-key: A331101453557202109017383 - app-secret: 496f0f2a19994f76b4fd9dae087366c7 - seal-platform: - project-id: 330001110 - project-secret: 70e512d40c8f440484db4acab181570a - access-key: 42bcb49bea174986a3bfdfba7d005566 - secret-key: bebff29877d4443abd67fc4f8fb335d8 - api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf - app-report: - url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl - appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c - appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b - push-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - search-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - province-gov: - can-search: false - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm - interfaceName: 62vd5jAdM0b7Gr00 - appSecret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - push-project-detail: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm - 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm - refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm - interface-local-refresh: - method: GET - request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} - refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} -hostname: iZbp13nwyvib53j4j1p2xoZ -project: - push-url: http://120.26.44.207:38088/open/api/v1/project-receive/save - no-effective-url: http://120.26.44.207:38088/open/api/v1/project-receive/not-effective - delete-all-url: http://120.26.44.207:38088/open/api/v1/project-receive/delete-all -login: - phone-verify-code: - skip: true - url: http://lspm.ningdatech.com/login -web: - url: http://lspm.ningdatech.com -# 专家报名验证码校验 -expert-registration: - verify-code: - check: false - - diff --git a/pmapi/src/main/resources/application-pre.yml b/pmapi/src/main/resources/application-pre.yml deleted file mode 100644 index 23ebcb4..0000000 --- a/pmapi/src/main/resources/application-pre.yml +++ /dev/null @@ -1,248 +0,0 @@ -server: - port: 38888 - servlet: - context-path: /pm - #最大并发数,默认200 - tomcat: - threads: - max: 600 -spring: - mvc: - pathmatch: - matching-strategy: ant_path_matcher - session: - store-type: redis - redis: - namespace: "spring:session" - redis: - timeout: 5000 - host: localhost - port: 6379 - database: 0 - password: Ndkj1234 - jedis: - pool: - max-active: 200 - max-idle: 500 - min-idle: 8 - max-wait: 10000 - application: - name: pm - jackson: - default-property-inclusion: non_null - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - jpa: - properties: - hibernate: - default_schema: PUBLIC - hbm2ddl: - auto: update - show_sql: true - show-sql: true - hibernate: - ddl-auto: update - datasource: - type: com.zaxxer.hikari.HikariDataSource - driverClassName: com.kingbase8.Driver - url: jdbc:kingbase8://10.53.168.41:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&nullCatalogMeansCurrent=true - username: SYSTEM - password: Ndkj1234 - # 数据源 - hikari: - # 是客户端等待连接池连接的最大毫秒数 - connection-timeout: 30000 - # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 10 - # 配置最大池大小 - maximum-pool-size: 300 - # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) - idle-timeout: 60000 - # 池中连接关闭后的最长生命周期(以毫秒为单位) - max-lifetime: 600000 - # 配置从池返回的连接的默认自动提交行为。默认值为true。 - auto-commit: true - # 开启连接监测泄露 - leak-detection-threshold: 5000 - # 测试连接数据库 - connection-test-query: SELECT 1 - #设置上传 单个文件的大小 - servlet: - multipart: - max-file-size: 100MB - max-request-size: 150MB -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - logic-delete-value: true - logic-not-delete-value: false -logging: - config: classpath:logback-spring.xml - #日志配置 - level: - root: info - file: - path: logs -nd: - cache: - type: REDIS - serializerType: ProtoStuff - cacheNullVal: true - def: - keyPrefix: pm - log: - enabled: true - type: DB - # 文件存储 - file: - storage-type: ALI_OSS - ali: - protocol: http:// - bucket: projectmangmentoss - urlPrefix: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn - endpoint: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn - accessKeyId: XS3kNLtfW5i41SaC - accessKeySecret: 2cywvSZWANml7pZXxRAeAiHfisIhqm -# 日志文件配置 -log: - path: ./logs - info: - file-size: 50MB - max-size: 5 - total-size: 200MB - error: - file-size: 10MB - max-size: 5 - total-size: 50MB - -swagger: - enabled: true - -flowable: - async-executor-activate: true - #关闭一些不需要的功能服务 - rest-api-enabled: false -# database-schema-update: false - idm: - enabled: false - common: - enabled: false - dmn: - enabled: false - form: - enabled: false - app: - enabled: false - -wflow: - file: - max-size: 20 #最大文件上传大小,MB - -sa-token: - # token 名称 (同时也是cookie名称) - token-name: wflowToken - # token 有效期,单位s 默认30天, -1代表永不过期 - timeout: 172800 - # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 - activity-timeout: -1 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # token风格 - token-style: uuid - # 是否输出操作日志 - is-log: false -#浙政钉公司顶级organizationCode -organization: - dept-visible-scopes: - - GO_c1a6f8d5338e4a468337b08da76e2e31 - -yxt: - wsdl-url: classpath:wsdl-prod.xml - #账号 - user-code: Lssdsjj - #密码 - password: Lssdsjj@2021 - #音信通开关 - sms-enable: true - tel-enable: true - -#省局联审 请求信息 -provincial: - host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign - pushUrl: /api/v1/foreign/importantPro - detailUrl: /api/v1/foreign/importantProView - domainUrl: /api/v1/foreign/dominantUnit - key: b5b2096953534a53991be4ea95f8cffa - secret: 1bec9b77134d4962ac466fbe9696b897 -# host: http://223.4.72.75/prometheus-zhejiang_foreign -# pushUrl: /api/v1/foreign/importantPro -# detailUrl: /api/v1/foreign/importantProView -# key: b5b2096953534a53991be4ea95f8cffa -# secret: 1bec9b77134d4962ac466fbe9696b897 - - -#天印服务器接口信息 -irs: - is-search-app: true - digital-resource-indicators: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm - interfaceName: 99E2bic31KdXzaa7 - app-key: A331101453557202109017383 - app-secret: 496f0f2a19994f76b4fd9dae087366c7 - seal-platform: - project-id: 330001110 - project-secret: 70e512d40c8f440484db4acab181570a - access-key: 42bcb49bea174986a3bfdfba7d005566 - secret-key: bebff29877d4443abd67fc4f8fb335d8 - api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf - app-report: - url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl - appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c - appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b - push-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - search-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - province-gov: - can-search: true - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm - interfaceName: 62vd5jAdM0b7Gr00 - appSecret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - push-project-detail: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm - 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm - refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm - interface-local-refresh: - method: GET - request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} - refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} -hostname: iZ6mx01asxnsmennpzoxooZ -project: - push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save - no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective - delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all -login: - phone-verify-code: - skip: true - url: http://60.188.225.145:8080/login -web: - url: http://60.188.225.145:8080 \ No newline at end of file diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml deleted file mode 100644 index 5bdca26..0000000 --- a/pmapi/src/main/resources/application-prod.yml +++ /dev/null @@ -1,248 +0,0 @@ -server: - port: 38888 - servlet: - context-path: /pm - #最大并发数,默认200 - tomcat: - threads: - max: 600 -spring: - mvc: - pathmatch: - matching-strategy: ant_path_matcher - session: - store-type: redis - redis: - namespace: "spring:session" - redis: - timeout: 5000 - host: localhost - port: 6379 - database: 0 - password: Ndkj1234 - jedis: - pool: - max-active: 200 - max-idle: 500 - min-idle: 8 - max-wait: 10000 - application: - name: pm - jackson: - default-property-inclusion: non_null - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - jpa: - properties: - hibernate: - default_schema: PUBLIC - hbm2ddl: - auto: update - show_sql: true - show-sql: true - hibernate: - ddl-auto: update - datasource: - type: com.zaxxer.hikari.HikariDataSource - driverClassName: com.kingbase8.Driver - url: jdbc:kingbase8://10.53.172.221:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&nullCatalogMeansCurrent=true - username: SYSTEM - password: Ndkj1234 - # 数据源 - hikari: - # 是客户端等待连接池连接的最大毫秒数 - connection-timeout: 30000 - # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 10 - # 配置最大池大小 - maximum-pool-size: 300 - # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) - idle-timeout: 60000 - # 池中连接关闭后的最长生命周期(以毫秒为单位) - max-lifetime: 600000 - # 配置从池返回的连接的默认自动提交行为。默认值为true。 - auto-commit: true - # 开启连接监测泄露 - leak-detection-threshold: 5000 - # 测试连接数据库 - connection-test-query: SELECT 1 - #设置上传 单个文件的大小 - servlet: - multipart: - max-file-size: 100MB - max-request-size: 150MB -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - logic-delete-value: true - logic-not-delete-value: false -logging: - config: classpath:logback-spring.xml - #日志配置 - level: - root: info - file: - path: logs -nd: - cache: - type: REDIS - serializerType: ProtoStuff - cacheNullVal: true - def: - keyPrefix: pm - log: - enabled: true - type: DB - # 文件存储 - file: - storage-type: ALI_OSS - ali: - protocol: http:// - bucket: projectmangmentoss - urlPrefix: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn - endpoint: oss-cn-lishui-gov-d01-a.ops.lsdx-zw.gov.cn - accessKeyId: XS3kNLtfW5i41SaC - accessKeySecret: 2cywvSZWANml7pZXxRAeAiHfisIhqm -# 日志文件配置 -log: - path: ./logs - info: - file-size: 50MB - max-size: 30 - total-size: 2048MB - error: - file-size: 10MB - max-size: 30 - total-size: 300MB - -swagger: - enabled: true - -flowable: - async-executor-activate: true - #关闭一些不需要的功能服务 - rest-api-enabled: false - # database-schema-update: false - idm: - enabled: false - common: - enabled: false - dmn: - enabled: false - form: - enabled: false - app: - enabled: false - -wflow: - file: - max-size: 20 #最大文件上传大小,MB - -sa-token: - # token 名称 (同时也是cookie名称) - token-name: wflowToken - # token 有效期,单位s 默认30天, -1代表永不过期 - timeout: 172800 - # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 - activity-timeout: -1 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # token风格 - token-style: uuid - # 是否输出操作日志 - is-log: false -#浙政钉公司顶级organizationCode -organization: - dept-visible-scopes: - - GO_c1a6f8d5338e4a468337b08da76e2e31 - -yxt: - wsdl-url: classpath:wsdl-prod.xml - #账号 - user-code: Lssdsjj - #密码 - password: Lssdsjj@2021 - #音信通开关 - sms-enable: true - tel-enable: true - -#省局联审 请求信息 -provincial: - host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign - pushUrl: /api/v1/foreign/importantPro - detailUrl: /api/v1/foreign/importantProView - domainUrl: /api/v1/foreign/dominantUnit - key: b5b2096953534a53991be4ea95f8cffa - secret: 1bec9b77134d4962ac466fbe9696b897 -# host: http://223.4.72.75/prometheus-zhejiang_foreign -# pushUrl: /api/v1/foreign/importantPro -# detailUrl: /api/v1/foreign/importantProView -# key: b5b2096953534a53991be4ea95f8cffa -# secret: 1bec9b77134d4962ac466fbe9696b897 - - -#天印服务器接口信息 -irs: - is-search-app: true - digital-resource-indicators: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm - interfaceName: 99E2bic31KdXzaa7 - app-key: A331101453557202109017383 - app-secret: 496f0f2a19994f76b4fd9dae087366c7 - seal-platform: - project-id: 330001110 - project-secret: 70e512d40c8f440484db4acab181570a - access-key: 42bcb49bea174986a3bfdfba7d005566 - secret-key: bebff29877d4443abd67fc4f8fb335d8 - api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf - app-report: - url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl - appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c - appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b - push-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - search-app: - url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm - appScret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - province-gov: - can-search: true - interfaceName: 62vd5jAdM0b7Gr00 - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm - appSecret: 496f0f2a19994f76b4fd9dae087366c7 - appKey: A331101453557202109017383 - push-project-detail: - url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm - 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: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm - refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm - interface-local-refresh: - method: GET - request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} - refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} -hostname: iZ6mx01gyeodd80imxd2gbZ -project: - push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save - no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective - delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all -login: - phone-verify-code: - skip: false - url: http://60.188.225.145/login -web: - url: http://60.188.225.145 \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/AppTests.java b/pmapi/src/test/java/com/ningdatech/pmapi/AppTests.java deleted file mode 100644 index be21a0e..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/AppTests.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi; - -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -/** - *

- * AppRunTests - *

- * - * @author WendyYang - * @since 19:27 2022/5/10 - */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = App.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class AppTests { - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java deleted file mode 100644 index ed6efcb..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.cctask; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.wflow.bean.entity.WflowCcTasks; -import com.wflow.service.WflowCcTasksService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; - -/** - * @Classname CcTaskTest - * @Description - * @Date 2023/6/30 16:52 - * @Author PoffyZhang - */ -public class CcTaskTest extends AppTests { - - @Autowired - private WflowCcTasksService wflowCcTasksService; - - @Test - public void test(){ - String nodeId = "node_649e9620711424df271ba98c"; - String instanceId = "72fffd9c-1722-11ee-b7f5-02426daa406d"; - List ccTasks = wflowCcTasksService.list(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getNodeId,nodeId) - .eq(WflowCcTasks::getInstanceId,instanceId)); - System.out.println(JSON.toJSONString(ccTasks)); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java deleted file mode 100644 index 47ff237..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.ningdatech.pmapi.collection; - -import com.alibaba.fastjson.JSON; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import java.io.*; -import java.time.LocalDateTime; -import java.util.*; - -/** - * @Classname SaveCollectionTest - * @Description - * @Date 2023/9/4 17:43 - * @Author PoffyZhang - */ -public class SaveCollectionTest extends AppTests {// - - @Autowired - private GovProjectCollectionManage manage; - - @Autowired - private GenerateProjectCodeUtil projectCodeUtil; - - @Test - public void importData() throws Exception { - Workbook wb; - File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.xlsx"); - wb = readExcel(new FileInputStream(f),f.getName()); - Row row = null; - if(wb != null) { - //获取第一个sheet - Sheet sheet = wb.getSheetAt(0); - //获取最大行数 - int rownum = sheet.getPhysicalNumberOfRows(); - - //获取第一行 - row = sheet.getRow(0); - //获取最大列数 - for (int i = 1; i < rownum; i++) { - row = sheet.getRow(i); - if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ - break; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - - GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); - // - String projName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjName(projName); - baseinfoDTO.setBaseAreaCode(RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); - baseinfoDTO.setBaseAreaName("丽水市"); - baseinfoDTO.setAreaCode(RegionConst.RC_LS); - baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - baseinfoDTO.setTongTime(LocalDateTime.now()); - baseinfoDTO.setBizTime(LocalDateTime.now()); - baseinfoDTO.setOp("insert"); - String principal = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjPrincipal(principal); - String contacts = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjContacts(contacts); - String contactsCall = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjContactsCall(contactsCall); - String baseProvManDeprt = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProvManDeprt(baseProvManDeprt); - String baseProvManDeprtDing = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProvManDeprtDing(baseProvManDeprtDing); - String baseManDeprt = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseManDeprt(baseManDeprt); - String baseManDeprtDing = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseManDeprtDing(baseManDeprtDing); - String baseProjType = Objects.nonNull(row.getCell(15)) ? row.getCell(15).toString() : StringUtils.EMPTY; - if("0".equals(baseProjType)){ - baseProjType = "01"; - }else if("1".equals(baseProjType)){ - baseProjType = "04"; - } - baseinfoDTO.setBaseProjType(baseProjType); - String baseProjSetProg = Objects.nonNull(row.getCell(17)) ? row.getCell(17).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjSetProg(baseProjSetProg); - - saveDTO.setBaseinfo(baseinfoDTO); - - GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); - String baseProjSetYear = Objects.nonNull(row.getCell(22)) ? row.getCell(22).toString() : StringUtils.EMPTY; - applyDTO.setBaseProjSetYear(baseProjSetYear); - String baseProjIntro = Objects.nonNull(row.getCell(23)) ? row.getCell(23).toString() : StringUtils.EMPTY; - applyDTO.setBaseProjIntro(baseProjIntro); - saveDTO.setApply(applyDTO); - //生产编号 - String projId = projectCodeUtil.generateProjectCode(saveDTO); - saveDTO.setBaseProjId(projId); - saveDTO.getBaseinfo().setBaseProjId(projId); - saveDTO.getApply().setBaseProjId(projId); - UserInfoDetails user = new UserInfoDetails(); - user.setRegionCode(RegionConst.RC_LS); - user.setUsername("系统导入"); - String save = ""; - try{ - save = manage.save(saveDTO, user); - }catch (Exception e){ - e.printStackTrace(); - } - System.out.println(JSON.toJSONString(save)); - } - } - - System.out.println("导入完成"); - } - - //这个下面是单独函数 - public static Workbook readExcel(InputStream is, String extString){ - Workbook wb = null; - extString = extString.substring(extString.lastIndexOf(".")); - try { - if(".xls".equals(extString)){ - return wb = new HSSFWorkbook(is); - }else if(".xlsx".equals(extString)){ - return wb = new XSSFWorkbook(is); - }else { - return wb = null; - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return wb; - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java b/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java deleted file mode 100644 index 133a10d..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.ningdatech.pmapi.collection; - -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.common.constant.RegionConst; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.io.*; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname SaveCollectionTest - * @Description - * @Date 2023/9/4 17:43 - * @Author PoffyZhang - */ -public class SaveCollectionTest331125 extends AppTests {// - - @Autowired - private GovProjectCollectionManage manage; - - @Autowired - private GenerateProjectCodeUtil projectCodeUtil; - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - @Autowired - private IGovBizProjectApplyService applyService; - @Autowired - private IGovBizProjectApproveService approveService; - @Autowired - private IGovBizProjectCimplementService cimplementService; - @Autowired - private IGovBizProjectMimplementService mimplementService; - @Autowired - private IGovBizProjectProcureService procureService; - - @Test - public void importData() throws Exception { - Workbook wb; - File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx"); - wb = readExcel(new FileInputStream(f),f.getName()); - Row row = null; - if(wb != null) { - //获取第一个sheet - Sheet sheet = wb.getSheetAt(0); - //获取最大行数 - int rownum = sheet.getPhysicalNumberOfRows(); - - //获取第一行 - row = sheet.getRow(0); - //获取最大列数 - for (int i = 1; i < rownum; i++) { - row = sheet.getRow(i); - if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ - break; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - - GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); - // - String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjName(projName); - baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST); - baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME); - baseinfoDTO.setAreaCode(RegionConst.RC_LS); - baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - baseinfoDTO.setTongTime(LocalDateTime.now()); - baseinfoDTO.setBizTime(LocalDateTime.now()); - baseinfoDTO.setOp("insert"); - String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjPrincipal(principal); - String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjContacts(contacts); - baseinfoDTO.setBaseProjType("01"); - saveDTO.setBaseinfo(baseinfoDTO); - - GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); - String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString() : StringUtils.EMPTY; - applyDTO.setBaseProjSetYear(baseProjSetYear); - saveDTO.setApply(applyDTO); - //生产编号 - String projId = projectCodeUtil.generateProjectCode(saveDTO); - saveDTO.setBaseProjId(projId); - saveDTO.getBaseinfo().setBaseProjId(projId); - saveDTO.getApply().setBaseProjId(projId); - UserInfoDetails user = new UserInfoDetails(); - user.setRegionCode(RegionConst.LS_KF); - user.setUsername("系统导入"); - String save = ""; - try{ - GovBizProjectBaseinfo old = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjName, projName) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(old)){ - save = manage.save(saveDTO, user); - }else{ - System.out.println(projName + ",重复了 要改到经开区里"); - String newProjId = old.getBaseProjId().replace("331100000","331118000"); - baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjName, projName) - .eq(GovBizProjectBaseinfo::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectBaseinfo::getBaseAreaCode,RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST) - .set(GovBizProjectBaseinfo::getBaseProjId,newProjId)); - applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjName, projName) - .eq(GovBizProjectApply::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectApply::getBaseProjId,newProjId)); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjName, projName) - .eq(GovBizProjectApprove::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectApprove::getBaseProjId,newProjId)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjName, projName) - .eq(GovBizProjectCimplement::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectCimplement::getBaseProjId,newProjId)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjName, projName) - .eq(GovBizProjectMimplement::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectMimplement::getBaseProjId,newProjId)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjName, projName) - .eq(GovBizProjectProcure::getBaseProjId, old.getBaseProjId()) - .set(GovBizProjectProcure::getBaseProjId,newProjId)); - } - }catch (Exception e){ - e.printStackTrace(); - } - System.out.println(JSON.toJSONString(save)); - } - } - - System.out.println("导入完成"); - } - - @Test - public void test2() throws FileNotFoundException { - //先删除 开发区的 - List lss = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseAreaCode, RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST)); - List codes = lss.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - applyService.remove(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,codes)); - approveService.remove(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,codes)); - cimplementService.remove(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .in(GovBizProjectCimplement::getBaseProjId,codes)); - mimplementService.remove(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .in(GovBizProjectMimplement::getBaseProjId,codes)); - procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,codes)); - baseinfoService.remove(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .in(GovBizProjectBaseinfo::getBaseProjId,codes)); - - Workbook wb; - File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx"); - wb = readExcel(new FileInputStream(f),f.getName()); - Row row = null; - if(wb != null) { - //获取第一个sheet - Sheet sheet = wb.getSheetAt(0); - //获取最大行数 - int rownum = sheet.getPhysicalNumberOfRows(); - - //获取第一行 - row = sheet.getRow(0); - //获取最大列数 - for (int i = 1; i < rownum; i++) { - row = sheet.getRow(i); - if (Objects.isNull(row) || Objects.isNull(row.getCell(0))) { - break; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - - GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO(); - // - String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjName(projName); - baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST); - baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME); - baseinfoDTO.setAreaCode(RegionConst.RC_LS); - baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - baseinfoDTO.setTongTime(LocalDateTime.now()); - baseinfoDTO.setBizTime(LocalDateTime.now()); - baseinfoDTO.setOp("insert"); - String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjPrincipal(principal); - String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; - baseinfoDTO.setBaseProjContacts(contacts); - baseinfoDTO.setBaseProjType("01"); - saveDTO.setBaseinfo(baseinfoDTO); - - GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO(); - String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString().substring(0,4) : StringUtils.EMPTY; - applyDTO.setBaseProjSetYear(baseProjSetYear); - saveDTO.setApply(applyDTO); - //生产编号 - String projId = projectCodeUtil.generateProjectCode(saveDTO); - saveDTO.setBaseProjId(projId); - saveDTO.getBaseinfo().setBaseProjId(projId); - saveDTO.getApply().setBaseProjId(projId); - UserInfoDetails user = new UserInfoDetails(); - user.setRegionCode(RegionConst.LS_KF); - user.setUsername("系统导入"); - String save = ""; - try { - save = manage.save(saveDTO, user); - }catch (Exception e){ - e.printStackTrace(); - } - System.out.println(JSON.toJSONString(save)); - } - } - } - - //这个下面是单独函数 - public static Workbook readExcel(InputStream is, String extString){ - Workbook wb = null; - extString = extString.substring(extString.lastIndexOf(".")); - try { - if(".xls".equals(extString)){ - return wb = new HSSFWorkbook(is); - }else if(".xlsx".equals(extString)){ - return wb = new XSSFWorkbook(is); - }else { - return wb = null; - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return wb; - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/common/helper/RegionCacheHelperTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/common/helper/RegionCacheHelperTest.java deleted file mode 100644 index 5123e5e..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/common/helper/RegionCacheHelperTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.common.helper; - -import com.ningdatech.pmapi.AppTests; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import static org.junit.jupiter.api.Assertions.*; - -/** - *

- * RegionCacheHelperTest - *

- * - * @author WendyYang - * @since 15:52 2023/3/7 - */ -class RegionCacheHelperTest extends AppTests { - - @Autowired - private RegionCacheHelper regionCacheHelper; - - @Test - void listChildren() { - regionCacheHelper.listChildren("331100", 2).forEach(System.out::println); - } -} \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java deleted file mode 100644 index 48dd2df..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/cpu/CPUTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.cpu; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class CPUTest { - public static ExecutorService executorService = Executors.newFixedThreadPool(10); - - public static volatile boolean flag = true; - - public static void main(String[] args) { - for(int i = 0;i < 10;i++){ - executorService.execute(() -> { - while (flag) { - // 一个复杂的计算任务 - long x = 123456789123456789L; - for (int j = 0; j < 10000; j++) { - if(!flag){ - break; - } - x = (x * 123456789123456789L) % 123456789; - } - } - }); - } - - try{ - Thread.sleep(10000); - executorService.shutdownNow(); - flag = false; - }catch (Exception e){ - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java deleted file mode 100644 index 9168b03..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.pmapi.employee; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; -import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * @Classname EmployeeTest - * @Description - * @Date 2023/9/6 14:34 - * @Author PoffyZhang - */ -public class EmployeeTest extends AppTests { - - @Autowired - private IDingEmployeeInfoService dingEmployeeInfoService; - - @Autowired - private IDingOrganizationService dingOrganizationService; - - @Autowired - private IUserInfoService userInfoService; - - @Autowired - private OrganizationBatchGetTask organizationBatchGetTask; - - @Autowired - private EmployeeBatchGetTask employeeBatchGetTask; - - @Test - public void test(){ - List employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeName, "吴玉斌")); - - for(DingEmployeeInfo employee : employees){ - UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employee.getEmployeeCode()) - .last(BizConst.LIMIT_1)); - - if(Objects.nonNull(user)){ - DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode()) - .last(BizConst.LIMIT_1)); - user.setRegionCode(RegionConst.LS_KF); - user.setEmpPosUnitCode(employee.getEmpPosUnitCode()); - user.setEmpPosUnitName(organization.getOrganizationName()); - userInfoService.updateById(user); - }else{ - DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode()) - .last(BizConst.LIMIT_1)); - UserInfo saveUser = new UserInfo(); - saveUser.setRegionCode(RegionConst.LS_KF); - saveUser.setEmpPosUnitCode(employee.getEmpPosUnitCode()); - saveUser.setEmpPosUnitName(organization.getOrganizationName()); - saveUser.setCreateOn(LocalDateTime.now()); - saveUser.setUsername("吴玉斌"); - saveUser.setRealName("吴玉斌"); - saveUser.setUpdateOn(LocalDateTime.now()); - saveUser.setAccountId(employee.getAccountId()); - saveUser.setEmployeeCode(employee.getEmployeeCode()); - userInfoService.save(saveUser); - } - - } - } - - @Test - public void test2(){ - String orgCode = "GO_4e6be07f25594df88e7bd1b7b7cdf9a8"; - organizationBatchGetTask.organizationGetSubs(orgCode); - } - - @Test - public void test3(){ - String orgCode = "GO_1aceac0b3a664afbb31ea0d627189781"; - employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode); - } - - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/expert/ExpertTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/expert/ExpertTest.java deleted file mode 100644 index 6fd47a3..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/expert/ExpertTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ningdatech.pmapi.expert; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; -import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; -import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.service.IExpertTagService; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @Classname ExpertTest - * @Description - * @Date 2023/11/24 9:35 - * @Author PoffyZhang - */ -public class ExpertTest extends AppTests { - - @Autowired - private IExpertTagService expertTagService; - - @Autowired - private IExpertUserFullInfoService expertUserFullInfoService; - - @Test - public void test(){ - List lsRegionCodes = RegionConst.LS_ARR; - List experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) - .in(ExpertUserFullInfo::getRegionCode,lsRegionCodes) - .eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); - - List goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); - Map> tagMap = goodAt.stream() - .collect(Collectors.groupingBy(ExpertTag::getUserId)); - - String networkCode = "1030000"; - String xinchuangCode = "2040000"; - String fanganCode = "2030000"; - String jishuCode = "2010000"; - String dangzhengCode = "1020000"; - String ruanyingCode = "2020000"; - String caiwuCode = "5600000"; - List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, - dangzhengCode,ruanyingCode,caiwuCode); - - List users = Lists.newArrayList(); - for(ExpertUserFullInfo e : experts) { - if (tagMap.containsKey(e.getUserId())) { - List expertTags = tagMap.get(e.getUserId()); - Boolean isContain = Boolean.FALSE; - for (ExpertTag expertTag : expertTags) { - if (specialTags.contains(expertTag.getTagCode())) { - isContain = Boolean.TRUE; - } - } - if (!isContain) { - users.add(e.getUserId()); - } - } - } - System.out.println(users); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java deleted file mode 100644 index 92242d3..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.file; - -import com.ningdatech.pmapi.common.util.CommonInputStreamResource; -import org.junit.Test; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.io.FileInputStream; - -import org.apache.http.entity.ContentType; -import java.io.*; - -/** - * @Classname ProvinceOssTest - * @Description - * @Date 2023/9/5 14:21 - * @Author PoffyZhang - */ -public class ProvinceOssTest { - - @Test - public void test() throws FileNotFoundException { - File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.xlsx"); - String url = "https://pms.zj.gov.cn/prometheus-zhejiang_file_service/api/v1/file/uploadFile"; - MultiValueMap params = new LinkedMultiValueMap<>(); - byte[] fileBytes = getBytesByFile(f); - ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes); - CommonInputStreamResource commonInputStreamResource = new CommonInputStreamResource(inputStream,fileBytes.length,f.getName()); - params.add("file",commonInputStreamResource); - RestTemplate restTemplate = new RestTemplate(); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("multipart/form-data"); - headers.setContentType(type); - HttpEntity formEntity = new HttpEntity(params, headers); - ResponseEntity res = restTemplate.postForEntity(url, formEntity, String.class); - System.out.println(res.getBody()); - } - - public static MultipartFile getMultipartFile(File file) { - try{ - FileInputStream fileInputStream = new FileInputStream(file); - MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(),ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); - return multipartFile; - }catch (Exception e){ - e.printStackTrace(); - } - return null; - } - - //将文件转换成Byte数组 - public static byte[] getBytesByFile(File file) { - try { - FileInputStream fis = new FileInputStream(file); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); - byte[] b = new byte[1000]; - int n; - while ((n = fis.read(b)) != -1) { - bos.write(b, 0, n); - } - fis.close(); - byte[] data = bos.toByteArray(); - bos.close(); - return data; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java deleted file mode 100644 index a7f8f86..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.ningdatech.pmapi.instance; - -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; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.runtime.ActivityInstance; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname InstanceTest - * @Description - * @Date 2023/2/16 14:44 - * @Author PoffyZhang - */ -@Slf4j -public class InstanceTest extends AppTests { - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private HistoryService historyService; - - @Autowired - private ProjectLibManage projectLibManage; - - @Autowired - private IProjectInstService projectInstService; - - @Test - public void test() { - String instanceId = "896fa188-96d8-11ed-9539-e2d4e8f16b2f"; - Object user = runtimeService.getVariable(instanceId, - "owner"); - System.out.println(JSON.toJSONString(user)); - } - - @Test - public void testHistory() { - //如果有已经被审核过的 节点 - List finished = historyService.createHistoricActivityInstanceQuery() - .processInstanceId("085af7ef-d133-11ed-a3f6-02426daa406d").finished() - .activityType("userTask") - .orderByHistoricActivityInstanceEndTime().asc().list(); - HistoricActivityInstance historicActivityInstance = finished.get(0); - System.out.println(finished); - } - - @Test - public void testRuntime() { - //如果有已经被审核过的 节点 - List userTask = runtimeService.createActivityInstanceQuery() - .processInstanceId("1709ebe3-d148-11ed-9351-02426daa406d") - .activityType("userTask") - .orderByActivityInstanceStartTime().asc().list(); - System.out.println(userTask); - } - - @Test - public void testTodo() { - String employeeCode = "GE_e9d5c7917acd4eeea04ff2a9454af62e"; - // 查出项目库项目 - ProjectListReq projectListReq = new ProjectListReq(); - List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectIdList)) { - System.out.println("没有项目"); - return; - } - 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()))); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setEmployeeCode(employeeCode); - req.setInstCodes(instCodes); - - // 自定义sql查询所有已办的任务实例 - String nativeSql = "SELECT ht.* FROM act_hi_taskinst ht WHERE assignee_ = '" + employeeCode + - "' and end_time_ is not NULL"; - NativeHistoricTaskInstanceQuery taskInstanceQuery = - historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); - List taskInstances = taskInstanceQuery.list(); - - Set set = new HashSet<>(); - List taskInstanceList = taskInstances.stream() - .filter(t -> instCodes.contains(t.getProcessInstanceId())) - .sorted(Comparator.comparing(HistoricTaskInstance::getEndTime)).collect(Collectors.toList()) - .stream() - .filter(v -> set.add(v.getProcessInstanceId())) - .collect(Collectors.toList()); - - System.out.println(taskInstanceList.size()); - } - - @Test - public void test2() { - // 获取节点处理结果 -// Map varMap = historyService.createHistoricVariableInstanceQuery() -// .processInstanceId("e99fe24c-d21c-11ed-af5d-02426daa406d") -// .variableNameLike("approve_%") -// .list().stream() -// .collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); - runtimeService.removeVariable("564102ce-d1ff-11ed-b694-02424b2b849f", "approve_7d2a191a-d1ff-11ed-b694-02424b2b849f"); - System.out.println(1); - } - - @Test - public void usageTimeStat() { - // 查询所有已完成的流程实例 - List processInstanceList = historyService.createHistoricProcessInstanceQuery() - .orderByProcessInstanceStartTime() - .desc() - .finished() - .list(); - - // 统计每个流程实例的审批耗时 - for (HistoricProcessInstance processInstance : processInstanceList) { - System.out.println("流程实例ID:" + processInstance.getId()); - System.out.println("流程开始时间:" + processInstance.getStartTime()); - System.out.println("流程结束时间:" + processInstance.getEndTime()); - System.out.println("流程耗时(ms):" + processInstance.getDurationInMillis() / 1000); - System.out.println("================================================================"); - } - } - - @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/CoreTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/CoreTest.java deleted file mode 100644 index d442f50..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/CoreTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ningdatech.pmapi.irs; - -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Maps; -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 com.ningdatech.pmapi.common.util.Md5Utils; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.gov.model.req.ProjectPushReq; -import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.*; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - -import javax.annotation.Resource; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname CoreTest - * @Description - * @Date 2023/8/31 17:21 - * @Author PoffyZhang - */ -@Slf4j -public class CoreTest {//extends AppTests - -// @Value("${irs.core-biz.appKey}") - private String appKey = "A331101453557202109017383"; - -// @Value("${irs.core-biz.appSecret}") - private String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; - -// @Value("${irs.core-biz.url}") - private String coreBizUrl = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm"; - -// @Value("${irs.core-biz.interfaceName}") - private String interfaceName = "Fc3re2cq7r64Qfa7"; - - @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 searchCoreBiz() { - long requestTime = System.currentTimeMillis(); - String businessName = ""; - String orgCode = ""; - Integer limit = 10; - Integer page = 1; - - String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, - HttpMethod.POST.name()); -// String secret = "15345863c0fb4a85a28b2b467e5e6253"; -// String secret = appSecret; -// String secret = RefreshKeyUtil.getRequestSecret(appKey, appSecret,requestTime); -// String secret = RefreshKeyUtil.refreshSecret(appKey, "78cde959148b4335b8eba556f9c8c7bf",requestTime); - System.out.println("secret:" + secret); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if(Objects.nonNull(factory)){ - restTemplate = new RestTemplate(factory); - }else{ - restTemplate = new RestTemplate(); - } - ForwardDTO dto = new ForwardDTO(); - Map map = Maps.newHashMap(); - map.put("dingCode",orgCode); - map.put("matterName",(StringUtils.isNotBlank(businessName)?businessName:StringUtils.EMPTY)); - map.put("useState",1); - map.put("limit",limit); - map.put("page",page); - map.put("appKey",appKey); - dto.setData(map); - dto.setUrl(coreBizUrl); - dto.setSecret(secret); - dto.setAppKey(appKey); - dto.setSecret(secret); - dto.setRequestTime(requestTime); - String sign = Md5Utils.hash(appKey + secret + requestTime); - dto.setSign(sign); - HttpHeaders headers = new HttpHeaders(); - MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); - headers.setContentType(type); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(dto, headers); - String url = "http://10.53.168.41:38088/open/api/v1/project-receive/forward"; - ResponseEntity forEntity = restTemplate.postForEntity(url,formEntity, String.class); - String body = forEntity.getBody(); - System.out.println(body); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/CurrentTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/CurrentTest.java deleted file mode 100644 index 544035b..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/CurrentTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.irs; - -import org.junit.Test; - -/** - * @Classname CurrentTest - * @Description - * @Date 2023/9/4 9:26 - * @Author PoffyZhang - */ -public class CurrentTest { - - @Test - public void currentTime(){ - System.out.println(System.currentTimeMillis()); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java deleted file mode 100644 index 736954b..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.ningdatech.pmapi.irs; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.user.constant.UserAvailableEnum; -import com.ningdatech.pmapi.user.entity.UserInfo; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.Page; -import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; -import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; -import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; -import org.junit.Test; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname EmployeeTest - * @Description - * @Date 2023/9/11 10:59 - * @Author PoffyZhang - */ -public class EmployeeTest extends AppTests { - - @Autowired - private IDingOrganizationService iDingOrganizationService; - - @Autowired - private ZwddIntegrationProperties zwddIntegrationProperties; - - @Autowired - private IDingEmployeeInfoService iDingEmployeeInfoService; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private IUserInfoService iUserInfoService; - - @Test - public void test(){ - String orgCode = "GO_3663776dcc2c414db2ed947e225bfc5b"; - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, orgCode) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); - System.out.println("所属单位 {} 要更新员工信息了:" + org.getOrganizationName()); - - List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = orgCode; - PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); - query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); - query.setReturnTotalSize(true); - query.setTenantId(zwddIntegrationProperties.getTenantId()); - int pageNo = 1; - query.setPageNo(pageNo); - query.setPageSize(100); - - // 查询组织下 用户信息 - GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - Page data = firstPageGenericResult.getData(); - if (Objects.isNull(data)){ - System.out.println("响应为空:{}" + organizationCode); - return; - } - System.out.println(JSON.toJSONString(data.getData())); - if (CollUtil.isNotEmpty(data.getData())) { - allOrganizationEmployeePositionList.addAll(data.getData()); - } - Long totalSize = data.getTotalSize(); - - System.out.println("dingOrganization :{}" + JSON.toJSONString(org)); - - System.out.println("totalSize :{},{}" + totalSize + "," + org.getOrganizationName()); - - List dingEmployeeInfoSaveRecordList = new ArrayList<>(); - assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); - System.out.println("dingEmployeeInfoSaveRecordList :{}" + JSON.toJSONString(dingEmployeeInfoSaveRecordList)); - // 批量保存用户信息 - saveBatch(dingEmployeeInfoSaveRecordList); - } - - private void saveBatch(List dingEmployeeInfoSaveRecordList) { - dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() - .filter(r -> ("true".equals(r.getMainJob()) - && "A".equals(r.getEmpStatus()) - && StringUtils.isNotBlank(r.getEmpPosUnitCode()) - && StringUtils.isNotBlank(r.getEmployeeCode())) - || "GE_48606ed7c10d4d15b0f931a9a4b89f21".equals(r.getEmployeeCode()) - ).collect(Collectors.toList()); - - Set uniqueKeySet = new HashSet(); - - List saveList = new ArrayList<>(); - - for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { - if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { - saveList.add(dingEmployeeInfo); - } - } - - List organizations = iDingOrganizationService.list(); - Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); - - System.out.println("saveList:" + JSON.toJSONString(saveList)); - for (DingEmployeeInfo dingEmployeeInfo : saveList) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - - DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(employeeInfo)) { - iDingEmployeeInfoService.save(dingEmployeeInfo); - } else { - dingEmployeeInfo.setId(employeeInfo.getId()); - iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); - } - generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); - } - } - - private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { - List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); - GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); - List employeeAccountIdDTOList = listGenericResult.getData(); - if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { - Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) - .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); - - List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); - - dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { - r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); - return r; - }).collect(Collectors.toList()); - dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); - } - } - private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { - List saveRecordList = new ArrayList<>(); - for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { - List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); - if (CollUtil.isNotEmpty(govEmployeePositions)) { - List segmentSaveRecordList = new ArrayList<>(); - for (OrganizationEmployeePosition.GovEmployeePosition govEmployeePosition : govEmployeePositions) { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); - dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); - dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); - dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); - dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); - dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); - dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); - dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); - dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); - dingEmployeeInfo.setCreateOn(LocalDateTime.now()); - dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); - dingEmployeeInfo.setCreateBy(-1L); - dingEmployeeInfo.setUpdateBy(-1L); - segmentSaveRecordList.add(dingEmployeeInfo); - } - saveRecordList.addAll(segmentSaveRecordList); - } else { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - saveRecordList.add(dingEmployeeInfo); - } - } - return saveRecordList; - } - - public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode)); - if (Objects.isNull(userInfo)) { - userInfo = UserInfo.builder() - .accountId(dingEmployeeInfo.getAccountId()) - .username(dingEmployeeInfo.getEmployeeName()) - .realName(dingEmployeeInfo.getEmployeeName()) - .employeeCode(dingEmployeeInfo.getEmployeeCode()) - .available(UserAvailableEnum.DISABLE.name()) - .createBy(-1L) - .updateBy(-1L) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) - .avatar(dingEmployeeInfo.getAvatar()) - .build(); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.save(userInfo); - }else{ - userInfo.setAvatar(dingEmployeeInfo.getAvatar()); - userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.updateById(userInfo); - } - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java deleted file mode 100644 index 22cd848..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.ningdatech.pmapi.irs; - -import com.alibaba.fastjson.JSON; -import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; -import com.alibaba.xxpt.gateway.shared.client.http.GetClient; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HmacAuthUtil; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.irs.manage.AppIrsManage; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddAuthClient; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.NoSuchAlgorithmException; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname IrsTest - * @Description - * @Date 2023/6/26 17:42 - * @Author PoffyZhang - */ -public class IrsTest extends AppTests { - - @Autowired - private ZwddAuthClient zwddAuthClient; - - @Autowired - private ZwddClient zwddClient; - @Autowired - private AppIrsManage appIrsManage; - - @Test - public void test1() { - String method = "GET"; - String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + - "?appCode=A331123467587202210014168"; - String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; - String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; - - Map header = HmacAuthUtil.generateHeader(url, method, appKey, appScret); - //请求头 - HttpHeaders headers = new HttpHeaders(); - - for (Map.Entry entry : header.entrySet()) { - headers.add(entry.getKey(), entry.getValue()); - } - //封装请求头 - HttpEntity> formEntity = new HttpEntity>(headers); - - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class); - - System.out.println(JSON.toJSONString(forEntity)); - } - - @Test - public void testApp() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String areaCode = "331123"; - String appScret = "496f0f2a19994f76b4fd9dae087366c7"; - String appKey = "A331101453557202109017383"; - String appCode = "A331123467587202307014177";//A331123467587202307014171 - - String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret,timestamp); - String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); - String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm?" + - "requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&name=&" + - "pageSize=10&deptCode=&areaCode=" + areaCode + "&pageNum=1&appCode=" + appCode; - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - System.out.println(JSON.toJSONString(forEntity)); - } - - @Test - public void test2() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String areaCode = "331123"; - String appKey = "A331101453557202109017383"; - String appScret = "496f0f2a19994f76b4fd9dae087366c7"; - String baseProjSys = "初次建设的应用21"; - String baseProjSysCode = "A331123467587202307014177"; - String baseProjName = "遂昌县-nsl-项目测试004"; - String baseProjId = "331123230130123412186"; - String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret,timestamp); - - String capCode = CryptUtils.MD5Encode(timestamp + areaCode); - String capTime = String.valueOf(timestamp); - String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); - String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + - "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + - "&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId + - "&isEffective=1&baseProjSysCode=" + baseProjSysCode; - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - System.out.println(JSON.toJSONString(forEntity)); - } - - @Test - public void test3() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String areaCode = "331121"; - System.out.println(CryptUtils.MD5Encode(timestamp + areaCode)); - } - - @Test - public void test4() { - CloseableHttpResponse response = null; - try { - String api = "/media/download"; - GetClient getClient = getZwddExecutableClient().newGetClient(api); - //设置参数 - getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); - getClient.addParameter("media_id", "$hQHNKaUCo2pwZwMGDAEN2gBAK2Z2YUVMb0xYZnFJSGRuZ1h3OVZGd3hadDNrTXlYNWlQOXF0OERrZTc0b2M5UU0xeExsUVFkalBQNFVJakZ0aA"); - //调用API - //String result = getClient.get(); - //System.err.println(result); - response = getClient.getB(); - org.apache.http.HttpEntity entity = response.getEntity(); - InputStream is = entity.getContent(); - System.out.println(is); - File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); - OutputStream fos = new FileOutputStream(voice); - int cache = 10 * 1024; - byte[] buffer = new byte[cache]; - int ch = 0; - StringBuffer sb = new StringBuffer(); - while ((ch = is.read(buffer)) != -1) { - fos.write(buffer, 0, ch); - sb.append(buffer); - } - System.out.println(sb.toString()); - is.close(); - fos.flush(); - fos.close(); - } catch (Exception e) { - System.out.println(e); - } finally { - if (response != null) { - try { - //特别提醒:需要调用response的close方法关闭网络连接!!! - response.close(); - } catch (Exception e) { - System.out.println(e); - } - } - } - } - - @Test - public void test5() { - CloseableHttpResponse response = null; - try { - String api = "/media/download"; - GetClient getClient = getZwddExecutableClient().newGetClient(api); - //设置参数 - getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); - getClient.addParameter("media_id", "$hQHNxoECo2pwZwMGDAEN2gAsOEkvNENaMmZ5UUVncDduWERralJxRW5aem45ODN5UHpKRjErcUxFeUkvTT0"); - //调用API - //String result = getClient.get(); - //System.err.println(result); - response = getClient.getB(); - org.apache.http.HttpEntity entity = response.getEntity(); - InputStream is = entity.getContent(); - System.out.println(is); - File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); - OutputStream fos = new FileOutputStream(voice); - int cache = 10 * 1024; - byte[] buffer = new byte[cache]; - int ch = 0; - StringBuffer sb = new StringBuffer(); - while ((ch = is.read(buffer)) != -1) { - fos.write(buffer, 0, ch); - sb.append(buffer); - } - System.out.println(sb.toString()); - is.close(); - fos.flush(); - fos.close(); - } catch (Exception e) { - System.out.println(e); - } finally { - if (response != null) { - try { - //特别提醒:需要调用response的close方法关闭网络连接!!! - response.close(); - } catch (Exception e) { - System.out.println(e); - } - } - } - } - - private static ExecutableClient zwddExecutableClient; - @Autowired - private ZwddIntegrationProperties zwddProperties; - - public ExecutableClient getZwddExecutableClient() { - if (Objects.isNull(zwddExecutableClient)) { - synchronized (ZwddAuthClientProvider.class) { - if (Objects.isNull(zwddExecutableClient)) { - zwddExecutableClient = ExecutableClient.getInstance(); - //DomainName不同环境对应不同域名,示例为sass域名 - zwddExecutableClient.setDomainName(zwddProperties.getDomain()); - zwddExecutableClient.setProtocal("https"); - //应用App Key - zwddExecutableClient.setAccessKey(zwddProperties.getAppKey()); - //应用App Secret - zwddExecutableClient.setSecretKey(zwddProperties.getAppSecret()); - zwddExecutableClient.init(); - } - } - } - return zwddExecutableClient; - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest2.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest2.java deleted file mode 100644 index c91e139..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest2.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ningdatech.pmapi.irs; - -import com.alibaba.fastjson.JSON; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import liquibase.util.MD5Util; -import org.junit.Test; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.NoSuchAlgorithmException; -import java.util.Objects; - -/** - * @Classname IrsTest2 - * @Description - * @Date 2023/7/20 10:48 - * @Author PoffyZhang - */ -public class IrsTest2 { - - @Test - public void test() throws UnsupportedEncodingException, NoSuchAlgorithmException { - String appSecret = "e066f496194540afa829c66983d4710e"; - String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; - String dataName = URLEncoder.encode("丽水市大数据","UTF-8"); - long timestamp = System.currentTimeMillis(); - String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp); - String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey + - "&sign=" + sign + "&requestTime=" + timestamp; - RestTemplate restTemplate = new RestTemplate(); - System.out.println("url:" + url); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - - System.out.println(JSON.toJSONString(forEntity)); - } - - @Test - public void refreshToken() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String appSecret = "e066f496194540afa829c66983d4710e"; - String appKey = "8fb070a1f1194b2ebffdc6f596bb8a96"; - String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if(Objects.nonNull(factory)){ - restTemplate = new RestTemplate(factory); - }else{ - restTemplate = new RestTemplate(); - } - String url = "https://interface.ls.local/a/api/refreshTokenKey?appKey=" + appKey + - "&requestTime=" + timestamp + "&sign=" + sign; - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - System.out.println(forEntity.getBody()); - } - - @Test - public void test3() throws NoSuchAlgorithmException { - String timestamp = "1689841393364"; - String appSecret = "f12a6f2e9fc143fcbe4622295db097fd"; - String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; - String sign1 = MD5Util.computeMD5(appkey + appSecret + timestamp); - String sign2 = CryptUtils.MD5Encode(appkey + appSecret + timestamp); - System.out.println(sign1); - System.out.println(sign2); - } - - @Test - public void test4(){ - long timestamp = 1690354109541L; - - long now = System.currentTimeMillis(); - - System.out.println( (timestamp - now)/1000 + "s"); - - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java deleted file mode 100644 index e77829d..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java +++ /dev/null @@ -1,90 +0,0 @@ -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.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 irsTest3 extends AppTests { - - @Resource - private IRefreshTokenService refreshTokenService; - - @Value("${irs.interface-local-refresh.request-token-url}") - private String requestTokenUrl; - @Value("${irs.interface-local-refresh.refresh-token-url}") - private String refreshTokenUrl; - - @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 sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); - HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); - RestTemplate restTemplate; - if(Objects.nonNull(factory)){ - restTemplate = new RestTemplate(factory); - }else{ - restTemplate = new RestTemplate(); - } - - String url = "https://interface.ls.local/a/api/shared/1689239219101?" + - "data_name=" + dataName + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; - - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - System.out.println(forEntity.getBody()); - } - - @Test - public void test2() throws NoSuchAlgorithmException { - long timestamp = System.currentTimeMillis(); - String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; - String appKey = "A331101453557202109017383"; - String method = "POST"; - String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); - 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 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/" + - "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + - "&sign=" + sign + "&appKey=" + appKey + - "&capCode=abc&appId=abc&capTime=" + timestamp + - "&appId=" + appId + "&updateTime=" + updateTime; - log.info("url :{}",url); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java deleted file mode 100644 index f685c76..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java +++ /dev/null @@ -1,59 +0,0 @@ -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, 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/java/com/ningdatech/pmapi/org/OrgTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java deleted file mode 100644 index dc4e571..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.ningdatech.pmapi.org; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.spring.SpringUtil; -import cn.hutool.poi.excel.ExcelReader; -import cn.hutool.poi.excel.ExcelUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.SpringUtils; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.gov.entity.BelongOrg; -import com.ningdatech.pmapi.gov.enumeration.BelongTypeEnum; -import com.ningdatech.pmapi.gov.service.IBelongOrgService; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; - -/** - * @Classname RegionTest - * @Description - * @Date 2023/6/8 14:44 - * @Author PoffyZhang - */ -public class OrgTest extends AppTests { - - @Autowired - private IDingOrganizationService organizationService; - @Autowired - private IBelongOrgService belongOrgService; - - @Test - public void test() { - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getDivisionCode, "331199")); - - for (DingOrganization org : orgs) { - List inners = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getParentCode, org.getOrganizationCode())); - for (DingOrganization inner : inners) { - mergeRegionCode(inner); - } - } - } - - private void mergeRegionCode(DingOrganization inner) { - inner.setDivisionCode("331199"); - organizationService.updateById(inner); - - List is = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getParentCode, inner.getOrganizationCode())); - if (CollUtil.isEmpty(is)) { - return; - } - for (DingOrganization i : is) { - mergeRegionCode(i); - } - } - - @Test - public void businessStrip() { - String path = "/Users/wendy/Desktop/省市县条线单位梳理202303016.xlsx"; - ExcelReader reader = ExcelUtil.getReader(path); - Set orgCodes = new HashSet<>(); - List belongOrgs = new ArrayList<>(); - for (int i = 0; i < reader.getSheetCount(); i++) { - reader.setSheet(i); - List> maps = reader.readAll(); - for (Map map : maps) { - String cityName = MapUtil.getStr(map, "市级组织名称"); - if (cityName == null || !cityName.contains("丽水")) { - continue; - } - String cityCode = MapUtil.getStr(map, "市级组织机构代码"); - if (StrUtil.isBlank(cityCode)) { - continue; - } - String countyName = MapUtil.getStr(map, "区县组织名称"); - if (StrUtil.isBlank(countyName)) { - continue; - } - String countyCode = MapUtil.getStr(map, "区县组织机构代码"); - if (StrUtil.isBlank(countyCode)) { - continue; - } - System.out.printf("市级:%s -> %s 区县:%s -> %s\n", cityName, cityCode, countyName, countyCode); - BelongOrg county = new BelongOrg(); - county.setBelongCode(cityCode); - county.setBelongName(cityName); - county.setOrgCode(countyCode); - county.setOrgName(countyName); - county.setOrgType(BelongTypeEnum.ORGANIZATION.name()); - belongOrgs.add(county); - if (!orgCodes.add(cityCode)) { - continue; - } - BelongOrg city = new BelongOrg(); - city.setBelongCode(cityCode); - city.setBelongName(cityName); - city.setOrgCode(cityCode); - city.setOrgName(cityName); - city.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name()); - belongOrgs.add(city); - } - belongOrgs.forEach(System.out::println); - } - belongOrgService.saveBatch(belongOrgs); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java deleted file mode 100644 index 9201518..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.ningdatech.pmapi.organization; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.google.common.collect.Lists; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; -import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; -import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; -import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.dto.*; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/2/9 下午3:54 - */ -@Slf4j -class OrganizationTest extends AppTests { - - @Autowired - private OrganizationBatchGetTask organizationBatchGetTask; - - @Autowired - private EmployeeBatchGetTask employeeBatchGetTask; - - @Autowired - private GovBusinessStripsTask govBusinessStripsTask; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private IDingOrganizationService organizationService; - - private static final Integer GROUP_SIZE = 100; - - @Test - public void testBatchGetOrganization() { - organizationBatchGetTask.batchGetOrganizationTask(); - } - - @Test - public void testEmployeeBatchGetTask() { - employeeBatchGetTask.batchGetEmployeeTask(); - } - - @Test - public void testGovBusinessStripsTask() { - govBusinessStripsTask.batchGetGovBusinessStripsTask(); - } - - @Test - public void getEmployeeInfo() { - GenericResult dingInfoByMobile = zwddClient.getDingInfoByMobile("13164388876"); -// GenericResult ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_809a061236b941d281446df6f14dc8f0"); - GenericResult ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_e68c7af513474eaa959b7ce7141a4d9f"); - - System.out.println("---"); - } - - @Test - public void test2() { - // 获取顶级组织code - GenericResult scopesV2Result = zwddClient.getScopesV2(); - DingScopesV2DTO scopesV2 = scopesV2Result.getData(); - - if (Objects.nonNull(scopesV2)) { - List currentAllOrganizationList = organizationService.list(); - - // 顶级组织code - List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); - log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); - // 获取顶级节点信息 - GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); - log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); - List dingOrgInfoDtos = listGenericResult.getData(); - for (String orgCode : deptVisibleScopes) { - List treeDTOList = new ArrayList<>(); - - DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); - //设置节点详情 - if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { - for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { - if (orgInfo.getOrganizationCode().equals(orgCode)) { - childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); - } - } - } - childDingOrgInfoTreeDTO.setCode(orgCode); - childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); - getDingOrgChild(childDingOrgInfoTreeDTO); - treeDTOList.add(childDingOrgInfoTreeDTO); - if (CollectionUtils.isNotEmpty(treeDTOList)) { - List saveRecordList = new ArrayList<>(); - buildSaveRecordList(treeDTOList, saveRecordList,currentAllOrganizationList); - // 批量保存 - if (saveRecordList.size() <= GROUP_SIZE) { - organizationService.saveOrUpdateBatch(saveRecordList); - } else { - List> split = Lists.partition(saveRecordList, GROUP_SIZE); - for (List segment : split) { - organizationService.saveOrUpdateBatch(segment); - } - } - } - log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); - } - } - } - - private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { - String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); - DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); - boolean leaf = orgInfoDTO.getLeaf(); - if (!leaf) { - int currentPage = 1; - int pageSize = 100; - GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); - PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); - - if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { - List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); - Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); - - while (totalSize > (long) currentPage * pageSize) { - GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient - .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); - PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); - if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { - subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); - } - } - - if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { - GenericResult> listGenericResult = zwddClient - .listOrganizationsByCodes(subOrganizationCodeList); - List dingOrgInfoDtos = listGenericResult.getData(); - List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { - DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); - dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); - dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); - dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); - getDingOrgChild(dingOrgInfoTreeDTO); - return dingOrgInfoTreeDTO; - }).collect(Collectors.toList()); - parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); - } - } - } - } - - private void buildSaveRecordList(List treeDTOList, List saveRecordList, - List oldList) { - Set set = new HashSet(); - Map map = oldList.stream() - .filter(o -> set.add(o.getOrganizationCode())) - .collect(Collectors.toMap(DingOrganization::getOrganizationCode,o -> o)); - if (CollectionUtils.isEmpty(treeDTOList)) { - return; - } - for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { - DingOrganization saveRecord = new DingOrganization(); - DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); - List childCodes = dingOrgInfoTreeDTO.getChildCodes(); - if(map.containsKey(dingOrgInfoDTO.getOrganizationCode())) { - DingOrganization organization = map.get(dingOrgInfoDTO.getOrganizationCode()); - saveRecord.setId(organization.getId()); - if (CollectionUtils.isNotEmpty(childCodes)) { - buildSaveRecordList(childCodes, saveRecordList,oldList); - } - continue; - } - - saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); -// saveRecord.setEnabled("1"); - saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); - saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); - saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); - saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); -// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); - saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); - saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode()); - saveRecordList.add(saveRecord); - if (CollectionUtils.isNotEmpty(childCodes)) { - buildSaveRecordList(childCodes, saveRecordList,oldList); - } - } - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java deleted file mode 100644 index dc34917..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.password; - -import org.junit.Test; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; - -/** - * @Classname PasswordTest - * @Description - * @Date 2023/8/2 17:39 - * @Author PoffyZhang - */ -public class PasswordTest { - - @Test - public void password(){ - String mingwen = "ELgaCeHteZA8VJK8"; - - String miwen = "$2a$10$MT82RbInrIkRVL/GRS01Vew8AO6ICngOpbAGbdkWgSnYFhog5n8.q"; - - String encode = new BCryptPasswordEncoder().encode(mingwen); - boolean matches = new BCryptPasswordEncoder().matches(mingwen, encode); - System.out.println(encode); - System.out.println(matches); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java deleted file mode 100644 index a0cbe9b..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.ningdatech.pmapi.projectCollection; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectCollectionTest - * @Description - * @Date 2023/9/7 15:08 - * @Author PoffyZhang - */ -public class ProjectCollection2Test extends AppTests { - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovBizProjectApplyService applyService; - - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IGovBizProjectMimplementService mimplementService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private GenerateProjectCodeUtil generateProjectCodeUtil; - - @Autowired - private IProjectService projectService; - - @Test - public void test(){ - List baseinfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)); - - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE)); - - List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - - //查出重复的 重新去生成编号 - List baseProjIds = baseinfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .filter(code -> projectCodes.contains(code)) - .collect(Collectors.toList()); - - for(String baseProjId : baseProjIds){ - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApply::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ - System.out.println("项目不存在 直接下一个"); - continue; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - - baseinfo.setBaseProjId(newProjId); - baseinfoService.updateById(baseinfo); - apply.setBaseProjId(newProjId); - applyService.updateById(apply); - - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApprove::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(newProjId); - approveService.updateById(approve); - } - - - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectCimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(newProjId); - cimplement.setBaseBidCode(newProjId); - cimplementService.updateById(cimplement); - } - - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectMimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(newProjId); - mimplement.setBaseBidCode(newProjId); - mimplementService.updateById(mimplement); - } - - List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - - for(GovBizProjectProcure procure : procures){ - procure.setBaseProjId(newProjId); - procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); - procureService.updateById(procure); - } - } - } - - @Test - public void test2(){ - //恢复误删 - String baseProjId = "33110000020220400117"; - - baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId,baseProjId) - .set(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)); - - applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,baseProjId) - .set(GovBizProjectApply::getDeleted,Boolean.FALSE)); - - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .set(GovBizProjectApprove::getDeleted,Boolean.FALSE)); - - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) - .set(GovBizProjectCimplement::getDeleted,Boolean.FALSE)); - - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) - .set(GovBizProjectMimplement::getDeleted,Boolean.FALSE)); - - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId) - .set(GovBizProjectProcure::getDeleted,Boolean.FALSE)); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java deleted file mode 100644 index 9d8c408..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.ningdatech.pmapi.projectCollection; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.gov.contants.BizProjectContant; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -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 lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.io.*; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname ProjectCollection3Test - * @Description - * @Date 2023/9/7 15:08 - * @Author PoffyZhang - */ -@Slf4j -public class ProjectCollection3Test extends AppTests { - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovBizProjectApplyService applyService; - - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IGovBizProjectMimplementService mimplementService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private GenerateProjectCodeUtil generateProjectCodeUtil; - - @Autowired - private IProjectService projectService; - - @Test - public void importData() throws Exception { - Workbook wb; - File f = new File("C:\\Users\\PoffyZhang\\Desktop\\恢复清单.xlsx"); - wb = readExcel(new FileInputStream(f),f.getName()); - Row row = null; - Integer successed = 0; - List failed = Lists.newArrayList(); - if(wb != null) { - //获取第一个sheet - Sheet sheet = wb.getSheetAt(0); - //获取最大行数 - int rownum = sheet.getPhysicalNumberOfRows(); - - //获取第一行 - row = sheet.getRow(0); - //获取最大列数 - for (int i = 0; i < rownum; i++) { - row = sheet.getRow(i); - if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){ - break; - } - - GovBizProjectBaseinfo baseinfo = new GovBizProjectBaseinfo(); - // - String projName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; - log.info("projName :{}",projName); - GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjName, projName) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(base)){ - log.info("没有匹配项目 :{}",projName); - failed.add(projName); - continue; - } - //否则 就去恢复 - String baseProjId = base.getBaseProjId(); - base.setDeleted(Boolean.FALSE); - baseinfoService.updateById(base); - - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(apply)){ - apply.setDeleted(Boolean.FALSE); - applyService.updateById(apply); - } - - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setDeleted(Boolean.FALSE); - approveService.updateById(approve); - } - - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setDeleted(Boolean.FALSE); - cimplementService.updateById(cimplement); - } - - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setDeleted(Boolean.FALSE); - mimplementService.updateById(mimplement); - } - - List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - if(CollUtil.isNotEmpty(procures)){ - for(GovBizProjectProcure procure : procures){ - procure.setDeleted(Boolean.FALSE); - procureService.updateById(procure); - } - } - - successed ++; - } - } - - log.info("导入完成 :{}个",successed); - log.info("导入失败 :{}",failed); - } - - //这个下面是单独函数 - public static Workbook readExcel(InputStream is, String extString){ - Workbook wb = null; - extString = extString.substring(extString.lastIndexOf(".")); - try { - if(".xls".equals(extString)){ - return wb = new HSSFWorkbook(is); - }else if(".xlsx".equals(extString)){ - return wb = new XSSFWorkbook(is); - }else { - return wb = null; - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return wb; - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java deleted file mode 100644 index 471ba76..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.ningdatech.pmapi.projectCollection; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.log.model.domain.OptLog; -import com.ningdatech.log.service.OptLogService; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; -import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.net.UnknownHostException; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; -import java.time.temporal.Temporal; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.StringJoiner; - -/** - * @Classname ProjectCollectionTest - * @Description - * @Date 2023/9/7 15:08 - * @Author PoffyZhang - */ -public class ProjectCollectionTest extends AppTests { - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovBizProjectApplyService applyService; - - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IGovBizProjectMimplementService mimplementService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private GenerateProjectCodeUtil generateProjectCodeUtil; - - @Autowired - private SynProjectCollectionTask collectionTask; - - @Autowired - private OptLogService optLogService; - - @Autowired - private SynProjectCoreBizTask projectCoreBizTask; - - @Test - public void test(){ - List baseProjIds = Lists.newArrayList("33118100020200100002"); - for(String baseProjId : baseProjIds){ - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectBaseinfo::getTongTime) - .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApply::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ - System.out.println("项目不存在 直接下一个"); - continue; - } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - - baseinfo.setBaseProjId(newProjId); - baseinfoService.updateById(baseinfo); - apply.setBaseProjId(newProjId); - applyService.updateById(apply); - - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApprove::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(newProjId); - approveService.updateById(approve); - } - - - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectCimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(newProjId); - cimplement.setBaseBidCode(newProjId); - cimplementService.updateById(cimplement); - } - - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectMimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(newProjId); - mimplement.setBaseBidCode(newProjId); - mimplementService.updateById(mimplement); - } - - List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - - for(GovBizProjectProcure procure : procures){ - procure.setBaseProjId(newProjId); - procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); - procureService.updateById(procure); - } - } - } - - @Test - public void test2() throws UnknownHostException { - collectionTask.doTask(); - } - - @Test - public void test3() throws UnknownHostException { - collectionTask.stagingConvertPdf("33112200020230100008"); - } - - /** - * 去补文件 - */ - @Test - public void test4(){ - List approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getApprovalFile,"null")); - - System.out.println("approves size :" + approves.size()); - - for(GovBizProjectApprove approve : approves){ - //https://sjxmglxt-oss.oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn/20230912/6a5c00def2db41b199d8cc99ff04728e.pdf - String baseProjId = approve.getBaseProjId(); - - List opLogs = optLogService.list(Wrappers.lambdaQuery(OptLog.class) - .like(OptLog::getParams, approve.getBaseProjName()) - .like(OptLog::getParams, "\"approvalFile\"") - .last(BizConst.LIMIT_1)); - if(CollUtil.isEmpty(opLogs)){ - System.out.println("没有这个记录"); - continue; - } - - for(OptLog opLog : opLogs){ - System.out.println(opLog.getParams()); - - if(StringUtils.isNotBlank(opLog.getParams())){ - StringJoiner sj = new StringJoiner(";"); - JSONArray jsonArray = JSON.parseArray(opLog.getParams()); - jsonArray.forEach(j -> { - JSONObject json = JSON.parseObject(JSON.toJSONString(j)); - JSONObject approveJson = json.getJSONObject("approve"); - if(Objects.nonNull(approveJson)){ - String approvalFile = approveJson.getString("approvalFile"); - System.out.println("approvalFile:" + approvalFile); - if(StringUtils.isBlank(approvalFile) || "null".equals(approvalFile)){ - return; - } - sj.add(approvalFile); - } - }); - if(StringUtils.isNotBlank(sj.toString())){ - approve.setApprovalFile(sj.toString()); - approveService.updateById(approve); - break; - } - } - } - } - } - - @Test - public void test5(){ - List list = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .isNotNull(GovBizProjectApply::getBaseProjStartTime) - .isNotNull(GovBizProjectApply::getBaseProjEndTime) - .isNull(GovBizProjectApply::getBaseProjDuration)); - - for(GovBizProjectApply apply : list){ - apply.setBaseProjDuration(convertMonth(apply.getBaseProjStartTime(),apply.getBaseProjEndTime())); - applyService.updateById(apply); - } - } - - public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { - Temporal temporal1 = baseProjStartTime.toLocalDate(); - Temporal temporal2 = baseProjEndTime.toLocalDate(); - // 方法返回为相差月份 - Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); - return ll.toString(); - } - - @Test - public void test6(){ - List list = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getDeleted,Boolean.FALSE)); - - for(GovBizProjectProcure procure : list){ - try{ - String index = procure.getBaseBidCode().split("-")[1]; - procure.setBaseBidCode(procure.getBaseProjId() + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,Integer.parseInt(index))); - procureService.updateById(procure); - }catch (Exception e){ - e.printStackTrace(); - } - } - } - - @Test - public void test7() throws UnknownHostException { - String orgCode = "GO_5f1f6f28a6f7484ea3b9991d8d02599f"; - projectCoreBizTask.doTask(orgCode); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java deleted file mode 100644 index 0996b7f..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ningdatech.pmapi.projectCollection; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.log.model.domain.OptLog; -import com.ningdatech.log.service.OptLogService; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; -import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; -import com.ningdatech.pmapi.gov.model.entity.*; -import com.ningdatech.pmapi.gov.service.*; -import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; -import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; -import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; -import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; -import com.ningdatech.pmapi.projectdeclared.service.IOperationService; -import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; -import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; -import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; -import com.ningdatech.pmapi.projectlib.model.entity.*; -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.service.IPersonSafetyInfoService; -import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; -import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; -import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.wflow.bean.entity.WflowCcTasks; -import com.wflow.service.WflowCcTasksService; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RuntimeService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import java.net.UnknownHostException; -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.time.temporal.Temporal; -import java.util.List; -import java.util.Objects; -import java.util.StringJoiner; -import java.util.stream.Collectors; - -/** - * @Classname ProjectCollectionTest - * @Description - * @Date 2023/9/7 15:08 - * @Author PoffyZhang - */ -public class ProjectRemoveTest extends AppTests { - - @Autowired - private IProjectService projectService; - - @Autowired - private IProjectApplicationService applicationService; - - @Autowired - private IProjectInstService projectInstService; - - @Autowired - private IProjectStagingService stagingService; - - @Autowired - private INdProjectStatusChangeService statusChangeService; - - @Autowired - private ISupplierSafetyQualificationService supplierSafetyQualificationService; - - @Autowired - private IPersonSafetyInfoService personService; - - @Autowired - private IOperationService operationService; - - @Autowired - private IPurchaseService purchaseService; - - @Autowired - private IProjectTagService projectTagService; - - @Autowired - private IPreInsAcceptancePersonService preInsAcceptancePersonService; - - @Autowired - private IProjectRenewalFundDeclarationService renewalFundDeclarationService; - - @Autowired - private HistoryService historyService; - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private WflowCcTasksService ccTasksService; - - @Test - public void test(){ - List projectCodes = Lists.newArrayList("33110000020230100078","33110000020230100077"); - - for(String projectCode : projectCodes){ - //项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - - List projectIds = projects.stream().map(Project::getId).collect(Collectors.toList()); - - //1.删除应用 - applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,projectCode)); - - //2.删除相关流程 - List projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIds)); - for(ProjectInst projectInst : projectInsts){ - //实例 - try{ - runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); - }catch (Exception e){ - - } - try{ - historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); - }catch (Exception e){ - - } - //抄送 - ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); - } - projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); - - //3.删除实施表 - operationService.remove(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode,projectCode)); - - //4.删除续建项目资金表 - renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); - - //5.暂存表 - stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) - .in(ProjectStaging::getProjectId,projectIds)); - - //6.状态变更表 - statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId,projectIds)); - - //7.采购表 - purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId,projectIds)); - - //8.标签 - projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode,projectCode)); - - //9.初验人员 - preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .in(PreInsAcceptancePerson::getProjectId,projectIds)); - - //10.供应商安全质量 - supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) - .eq(SupplierSafetyQualification::getProjectCode,projectCode)); - - //11.安全人员 - personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) - .eq(PersonSafetyInfo::getProjectCode,projectCode)); - - //12.最后删除项目 - projectService.remove(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectCode, projectCode)); - } - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java b/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java deleted file mode 100644 index b5699e7..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.ningdatech.pmapi.provincial; - -import cn.hutool.crypto.SecureUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; -import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; -import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; -import com.ningdatech.pmapi.staging.contants.StagingContant; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.service.IProjectStagingService; -import com.wflow.exception.BusinessException; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; - -import java.io.UnsupportedEncodingException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.time.LocalDateTime; -import java.util.List; - -/** - * @Classname Test - * @Description - * @Date 2023/3/2 16:14 - * @Author PoffyZhang - */ -@Slf4j -public class Test extends AppTests{// - - @Autowired - private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; - - @Autowired - private IProjectService projectService; - - @Autowired - private IProjectApplicationService applicationService; - - @Autowired - private FileService fileService; - - @Autowired - private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - @Autowired - private IProjectStagingService projectStagingService; - - @org.junit.Test - public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { -// Long timeStamp = System.currentTimeMillis()/1000; - Long timeStamp = 1677750055L; - String key = "7196317343a64e67895dc0375c098fe7"; - String url = "/api/v1/foreign/importantProView"; - String methed = "POST"; - String bytesToSign = methed + "\n" + url + "\n" + timeStamp + "\n" + key; - - log.info("" + bytesToSign); - - String secret = "75152a97f20e4c4c854dc6301cf72ad4"; - String str = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); - log.info("" + str); - } - - @org.junit.Test - public void Test222(){ - Project project = projectService.getById(340); - prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId(),Boolean.FALSE); - } - - @org.junit.Test - public void Test3333(){ - String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D"; - String s = "Expires"; - System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY)); - } - - @Value("${spring.profiles.active}") - private String active; - - @org.junit.Test - public void Test4444(){ - // 对接省级联审的接口 - Project p = projectService.getById(448); - - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, p.getId())); - if(!joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(p,applications,fileService,active))){ - throw new BusinessException("提交省级部门联审失败"); - } - System.out.println("成功"); - } - - @org.junit.Test - public void test5(){ - //1. 定时取 项目暂存表的数据 去进行状态继续流转 - List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) - .eq(ProjectStaging::getDead,Boolean.FALSE) - .le(ProjectStaging::getNextTime, LocalDateTime.now()) - .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) - .orderByAsc(ProjectStaging::getProjectId)); - - log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); - } - - @org.junit.Test - public void test6(){ - List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) - .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) - .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) - .eq(Project::getAreaCode, RegionConst.RC_LS) - .orderByAsc(Project::getCreateOn)); - - log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java deleted file mode 100644 index 37de96f..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.redis; - -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.pmapi.AppTests; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * @Classname RedisTest - * @Description - * @Date 2023/8/31 17:45 - * @Author PoffyZhang - */ -public class RedisTest extends AppTests { - - @Autowired - private CachePlusOps cachePlusOps; - - @Test - public void test1(){ - Object o = cachePlusOps.get("irs:A331101453557202109017383:Fc3re2cq7r64Qfa7:refresh"); - System.out.println(o.toString()); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java deleted file mode 100644 index 2e69c04..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ningdatech.pmapi.refund; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; -import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import java.util.List; -import java.util.Objects; - -/** - * @Classname ProjectRefundTest - * @Description - * @Date 2023/9/7 15:08 - * @Author PoffyZhang - */ -public class ProjectRefundTest extends AppTests { - - @Autowired - private IProjectRenewalFundDeclarationService renewalFundDeclarationService; - - @Autowired - private IProjectService projectService; - - @Test - public void test(){ - List funds = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)); - for(ProjectRenewalFundDeclaration fund : funds){ - if(StringUtils.isBlank(fund.getProjectCode())){ - Project project = projectService.getById(fund.getProjectId()); - if(Objects.nonNull(project)){ - fund.setProjectCode(project.getProjectCode()); - renewalFundDeclarationService.updateById(fund); - } - } - } - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/region/RegionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/region/RegionTest.java deleted file mode 100644 index 10568d7..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/region/RegionTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.pmapi.region; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.util.ExpertRegisterUtil; -import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; -import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; -import com.ningdatech.pmapi.expert.controller.ExpertController; -import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; -import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; -import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; -import com.ningdatech.pmapi.meta.helper.DictionaryCache; -import com.ningdatech.pmapi.meta.helper.TagCache; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @Classname RegionTest - * @Description - * @Date 2023/6/8 14:44 - * @Author PoffyZhang - */ -public class RegionTest extends AppTests { - - @Autowired - private IRegionService regionService; - - @Test - public void test() { - Set set = regionService.list().stream().collect(Collectors.toSet()); - - Set ids = set.stream().map(Region::getId).collect(Collectors.toSet()); - - regionService.removeByIds(ids); - - regionService.saveBatch(set); - } - - @Autowired - private RegionCacheHelper regionCacheHelper; - @Autowired - private IDingOrganizationService organizationService; - @Autowired - private DictionaryCache dictionaryCache; - @Autowired - private TagCache tagCache; - @Autowired - private ExpertController expertController; - - @Test - public void test1() { - System.out.println(regionCacheHelper.getByRegionName("浙江省-杭州市-滨江区")); - } - - @Test - public void test2() { - String[] paths = {"/Users/wendy/Desktop/景宁县专家(1).xlsx", - "/Users/wendy/Desktop/专家基础信息归集表(遂昌县).xlsx", - "/Users/wendy/Desktop/专家基础信息归集表-缙云县.xlsx", - "/Users/wendy/Desktop/松阳专家汇总.xlsx", - "/Users/wendy/Desktop/青田县---专家基础信息归集表.xlsx"}; - ExpertRegisterUtil.regionCacheHelper = regionCacheHelper; - ExpertRegisterUtil.tagCache = tagCache; - ExpertRegisterUtil.dictionaryCache = dictionaryCache; - ExpertRegisterUtil.organizationService = organizationService; - ExpertRegisterUtil.expertController = expertController; - for (String path : paths) { - ExpertRegisterUtil.registerExpertBatch(path); - } - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java deleted file mode 100644 index 5b44438..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ningdatech.pmapi.statemachine; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * 状态机测试 - * - * @author CMM - * @since 2023/02/08 11:46 - */ - -public class StateMachineTest extends AppTests { - @Autowired - private StateMachineUtils stateMachineUtils; - - @Autowired - private IProjectService projectService; - - @Test - public void stateMachineTest() { - Project project = projectService.getById(485); - stateMachineUtils.pass(project); - System.out.println(String.format("project:%s", JSON.toJSONString(project))); - projectService.updateById(project); - } - - @Test - public void yyyyyy(){ - Project project = projectService.getById(400); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); - System.out.println(project); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/stream/stream.java b/pmapi/src/test/java/com/ningdatech/pmapi/stream/stream.java deleted file mode 100644 index 7de6137..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/stream/stream.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.stream; - -import org.flowable.task.api.history.HistoricTaskInstance; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @Classname stream - * @Description - * @Date 2023/4/3 14:52 - * @Author PoffyZhang - */ -public class stream { - - @Test - public void test(){ - List list = new ArrayList<>(); - list.add(1); - list.add(2); - list.add(2); - list.add(3); - list.add(3); - list.add(1); - list.add(1); - list.add(1); - - Set set = list.stream().collect(Collectors.toSet()); - System.out.println(set); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/Node.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/Node.java deleted file mode 100644 index 2f74135..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/Node.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.sys.processDef; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class Node implements Serializable { - private static final long serialVersionUID = -45475579271153023L; - - private String id; - - private String parentId; - - private String name; - - private T props; - - private Node children; - - private List> branchs; -} \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/ProcessDefTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/ProcessDefTest.java deleted file mode 100644 index 22f7e09..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/processDef/ProcessDefTest.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.ningdatech.pmapi.sys.processDef; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; -import cn.hutool.core.util.IdUtil; -import com.alibaba.fastjson.JSON; -import com.google.common.collect.Maps; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.constant.RegionConst; -import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.service.IRegionService; -import com.wflow.bean.dto.WflowModelHistorysInsertDto; -import com.wflow.bean.entity.WflowForms; -import com.wflow.workflow.bean.process.ProcessNode; -import com.wflow.workflow.service.ProcessModelService; -import com.wflow.workflow.service.WflowFormsService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; - -import javax.annotation.Resource; -import java.io.Serializable; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; - -/** - * @Classname ProcessTest - * @Description - * @Date 2023/2/4 9:54 - * @Author PoffyZhang - */ -@Slf4j -public class ProcessDefTest extends AppTests { - @Resource - private ProcessModelService processModelService; - @Resource - private WflowFormsService formsService; - @Resource - private RegionCacheHelper regionCacheHelper; - @Test - public void test() { - String processStr = "{\"id\":\"node_039152532706\",\"name\":\"审批单位\",\"type\":\"ORG\",\"props\":{\"regionCode\":\"\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\",\"subNode\":[]},\"children\":{},\"parentId\":\"root\"}"; - - Node node = JSON.parseObject(processStr, Node.class); - - OrgProps props = JSON.parseObject(node.getProps().toString(), OrgProps.class); - System.out.println(props.getOrgCode()); - } - - @Test - public void date(){ - System.out.println(LocalDateTime.parse("2023-02-05 10:25", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); - } - - @Test - public void apply() { - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - - if(CollUtil.isEmpty(regions)){ - throw new BizException("丽水地区数据为空 任务结束!"); - } - - for(RegionDTO region : regions){ - log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); - - Integer[] processTypeList = TaskContant.Wflow.APPLY_PROCESS_TYPE_LIST; - for(Integer processType : processTypeList){ - String formName = ProjectProcessStageEnum.getDesc(processType); - WflowModelHistorysInsertDto models = new WflowModelHistorysInsertDto(); - - models.setGroupId(1); - models.setProcessDefId("pd" + IdUtil.objectId()); - models.setFormName(formName); - models.setProcessType(processType); - models.setRegionCode(region.getRegionCode()); - String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; - ProcessNode processNode = JSON.parseObject(process,ProcessNode.class); - models.setProcess(processNode); - models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); - models.setFormItems("[]"); - - String formId = processModelService.insertProcess(models); - if(StringUtils.isNotBlank(formId)){ - //初始的流程在部署表也存一份,用来查询 - if(StringUtils.isNotBlank(processModelService.deployProcess(formId,null))){ - log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getRegionName(),formName); - }else{ - log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getRegionName(),formName); - } - }else{ - log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getRegionName(),formName); - } - } - } - - stopWatch.stop(); - log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); - } - - public static class OrgProps { - private String regionCode; - - private String orgCode; - - private String type; - - private String processDefId; - - private List subNode; - - public String getRegionCode() { - return regionCode; - } - - public void setRegionCode(String regionCode) { - this.regionCode = regionCode; - } - - public String getOrgCode() { - return orgCode; - } - - public void setOrgCode(String orgCode) { - this.orgCode = orgCode; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getProcessDefId() { - return processDefId; - } - - public void setProcessDefId(String processDefId) { - this.processDefId = processDefId; - } - - public List getSubNode() { - return subNode; - } - - public void setSubNode(List subNode) { - this.subNode = subNode; - } - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/DraftTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/DraftTest.java deleted file mode 100644 index f1b3fa2..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/DraftTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ningdatech.pmapi.sys.project; - -import com.alibaba.fastjson.JSON; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; -import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; -import org.junit.Test; - -import javax.annotation.Resource; - -/** - * @Classname DraftTest - * @Description - * @Date 2023/2/7 10:56 - * @Author PoffyZhang - */ -public class DraftTest extends AppTests { - - @Resource - private IProjectDraftService projectDraftService; - - @Test - public void one(){ - - ProjectDraft byId = projectDraftService.getById(1); - - System.out.println(JSON.toJSONString(byId)); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java deleted file mode 100644 index 6836c45..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.sys.project; - -import cn.hutool.core.date.StopWatch; -import com.alibaba.fastjson.JSON; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; -import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import org.junit.Test; - -import javax.annotation.Resource; - -/** - * @Classname ProjectStateTest - * @Description - * @Date 2023/2/8 11:12 - * @Author PoffyZhang - */ -public class ProjectStateTest extends AppTests { - - @Resource - private StateMachineUtils stateMachineUtils; - - @Resource - private IProjectService projectService; - - @Test - public void execute() throws Exception { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - System.out.println("调用状态机开始"); - - Project project = new Project(); - project.setInstCode("1"); - project.setId(1L); - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); - - stopWatch.stop(); - System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); - } - - @Test - public void getProject() { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - Project project = projectService.getById(1); - - stopWatch.stop(); - System.out.println("project :" + JSON.toJSONString(project)); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java deleted file mode 100644 index 149f4e1..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.io.FileUtil; -import cn.hutool.db.Db; -import cn.hutool.db.Entity; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.sys.model.entity.Menu; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.entity.RoleMenu; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.sql.SQLException; -import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicLong; - -/** - *

- * IMenuServiceTest - *

- * - * @author WendyYang - * @since 11:18 2023/1/29 - */ -class IMenuServiceTest extends AppTests { - - @Autowired - private IMenuService menuService; - @Autowired - private IRoleService roleService; - - /** - * 初始化固定角色 - */ - @Test - public void roleService() { - roleService.remove(null); - AtomicLong integer = new AtomicLong(0); - Arrays.stream(RoleEnum.values()).map(w -> { - Role role = new Role(); - role.setId(integer.incrementAndGet()); - role.setCode(w.name()); - role.setName(w.getDesc()); - role.setDescribe(w.getDesc()); - role.setFixed(true); - role.setCreateOn(LocalDateTime.now()); - return role; - }).forEach(roleService::save); - } - - @Test - public void test() throws SQLException { - menuService.remove(null); - List menu = Db.use().findAll("nd_menu"); - menu.forEach(System.out::println); - menu.forEach(w -> { - Menu bean = w.toBean(Menu.class); - menuService.save(bean); - }); - } - - - @Autowired - private IRoleMenuService roleMenuService; - - @Test - public void initMenu() { - menuService.remove(null); - roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class) - .eq(RoleMenu::getRoleId, 1)); - String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); - List obj = JSONUtil.toList(str, JSONObject.class); - save(obj, 0); - menuService.list().forEach(w -> { - roleMenuService.save(new RoleMenu() {{ - setRoleId(1L); - setMenuId(w.getId()); - }}); - }); - } - - public void save(List objs, long parentId) { - objs.forEach(w -> { - Menu menu = new Menu(); - menu.setActiveMenu(w.getStr("activeMenu")); - menu.setComponent(w.getStr("component")); - menu.setIcon(w.getStr("icon")); - menu.setPath(w.getStr("path")); - menu.setName(w.getStr("path").replace("/", "")); - menu.setTopMenu(w.getStr("topMenu")); - menu.setTitle(w.getStr("title")); - menu.setHidden(w.getInt("hidden")); - menu.setPid(parentId); - menu.setRedirect(w.getStr("redirect")); - menu.setSort(w.getInt("sort")); - menu.setDataScopeOption(""); - menu.setHasDataScope(false); - menuService.save(menu); - List children = w.getBeanList("children", JSONObject.class); - if (CollUtil.isNotEmpty(children)) { - save(children, menu.getId()); - } - }); - } - -} \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java deleted file mode 100644 index a228101..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ningdatech.pmapi.sys.service; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.sys.model.entity.Region; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - -/** - *

- * IRegionServiceTest - *

- * - * @author WendyYang - * @since 16:57 2023/3/1 - */ -class IRegionServiceTest extends AppTests { - - @Autowired - private RegionCacheHelper regionCacheHelper; - @Autowired - private IRegionService regionService; - - @Test - public void test1() { - AtomicLong idIncr = new AtomicLong(1); - Map> map = CollUtils.group(regionService.list(), Region::getRegionLevel); - regionService.remove(null); - map.keySet().stream().sorted().forEach(w -> { - List list = new ArrayList<>(); - List regions = map.get(w); - for (Region region : regions) { - if (w == 1) { - region.setRegionCodePath(region.getParentCode() + "," + region.getRegionCode()); - region.setParentId(0L); - } else { - Region parent = regionService.getOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, region.getParentCode()) - .eq(Region::getRegionLevel, region.getRegionLevel() - 1)); - region.setRegionCodePath(parent.getRegionCodePath() + "," + region.getRegionCode()); - region.setParentId(parent.getId()); - } - region.setId(idIncr.getAndIncrement()); - list.add(region); - } - regionService.saveBatch(list); - System.out.println("============================================================================"); - }); - } - - @Test - public void test2() { - System.out.println(regionCacheHelper.getDisplayName("330100", 2)); - System.out.println(regionCacheHelper.getFullDisplayName("330102", 3)); - } - -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/FlowableTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/FlowableTest.java deleted file mode 100644 index 6a08b78..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/FlowableTest.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.ningdatech.pmapi.todocenter; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.AppTests; -import com.wflow.bean.entity.WflowCcTasks; -import com.wflow.mapper.WflowCcTasksMapper; -import com.wflow.utils.CodeUtil; -import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; -import com.wflow.workflow.enums.ProcessHandlerEnum; -import com.wflow.workflow.mapper.CustomHisActInstMapper; -import com.wflow.workflow.utils.ProcessTaskUtils; -import lombok.extern.slf4j.Slf4j; -import org.assertj.core.util.Lists; -import org.flowable.bpmn.model.BpmnModel; -import org.flowable.bpmn.model.FlowElement; -import org.flowable.common.engine.impl.cmd.CustomSqlExecution; -import org.flowable.engine.*; -import org.flowable.engine.history.HistoricActivityInstance; -import org.flowable.engine.impl.cmd.AbstractCustomSqlExecution; -import org.flowable.engine.runtime.Execution; -import org.flowable.task.api.Task; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname FlowableTest - * @Description - * @Date 2023/5/14 9:12 - * @Author PoffyZhang - */ -@Slf4j -public class FlowableTest extends AppTests { - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private HistoryService historyService; - - @Autowired - private RepositoryService repositoryService; - - @Autowired - private TaskService taskService; - - @Autowired - private ManagementService managementService; - - @Autowired - private WflowCcTasksMapper ccTasksMapper; - - @Test - public void withdrawTest(){ - String taskId = "cc3d7536-f1f3-11ed-b9e0-02426daa406d"; - - // 不是流程发起人撤回 - HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() - .taskId(taskId) - .singleResult(); - if (Objects.isNull(handledTaskInstance)){ - throw new BizException("获取任务实例失败!"); - } - - String processInstanceId = handledTaskInstance.getProcessInstanceId(); - - // 获取已处理历史活跃实例节点ID - String handledNodeId = handledTaskInstance.getTaskDefinitionKey(); - - BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); - - //先得到 其所在子流程 - Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); - String subProcessId = subNodeMap.get(handledNodeId); - //然后得到 子流程下的所有 nodeId - Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); - List nodeIds = allSubNodeMap.get(subProcessId); - - // 获取待处理历史活跃实例节点ID(会签/或签会有多个) - // 获取当前流程实例待审核任务信息 - List taskList = taskService.createTaskQuery() - .processInstanceId(processInstanceId) - .taskDefinitionKeys(nodeIds) - .list(); - //保证是此子流程下的任务 那第一个就是当前操作节点了 - Task currentTask = taskList.get(0); - String currentNodeId = currentTask.getTaskDefinitionKey(); - - // 传节点定义key 获取撤回操作人在流程配置中所在的节点 - FlowElement beforeFlowElement = bpmnModel.getFlowElement(handledNodeId); - // 获取执行撤回操作的节点所在子流程所有节点ID - List actIdList = Lists.newArrayList(handledNodeId,currentNodeId); - - List historicActivityInstanceList = historyService - .createHistoricActivityInstanceQuery() - .processInstanceId(processInstanceId) - .list(); - - // 标记执行撤回操作节点及当前待处理节点(userTask类型)为被撤回(使用DELETE_REASON_标志) - List activityInstances = historicActivityInstanceList.stream() - .filter(a -> actIdList.contains(a.getActivityId())) - .collect(Collectors.toList()); - - // 先查出当前撤回节点所在子流程节点的节点ID - List subProcessActIds = historicActivityInstanceList.stream() - .filter(a -> "subProcess".equals(a.getActivityType())) - .map(HistoricActivityInstance::getActivityId) - .collect(Collectors.toList()); - List executions = runtimeService.createExecutionQuery() - .processInstanceId(processInstanceId).onlyChildExecutions().list(); - List actIds = executions.stream().map(Execution::getActivityId).collect(Collectors.toList()); - // 去除子流程节点ID - actIds.removeAll(subProcessActIds); - // 强制流程指向前一个审核人节点 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(processInstanceId) - .moveActivityIdsToSingleActivityId(actIds,handledNodeId) - .changeState(); - - // 如果是从会签节点撤回,执行会签节点的节点ID和当前待处理节点ID相同,只需要标记当前会签节点为被撤回 - if (handledNodeId.equals(currentNodeId)){ - activityInstances = activityInstances.stream().filter(a -> currentNodeId.equals(a.getActivityId())).collect(Collectors.toList()); - } - for (HistoricActivityInstance activityInstance : activityInstances) { - String executionId = activityInstance.getExecutionId(); - // 备注子流程已处理节点为被撤回 - CustomSqlExecution customSqlExecution = new AbstractCustomSqlExecution(CustomHisActInstMapper.class) { - @Override - public Integer execute(CustomHisActInstMapper customHisActInstMapper) { - // 更新历史活跃实例表中删除原因为被撤回 - return customHisActInstMapper.deleteHisActInst(processInstanceId, executionId); - } - }; - managementService.executeCustomSql(customSqlExecution); - taskService.deleteTask(activityInstance.getTaskId()); - historyService.deleteHistoricTaskInstance(activityInstance.getTaskId()); - } - } - - @Test - public void testWithDraw(){ - ReqProcessHandlerDTO param = new ReqProcessHandlerDTO(); - param.setProjectId(633L); - param.setTaskId("8e3e9329-f544-11ed-91fd-02426daa406d"); - param.setAction(ProcessHandlerEnum.WITHDRAW); - param.setInstanceId("93877c57-f542-11ed-91fd-02426daa406d"); - - // 不是流程发起人撤回 - HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() - .taskId(param.getTaskId()) - .singleResult(); - if (Objects.isNull(handledTaskInstance)){ - throw new BizException("获取任务实例失败!"); - } - - String processInstanceId = handledTaskInstance.getProcessInstanceId(); - - // 获取已处理历史活跃实例节点ID - String handledNodeId = handledTaskInstance.getTaskDefinitionKey(); - Date handleCreateTime = handledTaskInstance.getCreateTime(); - - BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); - - //先得到 其所在子流程 - Map subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel); - String subProcessId = subNodeMap.get(handledNodeId); - //然后得到 子流程下的所有 nodeId - Map> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel); - List nodeIds = allSubNodeMap.get(subProcessId); - - // 获取待处理历史活跃实例节点ID(会签/或签会有多个) - // 获取当前流程实例待审核任务信息 - List taskList = taskService.createTaskQuery() - .processInstanceId(processInstanceId) - .taskDefinitionKeys(nodeIds) - .list(); - //保证是此子流程下的任务 那第一个就是当前操作节点了 - Task currentTask = taskList.get(0); - Date currentCreateTime = currentTask.getCreateTime(); - String currentNodeId = currentTask.getTaskDefinitionKey(); - - // 传节点定义key 获取撤回操作人在流程配置中所在的节点 - FlowElement beforeFlowElement = bpmnModel.getFlowElement(handledNodeId); - // 获取执行撤回操作的节点所在子流程所有节点ID - List actIdList = Lists.newArrayList(handledNodeId,currentNodeId); - - List historicActivityInstanceList = historyService - .createHistoricActivityInstanceQuery() - .processInstanceId(processInstanceId) - .list(); - - // 标记执行撤回操作节点及当前待处理节点(userTask类型)为被撤回(使用DELETE_REASON_标志) - List activityInstances = historicActivityInstanceList.stream() - .filter(a -> { - if(actIdList.contains(a.getActivityId())){ - if(a.getActivityId().equals(handledNodeId)){ - return (CodeUtil.computationTime(a.getStartTime(),handleCreateTime) == 0L); - }else if(a.getActivityId().equals(currentNodeId)){ - return (CodeUtil.computationTime(a.getStartTime(),currentCreateTime) == 0L); - } - } - return Boolean.FALSE; - }) - .collect(Collectors.toList()); - - // 先查出当前撤回节点所在子流程节点的节点ID - List subProcessActIds = historicActivityInstanceList.stream() - .filter(a -> "subProcess".equals(a.getActivityType())) - .map(HistoricActivityInstance::getActivityId) - .collect(Collectors.toList()); - List executions = runtimeService.createExecutionQuery() - .processInstanceId(processInstanceId).onlyChildExecutions().list(); - List actIds = executions.stream().map(Execution::getActivityId).collect(Collectors.toList()); - // 去除子流程节点ID - actIds.removeAll(subProcessActIds); - // 强制流程指向前一个审核人节点 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(processInstanceId) -// .moveActivityIdTo(currentNodeId,handledNodeId) - .moveActivityIdsToSingleActivityId(actIds,handledNodeId) - .changeState(); - - // 如果是从会签节点撤回,执行会签节点的节点ID和当前待处理节点ID相同,只需要标记当前会签节点为被撤回 - if (handledNodeId.equals(currentNodeId)){ - activityInstances = activityInstances.stream().filter(a -> currentNodeId.equals(a.getActivityId())).collect(Collectors.toList()); - } - for (HistoricActivityInstance activityInstance : activityInstances) { - String executionId = activityInstance.getExecutionId(); - // 备注子流程已处理节点为被撤回 - CustomSqlExecution customSqlExecution = new AbstractCustomSqlExecution(CustomHisActInstMapper.class) { - @Override - public Integer execute(CustomHisActInstMapper customHisActInstMapper) { - // 更新历史活跃实例表中删除原因为被撤回 - return customHisActInstMapper.deleteHisActInst(processInstanceId, executionId); - } - }; - managementService.executeCustomSql(customSqlExecution); - taskService.deleteTask(activityInstance.getTaskId()); - historyService.deleteHistoricTaskInstance(activityInstance.getTaskId()); - } - // 如果当前执行撤回操作的节点后有抄送节点,撤回后,需将抄送任务节点删除 - String ccNodeId = param.getCcNodeId(); - ccTasksMapper.delete(Wrappers.lambdaQuery(WflowCcTasks.class).eq(WflowCcTasks::getNodeId,ccNodeId)); - } - - @Test - public void reject(){ - String instCode = "0e63faec-08ff-11ee-9663-00163e000353"; - String nodeId1 = "node_6486ddcbe4b0ab4a27ccfdbd"; - String nodeId2 = "node_6486ddcbe4b0ab4a27ccfdc1"; - String nodeId3 = "node_6486ddcbe4b0ab4a27ccfdc3"; - - List executions = runtimeService.createExecutionQuery() - .processInstanceId(instCode) - .onlyChildExecutions().list(); - //强制流程指向驳回 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(instCode) - .moveActivityIdsToSingleActivityId(Lists.newArrayList(nodeId1,nodeId2,nodeId3), "refuse-end") - .moveExecutionsToSingleActivityId(executions.stream().map(Execution::getId) - .collect(Collectors.toList()), "refuse-end") - .changeState(); - - log.info("操作成功!"); - } -} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java deleted file mode 100644 index 5af1922..0000000 --- a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.ningdatech.pmapi.todocenter; - -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.file.entity.vo.result.FileResultVO; -import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.AppTests; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; -import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; -import com.ningdatech.pmapi.sys.manage.NoticeManage; -import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; -import com.ningdatech.pmapi.todocenter.model.dto.PdfGenerateDTO; -import com.ningdatech.pmapi.todocenter.utils.PdfUtils; -import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.ningdatech.zwdd.client.ZwddClient; -import com.wflow.contants.ProcessConstant; -import lombok.extern.slf4j.Slf4j; -import org.flowable.engine.HistoryService; -import org.flowable.engine.TaskService; -import org.flowable.task.api.Task; -import org.flowable.task.api.TaskQuery; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; -import org.junit.Test; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; -import java.io.InputStream; -import java.time.LocalDateTime; -import java.util.List; -import java.util.concurrent.*; -import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; - -/** - * 待办中心测试 - * - * @author CMM - * @since 2023/02/15 22:03 - */ -@Slf4j -public class TodoCenterTest extends AppTests { - @Autowired - private TodoCenterManage todoCenterManage; - @Autowired - private IUserInfoService userInfoService; - @Autowired - private ZwddClient zwddClient; - @Autowired - private INdWorkNoticeStagingService workNoticeStagingService; - @Autowired - private ProjectLibManage projectLibManage; - @Autowired - private FileService fileService; - @Autowired - private IProjectService projectService; - @Autowired - private PdfUtils pdfUtils; - - @Autowired - private TaskService taskService; - - @Autowired - private HistoryService historyService; - - @Autowired - private NoticeManage handlerManage; - - @Test - public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { - //String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); - //log.info("开始发送工作通知"); - //zwddClient.sendWorkNotice("846085", "0223-00", msg); - //// zwddClient.sendWorkNotice("829728","0216-5",msg); - //log.info("发送工作通知结束"); - - //ApplicationContext ac = new AnnotationConfigApplicationContext(BeanConfig.class); - // - ////若没有指定属性名,则默认为方法名 - //TaskExecutor taskExecutor = (TaskExecutor) ac.getBean("executor"); - - String userId = "4"; - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo workNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); - // workNoticeInfo.setBizMsgId("1"); - String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-02-测试项目"); - - //// 先创建1个活动线程的线程池 - //ExecutorService executor = Executors.newFixedThreadPool(1); - - // 初始化线程池 - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, - 60, TimeUnit.SECONDS, new ArrayBlockingQueue(20), new ThreadPoolExecutor.AbortPolicy()); - - // 将发送工作通知交给异步任务Future - CompletableFuture future = CompletableFuture.supplyAsync(() -> { - // 调用浙政钉的接口发送工作通知 - long startTime = System.currentTimeMillis(); - GenericResult result = - zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); - String resultMsg = result.getMsg(); - if (resultMsg.equals("success")) { - log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); - long endTime = System.currentTimeMillis(); - log.info("方法执行完成返回,耗时:" + (endTime - startTime)); - }else { - return "发送工作通知失败!"; - } - return "发送工作通知成功!"; - }, threadPool); - String s = future.get(); - threadPool.shutdown(); - while (threadPool.isTerminated()) { - log.info(s); - break; - } - } - - @Test - public void sendWorkNoticeTest2(){ - String userId = "2"; - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); - String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); - passWorkNoticeInfo.setMsg(passMsg); - // 放入工作通知暂存表中,通过扫表异步发送 -// workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); - } - - @Test - public void GeneratePdf(){ - // 获取本地目录的pdf模板 - String fileName = "预审申请单"; - InputStream htmlInputStream = - this.getClass().getClassLoader().getResourceAsStream("template/" + fileName + ".html"); - // 获取表单数据 - ProjectDetailVO projectDetail = projectLibManage.getProjectDetail(44L); - PdfGenerateDTO pdfGenerateDTO = new PdfGenerateDTO(); - BeanUtils.copyProperties(projectDetail, pdfGenerateDTO); - // 设置pdf模板参数 - JSONObject paramsMap = JSONObject.parseObject(JSONObject.toJSONString(pdfGenerateDTO)); - paramsMap.put("time", NdDateUtils.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm")); - paramsMap.put("isTemporaryAugment", "否"); - String projectType = projectDetail.getProjectType(); - paramsMap.put("projectType", ProjectTypeNewEnum.getDesc(projectType)); - Integer isFirst = projectDetail.getIsFirst(); - paramsMap.put("isFirst", "是"); - Boolean isInnovateWholeProvinceShare = projectDetail.getIsInnovateWholeProvinceShare(); - paramsMap.put("isInnovateWholeProvinceShare", Boolean.TRUE.equals(isInnovateWholeProvinceShare) ? "是" : "否"); - String beginTime = projectDetail.getBeginTime(); - String endTime = projectDetail.getEndTime(); - String beginAndEndTime = beginTime + StrUtil.DASHED + endTime; - paramsMap.put("beginAndEndTime", beginAndEndTime); - Integer fourSystems = projectDetail.getFourSystems(); - paramsMap.put("fourSystems", "业务应用"); - Integer isDigitalReform = projectDetail.getIsDigitalReform(); - paramsMap.put("isDigitalReform", "否"); - Integer isCloud = projectDetail.getIsCloud(); - paramsMap.put("isCloud", "否"); - paramsMap.put("yearPlanInvest",null); - paramsMap.put("bigDataBureauName",null); - - // 生成pdf字节数组 - byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); - - // 转换成MultipartFile - MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); - - // 上传OSS - FileResultVO resultVO = fileService.upload(multipartFile, "default"); - - // 将返回的文件ID保存到项目库中 - Project project = projectService.getById(44L); - project.setPretrialFileId(resultVO.getId()); - - try { - if (null != htmlInputStream) { - htmlInputStream.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Test - public void todo(){ - //测试 有多少个 - TaskQuery taskQuery = taskService.createTaskQuery(); - taskQuery.active() - .taskCandidateOrAssigned(String.valueOf(2)); - List taskList = taskQuery.list(); - - System.out.println(taskList.size()); - } - - public void ido(){ - String userId = "2"; - // 自定义sql查询所有已办的任务实例 - String nativeSql = "SELECT\n" + - "\taht.*\n" + - "FROM\n" + - "\tACT_HI_TASKINST AS aht\n" + - "LEFT JOIN ACT_HI_VARINST AS ahv ON\n" + - "\tSUBSTRING(ahv.NAME_, 9) = aht.ID_\n" + - "\tAND ahv.NAME_ LIKE 'approve_%'\n" + - "WHERE\n" + - "\taht.ASSIGNEE_ = '" + userId + - "'AND ahv.NAME_ IS NOT NULL\n" + - "\tOR aht.DELETE_REASON_ = '" + ProcessConstant.Field.CANCEL + "'"; - NativeHistoricTaskInstanceQuery taskInstanceQuery = - historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); - List taskInstances = taskInstanceQuery.list(); - - System.out.println(taskInstances.size()); - } -} diff --git a/pom.xml b/pom.xml index a59b50e..334e5f3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,11 +3,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ningdatech - project-management + com.hz.pm + hz-project-management pom 1.0.0 - project-management + hz-project-management 丽水项管二期项目 @@ -207,7 +207,7 @@ - pmapi - syn-data-task + hz-pm-api + hz-pm-sync
diff --git a/syn-data-task/pom.xml b/syn-data-task/pom.xml deleted file mode 100644 index a5ab966..0000000 --- a/syn-data-task/pom.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - project-management - com.ningdatech - 1.0.0 - - 4.0.0 - - syn-data-task - - - 8 - 8 - - - - - com.google.guava - guava - - - cn.hutool - hutool-all - 5.8.5 - - - - mysql - mysql-connector-java - - - - org.projectlombok - lombok - - - - com.baomidou - mybatis-plus-boot-starter - - - org.apache.commons - commons-lang3 - - - com.alibaba - fastjson - - - org.apache.tomcat.embed - tomcat-embed-core - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.springframework.boot - spring-boot-devtools - true - true - - - org.springframework.boot - spring-boot-starter-aop - - - com.ningdatech - nd-swagger2-starter - - - org.slf4j - slf4j-log4j12 - - - - - com.ningdatech - nd-basic - - - org.slf4j - slf4j-log4j12 - - - spring-boot-starter-security - org.springframework.boot - - - spring-security-config - org.springframework.security - - - spring-security-web - org.springframework.security - - - spring-security-core - org.springframework.security - - - com.baomidou - mybatis-plus-boot-starter - - - - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - - - - - - dev - - - dev - - - - test - - test - - - - pre - - pre - - - - prod - - prod - - - - - - - - src/main/resources - - **/* - - - - src/main/java - - **/*.xml - - - - src/main/lib - BOOT-INF/lib/ - - **/*.jar - - - - src/main/resources - BOOT-INF/classes/ - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - 2.6.8 - - true - - - - - repackage - - - - - - - \ No newline at end of file diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java deleted file mode 100644 index 0949303..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ningdatech.syndataapi; - - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -/** - * @author CMM - * @since 2023/08/22 18:14 - */ -@SpringBootApplication -@EnableAsync -@MapperScan(SynDataTaskApp.MAPPER_PACKAGES) -@EnableScheduling -@EnableTransactionManagement -@EnableAspectJAutoProxy(exposeProxy = true) -@ComponentScan(basePackages = {"com.ningdatech.syndataapi.**"}) -public class SynDataTaskApp { - - protected static final String MAPPER_PACKAGES = "com.ningdatech.syndataapi.**.mapper"; - - public static void main(String[] args) { - SpringApplication.run(SynDataTaskApp.class, args); - } -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/constant/BizConst.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/constant/BizConst.java deleted file mode 100644 index b8f6d00..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/constant/BizConst.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ningdatech.syndataapi.common.constant; - -import com.ningdatech.basic.model.ApiResponse; - -import java.math.BigDecimal; - -/** - *

- * 业务常量 - *

- * - * @author WendyYang - * @since 13:42 2022/12/1 - */ -public interface BizConst { - - /** - * SQL查询一条 - */ - String LIMIT_1 = "limit 1"; - - String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; - - /** - * 一小时秒数 - **/ - BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); - - /** - * 十分钟的毫秒数 - */ - long MILLS_10_MIN = 1000L * 60 * 10; - - /** - * 中国行政区划编码 - */ - long ROOT_REGION_CODE = 100000L; - - /** - * 一级行政区划数量 - */ - int NUM_PROVINCE = 34; - - /** - * 默认的父id - */ - long PARENT_ID = 0L; - - /** - * 默认树层级 - */ - int TREE_GRADE = 0; - - /** - * 默认的排序 - */ - int SORT_VALUE = 0; - - /** - * 浙江省的region_id - */ - long ZJ_REGION_CODE = 330000L; - String NINE_AREA_CODE_LAST = "000"; - - /** - * 省/直辖市 level - */ - int GOV_L1 = 1; - - /** - * 市 level - */ - int GOV_L2 = 2; - - /** - * 区/县 level - */ - int GOV_L3 = 3; - - /** - * 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 - */ - String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; - - ApiResponse UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); - - int MAX_EXPORT_COUNT = 5000; - - String RESPONSE_KEY_DATA = "data"; - String ORG_NAME = "organizationName"; - String ORG_CODE = "organizationCode"; - - String DEV = "dev"; - String PRE = "pre"; - String PROD = "prod"; - - String SAVE_SUCCESS = "保存成功"; - String OP_SUCCESS = "操作成功"; - String SAVE_FAIL = "保存失败"; - String NOT_EFFECTIVE = "1"; - - String OP_INSERT = "insert"; - String OP_UPDATE = "update"; - String OP_DELETE = "delete"; - String OP_FAIL = "操作失败"; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/utils/CryptUtils.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/utils/CryptUtils.java deleted file mode 100644 index 7547809..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/common/utils/CryptUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ningdatech.syndataapi.common.utils; - -import org.apache.commons.codec.binary.Hex; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * 加密工具 - * @author hank - */ -public class CryptUtils { - - /** - * 默认的算法 - */ - private static final String DE_KEY_MAC = "HmacMD5"; - - /** - * 默认的字符集 - */ - private static final Charset DE_CHARSET = StandardCharsets.UTF_8; - - - /** - * 使用默认的算法(HmacMD5) 得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key) throws Exception { - return encryptHMAC(inputStr, key, DE_KEY_MAC); - } - /** - * 使用指定的算法得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @param keyMac hmac算法 - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception { - return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac)); - } - - public static String MD5Encode(String origin) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET))); - } - - private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception { - - SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac); - Mac mac = Mac.getInstance(secretKey.getAlgorithm()); - mac.init(secretKey); - return mac.doFinal(data); - } - - /** - * 生成HMAC-MD5值 - * @param data 消息数据 - * @param key 密钥 - * @return HMAC-MD5值 - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - */ - public static byte[] hmacMd5(byte[] data, byte[] key) - throws NoSuchAlgorithmException, InvalidKeyException { - SecretKeySpec signingKey = new SecretKeySpec(key, "HmacMD5"); - Mac mac = Mac.getInstance("HmacMD5"); - mac.init(signingKey); - return mac.doFinal(data); - } - - public static void main(String[] args) throws Exception{ - System.out.println("HMACStr:\n" + encryptHMAC("a", "hank")); - } -} \ No newline at end of file diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/controller/ProjectReceiveController.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/controller/ProjectReceiveController.java deleted file mode 100644 index 6c5463e..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/controller/ProjectReceiveController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ningdatech.syndataapi.open.controller; - -import com.ningdatech.basic.model.ApiResponse; -import com.ningdatech.syndataapi.open.manage.IrsManage; -import com.ningdatech.syndataapi.open.manage.ProjectReceiveManage; -import com.ningdatech.syndataapi.scheduler.model.dto.ForwardDTO; -import com.ningdatech.syndataapi.scheduler.model.dto.ProjectBaseInfoDTO; -import com.ningdatech.syndataapi.scheduler.model.dto.ProjectSaveDTO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - * @Classname ProjectCollectionController - * @Description - * @Date 2023/6/25 9:11 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "项目归集控制器") -@RequestMapping("/open/api/v1/project-receive") -public class ProjectReceiveController { - - private final ProjectReceiveManage receiveManage; - - private final IrsManage irsManage; - - @PostMapping("/save") - @ApiOperation("项目归集接收") - public ApiResponse save(@Valid @RequestBody ProjectSaveDTO dto) { - return ApiResponse.ofSuccess(receiveManage.save(dto)); - } - - @PostMapping("/not-effective") - @ApiOperation("项目归集置为无效") - public ApiResponse notEffective(@Valid @RequestBody ProjectBaseInfoDTO baseinfo) { - return ApiResponse.ofSuccess(receiveManage.notEffective(baseinfo)); - } - - @PostMapping("/delete-all") - @ApiOperation("清空当前表数据") - public ApiResponse deleteAll() { - return ApiResponse.ofSuccess(receiveManage.deleteAll()); - } - - @ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于") - @PostMapping("/forward") - public String forward(@Valid @RequestBody ForwardDTO dto) { - return irsManage.forward(dto); - } -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/enumeration/GovProjectStatusEnum.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/enumeration/GovProjectStatusEnum.java deleted file mode 100644 index 5016f2c..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/enumeration/GovProjectStatusEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ningdatech.syndataapi.open.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * GovProjectStatusEnum - * - * @return - * @author ZPF - * @since 2023/10/24 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum GovProjectStatusEnum { - /** - * 项目归集 状态 - */ - APPROVAL("01", "评审中"), - PENDING("02", "待立项"), - REJECTED("03","已驳回"), - APPROVED("04","已立项"), - PURCHASED("05","已采购"), - HAS_PRE_INS("06","已初验"), - HAS_FINAL_INS("07","已终验"), - TERMINATED("00","已终止"); - - private String code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static GovProjectStatusEnum match(String code) { - if (StringUtils.isBlank(code)) { - return null; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/IrsManage.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/IrsManage.java deleted file mode 100644 index 4d79476..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/IrsManage.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ningdatech.syndataapi.open.manage; - -import com.google.common.base.Joiner; -import com.ningdatech.syndataapi.common.constant.BizConst; -import com.ningdatech.syndataapi.common.utils.CryptUtils; -import com.ningdatech.syndataapi.scheduler.model.dto.ForwardDTO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.util.Map; - -/** - * @Classname IrsManage - * @Description - * @Date 2023/9/1 15:15 - * @Author PoffyZhang - */ -@Component -@Slf4j -public class IrsManage { - - - /** - * 转发IRS请求 - * @param dto - * @return - */ - public String forward(ForwardDTO dto) { - try{ - String url = dto.getUrl(); - String appkey = dto.getAppKey(); - long timestamp = System.currentTimeMillis(); - String requestSecret = dto.getSecret(); - String sign = CryptUtils.MD5Encode(appkey + requestSecret + timestamp); - url = url + "?requestTime=" + timestamp + "&sign=" + sign + "&" + asUrlParams(dto.getData()); - log.info("url :{}",url); - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - }catch (Exception e){ - log.error("e:" + e); - } - return BizConst.OP_FAIL; - } - - public static String asUrlParams(Map source){ - return Joiner.on("&") - // 用指定符号代替空值,key 或者value 为null都会被替换 - .useForNull("") - .withKeyValueSeparator("=") - .join(source); - } -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java deleted file mode 100644 index 11fe301..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.ningdatech.syndataapi.open.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.syndataapi.common.constant.BizConst; -import com.ningdatech.syndataapi.open.enumeration.GovProjectStatusEnum; -import com.ningdatech.syndataapi.scheduler.model.dto.ProjectBaseInfoDTO; -import com.ningdatech.syndataapi.scheduler.model.dto.ProjectSaveDTO; -import com.ningdatech.syndataapi.scheduler.model.entity.*; -import com.ningdatech.syndataapi.scheduler.service.*; -import lombok.RequiredArgsConstructor; -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; - -/** - * @Classname ProjectReceiveManage - * @Description - * @Date 2023/8/25 9:11 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectReceiveManage { - - private final IProjectBaseInfoService baseInfoService; - - private final IProjectApplyService applyService; - - private final IProjectApproveService approveService; - - private final IProjectCimplementService cimplementService; - - private final IProjectMimplementService mimplementService; - - private final IProjectProcureService procureService; - - /** - * 接收保存 项目 - * @param dto - * @return - */ - public String save(ProjectSaveDTO dto) { - - //1.保存项目基本信息 - ProjectBaseInfo baseInfo = dto.getBaseinfo(); - String baseProjId = baseInfo.getBaseProjId(); - VUtils.isTrue(StringUtils.isBlank(baseProjId)) - .throwMessage("项目编号不能为空!"); - - ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) - .eq(ProjectBaseInfo::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class); - - //项目状态 - String baseProjSetProg = saveBase.getBaseProjSetProg(); - if(StringUtils.isBlank(baseProjSetProg)){ - return "无状态不保存"; - } - //评审中 基本信息和申报信息 - GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg); - if(Objects.isNull(match)){ - return "状态不对 不保存"; - } - switch (match){ - case APPROVAL: - log.info("评审中状态 保存基本信息和申报信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); - saveApply(dto, baseProjId); - break; - case PENDING: - case APPROVED: - log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - break; - case PURCHASED: - log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - saveProcure(dto, baseProjId); - break; - case HAS_PRE_INS: - case HAS_FINAL_INS: - case TERMINATED: - log.info("初验 终验状态 终止 保存所有信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - saveProcure(dto, baseProjId); - saveCimplementOrMimplement(dto, baseProjId); - break; - case REJECTED: - log.info("驳回终止状态 啥都不保存 :{}",baseProjId); - break; - default: - log.info("没有匹配任何状态 保存失败 :{}",baseProjId); - } - - return BizConst.SAVE_SUCCESS; - } - - private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) { - // 4.保存 建设项目 实施信息 - ProjectCimplement cimplement = dto.getCimplement(); - if(Objects.nonNull(cimplement)){ - ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) - .eq(ProjectCimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,ProjectCimplement.class); - saveCimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldCimplement)){ - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())){ - saveCimplement.setOp(BizConst.OP_UPDATE); - }else{ - saveCimplement.setOp(BizConst.OP_INSERT); - } - saveCimplement.setTongTime(LocalDateTime.now()); - }else{ - saveCimplement.setOp(BizConst.OP_INSERT); - saveCimplement.setTongID(oldCimplement.getTongID()); - saveCimplement.setTongTime(LocalDateTime.now()); - } - saveCimplement.setBizTime(LocalDateTime.now()); - cimplementService.saveOrUpdate(saveCimplement); - } - - // 5.保存 运维项目 实施信息 - ProjectMimplement mimplement = dto.getMimplement(); - if(Objects.nonNull(mimplement)){ - ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) - .eq(ProjectMimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,ProjectMimplement.class); - saveMimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldMimplement)){ - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())){ - saveMimplement.setOp(BizConst.OP_UPDATE); - }else{ - saveMimplement.setOp(BizConst.OP_INSERT); - } - saveMimplement.setTongTime(LocalDateTime.now()); - }else{ - saveMimplement.setOp(BizConst.OP_INSERT); - saveMimplement.setTongID(oldMimplement.getTongID()); - saveMimplement.setTongTime(LocalDateTime.now()); - } - saveMimplement.setBizTime(LocalDateTime.now()); - mimplementService.saveOrUpdate(saveMimplement); - } - } - - private void saveProcure(ProjectSaveDTO dto, String baseProjId) { - // 6.保存 采购信息 - List procures = dto.getProcures(); - if(Objects.nonNull(procures)){ - List olds = procureService.list(Wrappers.lambdaQuery(ProjectProcure.class) - .eq(ProjectProcure::getBaseProjId, baseProjId) - .orderByAsc(ProjectProcure::getBaseBidCode)); - Integer index = 0; - for(ProjectProcure old : olds){ - if(StringUtils.isNotBlank(old.getBaseBidCode())){ - try{ - String bidCode = old.getBaseBidCode().split(StrPool.DASH)[1]; - index = Integer.parseInt(bidCode); - }catch (Exception e){} - } - //删除标记 - old.setOp(BizConst.OP_DELETE); - procureService.updateById(old); - } - index ++; - for(ProjectProcure procure : procures){ - //添加标记 - ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); - saveProcure.setBaseProjId(baseProjId); - saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); - saveProcure.setTongID(null); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setOp(BizConst.OP_INSERT); - procureService.save(saveProcure); - index ++; - } - } - } - - private void saveApprove(ProjectSaveDTO dto, String baseProjId) { - // 3.保存 审批信息 - ProjectApprove approve = dto.getApprove(); - - ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class) - .eq(ProjectApprove::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class); - saveApprove.setBaseProjId(baseProjId); - if(Objects.isNull(oldApprove)){ - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){ - saveApprove.setOp(BizConst.OP_UPDATE); - }else{ - saveApprove.setOp(BizConst.OP_INSERT); - } - saveApprove.setTongTime(LocalDateTime.now()); - }else{ - saveApprove.setOp(BizConst.OP_INSERT); - saveApprove.setTongID(oldApprove.getTongID()); - saveApprove.setTongTime(LocalDateTime.now()); - } - saveApprove.setBizTime(LocalDateTime.now()); - approveService.saveOrUpdate(saveApprove); - } - - private void saveApply(ProjectSaveDTO dto, String baseProjId) { - // 2.保存 申报信息 - ProjectApply apply = dto.getApply(); - - ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class) - .eq(ProjectApply::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class); - saveApply.setBaseProjId(baseProjId); - if(Objects.isNull(oldApply)){ - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){ - saveApply.setOp(BizConst.OP_UPDATE); - }else{ - saveApply.setOp(BizConst.OP_INSERT); - } - saveApply.setTongTime(LocalDateTime.now()); - }else{ - saveApply.setOp(BizConst.OP_INSERT); - saveApply.setTongID(oldApply.getTongID()); - saveApply.setTongTime(LocalDateTime.now()); - } - - saveApply.setBizTime(LocalDateTime.now()); - applyService.saveOrUpdate(saveApply); - } - - //保存基本信息 - private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase,ProjectBaseInfo baseInfo) { - if(Objects.isNull(oldBaseInfo)){ - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){ - saveBase.setOp(BizConst.OP_UPDATE); - }else{ - saveBase.setOp(BizConst.OP_INSERT); - } - saveBase.setTongTime(LocalDateTime.now()); - }else { - saveBase.setOp(BizConst.OP_INSERT); - saveBase.setTongID(oldBaseInfo.getTongID()); - saveBase.setTongTime(LocalDateTime.now()); - } - saveBase.setBizTime(LocalDateTime.now()); - baseInfoService.saveOrUpdate(saveBase); - } - - /** - * 置为无效 - * @param dto - * @return - */ - public String notEffective(ProjectBaseInfoDTO dto) { - ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) - .eq(ProjectBaseInfo::getBaseProjId, dto.getBaseProjId()) - .last(BizConst.LIMIT_1)); - - ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto,ProjectBaseInfo.class); - saveBaseinfo.setIsEffective(BizConst.NOT_EFFECTIVE); - if(Objects.isNull(oldBaseInfo)){ - saveBaseinfo.setTongTime(LocalDateTime.now()); - } - saveBaseinfo.setBizTime(LocalDateTime.now()); - saveBaseinfo.setOp(BizConst.OP_UPDATE); - baseInfoService.saveOrUpdate(saveBaseinfo); - - return BizConst.OP_SUCCESS; - } - - /** - * 删除表里的所有数据 - * @return - */ - public String deleteAll() { - baseInfoService.remove(Wrappers.lambdaQuery(ProjectBaseInfo.class)); - applyService.remove(Wrappers.lambdaQuery(ProjectApply.class)); - approveService.remove(Wrappers.lambdaQuery(ProjectApprove.class)); - cimplementService.remove(Wrappers.lambdaQuery(ProjectCimplement.class)); - mimplementService.remove(Wrappers.lambdaQuery(ProjectMimplement.class)); - procureService.remove(Wrappers.lambdaQuery(ProjectProcure.class)); - log.info("删除所有前置表数据成功"); - return BizConst.OP_SUCCESS; - } -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.java deleted file mode 100644 index eb26c2a..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApply; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 项目申报信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectApplyMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.xml deleted file mode 100644 index 7aa861e..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApplyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.java deleted file mode 100644 index 7cd8fe8..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApprove; - -/** - *

- * 项目立项评审信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectApproveMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.xml deleted file mode 100644 index 5693a15..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectApproveMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.java deleted file mode 100644 index 289ddc6..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectBaseInfo; - -/** - *

- * 项目基本信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectBaseInfoMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.xml deleted file mode 100644 index b6a2ec2..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectBaseInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.java deleted file mode 100644 index 1374124..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectCimplement; - -/** - *

- * 建设项目实施信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectCimplementMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.xml deleted file mode 100644 index da44170..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectCimplementMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.java deleted file mode 100644 index 824b749..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectMimplement; - -/** - *

- * 运维项目实施信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectMimplementMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.xml deleted file mode 100644 index 86e8f61..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectMimplementMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.java deleted file mode 100644 index 6c159a7..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectProcure; - -/** - *

- * 项目采购信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectProcureMapper extends BaseMapper { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.xml b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.xml deleted file mode 100644 index ba61ab8..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/mapper/ProjectProcureMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ForwardDTO.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ForwardDTO.java deleted file mode 100644 index 57e89f4..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ForwardDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Map; - -/** - * @Classname ForwardDTO - * @Description - * @Date 2023/7/13 18:03 - * @Author PoffyZhang - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ForwardDTO implements Serializable { - private static final long serialVersionUID = 1L; - - private String url; - private String secret; - private String appKey; - private Map data; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectBaseInfoDTO.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectBaseInfoDTO.java deleted file mode 100644 index 208513d..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectBaseInfoDTO.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.dto; - -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 javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 项目基本信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") -public class ProjectBaseInfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - @NotBlank(message = "项目编号不能为空") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("所属区划") - private String baseAreaName; - - @ApiModelProperty("所属区划编码") - private String baseAreaCode; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位浙政钉ID") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位浙政钉ID") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位统一社会信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位(申报单位)") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位浙政钉ID") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位统一社会信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人手机号") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectSaveDTO.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectSaveDTO.java deleted file mode 100644 index 8e09c32..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/dto/ProjectSaveDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.dto; - -import com.ningdatech.syndataapi.scheduler.model.entity.*; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @Classname ProjectSaveDTO - * @Description - * @Date 2023/8/25 9:45 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "SProjectSaveDTO", description = "项目保存") -public class ProjectSaveDTO { - - @NotNull(message = "项目基本信息不能为空") - private ProjectBaseInfo baseinfo; - - @NotNull(message = "项目申报信息不能为空") - private ProjectApply apply; - - @NotNull(message = "项目审批信息不能为空") - private ProjectApprove approve; - - private ProjectCimplement cimplement; - - private ProjectMimplement mimplement; - - private List procures; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApply.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApply.java deleted file mode 100644 index d956d14..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApply.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目申报信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_apply") -@ApiModel(value = "SzlsDaBiz331100ProjectApply对象", description = "项目申报信息") -public class ProjectApply implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("历年项目代码") - private String baseHistorProjId; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("“领域大脑”一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编码") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目起始时间") - private String baseProjStartTime; - - @ApiModelProperty("项目终止时间") - private String baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("预算年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private String baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private String baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可行性研究报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApprove.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApprove.java deleted file mode 100644 index fe760eb..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectApprove.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目立项评审信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_approve") -@ApiModel(value = "SzlsDaBiz331100ProjectApprove对象", description = "项目立项评审信息") -public class ProjectApprove implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private String baseExpertTotalMoney; - - @ApiModelProperty("建议年度预算") - private String baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private String baseInitialReviewTotalMoney; - - @ApiModelProperty("建议批复年度预算") - private String baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private String releaseYearMoney; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectBaseInfo.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectBaseInfo.java deleted file mode 100644 index 6b0fda9..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectBaseInfo.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目基本信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_baseinfo") -@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") -public class ProjectBaseInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("所属区划") - private String baseAreaName; - - @ApiModelProperty("所属区划编码") - private String baseAreaCode; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位浙政钉ID") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位浙政钉ID") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位统一社会信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位(申报单位)") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位浙政钉ID") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位统一社会信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人手机号") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectCimplement.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectCimplement.java deleted file mode 100644 index 98bbd31..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectCimplement.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 建设项目实施信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_cimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectCimplement对象", description = "建设项目实施信息") -public class ProjectCimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectMimplement.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectMimplement.java deleted file mode 100644 index b87994d..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectMimplement.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 运维项目实施信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_mimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectMimplement对象", description = "运维项目实施信息") -public class ProjectMimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectProcure.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectProcure.java deleted file mode 100644 index c32439a..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/model/entity/ProjectProcure.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目采购信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_procure") -@ApiModel(value = "SzlsDaBiz331100ProjectProcure对象", description = "项目采购信息") -public class ProjectProcure implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private String baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private String baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private String basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private String paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApplyService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApplyService.java deleted file mode 100644 index 367235b..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApplyService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApply; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 项目申报信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectApplyService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApproveService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApproveService.java deleted file mode 100644 index 3658447..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectApproveService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApprove; - -/** - *

- * 项目立项评审信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectApproveService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectBaseInfoService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectBaseInfoService.java deleted file mode 100644 index 06ce785..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectBaseInfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectBaseInfo; - -/** - *

- * 项目基本信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectBaseInfoService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectCimplementService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectCimplementService.java deleted file mode 100644 index 3b29574..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectCimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectCimplement; - -/** - *

- * 建设项目实施信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectCimplementService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectMimplementService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectMimplementService.java deleted file mode 100644 index 8c2e026..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectMimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectMimplement; - -/** - *

- * 运维项目实施信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectMimplementService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectProcureService.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectProcureService.java deleted file mode 100644 index a1bdbe7..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/IProjectProcureService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectProcure; - -/** - *

- * 项目采购信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectProcureService extends IService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/IProjectCimplementServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/IProjectCimplementServiceImpl.java deleted file mode 100644 index 2c6efd8..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/IProjectCimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectCimplementMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectCimplement; -import com.ningdatech.syndataapi.scheduler.service.IProjectCimplementService; - -/** - *

- * 建设项目实施信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class IProjectCimplementServiceImpl extends ServiceImpl implements IProjectCimplementService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApplyServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApplyServiceImpl.java deleted file mode 100644 index 7559bae..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApplyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApply; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectApplyMapper; -import com.ningdatech.syndataapi.scheduler.service.IProjectApplyService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 项目申报信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectApplyServiceImpl extends ServiceImpl implements IProjectApplyService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApproveServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApproveServiceImpl.java deleted file mode 100644 index af5d641..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectApproveServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectApproveMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectApprove; -import com.ningdatech.syndataapi.scheduler.service.IProjectApproveService; - -/** - *

- * 项目立项评审信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectApproveServiceImpl extends ServiceImpl implements IProjectApproveService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectBaseInfoServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectBaseInfoServiceImpl.java deleted file mode 100644 index 6c03809..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectBaseInfoServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectBaseInfoMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectBaseInfo; -import com.ningdatech.syndataapi.scheduler.service.IProjectBaseInfoService; - -/** - *

- * 项目基本信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectBaseInfoServiceImpl extends ServiceImpl implements IProjectBaseInfoService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectMimplementServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectMimplementServiceImpl.java deleted file mode 100644 index c0c880c..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectMimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectMimplementMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectMimplement; -import com.ningdatech.syndataapi.scheduler.service.IProjectMimplementService; - -/** - *

- * 运维项目实施信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectMimplementServiceImpl extends ServiceImpl implements IProjectMimplementService { - -} diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectProcureServiceImpl.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectProcureServiceImpl.java deleted file mode 100644 index f7d2df1..0000000 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/service/impl/ProjectProcureServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ningdatech.syndataapi.scheduler.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.syndataapi.scheduler.mapper.ProjectProcureMapper; -import com.ningdatech.syndataapi.scheduler.model.entity.ProjectProcure; -import com.ningdatech.syndataapi.scheduler.service.IProjectProcureService; - -/** - *

- * 项目采购信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectProcureServiceImpl extends ServiceImpl implements IProjectProcureService { - -} diff --git a/syn-data-task/src/main/resources/application.yml b/syn-data-task/src/main/resources/application.yml deleted file mode 100644 index 3d7808a..0000000 --- a/syn-data-task/src/main/resources/application.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - profiles: - active: dev